cancel
Showing results for 
Search instead for 
Did you mean: 

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

UVC100
Associate

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 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

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.

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.

View solution in original post

7 REPLIES 7
Andrew Neil
Super User

I think this is the key:

 


@UVC100 wrote:

Core/Src/stm32u0xx_hal_msp.c:102:(.text.HAL_PCD_MspInit+0x4c): dangerous relocation: unsupported relocation


See recent threads: 

https://community.st.com/t5/forums/searchpage/tab/message?advanced=false&allow_punctuation=false&q=dangerous%20relocation:%20unsupported%20relocation

 

Seems to relate to a recent Assembler change:

https://community.st.com/t5/stm32cubeide-mcus/cubeide-2-1-0-system-stm32wl3x-o-dangerous-relocation/m-p/883259/highlight/true#M41183

 

Proposed Solution:

https://community.st.com/t5/stm32cubeide-mcus/system-stm32wb0x-c-dangerous-relocation-unsupported-relocation/m-p/882621/highlight/true#M41119

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.
UVC100
Associate

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

 


@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.
UVC100
Associate

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

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.
UVC100
Associate

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   

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.

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.