STM32CubeMX 正在生成带有重复 C_SOURCES 的 Makefile
Posted
技术标签:
【中文标题】STM32CubeMX 正在生成带有重复 C_SOURCES 的 Makefile【英文标题】:STM32CubeMX is generating Makefiles with repeated C_SOURCES 【发布时间】:2019-04-05 19:03:39 【问题描述】:我刚刚开始学习 STM32 开发(在 Ubuntu 16.04 上)。
我已经使用 STM32CubeMX 构建了一个基于 Makefile 的项目。
生成的 Makefile 在 C_SOURCES 中有重复的条目,这(显然)会因为重复的符号而导致链接失败。
C_SOURCES = \
Src/stm32f0xx_it.c \
Src/stm32f0xx_hal_msp.c \
Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_rtc.c \
Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_tim_ex.c \
Src/stm32f0xx_it.c \
Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_rcc_ex.c \
Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_tim.c \
Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_uart_ex.c \
Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_i2s.c \
Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_pcd.c \
Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_dma.c \
Src/usbd_conf.c \
Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_pwr_ex.c \
Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_cortex.c \
Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_i2c_ex.c \
Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_flash.c \
Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c \
Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal.c \
Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_pcd_ex.c \
Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_pwr.c \
Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_rtc_ex.c \
Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_uart.c \
Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_rcc.c \
Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c \
Src/usb_device.c \
Src/usbd_desc.c \
Src/stm32f0xx_hal_msp.c \
Middlewares/ST/STM32_USB_Device_Library/Class/HID/Src/usbd_hid.c \
Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_cec.c \
Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_crc.c \
Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_gpio.c \
Src/usbd_desc.c \
Src/usbd_conf.c \
Src/system_stm32f0xx.c \
Src/usb_device.c \
Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c \
Src/main.c \
Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_crc_ex.c \
Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_i2c.c \
Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_flash_ex.c \
Src/main.c
Src/main.c
、Src/stm32f0xx_hal_msp.c
、Src/stm32f0xx_it.c
、Src/usbd_conf.c
、Src/usbd_desc.c
和 Src/usb_device.c
在此列表中各出现两次。
如果我从 Makefile 中删除重复项,生成的项目就会构建。
是我做错了什么,还是 STM32CubeMX 中的错误?
【问题讨论】:
作为提示,您可以在其使用点执行$(sort $(C_SOURCES))
(而不是手动丢弃多次出现)以消除重复项。
请注意,这与以下问题相同:*** 缺少分隔符。停止。在生成的makefile中。就我而言,这是因为重复的行 -IDrivers/CMSIS/Include
【参考方案1】:
这是一个错误,已在 ST Generated Makefile has duplicated entries for some source files 报告。
CubeMX 4.26.0 版本应该可以进行更正。
【讨论】:
以上是关于STM32CubeMX 正在生成带有重复 C_SOURCES 的 Makefile的主要内容,如果未能解决你的问题,请参考以下文章