1.问题来源
作为一名新手,我们在观看b站江协科技的教程时,因为下载的keil5版本与教程不一样,在编译时会发生
Build started: Project: project1.1
*** Using Compiler 'V6.21', folder: 'F:\32\ARM\ARMCLANG\Bin'
Build target 'Target 1'
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.
compiling core_cm3.c...
compiling system_stm32f10x.c...
".\Objects\project1.1" - 4 Error(s), 0 Warning(s).
Target not created.
Build Time Elapsed: 00:00:01
这样的问题,问题的原因是版本问题。
2.问题解决
2.1下载Compiler Version 5编译器
ARMCompiler_506_Windows_x86_b960.7z_免费高速下载|百度网盘-分享无限制
2.2 将文件的ARMCC文件复制/剪切到keil5项目的ARM文件夹下
注意:此步骤特别重要,不然识别不到路径
2.3打开此
2.4点击 Add another ARM Compiler Version to List...
2.5、选择V5编译器的安装路径ARMCC,点击确定
2.6 点击close
2.7最后在点击 “魔术棒”图标,进入Target页面,可以看到ARM Compiler的选择中多了Version 5,选择use default complier version 5),点击ok
3.大功告成
谢谢观看,希望鼓励点赞~~