一、问题
使用 GD32F10x_Firmware_Library_V2.2.2 固件库样例工程 Template 修改设备型号为 GD32F103RC
编译报以下错误:
*** Using Compiler 'V5.06 update 4 (build 422)', folder: 'D:\Keil_v\ARM\ARMCC\Bin'
Build target 'GD32F10X_CL'
compiling main.c...
..\..\Firmware\CMSIS\GD\GD32F10x\Include\gd32f10x.h(258): error: #101: "CAN0_RX1_IRQn" has already been declared in the current scope
CAN0_RX1_IRQn = 21, /*!< CAN0 RX1 interrupts */
..\..\Firmware\CMSIS\GD\GD32F10x\Include\gd32f10x.h(259): error: #101: "CAN0_EWMC_IRQn" has already been declared in the current scope
CAN0_EWMC_IRQn = 22, /*!< CAN0 EWMC interrupts */.
..\..\Firmware\CMSIS\GD\GD32F10x\Include\gd32f10x.h(260): error: #101: "EXTI5_9_IRQn" has already been declared in the current scope
EXTI5_9_IRQn = 23, /*!< EXTI[9:5] interrupts */
..\..\Firmware\CMSIS\GD\GD32F10x\Include\gd32f10x.h(261): error: #101: "TIMER0_BRK_IRQn" has already been declared in the current scope
TIMER0_BRK_IRQn = 24, /*!< TIMER0 break interrupts */
..\..\Firmware\CMSIS\GD\GD32F10x\Include\gd32f10x.h(262): error: #101: "TIMER0_UP_IRQn" has already been declared in the current scope
TIMER0_UP_IRQn = 25, /*!< TIMER0 update interrupts */
..\..\Firmware\CMSIS\GD\GD32F10x\Include\gd32f10x.h(263): error: #101: "TIMER0_TRG_CMT_IRQn" has already been declared in the current scope
TIMER0_TRG_CMT_IRQn = 26, /*!< TIMER0 trigger and commutation interrupts */
....此处略去
..\..\Utilities\gd32f10x_eval.c: 0 warnings, 30 errors
".\output\Project.axf" - 837 Error(s), 0 Warning(s).
Target not created.
Build Time Elapsed: 00:00:07
二、原因
GD32选型表 中找到 GD32F103RCT6
中密度产品(GD32F10X_MD) 是指 FLASH 存储器容量在
16 KB 至 128 KB
的 GD32F101xx 和 GD32F103xx 微控制器。
高密度产品(GD32F10X_HD) 是指 FLASH 存储器容量在256KB 至 512KB
的 GD32F101xx 和 GD32F103xx 微控制器。
超高密度产品(GD32F10X_XD) 是指FLASH存储器容量在512KB 以上
的GD32F101xx 和 GD32F103xx 微控制器。
互联型产品(GD32F10X_CL) 是指产品是指 GD32F105xx 和 GD32F107xx 微控制器。
所以 GD32F103RCT6 处于 HD 的产品,器件选型如果选错,就会冲突。startup_gd32f10x_hd.s 。 在KEIL5的器件选型里,注意选的器件全名跟你的启动文件是吻合的!
三、解决方法
点击 Options of Target 在 C/C++ 选项里面将 Define GD32F10X_CL
改为 GD32F10X_HD
。
• 由 Leung 写于 2022 年 4 月 2 日