当前位置:网站首页>華大單片機KEIL報錯_WEAK的解决方案
華大單片機KEIL報錯_WEAK的解决方案
2022-06-27 19:20:00 【蘇守坤】
1. Keil編譯無法識別__WEAK時的問題清單如下:
在使用Keil編譯有時出現無法識別__WEAK的問題,截圖如下:

提示的錯誤信息如下:
..\..\..\..\mcu\common\interrupts_hc32l13x.c(72): error: #77-D: this declaration has no storage class or type specifier
__WEAK void Uart1_IRQHandler(void);
..\..\..\..\mcu\common\interrupts_hc32l13x.c(72): error: #65: expected a ";"
__WEAK void Uart1_IRQHandler(void);
..\..\..\..\mcu\common\interrupts_hc32l13x.c(73): error: #77-D: this declaration has no storage class or type specifier
__WEAK void LpUart0_IRQHandler(void);
..\..\..\..\mcu\common\interrupts_hc32l13x.c(73): error: #65: expected a ";"
__WEAK void LpUart0_IRQHandler(void);
..\..\..\..\mcu\common\interrupts_hc32l13x.c(74): error: #77-D: this declaration has no storage class or type specifier
__WEAK void LpUart1_IRQHandler(void);
..\..\..\..\mcu\common\interrupts_hc32l13x.c(74): error: #65: expected a ";"
__WEAK void LpUart1_IRQHandler(void);
..\..\..\..\mcu\common\interrupts_hc32l13x.c(75): error: #77-D: this declaration has no storage class or type specifier
__WEAK void Spi0_IRQHandler(void);
..\..\..\..\mcu\common\interrupts_hc32l13x.c(75): error: #65: expected a ";" 解决辦法:
因為在Keil中需要定義成__weak才會被識別(非大寫的_WEAK),所以在頭文件base_types.h文件中添加如下幾行定義,編譯就OK啦!
#if defined (__ICCARM__)
#define __WEAK __WEAK __ATTRIBUTES
#elif defined (__CC_ARM)
#define __WEAK __weak
#else
#error "unsupported compiler!!"
#endif2、原因分析
ARM系列編譯工具鏈:__CC_ARM、__ICCARM__、__GNUC__、__TASKING__
為了解决上面報錯的問題,定義了__ICCARM__和__CC_ARM,這裏做一個說明:
__CC_ARM對應的平臺是:ARM RealView:
RealView,是一套包含編譯、調試和模擬的開發工具,需結合開發環境如uvision、eclipse或者CodeWarrior,形成集成開發環境來使用。
__ICCARM__對應的平臺是:IAR EWARM:
Embedded Workbench for ARM 是IARSystems 公司為ARM 微處理器開發的一個集成開發環境(下面簡稱IAR EWARM)。比較其他的ARM 開發環境,IAR EWARM 具有入門容易、使用方便和代碼緊凑等特點。
__GNUC__對應的平臺是:GNU Compiler Collection:
GCC的初衷是為GNU操作系統專門編寫的一款編譯器。GNU系統是徹底的自由軟件。
边栏推荐
- 教你打印自己的日志 -- 如何自定义 log4j2 各组件
- Redis 原理 - String
- Current market situation and development prospect forecast of the global ductless heating, ventilation and air conditioning system industry in 2022
- 别焦虑了,这才是中国各行业的工资真相
- Market status and development prospect forecast of global aircraft hose industry in 2022
- Bit. Store: long bear market, stable stacking products may become the main theme
- 云原生数据库:数据库的风口,你也可以起飞
- 中国工业软件市场研究报告出炉,力控SCADA、MES丰富国产工业软件生态
- maxwell 报错(连接为mysql 8.x)解决方法
- Bit.Store:熊市漫漫,稳定Staking产品或成主旋律
猜你喜欢

基于STM32F103ZET6库函数按键输入实验

Row to column and column to row in MySQL

What is ICMP? What is the relationship between Ping and ICMP?

阿里巴巴的使命、愿景、核心价值观

过关斩将,擒“指针”(下)

云原生数据库:数据库的风口,你也可以起飞

Hikvision tools manager Hikvision tools collection (including sadp, video capacity calculation and other tools) a practical tool for millions of security practitioners

Technology sharing | introduction to kubernetes pod

How to use the low code platform of the Internet of things for picture management?

工作流自动化 低代码是关键
随机推荐
[notice of the Association] notice on holding summer special teacher training in the field of artificial intelligence and Internet of things
教你打印自己的日志 -- 如何自定义 log4j2 各组件
使用logrotate对宝塔的网站日志进行自动切割
Keras深度学习实战(12)——面部特征点检测
VSCode 建议你启用 gopls,它到底是个什么东东?
网上期货开户安全么?
数仓的字符截取三胞胎:substrb、substr、substring
电脑安全证书错误怎么处理比较好
驾驭一切的垃圾收集器 -- G1
Cucumber自动化测试框架使用
Technology sharing | introduction to kubernetes pod
明美新能源冲刺深交所:年应收账款超6亿 拟募资4.5亿
芯动联科冲刺科创板:年营收1.7亿 北方电子院与中城创投是股东
工作流自动化 低代码是关键
Running lantern experiment based on stm32f103zet6 library function
PostgreSQL数据库WAL——资源管理器RMGR
[cloud based co creation] the "solution" of Digital Travel construction in Colleges and Universities
VS code 运行yarn run dev 报yarn : 无法加载文件XXX的问题
信息学奥赛一本通 1333:【例2-2】Blah数集 | OpenJudge NOI 3.4 2729:Blah数集
Informatics Olympiad 1333: [example 2-2] blah data set | openjudge noi 3.4 2729:blah data set