命名规则
- 创建工程文件夹、Keil 中新建工程,选择芯片型号
- 工程文件夹中创建 Start、Library、User 等文件夹,复制固件库中的文件到对应文件夹中
- Keil 工程中添加对应的 Start、Libray、User等同名的分区,然后将文件夹内的文件添加到对应的组里
- Keil 工程选项,C/C++,Include Paths 中添引入工作文件夹
- Keil 工程选项,C/C++, Define 内定义 USE_STDPERIRH_DRIVER
启动文件,ARM启动时候要初始化堆栈指针。等等
外设寄存器描述文件和时钟配置文件
内核的寄存器描述文件
1 | Project/ |
问题
一、初始化编译报错
error: non-ASM statement in naked function is not supported
修改编译器版本为 5 的版本
如果 Missing:Compiler Version 5 没有要去官网下载(需要登陆注册吧比较麻烦,百度云中有了)
error: A1023E: File “..\Firmware\CMSIS\startup_stm32f10x_md.s” could not be opened: No such file or directory
Error: #5: cannot open source input file “..\Firmware\CMSIS\core_cm3.c”: No such file or directory
Error: #5: cannot open source input file “..\Firmware\CMSIS\system_stm32f10x.c”: No such file or directory
这是路径错了,正确的路径应该是 ..\CMSIS\system_stm32f10x.c,删掉多余的引用;
warning: #223-D: function “assert_param” declared implicitly
在 stm32f10x.h 中没有引用 stm32f10x_conf.h 头文件,将其宏定义放开即可;添加 USE_STDPERIPH_DRIVER 宏。
Error: L6218E: Undefined symbol RCC_APB1PeriphResetCmd (referred from stm32f10x_usart.o).
引用的 RCC_APB1PeriphResetCmd 找不到,我们要将对应的 stm32f10x_rcc.h 添加到环境中;
Error: L6218E: Undefined symbol assert_param (referred from misc.o).