当前位置:网站首页>華大單片機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!!"
#endif
2、原因分析
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系統是徹底的自由軟件。
边栏推荐
- 惊呆!原来 markdown 的画图功能如此强大!
- Hikvision Tools Manager海康威视工具大全(含SADP、录像容量计算等工具)百万安防从业者的实用工具
- 过关斩将,擒“指针”(下)
- 如何实现IM即时通讯“消息”列表卡顿优化
- IDEA 官网插件地址
- 使用 WebDAV 替代445端口文件共享
- VS code 运行yarn run dev 报yarn : 无法加载文件XXX的问题
- 国际数字经济学院、华南理工 | Unified BERT for Few-shot Natural Language Understanding(用于小样本自然语言理解的统一BERT)
- Substrate及波卡一周技术更新速递 20220425 - 20220501
- PostgreSQL database Wal - resource manager rmgr
猜你喜欢
别焦虑了,这才是中国各行业的工资真相
Camera calibration with OpenCV
Redis 原理 - String
开源之夏 2022 | openGauss 项目中选公布
原创 | 2025实现“5个1”奋斗目标!解放动力全系自主非道路国四产品正式发布
Google Earth Engine(GEE)——ImageCollection (Error)遍历影像集合产生的错误
Industry university cooperation cooperates to educate people, and Kirin software cooperates with Nankai University to complete the practical course of software testing and maintenance
binder hwbinder vndbinder
基于STM32F103ZET6库函数蜂鸣器实验
Comprehensively analyze the zero knowledge proof: resolve the expansion problem and redefine "privacy security"
随机推荐
Differences between mongodb and MySQL
如何封装调用一个库
Redis 原理 - String
maxwell 报错(连接为mysql 8.x)解决方法
在arcgis中以txt格式导出点的坐标
基于STM32F103ZET6库函数按键输入实验
网上期货开户安全么?
Function key input experiment based on stm32f103zet6 Library
实战回忆录:从Webshell开始突破边界
Two methods of MySQL database login and logout
China's Industrial Software Market Research Report is released, and SCADA and MES of force control enrich the ecology of domestic industrial software
广发期货开户安全吗?
Hi,你有一份Code Review攻略待查收!
Keras deep learning practice (12) -- facial feature point detection
Jinyuan's high-end IPO was terminated: it was planned to raise 750million Rushan assets and Liyang industrial investment were shareholders
[elt.zip] openharmony paper Club - memory compression for data intensive applications
阿里巴巴的使命、愿景、核心价值观
喜讯丨英方软件2022获得10项发明专利!
PostgreSQL数据库WAL——资源管理器RMGR
Comment encapsuler un appel à une bibliothèque