AnsweredAssumed Answered

Bug Report: STM32CubeMX creates broken makefiles

Question asked by S D on Mar 16, 2018
Latest reply on Apr 4, 2018 by William Ransohoff

Hi!,

I have noticed some bugs in the makefiles generated by STM32CubeMX (version 4.25.0).

The generated Makefiles contain duplicate entries for some sourcefiles. This generates the following type of compiler errors:

 

/usr/bin/arm-none-eabi-gcc -x assembler-with-cpp -c -mcpu=cortex-m7 -mthumb  -mfloat-abi=softfp -DUSE_HAL_DRIVER -DSTM32F745xx -IInc -IDrivers/STM32F7xx_HAL_Driver/Inc -IDrivers/STM32F7xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F7xx/Include -IMiddlewares/Third_Party/FatFs/src -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/startup_stm32f745xx.d" -MT"build/startup_stm32f745xx.d" startup_stm32f745xx.s -o build/startup_stm32f745xx.o
/usr/bin/arm-none-eabi-gcc build/sd_diskio.o build/stm32f7xx_hal_rcc.o build/stm32f7xx_hal_tim.o build/stm32f7xx_hal_gpio.o build/stm32f7xx_hal_dma_ex.o build/stm32f7xx_hal_dma.o build/stm32f7xx_hal_cortex.o build/stm32f7xx_ll_sdmmc.o build/stm32f7xx_hal_flash_ex.o build/bsp_driver_sd.o build/stm32f7xx_hal_pwr.o build/main.o build/ff.o build/sd_diskio.o build/stm32f7xx_hal_tim_ex.o build/main.o build/system_stm32f7xx.o build/fatfs.o build/bsp_driver_sd.o build/syscall.o build/stm32f7xx_hal_pwr_ex.o build/fatfs.o build/stm32f7xx_hal_i2c_ex.o build/stm32f7xx_hal_flash.o build/stm32f7xx_hal.o build/stm32f7xx_hal_rcc_ex.o build/stm32f7xx_hal_msp.o build/stm32f7xx_hal_msp.o build/stm32f7xx_hal_sd.o build/stm32f7xx_it.o build/stm32f7xx_hal_i2c.o build/ff_gen_drv.o build/stm32f7xx_it.o build/diskio.o build/startup_stm32f745xx.o -mcpu=cortex-m7 -mthumb  -mfloat-abi=softfp -specs=nano.specs -TSTM32F745VGTx_FLASH.ld  -lc -lm -lnosys  -Wl,-Map=build/BugReport.map,--cref -Wl,--gc-sections -o build/BugReport.elf
build/sd_diskio.o: In function `SD_initialize':
/home/sdiepold/BugReport/Src/sd_diskio.c:142: multiple definition of `SD_initialize'
build/sd_diskio.o:/home/sdiepold/BugReport/Src/sd_diskio.c:142: first defined here
build/sd_diskio.o: In function `SD_CheckStatus':
/home/sdiepold/BugReport/Src/sd_diskio.c:125: multiple definition of `SD_status'
build/sd_diskio.o:/home/sdiepold/BugReport/Src/sd_diskio.c:125: first defined here
build/sd_diskio.o: In function `SD_CheckStatus':
/home/sdiepold/BugReport/Src/sd_diskio.c:125: multiple definition of `SD_read'
build/sd_diskio.o:/home/sdiepold/BugReport/Src/sd_diskio.c:125: first defined here
build/sd_diskio.o: In function `SD_CheckStatus':
/home/sdiepold/BugReport/Src/sd_diskio.c:125: multiple definition of `SD_write'
build/sd_diskio.o:/home/sdiepold/BugReport/Src/sd_diskio.c:125: first defined here
build/sd_diskio.o: In function `SD_CheckStatus':
/home/sdiepold/BugReport/Src/sd_diskio.c:125: multiple definition of `SD_ioctl'
build/sd_diskio.o:/home/sdiepold/BugReport/Src/sd_diskio.c:125: first defined here
build/sd_diskio.o: In function `SD_CheckStatus':
/home/sdiepold/BugReport/Src/sd_diskio.c:125: multiple definition of `BSP_SD_WriteCpltCallback'
build/sd_diskio.o:/home/sdiepold/BugReport/Src/sd_diskio.c:125: first defined here
build/sd_diskio.o: In function `SD_CheckStatus':
/home/sdiepold/BugReport/Src/sd_diskio.c:125: multiple definition of `BSP_SD_ReadCpltCallback'
build/sd_diskio.o:/home/sdiepold/BugReport/Src/sd_diskio.c:125: first defined here
build/sd_diskio.o: In function `SD_CheckStatus':
/home/sdiepold/BugReport/Src/sd_diskio.c:125: multiple definition of `SD_Driver'
build/sd_diskio.o:/home/sdiepold/BugReport/Src/sd_diskio.c:125: first defined here
build/main.o: In function `_Error_Handler':
/home/sdiepold/BugReport/Src/main.c:232: multiple definition of `_Error_Handler'
build/main.o:/home/sdiepold/BugReport/Src/main.c:232: first defined here
build/main.o: In function `MX_SDMMC1_SD_Init':
/home/sdiepold/BugReport/Src/main.c:195: multiple definition of `SystemClock_Config'
build/main.o:/home/sdiepold/BugReport/Src/main.c:195: first defined here
build/main.o: In function `MX_SDMMC1_SD_Init':
/home/sdiepold/BugReport/Src/main.c:195: multiple definition of `main'
build/main.o:/home/sdiepold/BugReport/Src/main.c:195: first defined here
build/bsp_driver_sd.o: In function `BSP_SD_ITConfig':
/home/sdiepold/BugReport/Src/bsp_driver_sd.c:107: multiple definition of `BSP_SD_ITConfig'
build/bsp_driver_sd.o:/home/sdiepold/BugReport/Src/bsp_driver_sd.c:107: first defined here
build/bsp_driver_sd.o: In function `BSP_SD_ITConfig':
/home/sdiepold/BugReport/Src/bsp_driver_sd.c:107: multiple definition of `BSP_SD_ReadBlocks'
build/bsp_driver_sd.o:/home/sdiepold/BugReport/Src/bsp_driver_sd.c:107: first defined here
build/bsp_driver_sd.o: In function `BSP_SD_ITConfig':
/home/sdiepold/BugReport/Src/bsp_driver_sd.c:107: multiple definition of `BSP_SD_WriteBlocks'
build/bsp_driver_sd.o:/home/sdiepold/BugReport/Src/bsp_driver_sd.c:107: first defined here
build/bsp_driver_sd.o: In function `BSP_SD_ITConfig':
/home/sdiepold/BugReport/Src/bsp_driver_sd.c:107: multiple definition of `BSP_SD_ReadBlocks_DMA'
build/bsp_driver_sd.o:/home/sdiepold/BugReport/Src/bsp_driver_sd.c:107: first defined here
build/bsp_driver_sd.o: In function `BSP_SD_ITConfig':
/home/sdiepold/BugReport/Src/bsp_driver_sd.c:107: multiple definition of `BSP_SD_WriteBlocks_DMA'
build/bsp_driver_sd.o:/home/sdiepold/BugReport/Src/bsp_driver_sd.c:107: first defined here
build/bsp_driver_sd.o: In function `BSP_SD_ITConfig':
/home/sdiepold/BugReport/Src/bsp_driver_sd.c:107: multiple definition of `BSP_SD_Erase'
build/bsp_driver_sd.o:/home/sdiepold/BugReport/Src/bsp_driver_sd.c:107: first defined here
build/bsp_driver_sd.o: In function `BSP_SD_ITConfig':
/home/sdiepold/BugReport/Src/bsp_driver_sd.c:107: multiple definition of `BSP_SD_GetCardState'
build/bsp_driver_sd.o:/home/sdiepold/BugReport/Src/bsp_driver_sd.c:107: first defined here
build/bsp_driver_sd.o: In function `BSP_SD_ITConfig':
/home/sdiepold/BugReport/Src/bsp_driver_sd.c:107: multiple definition of `BSP_SD_GetCardInfo'
build/bsp_driver_sd.o:/home/sdiepold/BugReport/Src/bsp_driver_sd.c:107: first defined here
build/bsp_driver_sd.o: In function `BSP_SD_ITConfig':
/home/sdiepold/BugReport/Src/bsp_driver_sd.c:107: multiple definition of `BSP_SD_IsDetected'
build/bsp_driver_sd.o:/home/sdiepold/BugReport/Src/bsp_driver_sd.c:107: first defined here
build/bsp_driver_sd.o: In function `BSP_SD_ITConfig':
/home/sdiepold/BugReport/Src/bsp_driver_sd.c:107: multiple definition of `BSP_SD_Init'
build/bsp_driver_sd.o:/home/sdiepold/BugReport/Src/bsp_driver_sd.c:107: first defined here
build/fatfs.o: In function `MX_FATFS_Init':
/home/sdiepold/BugReport/Src/fatfs.c:61: multiple definition of `MX_FATFS_Init'
build/fatfs.o:/home/sdiepold/BugReport/Src/fatfs.c:61: first defined here
build/fatfs.o: In function `MX_FATFS_Init':
/home/sdiepold/BugReport/Src/fatfs.c:61: multiple definition of `get_fattime'
build/fatfs.o:/home/sdiepold/BugReport/Src/fatfs.c:61: first defined here
build/stm32f7xx_hal_msp.o: In function `HAL_MspInit':
/home/sdiepold/BugReport/Src/stm32f7xx_hal_msp.c:60: multiple definition of `HAL_MspInit'
build/stm32f7xx_hal_msp.o:/home/sdiepold/BugReport/Src/stm32f7xx_hal_msp.c:60: first defined here
build/stm32f7xx_hal_msp.o: In function `HAL_MspInit':
/home/sdiepold/BugReport/Src/stm32f7xx_hal_msp.c:60: multiple definition of `HAL_SD_MspInit'
build/stm32f7xx_hal_msp.o:/home/sdiepold/BugReport/Src/stm32f7xx_hal_msp.c:60: first defined here
build/stm32f7xx_hal_msp.o: In function `HAL_MspInit':
/home/sdiepold/BugReport/Src/stm32f7xx_hal_msp.c:60: multiple definition of `HAL_SD_MspDeInit'
build/stm32f7xx_hal_msp.o:/home/sdiepold/BugReport/Src/stm32f7xx_hal_msp.c:60: first defined here
build/stm32f7xx_it.o: In function `NMI_Handler':
/home/sdiepold/BugReport/Src/stm32f7xx_it.c:52: multiple definition of `NMI_Handler'
build/stm32f7xx_it.o:/home/sdiepold/BugReport/Src/stm32f7xx_it.c:52: first defined here
build/stm32f7xx_it.o: In function `NMI_Handler':
/home/sdiepold/BugReport/Src/stm32f7xx_it.c:52: multiple definition of `HardFault_Handler'
build/stm32f7xx_it.o:/home/sdiepold/BugReport/Src/stm32f7xx_it.c:52: first defined here
build/stm32f7xx_it.o: In function `NMI_Handler':
/home/sdiepold/BugReport/Src/stm32f7xx_it.c:52: multiple definition of `MemManage_Handler'
build/stm32f7xx_it.o:/home/sdiepold/BugReport/Src/stm32f7xx_it.c:52: first defined here
build/stm32f7xx_it.o: In function `NMI_Handler':
/home/sdiepold/BugReport/Src/stm32f7xx_it.c:52: multiple definition of `BusFault_Handler'
build/stm32f7xx_it.o:/home/sdiepold/BugReport/Src/stm32f7xx_it.c:52: first defined here
build/stm32f7xx_it.o: In function `NMI_Handler':
/home/sdiepold/BugReport/Src/stm32f7xx_it.c:52: multiple definition of `UsageFault_Handler'
build/stm32f7xx_it.o:/home/sdiepold/BugReport/Src/stm32f7xx_it.c:52: first defined here
build/stm32f7xx_it.o: In function `NMI_Handler':
/home/sdiepold/BugReport/Src/stm32f7xx_it.c:52: multiple definition of `SVC_Handler'
build/stm32f7xx_it.o:/home/sdiepold/BugReport/Src/stm32f7xx_it.c:52: first defined here
build/stm32f7xx_it.o: In function `NMI_Handler':
/home/sdiepold/BugReport/Src/stm32f7xx_it.c:52: multiple definition of `DebugMon_Handler'
build/stm32f7xx_it.o:/home/sdiepold/BugReport/Src/stm32f7xx_it.c:52: first defined here
build/stm32f7xx_it.o: In function `NMI_Handler':
/home/sdiepold/BugReport/Src/stm32f7xx_it.c:52: multiple definition of `PendSV_Handler'
build/stm32f7xx_it.o:/home/sdiepold/BugReport/Src/stm32f7xx_it.c:52: first defined here
build/stm32f7xx_it.o: In function `NMI_Handler':
/home/sdiepold/BugReport/Src/stm32f7xx_it.c:52: multiple definition of `SysTick_Handler'
build/stm32f7xx_it.o:/home/sdiepold/BugReport/Src/stm32f7xx_it.c:52: first defined here

 

 

And even after removing the duplicate lines i got the following error messages:

 

/usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: warning: /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/lib/libc_nano.a(lib_a-atexit.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: warning: /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/lib/libc_nano.a(lib_a-exit.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: warning: /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/lib/libc_nano.a(lib_a-fini.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: warning: /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/lib/libc_nano.a(lib_a-impure.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: warning: /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/lib/libc_nano.a(lib_a-init.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: warning: /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/lib/libc_nano.a(lib_a-memset.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: warning: /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/lib/libc_nano.a(lib_a-__atexit.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: warning: /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/lib/libc_nano.a(lib_a-__call_atexit.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail.

 

 

I'm using arm-none-eabi-gcc 4.9.3 on Ubuntu 16.04. Those problems didn't occure in erlier versions of the HAL.

Note: I changed the FPU settings in the makefile. This does not have any effect on the above mentioned problems.

 

Best regards

void

Attachments

Outcomes