1、新建工程:liubo.uvproj
2、建立目录:
工程目录下建立文件夹: USR, Readme
库函数中加入文件夹:ASM, System复制进入工程文件夹
Tartge : STM32
groups: ASM , USR, Lib , System, Readme
3、设置
(1) Device:STM32F103VE
(2) Target: 选择晶振
(3) Output: 生成hex
(4) C/C++: Define: USE_STDPERIPH_DRIVER,STM32F10X_HD
IncludePaths: libinc, System, USR
(5) Debug: use: J-LINK/J-Trace Cortex
Debug ---- Settings : ort: JTAG 2MHZ
Flash Download ---- Erase Full C , 勾选Program , Verify, Reset and Run
Add: STM32F10X High-density
(6) Utilities: Use Target Driver for Flash Programming: J-LINK/J-Trace Cortex
4、groups添加文件:
ASM中添加startup_stm32f10x_hd.s
Lib中添加stm32f10x_rcc.c , stm32f10x_gpio.c 等需要的库
System中添加system_stm32f10x.c, core_cm3.c 文件
5、新建pbdata.c 添加到USR,保存在USR文件夹
新建pbdata.h保存在USR文件夹
pbdata.h中定义示例如下:
1 #ifndef _pbdata_H
2 #define _pbdata_H
3
4 #include"stm32f10x.h"
5
6 /*定义变量*/
7 extern u8 dt;
8
9 /*定义函数*/
10 void delay(u32 nCount);
11
12 #endif
View Code
pbdata.c中定义示例:
1 #include"pbdata.h"
2
3
4 u8 dt=0;
5
6 void delay(u32 nCount)
7 {
8 for(;nCount!=0;nCount--);
9 }
View Code
主函数定义示例:
1 #include"stm32f10x.h"
2 #include"pbdata.h"
3
4 int main(void)
5 {
6 dt=123;
7 delay(100);
8 }
View Code
6、 每个代码文件最后必须回车,否则报错
7、配置好的工程:http://download.csdn.net/detail/a1181803348/8733491
原文链接: https://www.cnblogs.com/STM32bo/p/4525827.html
欢迎关注
微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍
原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/216577
非原创文章文中已经注明原地址,如有侵权,联系删除
关注公众号【高性能架构探索】,第一时间获取最新文章
转载文章受原作者版权保护。转载请注明原作者出处!