cancel
Showing results for 
Search instead for 
Did you mean: 

Linking errors of examples with new STM32WBA release 1.6 & Cannot launch debugger in VS Code

CarlosMartinez
Associate

Hello there,

I am trying to get my Nucleo WBA55 running with the new CubeMX 6.14 and the new MCU package 1.6.0.

Generating a project with just the bare minimum BLE GATT Server application, CMake configuration.

Importing into VS Code with extension 2.1.1, compiling "debug" version, I get several multiple definition errors.

The file is included twice in the makefiles in two different sections it seems.

[build] [86/86] Linking C executable LCU_Demo.elf
[build] FAILED: LCU_Demo.elf 
[build] C:\Windows\system32\cmd.exe /C "cd . && C:\ST\STM32CubeCLT_1.17.0\GNU-tools-for-STM32\bin\arm-none-eabi-gcc.exe -mcpu=cortex-m33 -mfpu=fpv4-sp-d16 -mfloat-abi=hard  -Wall -Wextra -Wpedantic -fdata-sections -ffunction-sections -mcpu=cortex-m33 -mfpu=fpv4-sp-d16 -mfloat-abi=hard  -Wall -Wextra -Wpedantic -fdata-sections -ffunction-sections -mcpu=cortex-m33 -mfpu=fpv4-sp-d16 -mfloat-abi=hard  -Wall -Wextra -Wpedantic -fdata-sections -ffunction-sections -O0 -g3 -mcpu=cortex-m33 -mfpu=fpv4-sp-d16 -mfloat-abi=hard  -T "C:/SVN/LasGAR2/Demonstrator/Software/Source/_trunk_/Nucleo-WBA/SUT/LCU_Demo/STM32WBA55xx_FLASH.ld" --specs=nano.specs -Wl,-Map=LCU_Demo.map -Wl,--gc-sections -Wl,--start-group -lc -lm -Wl,--end-group -Wl,--print-memory-usage  @CMakeFiles\LCU_Demo.rsp -o LCU_Demo.elf  && cd ."
[build] C:/ST/STM32CubeCLT_1.17.0/GNU-tools-for-STM32/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: CMakeFiles/LCU_Demo.dir/Projects/Common/WPAN/Startup/stm32wbaxx_ResetHandler_GCC.s.obj: in function `backup_loop_init':
[build] C:/SVN/LasGAR2/Demonstrator/Software/Source/_trunk_/Nucleo-WBA/SUT/LCU_Demo/Projects/Common/WPAN/Startup/stm32wbaxx_ResetHandler_GCC.s:132: multiple definition of `backup_system_register'; cmake/stm32cubemx/CMakeFiles/Startup.dir/__/__/Projects/Common/WPAN/Startup/stm32wbaxx_ResetHandler_GCC.s.obj:C:/SVN/LasGAR2/Demonstrator/Software/Source/_trunk_/Nucleo-WBA/SUT/LCU_Demo/Projects/Common/WPAN/Startup/stm32wbaxx_ResetHandler_GCC.s:132: first defined here
[build] C:/ST/STM32CubeCLT_1.17.0/GNU-tools-for-STM32/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: CMakeFiles/LCU_Demo.dir/Projects/Common/WPAN/Startup/stm32wbaxx_ResetHandler_GCC.s.obj: in function `restore_loop_init':
[build] C:/SVN/LasGAR2/Demonstrator/Software/Source/_trunk_/Nucleo-WBA/SUT/LCU_Demo/Projects/Common/WPAN/Startup/stm32wbaxx_ResetHandler_GCC.s:158: multiple definition of `restore_system_register'; cmake/stm32cubemx/CMakeFiles/Startup.dir/__/__/Projects/Common/WPAN/Startup/stm32wbaxx_ResetHandler_GCC.s.obj:C:/SVN/LasGAR2/Demonstrator/Software/Source/_trunk_/Nucleo-WBA/SUT/LCU_Demo/Projects/Common/WPAN/Startup/stm32wbaxx_ResetHandler_GCC.s:158: first defined here
[build] C:/ST/STM32CubeCLT_1.17.0/GNU-tools-for-STM32/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: CMakeFiles/LCU_Demo.dir/Projects/Common/WPAN/Startup/stm32wbaxx_ResetHandler_GCC.s.obj: in function `Reset_Handler':
[build] C:/SVN/LasGAR2/Demonstrator/Software/Source/_trunk_/Nucleo-WBA/SUT/LCU_Demo/Projects/Common/WPAN/Startup/stm32wbaxx_ResetHandler_GCC.s:79: multiple definition of `Reset_Handler'; cmake/stm32cubemx/CMakeFiles/Startup.dir/__/__/Projects/Common/WPAN/Startup/stm32wbaxx_ResetHandler_GCC.s.obj:C:/SVN/LasGAR2/Demonstrator/Software/Source/_trunk_/Nucleo-WBA/SUT/LCU_Demo/Projects/Common/WPAN/Startup/stm32wbaxx_ResetHandler_GCC.s:79: first defined here
[build] C:/ST/STM32CubeCLT_1.17.0/GNU-tools-for-STM32/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: CMakeFiles/LCU_Demo.dir/Projects/Common/WPAN/Startup/stm32wbaxx_ResetHandler_GCC.s.obj: in function `CPUcontextSave':
[build] C:/SVN/LasGAR2/Demonstrator/Software/Source/_trunk_/Nucleo-WBA/SUT/LCU_Demo/Projects/Common/WPAN/Startup/stm32wbaxx_ResetHandler_GCC.s:109: multiple definition of `CPUcontextSave'; cmake/stm32cubemx/CMakeFiles/Startup.dir/__/__/Projects/Common/WPAN/Startup/stm32wbaxx_ResetHandler_GCC.s.obj:C:/SVN/LasGAR2/Demonstrator/Software/Source/_trunk_/Nucleo-WBA/SUT/LCU_Demo/Projects/Common/WPAN/Startup/stm32wbaxx_ResetHandler_GCC.s:109: first defined here
[build] C:/ST/STM32CubeCLT_1.17.0/GNU-tools-for-STM32/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: warning: C:/ST/STM32CubeCLT_1.17.0/GNU-tools-for-STM32/bin/../lib/gcc/arm-none-eabi/12.3.1/thumb/v8-m.main+fp/hard/crtn.o: missing .note.GNU-stack section implies executable stack
[build] C:/ST/STM32CubeCLT_1.17.0/GNU-tools-for-STM32/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
[build] Memory region         Used Size  Region Size  %age Used
[build]              RAM:       43840 B       128 KB     33.45%
[build]            FLASH:      282384 B         1 MB     26.93%
[build] collect2.exe: error: ld returned 1 exit status
[build] ninja: build stopped: subcommand failed.
[proc] The command: C:/ST/STM32CubeCLT_1.17.0/CMake/bin/cmake.exe --build C:/SVN/LasGAR2/Demonstrator/Software/Source/_trunk_/Nucleo-WBA/SUT/LCU_Demo/build/Debug -- exited with code: 1
[driver] Build completed: 00:00:08.214
[build] Build finished with exit code 1

When I delete one of the occurrences in the CMakeLists.txt it links correctly.

The second error I could not get rid of: when clicking on "run" in VS Code, Windows asks me what should it do with a ELF file. Any idea of what went wrong?

 

1 REPLY 1
Sarra.S
ST Employee

Hello @CarlosMartinez

This error occurs because Windows does not natively know how to handle ELF files, instead, the ELF file should be loaded and executed by the debugger, not directly by Windows.

So, you need to set up the debugger in VS Code, you can use arm-none-eabi-gdb

Also, the launch configuration (in launch.json) should be configured to use the appropriate debugger for the STM32WBA55 board, and make sure you have the necessary extensions such as cortex-debug! 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.