This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Linker error after project update

Hi, last week I had my project working perfectly in Keil 5.28.0.0 generated from STM32 Cube Mx 4.7, i'm using an STM32F103C8T6 for an univercity project. Per a professor request i had to add usb communication with a serial monitor, so i went and added the pins in cube mx and enabled the usb middleware as CDC (virtual com) , then generated the new code. BTW all my code is inside the "user code" sections in the generated main.c file (and i checked that nothing was deleted). Problem is that when de compiling the linker encounters "symbols multiply defined" and points at two files, example below:

blink basico\blink basico.axf: Error: L6200E: Symbol USB_ActivateEndpoint multiply defined (by stm32f1xx_ll_usb_1.o and stm32f1xx_ll_usb.o).

Files are stm32f1xx_ll_usb_1.o and stm32f1xx_ll_usb.o . The "_1" makes me think that it is creating a copy of the original file, however, even if I delete both files it creates them againg and gives the same error.

All this started happenig when I added the usb support in CUBEMX, the previous version of the project compiles without errors.

  • That's clearly a bug in CubeMX then.  You'll have to ask there.

  • Files are stm32f1xx_ll_usb_1.o and stm32f1xx_ll_usb.o .

    Those are object files; ie, the files that the compiler creates from translating your source files.

    The corresponding source files would be stm32f1xx_ll_usb_1.c and stm32f1xx_ll_usb.c 

    makes me think that it is creating a copy of the original file

    Which "it" are you referring to?

    The compiler will create an object file for each & every source file in your project (unless you specifically exclude them) - so, if you have multiple copies of the same source file, you will get multiple copies of the object file!

    And, if you have multiple copies of an object file, you will get multiple definitions when the Linker links them together!

     

    ...

  • a bug in CubeMX

    Or an error / mis-configuration in the CubeMX Project.

    https://community.st.com/s/