• 解决STM32F103编译出错过程:
  • 问题详细描述:

..\Src\ipmi_sensor.c: 9 warnings, 0 errors
compiling ipmi_wdt.c...
..\Src\ipmi_wdt.c(63): warning: #223-D: function "vTaskDelay" declared implicitly
vTaskDelay(1);
..\Src\ipmi_wdt.c: 1 warning, 0 errors
linking...
BACK_MCU\BACK_MCU.axf: Error: L6200E: Symbol SystemInit multiply defined (by system_stm32f1xx_1.o and system_stm32f1xx.o).
BACK_MCU\BACK_MCU.axf: Error: L6200E: Symbol hadc1 multiply defined (by ipmi_sensor.o and main.o).
BACK_MCU\BACK_MCU.axf: Error: L6200E: Symbol uhADCxConvertedData multiply defined (by ipmi_sensor.o and main.o).
BACK_MCU\BACK_MCU.axf: Error: L6200E: Symbol uhADCxConvertedData_Voltage_mVolt multiply defined (by ipmi_sensor.o and main.o).
BACK_MCU\BACK_MCU.axf: Error: L6200E: Symbol __asm___18_system_stm32f1xx_c_5d646a67____REV16 multiply defined (by system_stm32f1xx_1.o and system_stm32f1xx.o).
BACK_MCU\BACK_MCU.axf: Error: L6200E: Symbol __asm___18_system_stm32f1xx_c_5d646a67____REVSH multiply defined (by system_stm32f1xx_1.o and system_stm32f1xx.o).
BACK_MCU\BACK_MCU.axf: Error: L6200E: Symbol __asm___18_system_stm32f1xx_c_5d646a67____RRX multiply defined (by system_stm32f1xx_1.o and system_stm32f1xx.o).
BACK_MCU\BACK_MCU.axf: Error: L6200E: Symbol AHBPrescTable multiply defined (by system_stm32f1xx_1.o and system_stm32f1xx.o).
BACK_MCU\BACK_MCU.axf: Error: L6200E: Symbol APBPrescTable multiply defined (by system_stm32f1xx_1.o and system_stm32f1xx.o).
BACK_MCU\BACK_MCU.axf: Error: L6200E: Symbol SystemCoreClock multiply defined (by system_stm32f1xx_1.o and system_stm32f1xx.o).
BACK_MCU\BACK_MCU.axf: Error: L6200E: Symbol SystemCoreClockUpdate multiply defined (by system_stm32f1xx_1.o and system_stm32f1xx.o).
Not enough information to list image symbols.
Not enough information to list load addresses in the image map.
Finished: 2 information, 0 warning and 11 error messages.
"BACK_MCU\BACK_MCU.axf" - 11 Error(s), 15 Warning(s).
Target not created.
Build Time Elapsed: 00:00:06

  1. 问题解决_1:BACK_MCU\BACK_MCU.axf: Error: L6200E: Symbol hadc1 multiply defined (by ipmi_sensor.o and main.o).增加extern ADC_HandleTypeDef hadc1;
  2. 问题解决_2:BACK_MCU\BACK_MCU.axf: Error: L6200E: Symbol uhADCxConvertedData multiply defined (by ipmi_sensor.o and main.o).

    删除另一个文件的uhADCxConvertedData

  • 经过以上2步骤,剩余问题如下:

BACK_MCU\BACK_MCU.axf: Error: L6200E: Symbol SystemInit multiply defined (by system_stm32f1xx_1.o and system_stm32f1xx.o).
BACK_MCU\BACK_MCU.axf: Error: L6200E: Symbol __asm___18_system_stm32f1xx_c_5d646a67____REV16 multiply defined (by system_stm32f1xx_1.o and system_stm32f1xx.o).
BACK_MCU\BACK_MCU.axf: Error: L6200E: Symbol __asm___18_system_stm32f1xx_c_5d646a67____REVSH multiply defined (by system_stm32f1xx_1.o and system_stm32f1xx.o).
BACK_MCU\BACK_MCU.axf: Error: L6200E: Symbol __asm___18_system_stm32f1xx_c_5d646a67____RRX multiply defined (by system_stm32f1xx_1.o and system_stm32f1xx.o).
BACK_MCU\BACK_MCU.axf: Error: L6200E: Symbol AHBPrescTable multiply defined (by system_stm32f1xx_1.o and system_stm32f1xx.o).
BACK_MCU\BACK_MCU.axf: Error: L6200E: Symbol APBPrescTable multiply defined (by system_stm32f1xx_1.o and system_stm32f1xx.o).
BACK_MCU\BACK_MCU.axf: Error: L6200E: Symbol SystemCoreClock multiply defined (by system_stm32f1xx_1.o and system_stm32f1xx.o).
BACK_MCU\BACK_MCU.axf: Error: L6200E: Symbol SystemCoreClockUpdate multiply defined (by system_stm32f1xx_1.o and system_stm32f1xx.o).

由于CubeMX在原先工程基础上,使用CubeMX再更新,会产生新的system_stm32f1xx.c文件,可以在Keil 5的Project界面看到有两个system_stm32f1xx.c被包含,删掉一个。

 最后一个问题原因是:文件重复包含。删除第一个重复文件;即可编译成功。

  • 之后编译:OK

"BACK_MCU\BACK_MCU.axf" - 0 Error(s), 0 Warning(s).

 

posted on 2020-09-17 13:22  aiziyou  阅读(775)  评论(0)    收藏  举报