2023-05-03 07:10 AM
I recently updated CubeIDE from 1.12.0 to 1.12.1 and it requires regenerating code from CubeMX 6.8.1
After generating the code I see bunch of errors like below.
I tried clean and build the project but no success.
Is this known bug for 1.12.1?
c:\st\stm32cubeide_1.10.1\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.200.202301161003\tools\arm-none-eabi\bin\ld.exe: ./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_tim.o: in function `HAL_TIM_OC_Start_DMA':
project_folder//Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c:1047: multiple definition of `HAL_TIM_OC_Start_DMA'; ./Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.o:project_folder//Debug/../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c:1047: first defined here
c:\st\stm32cubeide_1.10.1\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.200.202301161003\tools\arm-none-eabi\bin\ld.exe: ./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_tim.o: in function `TIM_DMADelayPulseHalfCplt':
project_folder//Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c:6561: multiple definition of `TIM_DMADelayPulseHalfCplt'; ./Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.o:project_folder//Debug/../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c:6561: first defined here
c:\st\stm32cubeide_1.10.1\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.200.202301161003\tools\arm-none-eabi\bin\ld.exe: ./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_tim.o: in function `HAL_TIM_OC_Stop_DMA':
project_folder//Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c:1210: multiple definition of `HAL_TIM_OC_Stop_DMA'; ./Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.o:project_folder//Debug/../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c:1210: first defined here
c:\st\stm32cubeide_1.10.1\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.200.202301161003\tools\arm-none-eabi\bin\ld.exe: ./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_tim.o: in function `HAL_TIM_PWM_Init':
project_folder//Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c:1315: multiple definition of `HAL_TIM_PWM_Init'; ./Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.o:project_folder//Debug/../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c:1315: first defined here
c:\st\stm32cubeide_1.10.1\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.200.202301161003\tools\arm-none-eabi\bin\ld.exe: ./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_tim.o: in function `HAL_TIM_PWM_DeInit':
project_folder//Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c:1376: multiple definition of `HAL_TIM_PWM_DeInit'; ./Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.o:project_folder//Debug/../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c:1376: first defined here
c:\st\stm32cubeide_1.10.1\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.200.202301161003\tools\arm-none-eabi\bin\ld.exe: ./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_tim.o: in function `HAL_TIM_PWM_Start':
stm32f4xx_hal_tim.c:(.text.HAL_TIM_PWM_Start+0x0): multiple definition of `HAL_TIM_PWM_Start'; ./Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.o:stm32f4xx_hal_tim.c:(.text.HAL_TIM_PWM_Start+0x0): first defined here
c:\st\stm32cubeide_1.10.1\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.200.202301161003\tools\arm-none-eabi\bin\ld.exe: ./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_tim.o: in function `HAL_TIM_PWM_Stop':
stm32f4xx_hal_tim.c:(.text.HAL_TIM_PWM_Stop+0x0): multiple definition of `HAL_TIM_PWM_Stop'; ./Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.o:stm32f4xx_hal_tim.c:(.text.HAL_TIM_PWM_Stop+0x0): first defined here
c:\st\stm32cubeide_1.10.1\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.200.202301161003\tools\arm-none-eabi\bin\ld.exe: ./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_tim.o: in function `HAL_TIM_PWM_Start_IT':
stm32f4xx_hal_tim.c:(.text.HAL_TIM_PWM_Start_IT+0x0): multiple definition of `HAL_TIM_PWM_Start_IT'; ./Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.o:stm32f4xx_hal_tim.c:(.text.HAL_TIM_PWM_Start_IT+0x0): first defined here
c:\st\stm32cubeide_1.10.1\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.200.202301161003\tools\arm-none-eabi\bin\ld.exe: ./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_tim.o: in function `HAL_TIM_PWM_Stop_IT':
stm32f4xx_hal_tim.c:(.text.HAL_TIM_PWM_Stop_IT+0x0): multiple definition of `HAL_TIM_PWM_Stop_IT'; ./Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.o:stm32f4xx_hal_tim.c:(.text.HAL_TIM_PWM_Stop_IT+0x0): first defined here
c:\st\stm32cubeide_1.10.1\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.200.202301161003\tools\arm-none-eabi\bin\ld.exe: ./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_tim.o: in function `HAL_TIM_PWM_Start_DMA':
stm32f4xx_hal_tim.c:(.text.HAL_TIM_PWM_Start_DMA+0x0): multiple definition of `HAL_TIM_PWM_Start_DMA'; ./Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.o:stm32f4xx_hal_tim.c:(.text.HAL_TIM_PWM_Start_DMA+0x0): first defined here
c:\st\stm32cubeide_1.10.1\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.200.202301161003\tools\arm-none-eabi\bin\ld.exe: ./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_tim.o: in function `HAL_TIM_PWM_Stop_DMA':
stm32f4xx_hal_tim.c:(.text.HAL_TIM_PWM_Stop_DMA+0x0): multiple definition of `HAL_TIM_PWM_Stop_DMA'; ./Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.o:stm32f4xx_hal_tim.c:(.text.HAL_TIM_PWM_Stop_DMA+0x0): first defined here
c:\st\stm32cubeide_1.10.1\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.200.202301161003\tools\arm-none-eabi\bin\ld.exe: ./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_tim.o: in function `HAL_TIM_IC_Init':
project_folder//Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c:1977: multiple definition of `HAL_TIM_IC_Init'; ./Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.o:project_folder//Debug/../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c:1977: first defined here
c:\st\stm32cubeide_1.10.1\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.200.202301161003\tools\arm-none-eabi\bin\ld.exe: ./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_tim.o: in function `HAL_TIM_IC_DeInit':
project_folder//Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c:2038: multiple definition of `HAL_TIM_IC_DeInit'; ./Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.o:project_folder//Debug/../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c:2038: first defined here
c:\st\stm32cubeide_1.10.1\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.200.202301161003\tools\arm-none-eabi\bin\ld.exe: ./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_tim.o: in function `HAL_TIM_IC_Start':
project_folder//Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c:2113: multiple definition of `HAL_TIM_IC_Start'; ./Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.o:project_folder//Debug/../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c:2113: first defined here
2023-05-03 07:19 AM
In the listing, the path name c:\st\stm32cubeide_1.10.1\stm32cubeide\ stands out, which suggests that you have installed a newer version, but somehow still use the tools from the old path?
Did you install each STM32CubeIDE version in a separate directory?
Regards
/Peter
2023-05-03 07:21 AM
No I only installed once and upgraded from there.
Do I have to uninstall previous version and download the latest one?
2023-05-03 07:29 AM
Actually, it should not be necessary to uninstall previous versions, I was just wondering about the path names that suggested older tools.
I myself always install the different versions in parallel in
and keep the last 3...4 versions for troubleshooting and other problems.
I have also heard of problems when STM32CubeIDE updates itself, but can't actuate it, nor have I investigated or tried it.
However, you can always install the latest version alongside the existing one. To be on the safe side, you should also create a new workspace for this version, so that the settings stored there don't mess up your compilation.
2023-05-03 07:32 AM
Uninstall the previous installation and reinstalled the latest IDE however the problem still persists.
Building the code from other IDE like IAR seems fine and only CubeIDE is affected by this.
2023-05-04 05:29 PM
This sounds like something I have run into before.
Under <project>/core/src/system)stm32<processor type>.c
You need that
If you can find, under Drivers/CMSIS/Device/ST/STM<processor>/Source/Templates/SystemSTM32<processor>.c
and including that file is giving you the multiple definition errors.
Go to that last file, find properties, and check "exclude from build".
No idea why it is there, Never been able to get it debugged by ST. Editing the ioc file regenerates this file. It is not needed. However, excluding it from the build is persistent, and if that's the problem, this is the workaround.
2023-05-05 08:45 AM - edited 2023-11-20 06:36 AM
Thank you for sharing your experience.
After comparing with old project I found virtual files included in the project as below.
Below items should not be in Middlewares
Also below system_stm32f4xx.c file is virtual and should be removed.
After deleting these files I can successfully build the project again.
I still don't know why those files are generated and included in the project.
2023-05-05 09:05 AM
OK:
FatFS and USB_Device_Library are provided by third parties, and are considered middleware. So somewhere in the project configuration you have FatFS selected and also USB support. They never come in for my projects unless I have selected those options in the IOC file.
Now, for the system_sem32f4xx.c file:
I don't know why it's there, either. It causes multiple definitions.
However, deleting it is not the answer. The next time you make any changes that cause the system to regenerate code from the IOC file, THAT FILE will be put back, and you will just have to delete it again.
GIve it a try and see if it happens. Change something trial, like the baudrate on a serial port that you can easily change back. Bet the file magically appears. Been there, done that.
The solution (or at least the workaround) is to highlight that unwanted file. Right click and select properties. On the second screen of properties, you should see an option "remove from build". Check that.
That tells the compiler to NOT build the file, just as if you'd put an #ifdef that is not satisfied around the source code. BTW: THAT does not work since the file is completely regenerated and will likely remove the #ifdef unless you find a "user code" section.
Since the IOC builder does NOT change the file properties, once ignored, the file will stay ignored. Let the IOC builder do what it wants.
STMicro cannot duplicate this problem, I've reported it every few years or so.