当前位置:网站首页>華大單片機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系統是徹底的自由軟件。
边栏推荐
- Market status and development prospect forecast of global aircraft hose industry in 2022
- Four years of College for an ordinary graduate
- 校园书籍资源共享平台
- 【网络研讨会】MongoDB 携手 Google Cloud 加速企业数字化创新
- SQL update batch update
- 【ELT.ZIP】OpenHarmony啃论文俱乐部—数据密集型应用内存压缩
- SQL update批量更新
- Market status and development prospect forecast of global 4-methyl-2-pentanone industry in 2022
- 中国工业软件市场研究报告出炉,力控SCADA、MES丰富国产工业软件生态
- How to use the low code platform of the Internet of things for picture management?
猜你喜欢

Recommend several open source IOT platforms

2022年第一季度消费金融APP用户洞察——总数达4479万人

Summary of domestic database certification test guide (updated on June 16, 2022)

开源之夏 2022 | openGauss 项目中选公布

Alibaba's mission, vision and core values

芯动联科冲刺科创板:年营收1.7亿 北方电子院与中城创投是股东

国际数字经济学院、华南理工 | Unified BERT for Few-shot Natural Language Understanding(用于小样本自然语言理解的统一BERT)

Running lantern experiment based on stm32f103zet6 library function

昱琛航空IPO被终止:曾拟募资5亿 郭峥为大股东

基于STM32F103ZET6库函数跑马灯实验
随机推荐
Market status and development prospect forecast of the global shuttleless air jet loom industry in 2022
Minmei new energy rushes to Shenzhen Stock Exchange: the annual accounts receivable exceeds 600million and the proposed fund-raising is 450million
Keras deep learning practice (12) -- facial feature point detection
网上期货开户安全么?
Code and principle of RANSAC
工作流自动化 低代码是关键
Current market situation and development prospect forecast of the global ductless heating, ventilation and air conditioning system industry in 2022
图扑数字孪生智慧能源一体化管控平台
使用logrotate对宝塔的网站日志进行自动切割
im即时通讯开发之双进程守护保活实践
新中大冲刺科创板:年营收2.84亿 拟募资5.57亿
Alibaba's mission, vision and core values
Comprehensively analyze the zero knowledge proof: resolve the expansion problem and redefine "privacy security"
PostgreSQL database Wal - resource manager rmgr
驾驭一切的垃圾收集器 -- G1
The IPO of Yuchen Airlines was terminated: Guozheng was proposed to raise 500million yuan as the major shareholder
VSCode 建议你启用 gopls,它到底是个什么东东?
云原生数据库:数据库的风口,你也可以起飞
binder hwbinder vndbinder
Rxjs mergeMap 的使用场合