Keil5 MDK创建STM32基于标准库的工程
准备工作:
STM32库函数
Libraries(库函数文件)
project(官方提供的工程示例和模板)
Utilities(STM32官方评估板的相关例程)
start
启动汇编文件 startup_stm32f10x_md.s
stm32f1固件库\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\arm
系统的外设映射表 stm32f10x.h system_stm32f10x.c system_stm32f10x.h
stm32f1固件库\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x
核心寄存器映射表 core_cm3.h core_cm3.h
stm32f1固件库\Libraries\CMSIS\CM3\CoreSupport
外设库文件
stm32f1固件库\Libraries\STM32F10x_StdPeriph_Driver\src(源文件)
stm32f1固件库\Libraries\STM32F10x_StdPeriph_Driver\inc(头文件)
main
stm32f10x_conf.h(包含了各种外设的库文件,取消编译器对当前源文件编译)
stm32f10x_it.h stm32f10x_it (中断函数)
stm32f1固件库\Project\STM32F10x_StdPeriph_Template
建立过程:
Keil5建立project,打开文件所在位置,
创建 Library,Start,main,User文件夹,将以上文件分别放到各个文件夹当中,
在keil中添加各个文件夹路径,
编译模式改为UTF-8,Debug改为 STLINK
注意事项:
ARM Comliler 要使用 Use defaultcompiler version5
c/c++中要添加宏定义 USE_STDPERIPH_DRIVER
c/c++中要添加文件路径
编译效果如图