当前位置:网站首页>STM32F103 learn the steps and template fool tutorial of 1-keil5 project establishment
STM32F103 learn the steps and template fool tutorial of 1-keil5 project establishment
2022-07-29 02:36:00 【Sell yourself to buy a lens】
1、 Building engineering Folder

Create a new project folder
2、 Create four more folders in the folder

These four folders are for Firmware library and other comparative files
3、 Copy files from the firmware library to CMSIS Folder
Copy the files from the following locations of the firmware to the self created project CMSIS In the folder 

After copying , In the self built project documents CMSIS There is 5 File , as follows :
4、 Copy files to self built projects Start In the folder
Copy the file from the following location in the firmware library , To self built projects Start In the folder
\ Firmware library \STM32F10x_StdPeriph_Lib_V3.5.0\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\arm
After copying, it is as follows 
5、 Copy files from the firmware library to Self built projects Lib In the folder
Path as follows :
Copy these two folders directly To self built engineering projects Lib File at home
6、 Copy files from the firmware library to Self built projects User In the folder

Copy these four files to User in
7、 open keil5, In the file that just created the project , Create a project

Choose chip model 
8, Set up a group in the project



Add the file to the corresponding group 




Add completed , Click on OK, The file just added appears in the project 
9 Initialize configuration



Input STM32F10X_MD,USE_STDPERIPH_DRIVER
Here are two macros defined
USE_STDPERIPH_DRIVER and STM32F10X_MD Two macros , Both Hongs are stm32f10.h in
Why define USE_STDPERIPH_DRIVER This macro ?
The execution of the program is from “main.c” The file started , It must have a header file “stm32f10x.h”.We turn on “stm32f10x.h”, Press down “Ctrl+F” key , lookup USE_STDPERIPH_DRIVER, stay “Find What” Enter... In the column “USE_STDPERIPH_DRIVER”.
As shown in the figure . Click on “Find Next”, appear “USE_STDPERIPH_DRIVER” The corresponding code line , Repeat the above operation three times , The third time we can be in the 8296-8298 Line find the code segment shown in the figure .

This code means , Only pre-defined with precompiled instructions “USE_STDPERIPH_DRIVER”, Will be "stm32f10x_conf.h“ Include in “stm32f10x.h” in , As a result ”main.c“ be used . This explains , Why are we not in “main.c” Contained in the ”stm32f10x_conf.h", But after compiling, it is included in "main.c" in .
"stm32f10x_conf.h“ The file is equivalent to a switch file , If you want to use STM32 Firmware library drives standard peripherals , Then the peripheral driver header file is essential . Such as “stm32f10x_gpio.h”, stay ”stm32f10x_conf.h" We use code #include "stm32f10x_gpio.h" To do this .
stay C/C++ Add... To the predefined “USE_STDPERIPH_DRIVER” Is to allow “ Use standard peripheral drivers ” 了 .
- How can I automatically define USE_STDPERIPH_DRIVER( It is not necessary to define in every project USE_STDPERIPH_DRIVER)?
stm32f10x.h in , Yes :
#if !defined USE_STDPERIPH_DRIVER
/** * @brief Comment the line below if you will not use the peripherals drivers. In this case, these drivers will not be included and the application code will be based on direct access to peripherals registers */
/*#define USE_STDPERIPH_DRIVER*/
#endi
Just put #define USE_STDPERIPH_DRIVER Just remove the comments !
The startup file is predefined STM32F10X_MD
Tips : To avoid modifying this file every time you need to switch between these devices , Devices can be defined in the toolchain compiler preprocessor .
- Low density devices are STM32F101xx、STM32F102xx and STM32F103xx Micro controller
among flash The scope is 16-32Kbytes. The corresponding startup file is :startup_stm32f10x_ld.s
- Low density value-added devices are STM32F100xx Micro controller
among flash The scope is 16-32Kbytes Between . The corresponding startup file is :startup_stm32f10x_ld_vl.s
- Medium density equipment is STM32F101xx、STM32F102xx and STM32F103xx Micro controller
among flash The scope is 64-128Kbytes Between . The corresponding startup file is :startup_stm32f10x_md.s
- The medium density line equipment is STM32F100xx Micro controller
among flash The scope is 64-128Kbytes Between . The corresponding startup file is :startup_stm32f10x_md_vl.s
- High density equipment is STM32F101xx and STM32F103xx Micro controller
among flash The scope is 256-512Kbytes Between . The corresponding startup file is :startup_stm32f10x_hd.s
- High density value line equipment is STM32F100xx Micro controller
among flash The scope is 256-512 Kbytes Between . The corresponding startup file is :startup_stm32f10x_ld_vl.s
- Ultra high density devices are STM32F101xx and STM32F103xx Micro controller
among flash The scope is 512-1024 Kbytes Between . The corresponding startup file is :startup_stm32f10x_xl.s
- Internet based devices are STM32F105xx and STM32F107xx Micro controller . The corresponding startup file is :startup_stm32f10x_cl.s
Associated path 

10 Write the main function
Pay attention to write more blank lines at the end , Otherwise, there will be a warning

边栏推荐
- XSS靶场(二)xss.haozi
- 线上3d数字展厅制作方案及优点
- 一文读懂Okaleido Tiger近期动态,挖掘背后价值与潜力
- Summary of knowledge points of Engineering Economics
- Quickly master nodejs installation and getting started
- Altium designer outputs Gerber and other production documents
- Responsive Zhimeng template decoration design website
- 关于高并发,我想聊一聊。
- Understanding service governance in distributed development
- NPM install reports an error: eperm: operation not permitted, rename
猜你喜欢

Responsive dream weaving template hotel room website

Double write consistency of MySQL and redis

会议OA之会议通知

Transform okhttp cache with retrofit

Shell 脚本 快速入门 -01

ES6 detailed quick start!

I want to talk about high concurrency.

NPM install reports an error: eperm: operation not permitted, rename

When I look at the source code, what am I thinking?

Responsive dream weaving template outdoor camping website
随机推荐
Esbuild Bundler HMR
HTTP断点续传以及缓存问题
Intel's IPP Library (Integrated Performance Primitives)
MySQL基本操作和基于MySQL基本操作的综合实例项目
如何快速设计一套支持渲染富文本内容的跨端组件
Object based real-time spatial audio rendering - Dev for dev column
ECCV 2022 | AirDet:无需微调的小样本目标检测方法
HTTP缓存
DevOps 团队如何抵御 API 攻击?
Split, an avalanche caused by connection pool parameters
HTTP breakpoint resume and cache problems
time_ Wait and close_ Cause of wait
我被这个浏览了 746000 次的问题惊住了
Eight practical new functions of es2022
代码实现 —— 多项式的最大公因式(线性代数)
“12306”的架构到底有多牛逼?
外包公司“混”了2年,我只认真做了5件事,如今顺利拿到字节 Offer。
What are the TCP retransmission mechanisms?
On Multithreading
VR safety training of mine mining virtual reality improves employees' vigilance and protection awareness