当前位置:网站首页>華大單片機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系統是徹底的自由軟件。
边栏推荐
- Redis 原理 - String
- VS code 运行yarn run dev 报yarn : 无法加载文件XXX的问题
- DFS and BFS simple principle
- Gartner聚焦中国低代码发展 UniPro如何践行“差异化”
- Alibaba's mission, vision and core values
- The IPO of Yuchen Airlines was terminated: Guozheng was proposed to raise 500million yuan as the major shareholder
- Introduction to deep learning and neural networks
- 信息学奥赛一本通 1333:【例2-2】Blah数集 | OpenJudge NOI 3.4 2729:Blah数集
- Redis Series 2: data persistence improves availability
- Exporting coordinates of points in TXT format in ArcGIS
猜你喜欢

数仓的字符截取三胞胎:substrb、substr、substring
![[notice of the Association] notice on holding summer special teacher training in the field of artificial intelligence and Internet of things](/img/ef/5b86170e60a7e03c4db512445540b9.jpg)
[notice of the Association] notice on holding summer special teacher training in the field of artificial intelligence and Internet of things

The IPO of Yuchen Airlines was terminated: Guozheng was proposed to raise 500million yuan as the major shareholder

如何利用 RPA 实现自动化获客?

Mise à jour SQL mise à jour par lots

Teach you how to install Oracle 19C on Windows 10 (detailed picture and text with step on pit Guide)

Hi,你有一份Code Review攻略待查收!

MFS分布式文件系统

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

External interrupt experiment based on stm32f103zet6 library function
随机推荐
在arcgis中以txt格式导出点的坐标
高收益银行理财产品在哪里看?
Galaxy Kirin V10 system activation
新中大冲刺科创板:年营收2.84亿 拟募资5.57亿
Keras deep learning practice (12) -- facial feature point detection
Market status and development prospect forecast of global 4-methyl-2-pentanone industry in 2022
Hi,你有一份Code Review攻略待查收!
SQL update批量更新
Comment encapsuler un appel à une bibliothèque
Function key input experiment based on stm32f103zet6 Library
Current market situation and development prospect forecast of the global ductless heating, ventilation and air conditioning system industry in 2022
数据分析师太火?月入3W?用数据告诉你这个行业的真实情况
云原生数据库:数据库的风口,你也可以起飞
基于STM32F103ZET6库函数按键输入实验
Bit. Store: long bear market, stable stacking products may become the main theme
【网络研讨会】MongoDB 携手 Google Cloud 加速企业数字化创新
别焦虑了,这才是中国各行业的工资真相
Teach you how to install Oracle 19C on Windows 10 (detailed picture and text with step on pit Guide)
Market status and development prospect forecast of global tetramethylammonium hydroxide developer industry in 2022
Vscode suggests that you enable gopls. What exactly is it?