2026-05-14 6:48 AM - last edited on 2026-05-14 6:51 AM by Andrew Neil
missing --start-group around WBA2_LinkLayer_BLE_Full_lib.
Environment
Steps to reproduce
Expected Build links cleanly.
Actual Link fails with:
ld.exe: stm32wba_ble_stack_full.a(le_ctrl.o): in function `LECTRL_LL_Init': le_ctrl.c:(.text.LECTRL_LL_Init+0xa): undefined reference to `ll_ble_events_init' ld.exe: (ll_ble_events_init): Unknown destination type (ARM/Thumb) in stm32wba_ble_stack_full.a(le_ctrl.o) le_ctrl.c:(.text.LECTRL_LL_Init+0xa): dangerous relocation: unsupported relocation
Root cause The generated cmake/stm32cubemx/CMakeLists.txt emits the BLE archives in this order in MX_LINK_LIBS:
set(MX_LINK_LIBS
:WBA2_LinkLayer_BLE_Full_lib.a
:stm32wba_ble_stack_full.a
...
)which produces the link line:
... -l:WBA2_LinkLayer_BLE_Full_lib.a -l:stm32wba_ble_stack_full.a -lm
The two archives are mutually dependent:
GNU ld only scans static archives in the order they appear and does not re-scan earlier archives by default. When stm32wba_ble_stack_full.a is processed and pulls in le_ctrl.o, the new undefined reference to ll_ble_events_init cannot be resolved because the link-layer archive has already been scanned. The follow-up Unknown destination type (ARM/Thumb) is a secondary error from ld attempting to emit an interworking veneer to a still-unresolved symbol.
I confirmed ll_ble_events_init is present and defined in WBA2_LinkLayer_BLE_Full_lib.a (arm-none-eabi-nm shows T ll_ble_events_init, size 8 bytes — a small Thumb-2 trampoline into ll_sys_ble_cntrl_init). So this is purely a link-ordering bug, not a missing-library issue.
Suggested fix in the CubeMX CMake template Wrap the two BLE archives in --start-group/--end-group so ld re-scans until all references are resolved:
set(MX_LINK_LIBS
-Wl,--start-group
:WBA2_LinkLayer_BLE_Full_lib.a
:stm32wba_ble_stack_full.a
-Wl,--end-group
STM32_Drivers
${TOOLCHAIN_LINK_LIBRARIES}
Utilities STM32_WPAN Common
)(Or, for CMake ≥ 3.24, use $<LINK_GROUP:RESCAN,...>.) Simply swapping the order works for this specific symbol chain too, but the group is robust against any future circular dependency between the link-layer and BLE-stack archives. The IAR/MDK/Makefile templates appear unaffected because of how they emit the link command.
Workaround Manually edit cmake/stm32cubemx/CMakeLists.txt after each regeneration to add the --start-group/--end-group flags.
2026-05-14 8:09 AM
Hello @oriinbar
Could you please provide your ioc in order to investigate the issue?
KR, Souhaib
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.