mdk编译器切换为v6.4后报错

Qitas 2017-06-05 04:57:28
由MDK(5.20)默认的编译器v5.06切换到v6.4,会在core_cm3.c文件中报错,求解决方案。
*** Using Compiler 'V6.4', folder: 'C:\Keil_v5\ARM\ARMCLANG\Bin'
Build target 'Yuenjee'
..\Libraries\CMSIS\CM3\CoreSupport\core_cm3.c(445): error: non-ASM statement in naked function is not supported
uint32_t result=0;
^
..\Libraries\CMSIS\CM3\CoreSupport\core_cm3.c(442): note: attribute is here
uint32_t __get_PSP(void) __attribute__( ( naked ) );
^
..\Libraries\CMSIS\CM3\CoreSupport\core_cm3.c(465): error: parameter references not allowed in naked functions
"BX lr \n\t" : : "r" (topOfProcStack) );
^
..\Libraries\CMSIS\CM3\CoreSupport\core_cm3.c(461): note: attribute is here
void __set_PSP(uint32_t topOfProcStack) __attribute__( ( naked ) );
^
..\Libraries\CMSIS\CM3\CoreSupport\core_cm3.c(479): error: non-ASM statement in naked function is not supported
uint32_t result=0;
^
..\Libraries\CMSIS\CM3\CoreSupport\core_cm3.c(476): note: attribute is here
uint32_t __get_MSP(void) __attribute__( ( naked ) );
^
..\Libraries\CMSIS\CM3\CoreSupport\core_cm3.c(499): error: parameter references not allowed in naked functions
"BX lr \n\t" : : "r" (topOfMainStack) );
^
..\Libraries\CMSIS\CM3\CoreSupport\core_cm3.c(495): note: attribute is here
void __set_MSP(uint32_t topOfMainStack) __attribute__( ( naked ) );
^
4 errors generated.
compiling core_cm3.c...
".\Obj\Project.axf" - 4 Error(s), 0 Warning(s).
...全文
3276 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
weixin_42607138 2018-10-17
  • 打赏
  • 举报
回复 6
这个问题是因为core_cm3.c和core_cm3.h文件太老导致的,没猜错的话这个文件还是2009年的版本,ST已经停止维护。
解决办法:下载STM32cube_FW软件包,Drivers\CMSIS\Include目录下拷贝cmsis_armcc_V6.h、core_cm3.h、core_cmFunc.h、core_cmInstr.h这几个文件覆盖掉老的core_cm3.h文件,然后停用core_cm3.c,改用CMSIS标准接口。
方法如下图:

这是ARM的官方标准接口,坏处是CMSIS标准接口屏蔽了实现细节,但这是趋势。
以上建议,希望采纳!

27,373

社区成员

发帖
与我相关
我的任务
社区描述
硬件/嵌入开发 单片机/工控
社区管理员
  • 单片机/工控社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧