-
-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
1,111 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
build.*/** | ||
temp/** | ||
|
1 change: 1 addition & 0 deletions
1
examples/vsCode_Nucleo-G071_instrumented/.vscode/.cortex-debug.peripherals.state.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[] |
1 change: 1 addition & 0 deletions
1
examples/vsCode_Nucleo-G071_instrumented/.vscode/.cortex-debug.registers.state.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[] |
427 changes: 427 additions & 0 deletions
427
examples/vsCode_Nucleo-G071_instrumented/.vscode/c_cpp_properties.json
Large diffs are not rendered by default.
Oops, something went wrong.
34 changes: 34 additions & 0 deletions
34
examples/vsCode_Nucleo-G071_instrumented/.vscode/launch.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "clang Cortex Debug", | ||
"cwd": "${workspaceFolder}", | ||
"executable": "./build.clang/vsCode_Nucleo-G071_instrumented.elf", | ||
"request": "launch", | ||
"type": "cortex-debug", | ||
"runToEntryPoint": "main", | ||
"servertype": "jlink", | ||
"interface": "swd", | ||
"device": "STM32G071RB", | ||
"svdFile": "./STM32G071.svd", | ||
"runToMain": true | ||
}, | ||
{ | ||
"name": "gcc Cortex Debug", | ||
"cwd": "${workspaceFolder}", | ||
"executable": "./build.gcc/vsCode_Nucleo-G071_instrumented.elf", | ||
"request": "launch", | ||
"type": "cortex-debug", | ||
"runToEntryPoint": "main", | ||
"servertype": "jlink", | ||
"interface": "swd", | ||
"device": "STM32G071RB", | ||
"svdFile": "./STM32G071.svd", | ||
"runToMain": true | ||
} | ||
] | ||
} |
10 changes: 10 additions & 0 deletions
10
examples/vsCode_Nucleo-G071_instrumented/.vscode/settings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"makefile.launchConfigurations": [ | ||
{ | ||
"cwd": "c:\\Users\\ms\\repos\\IRIS2\\G0B1", | ||
"binaryPath": "c:\\Users\\ms\\repos\\IRIS2\\G0B1\\build.clang\\G0B1.elf", | ||
"binaryArgs": [] | ||
} | ||
], | ||
"cortex-debug.registerUseNaturalFormat": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,201 @@ | ||
|
||
|
||
# Put ARM Clang first in path temporary to avoid compiler variants issues. | ||
#export PATH := C:\bin\ArmClang\bin:$(PATH) | ||
|
||
# ARM Clang uses the ARM GNU toolchain libraries and finds them over C_INCLUDE_PATH. | ||
#export C_INCLUDE_PATH := C:\bin\ArmGNUToolchain\arm-none-eabi\include | ||
export C_INCLUDE_PATH := /usr/include/newlib/ | ||
|
||
MAKEFILE = Makefile mcu.mak flags.mak gcc0.mak gcc1.mak clang0.mak clang1.mak | ||
VERBOSE = # -v | ||
|
||
###################################### | ||
# target | ||
###################################### | ||
TARGET = vsCode_Nucleo-G071_instrumented | ||
|
||
|
||
###################################### | ||
# building variables | ||
###################################### | ||
# debug build? | ||
DEBUG = 1 | ||
|
||
|
||
###################################### | ||
# source | ||
###################################### | ||
# C sources | ||
C_SOURCES = \ | ||
Core/Src/main.c \ | ||
Core/Src/app_freertos.c \ | ||
Core/Src/stm32g0xx_it.c \ | ||
Core/Src/stm32g0xx_hal_msp.c \ | ||
Core/Src/stm32g0xx_hal_timebase_tim.c \ | ||
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_ll_gpio.c \ | ||
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_ll_exti.c \ | ||
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_ll_rcc.c \ | ||
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_ll_utils.c \ | ||
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_rcc.c \ | ||
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_rcc_ex.c \ | ||
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_flash.c \ | ||
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_flash_ex.c \ | ||
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_gpio.c \ | ||
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_dma.c \ | ||
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_dma_ex.c \ | ||
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_ll_dma.c \ | ||
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_pwr.c \ | ||
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_pwr_ex.c \ | ||
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_cortex.c \ | ||
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal.c \ | ||
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_exti.c \ | ||
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_tim.c \ | ||
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_tim_ex.c \ | ||
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_ll_usart.c \ | ||
Core/Src/system_stm32g0xx.c \ | ||
Middlewares/Third_Party/FreeRTOS/Source/croutine.c \ | ||
Middlewares/Third_Party/FreeRTOS/Source/event_groups.c \ | ||
Middlewares/Third_Party/FreeRTOS/Source/list.c \ | ||
Middlewares/Third_Party/FreeRTOS/Source/queue.c \ | ||
Middlewares/Third_Party/FreeRTOS/Source/stream_buffer.c \ | ||
Middlewares/Third_Party/FreeRTOS/Source/tasks.c \ | ||
Middlewares/Third_Party/FreeRTOS/Source/timers.c \ | ||
Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os2.c \ | ||
Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_4.c \ | ||
Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM0/port.c | ||
|
||
C_SOURCES += \ | ||
../../src/cobsDecode.c \ | ||
../../src/cobsEncode.c \ | ||
../../src/SEGGER_RTT.c \ | ||
../../src/tcobsv1Decode.c \ | ||
../../src/tcobsv1Encode.c \ | ||
../../src/trice.c \ | ||
../../src/trice16.c \ | ||
../../src/trice32.c \ | ||
../../src/trice64.c \ | ||
../../src/trice8.c \ | ||
../../src/triceAuxiliary.c \ | ||
../../src/triceDoubleBuffer.c \ | ||
../../src/triceRingBuffer.c \ | ||
../../src/triceStackBuffer.c \ | ||
../../src/triceStaticBuffer.c \ | ||
../../src/xtea.c | ||
|
||
# ASM sources | ||
ASM_SOURCES = \ | ||
startup_stm32g071xx.s | ||
|
||
include gcc0.mak | ||
include clang0.mak | ||
include mcu.mak | ||
|
||
####################################### | ||
# CFLAGS | ||
####################################### | ||
|
||
|
||
# macros for gcc | ||
# AS defines | ||
AS_DEFS = | ||
|
||
# C defines | ||
C_DEFS = \ | ||
-DUSE_FULL_LL_DRIVER \ | ||
-DSTM32G071xx \ | ||
-DUSE_HAL_DRIVER | ||
|
||
# -DCMSIS_device_header=<stm32g0xx.h> \ | ||
|
||
|
||
# AS includes | ||
AS_INCLUDES = \ | ||
-ICore/Inc | ||
|
||
# C includes | ||
C_INCLUDES = \ | ||
-ICore/Inc \ | ||
-IDrivers/STM32G0xx_HAL_Driver/Inc \ | ||
-IDrivers/STM32G0xx_HAL_Driver/Inc/Legacy \ | ||
-IMiddlewares/Third_Party/FreeRTOS/Source/include \ | ||
-IMiddlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 \ | ||
-IMiddlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM0 \ | ||
-IDrivers/CMSIS/Device/ST/STM32G0xx/Include \ | ||
-IDrivers/CMSIS/Include | ||
|
||
C_INCLUDES += \ | ||
-I../../src | ||
|
||
include flags.mak | ||
|
||
.PHONY: all gcc clean | ||
.SECONDARY: main-build | ||
|
||
all: pre-build main-build | ||
|
||
pre-build: | ||
@#echo PRE ... | ||
@trice insert -src ../../src -src ./ -src ../exampleData | ||
@#echo PRE ... done | ||
@#echo -e | ||
|
||
post-build: | ||
@#echo POST ... | ||
@trice clean -src ../../src -src ./ -src ../exampleData | ||
@#echo POST ... done | ||
@#echo -e | ||
|
||
main-build: clang | ||
|
||
clang: $(CLANG_BUILD)/$(TARGET).elf $(CLANG_BUILD)/$(TARGET).hex $(CLANG_BUILD)/$(TARGET).bin | ||
@$(MAKE) --no-print-directory post-build | ||
|
||
gcc: $(GCC_BUILD)/$(TARGET).elf $(GCC_BUILD)/$(TARGET).hex $(GCC_BUILD)/$(TARGET).bin | ||
@$(MAKE) --no-print-directory post-build | ||
|
||
log: | ||
trice l -p JLINK -args="-Device STM32G071RB -if SWD -Speed 4000 -RTTChannel 0" -pf none -ts ms -d16 | ||
|
||
#all: gcc clang | ||
# @ls -l build/*.o | ||
# @ls -l build/$(TARGET).* | ||
# @ls -l $(GCC_OBJECTS) | ||
# @ls -l $(GCC_BUILD)/$(TARGET).* | ||
# @ls -l $(CLANG_OBJECTS) | ||
# @ls -l $(CLANG_BUILD)/$(TARGET).* | ||
|
||
####################################### | ||
# build the application | ||
####################################### | ||
include gcc1.mak | ||
include clang1.mak | ||
|
||
clean: | ||
@-rm -fR $(GCC_BUILD) $(CLANG_BUILD) | ||
|
||
version: | ||
@which arm-none-eabi-gcc | ||
@arm-none-eabi-gcc --version | ||
@which $(CLANG_CC) | ||
@$(CLANG_CC) --version | ||
|
||
# openocdflashgcc: all | ||
# openocd -f interface/jlink.cfg -f target/stm32g0x.cfg -c "program $(GCC_BUILD)/$(TARGET).elf verify reset exit" | ||
# | ||
# openocdflashclang: all | ||
# openocd -f interface/jlink.cfg -f target/stm32g0x.cfg -c "program $(CLANG_BUILD)/$(TARGET).elf verify reset exit" | ||
# | ||
# seggerflashgcc: all | ||
# JFlash -openprj G0B1.jflash -open $(GCC_BUILD)/G0B1.hex,0x08000000 -auto -startapp -exit | ||
# | ||
# seggerflashclang: all | ||
# JFlash -openprj G0B1.jflash -open $(CLANG_BUILD)/G0B1.hex,0x08000000 -auto -startapp -exit | ||
# | ||
# # See UM0892 | ||
# stflashgcc: all | ||
# ST-LINK_CLI.exe -c SWD FREQ=4000 UR -P $(GCC_BUILD)/G0B1.hex -V | ||
# | ||
# # See UM0892 | ||
# stflashclang: all | ||
# ST-LINK_CLI.exe -c SWD FREQ=4000 UR -P $(CLANG_BUILD)/G0B1.hex -V |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
|
||
# Build path | ||
CLANG_BUILD = build.clang | ||
|
||
VERSION = -17 # When a default version is used, this should be empty. | ||
|
||
CLANG_CC = clang$(VERSION) | ||
CLANG_AS = clang$(VERSION) -x assembler-with-cpp | ||
CLANG_CP = llvm-objcopy$(VERSION) | ||
CLANG_SZ = llvm-size$(VERSION) | ||
CLANG_HEX = $(CLANG_CP) -O ihex | ||
CLANG_BIN = $(CLANG_CP) -O binary -S | ||
|
||
CLANG_ONLY_FLAGS = # | ||
#CLANG_ONLY_FLAGS += -Weverything # # clang only: enable the warning but liberally disable warnings from it that are not useful. | ||
CLANG_ONLY_FLAGS += --target=arm-none-eabi # | ||
#CLANG_CC_FLAGS += -Wa,-a,-ad,-alms=$(CLANG_BUILD)/$(notdir $(<:.c=.lst)) | ||
#CLANG_ONLY_FLAGS += -Wa,--noexecstack |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
CLANG_LDFLAGS = $(CPU) -specs=nano.specs -T$(LDSCRIPT) $(LIB_DIR) $(LIBS) -Wl,-Map=$(CLANG_BUILD)/$(TARGET).map,--cref -Wl,--gc-sections -Wl,--no-warn-rwx-segments # | ||
|
||
CLANG_OBJECTS = | ||
|
||
# list of clang ASM program objects | ||
CLANG_OBJECTS += $(addprefix $(CLANG_BUILD)/,$(notdir $(ASM_SOURCES:.s=.o))) | ||
vpath %.s $(sort $(dir $(ASM_SOURCES))) | ||
|
||
# list of clang objects | ||
CLANG_OBJECTS += $(addprefix $(CLANG_BUILD)/,$(notdir $(C_SOURCES:.c=.o))) | ||
vpath %.c $(sort $(dir $(C_SOURCES))) | ||
|
||
# assembler | ||
$(CLANG_BUILD)/%.o: %.s $(MAKEFILE) | $(CLANG_BUILD) | ||
@echo $< | ||
@$(CLANG_AS) $(VERBOSE) $(C_FLAGS) $(CLANG_ONLY_FLAGS) -c $< -o $@ | ||
# @echo - | ||
|
||
# compiler | ||
$(CLANG_BUILD)/%.o: %.c $(MAKEFILE) | $(CLANG_BUILD) pre-build | ||
@echo $< | ||
@$(CLANG_CC) $(VERBOSE) $(C_FLAGS) $(C_DEFS) $(C_INCLUDES) $(CLANG_ONLY_FLAGS) -c $< -o $@ | ||
# @echo -e | ||
|
||
# linker # https://www.redhat.com/en/blog/linkers-warnings-about-executable-stacks-and-segments | ||
$(CLANG_BUILD)/$(TARGET).elf: $(CLANG_OBJECTS) $(MAKEFILE) | ||
@echo linking... | ||
@$(GCC_CC) $(CLANG_OBJECTS) $(MCU) $(CLANG_LDFLAGS) $(VERBOSE) -o $@ 2> gccLinksClangWarning.txt | ||
@echo -e | ||
@$(CLANG_SZ) $@ | ||
|
||
# hex | ||
$(CLANG_BUILD)/%.hex: $(CLANG_BUILD)/%.elf | $(CLANG_BUILD) | ||
@$(CLANG_HEX) $< $@ | ||
|
||
# bin | ||
$(CLANG_BUILD)/%.bin: $(CLANG_BUILD)/%.elf | $(CLANG_BUILD) | ||
@$(CLANG_BIN) $< $@ | ||
# @ls -l $(GCC_BUILD)/*.o | ||
# @ls -l $(CLANG_BUILD)/$(TARGET).* | ||
|
||
$(CLANG_BUILD): | ||
mkdir $@ | ||
|
||
# dependencies | ||
-include $(wildcard $(CLANG_BUILD)/*.d) |
Oops, something went wrong.