2025-08-28 11:47 AM
Detail: I use CubeMX to create a CMake project and edit it in VSCode. My target MCU is STM32WBA54KGUx. I configured the STM32_WPAN, then clicked generate code. In VSCode, when I clicked the "build" button (or run task "Cmake: clean rebuild"), the build command returned an error of multiple definition. It turned out, the gcc build command linked two same file named "stm32wbaxx_ResetHandler_GCC.s.obj". Further investigation revealed that the "stm32wbaxx_ResetHandler_GCC.s" file located in /Projects/Common/WPAN/Startup/ is built twice:
[build] [15/89] Building ASM object CMakeFiles/wba54_test.dir/Projects/Common/WPAN/Startup/stm32wbaxx_ResetHandler_GCC.s.obj
[build] [81/89] Building ASM object cmake/stm32cubemx/CMakeFiles/Startup.dir/__/__/Projects/Common/WPAN/Startup/stm32wbaxx_ResetHandler_GCC.s.obj
Temporary Fix: Go to /cmake/stm32cubemx/CMakeLists.txt and comment out the "Startup" in the "# Project static libraries" section (around line 178). But CubeMX will overwrite it anyway when re-generate code, so this is not a real fix.
CubeMX version: 6.15.0
STM32 firmware version: STM32Cube_FW_WBA_V1.7.0