-
环境
Windows7
Keil V5.38a
MCU: STM32F10x
标准库版本: V3.6.0 -
创建文件夹
STM32F1xx
project
mdk -
双击打开Keil
-
点击-><New uVision Project…>
-
选择工程文件存放的路径以及设置工程名,这里命名为【mcu】
-
选择MCU,这里选择【STM32F103C8】
-
选择对应的组件,这里什么都不选,直接点击
-
复制对应文件到工程目录下:
1)复制标准库,STM32F10x_StdPeriph_Lib_V3.6.0\Libraries\STM32F10x_StdPeriph_Driver
2)复制如下文件
STM32F10x_StdPeriph_Lib_V3.6.0\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\stm32f10x.h
STM32F10x_StdPeriph_Lib_V3.6.0\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\system_stm32f10x.c
STM32F10x_StdPeriph_Lib_V3.6.0\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\system_stm32f10x.h
STM32F10x_StdPeriph_Lib_V3.6.0\Libraries\CMSIS\CM3\CoreSupport\core_cm3.c
STM32F10x_StdPeriph_Lib_V3.6.0\Libraries\CMSIS\CM3\CoreSupport\core_cm3.h
STM32F10x_StdPeriph_Lib_V3.6.0\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\arm
3)复制如下文件
STM32F10x_StdPeriph_Lib_V3.6.0\Project\STM32F10x_StdPeriph_Template\main.c
STM32F10x_StdPeriph_Lib_V3.6.0\Project\STM32F10x_StdPeriph_Template\stm32f10x_conf.h
STM32F10x_StdPeriph_Lib_V3.6.0\Project\STM32F10x_StdPeriph_Template\stm32f10x_it.c
STM32F10x_StdPeriph_Lib_V3.6.0\Project\STM32F10x_StdPeriph_Template\stm32f10x_it.h
-
管理工程项,添加目录及对应C文件
-
添加头文件所在目录:
-
在预编译中添加宏
<USE_STDPERIPH_DRIVER>
解决如下报错问题:
Error: L6218E: Undefined symbol assert_param
-
编译