Example F030R8_gen
This is a STMCubeMX generated project without TRICE instrumentation for easy compare with ../F030R8_inst to figure out the needed changes to set up trice.
Steps performed as potential guide
- Install STM32CubeMX to
C:\SMT32SubeMX
. - Select NUCLEO-F030R8 board.
- Initialize with default values.
- Optionally set system clock to 32MHz for faster target timestamps.
- Optionally set UART baud rate to 115200.
- Mantadory set UART data bits including parity to 9.
- Enable USART2 global interrupt.
- In Project Manager Project:
- Set toolchain folder location to
E:\repos\trice\examples\vsCode_NucleoF030R8_generated\
. - Set project name to
vsCode_NucleoF030R8_generated
. - Set toolchain / IDE to
Makefile
.
- Set toolchain folder location to
- In Project Manager Code Generator:
- Select βCopy only the necessary library filesβ.
- In Project Manager Advanced Settings:
- In Driver Selector change all to LL.
- Generate Code
- Start vsCode and open generated with it.
- Start a terminal and type
make
. The output should be similar to:
PS E:\repos\trice\examples\vsCode_NucleoF030R8_generated> make -j8
mkdir build
arm-none-eabi-gcc -c -mcpu=cortex-m0 -mthumb -DUSE_FULL_LL_DRIVER -DHSE_VALUE=8000000 -DHSE_STARTUP_TIMEOUT=100 -DLSE_STARTUP_TIMEOUT=5000 -DLSE_VALUE=32768 -DHSI_VALUE=8000000 -DLSI_VALUE=40000 -DVDD_VALUE=3300 -DPREFETCH_ENABLE=1 -DINSTRUCTION_CACHE_ENABLE=0 -DDATA_CACHE_ENABLE=0 -DSTM32F030x8 -ICore/Inc -IDrivers/STM32F0xx_HAL_Driver/Inc -IDrivers/CMSIS/Device/ST/STM32F0xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/main.d" -Wa,-a,-ad,-alms=build/main.lst Core/Src/main.c -o build/main.o
...
arm-none-eabi-gcc -x assembler-with-cpp -c -mcpu=cortex-m0 -mthumb -DUSE_FULL_LL_DRIVER -DHSE_VALUE=8000000 -DHSE_STARTUP_TIMEOUT=100 -DLSE_STARTUP_TIMEOUT=5000 -DLSE_VALUE=32768 -DHSI_VALUE=8000000 -DLSI_VALUE=40000 -DVDD_VALUE=3300 -DPREFETCH_ENABLE=1 -DINSTRUCTION_CACHE_ENABLE=0 -DDATA_CACHE_ENABLE=0 -DSTM32F030x8 -ICore/Inc -IDrivers/STM32F0xx_HAL_Driver/Inc -IDrivers/CMSIS/Device/ST/STM32F0xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/startup_stm32f030x8.d" startup_stm32f030x8.s -o build/startup_stm32f030x8.o
arm-none-eabi-gcc build/main.o build/stm32f0xx_it.o build/stm32f0xx_ll_gpio.o build/stm32f0xx_ll_pwr.o build/stm32f0xx_ll_exti.o build/stm32f0xx_ll_usart.o build/stm32f0xx_ll_rcc.o build/stm32f0xx_ll_dma.o build/stm32f0xx_ll_utils.o build/system_stm32f0xx.o build/sysmem.o build/syscalls.o build/startup_stm32f030x8.o -mcpu=cortex-m0 -mthumb -specs=nano.specs -TSTM32F030R8Tx_FLASH.ld -lc -lm -lnosys -Wl,-Map=build/vsCode_NucleoF030R8_generated.map,--cref -Wl,--gc-sections -o build/vsCode_NucleoF030R8_generated.elf
C:/bin/ArmGNUToolchain/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld.exe: warning: build/vsCode_NucleoF030R8_generated.elf has a LOAD segment with RWX permissions
arm-none-eabi-size build/vsCode_NucleoF030R8_generated.elf
text data bss dec hex filename
2428 12 1564 4004 fa4 build/vsCode_NucleoF030R8_generated.elf
arm-none-eabi-objcopy -O ihex build/vsCode_NucleoF030R8_generated.elf build/vsCode_NucleoF030R8_generated.hex
arm-none-eabi-objcopy -O binary -S build/vsCode_NucleoF030R8_generated.elf build/vsCode_NucleoF030R8_generated.bin
PS E:\repos\trice\examples\vsCode_NucleoF030R8_generated>
- If not done yet, install vsCode Cortex-Debug extension.
- Create a launch.json file inside the .vscode subfolder and edit it to get
{
// 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": "Cortex Debug",
"cwd": "${workspaceFolder}",
"executable": "./build/vsCode_NucleoF030R8_generated.elf",
"request": "launch",
"type": "cortex-debug",
"runToEntryPoint": "main",
"servertype": "jlink",
"device": "STM32F030R8",
"svdFile": "./STM32F030R8.svd",
"runToMain": true
}
]
}
- Download STM32G030.svd or get it from the STMCubeIDE installation folder if you want to install this Eclipse IDE as well, but IMHO you do not need it.
- You may need to extract and install the STM32 USB drivers ../../third_party/st.com/en.stsw-link009_v2.0.2.zip. You can get them also from the STM site directly.
-
It is assumed, that you converted the OB ST-Link to an OB J-Link already. See trice/docs/TRICEOverRTT.md#J-Linkoption for details.
- Press the Debug-Button or βCTRL+SHIFT+Dβ and start debugging.
Hint
- During the code generation, the CubeMX tool did not copy
syscalls.c
andsysmem.c
but added them to the Makefile. This seems to be a STM32CubeMX βfeatureβ.- You do not need these files for the example project, but you can add them manually to avoid some warnings.