解决方法:修改GD32F10x例程设备型号后编译时提示“CAN0_RX_IRQn“ has already been declared in the current scope CAN0_RX1...

一、问题

使用 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 日

• 参考:GD32F103RET6建立工程,选型的宏定义问题

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Leung_ManWah

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值