Skip to main content
Associate II
April 27, 2026
Solved

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

  • April 27, 2026
  • 4 replies
  • 715 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 

 

 

Best answer by UVC100

Hi Andrew ,

I have installed version  13.3.rel1, clean the files and re compile the code :

I have a different error from linker "undefined reference to the same function" although the function referenced in the files. 

 " 

C:/ST/STM32CubeIDE_2.0.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.13.3.rel1.win32_1.0.100.202509120712/tools/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld.exe: ./Core/Src/stm32u0xx_hal_msp.o: in function `HAL_PCD_MspInit':

C:/Users/../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'

collect2.exe: error: ld returned 1 exit status

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

"make -j12 all" terminated with exit code 2. Build might be incomplete.

 

15:33:51 Build Failed. 2 errors, 0 warnings. (took 13s.995ms)

 

UVC100   

4 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 II
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.
UVC100Author
Associate II
April 28, 2026

Hi Andrew ,

Thank you for the fast replay, 

I have 14.3rel1 gnu tools installed in my CUBEIDE - as I understand the tool version is newer and suppose to include all the changes and updates done in 13.3rel1?  

UVC100

Andrew Neil
Super User
April 28, 2026

Looking back at that thread where 13.3.rel1 was accepted as the solution, the original problem was reported with GNU tools for STM32 14.3.1.

 

So it's 14.3.1 which introduces the problem - therefore you need to downgrade to 13.3.1 to fix it.

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.
UVC100AuthorBest answer
Associate II
April 28, 2026

Hi Andrew ,

I have installed version  13.3.rel1, clean the files and re compile the code :

I have a different error from linker "undefined reference to the same function" although the function referenced in the files. 

 " 

C:/ST/STM32CubeIDE_2.0.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.13.3.rel1.win32_1.0.100.202509120712/tools/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld.exe: ./Core/Src/stm32u0xx_hal_msp.o: in function `HAL_PCD_MspInit':

C:/Users/../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'

collect2.exe: error: ld returned 1 exit status

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

"make -j12 all" terminated with exit code 2. Build might be incomplete.

 

15:33:51 Build Failed. 2 errors, 0 warnings. (took 13s.995ms)

 

UVC100   

Andrew Neil
Super User
April 28, 2026

Probably time to mark this thread as solved, and start a new thread for the other error?

Give a link here to the new thread;

Include a link in the new thread back to this one, for reference, if you think it helps.


The new thread is here: stm32 gnu tools version 13.3.rel1 undefined reference linker error - and now solved.

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.