Skip to main content
Associate
April 27, 2026
Question

Unknown destination type (ARM/Thumb) link error in CubeIDE v2.1.1 (GNU tools 14.3.1)

  • April 27, 2026
  • 2 replies
  • 113 views

Hi 

I am using latest CubeMx Ver 16.7.0 and CubeIde Ver 2.1.1

while trying to compile a USB CDC code this error shows once i linked the code :

"

C:/Users/../../Hardware - General/../Electronics/../Software/USB_CDC_U0/USB_CDC_U0/Debug/../Core/Src/stm32u0xx_hal_msp.c:102:(.text.HAL_PCD_MspInit+0x4c): undefined reference to `MX_USB_CDC_Init'

C:/ST/STM32CubeIDE_2.0.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.14.3.rel1.win32_1.0.100.202602081740/tools/bin/../lib/gcc/arm-none-eabi/14.3.1/../../../../arm-none-eabi/bin/ld.exe: (MX_USB_CDC_Init): Unknown destination type (ARM/Thumb) in ./Core/Src/stm32u0xx_hal_msp.o

C:/Users/../../Hardware - General/../Electronics/../Software/USB_CDC_U0/USB_CDC_U0/Debug/../Core/Src/stm32u0xx_hal_msp.c:102:(.text.HAL_PCD_MspInit+0x4c): dangerous relocation: unsupported relocation

collect2.exe: error: ld returned 1 exit status

make: *** [makefile:65: USB_CDC_U0.elf] Error 1

 "

the called the function "MX_USB_CDC_Init" exist in the USB/Class/CDC  dir, and the H file hold the function prototype and referenced from the "stm32u0xx_hal_msp.c" file

I have attached the project 

Please help 

 

 

2 replies

Andrew Neil
Super User
April 27, 2026
A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
UVC100Author
Associate
April 27, 2026

Hi

I have read all the similar solution before and try all of them: 

1. update the CubeIde .

2. Update CubeMx. 

3. There was a suggestion to update the GCC tools - I have the latest GCC tools (according to the tool manager in the CubeIDE) 

4. There was a suggestion to delete some system files and re-generate them with the CubeMx - not working  

Sorry, not working for me

 

Andrew Neil
Super User
April 27, 2026

@UVC100 wrote:

3. There was a suggestion to update the GCC tools


Specifically, GNU Tools for STM32 (13.3.rel1) - is that the version you have ?

@Mahmoud Ben Romdhane @Ghofrane GSOURI 

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.