解决keil编译报错Start/core_cm3.c(465): error
【摘要】Keil5 MDK5.39版本使用新ARM编译器时,因与STM32标准库不兼容会出现"naked function"相关编译错误(如core_cm3.c中的PSP/MSP函数报错)。解决方法需安装旧版编译器V5.06update6(build750):1.通过Arm官网"Legacy Arm Compilers"或GitCode仓库获取;2.在Kei
·
V5.06 update 6 (build750)编译器获取路径以放置在文末
出现该错误的原因
出现该错误的原因是STM32的标准库版本与当前的ARM编译器版本不匹配导致的,因此需要选择其他的编译器。
情况比如:你安装的Keil5 MDK5.39,此时的编译器中应为图中框选的三个ARM编译器。
但是在比如江协科技的STM32标准库教程中的工程文件中,使用这三个编译器是不能正常编译的。会出现如下报错
use defult compiler version6
Start/core_cm3.c(445): error: non-ASM statement in naked function is not supported
445 | uint32_t result=0;
| ^
Start/core_cm3.c(442): note: attribute is here
442 | uint32_t __get_PSP(void) __attribute__( ( naked ) );
| ^
Start/core_cm3.c(465): error: parameter references not allowed in naked functions
465 | "BX lr \n\t" : : "r" (topOfProcStack) );
| ^
Start/core_cm3.c(461): note: attribute is here
461 | void __set_PSP(uint32_t topOfProcStack) __attribute__( ( naked ) );
| ^
Start/core_cm3.c(479): error: non-ASM statement in naked function is not supported
479 | uint32_t result=0;
| ^
Start/core_cm3.c(476): note: attribute is here
476 | uint32_t __get_MSP(void) __attribute__( ( naked ) );
| ^
Start/core_cm3.c(499): error: parameter references not allowed in naked functions
499 | "BX lr \n\t" : : "r" (topOfMainStack) );
| ^
Start/core_cm3.c(495): note: attribute is here
495 | void __set_MSP(uint32_t topOfMainStack) __attribute__( ( naked ) );
| ^
4 errors generated.
解决办法
解决办法,向keil中添加5.3X之前的编译器,比如V5.06 update 6 (build750)
添加方法:


确定完即可,后回到魔术棒切换编译器,若没有刷新,就重启一下keil。找到V5.06 update 6 (build750)。
编译器获取链接:
1. 官方页面下载:
Legacy Arm Compilers – Arm Developer
2.个人仓库下载
https://gitcode.com/Amireux_T/keilcomplier_ARMCC.git
更多推荐



所有评论(0)