STM32 project creation--using Keil uVision5 software
Xiaoli Zi
1 Prepare library function library
STM32F10x_StdPeriph_Lib_V3.5.0
VX Search "Xiao Li Zi" to follow and reply STM32F10x to download
2. Create a directory to store the project
STM32Study
STM32Study/study1 stores the directory of this project
3. Open Keil uVision5 to create a project
4. Select the model (select according to the board model)
5. Add necessary files to the project
5.1. Startup file
The startup file is located in the library function
STM32F10x_StdPeriph_Lib_V3.5.0\STM32F10x_StdPeriph_Lib_V3.5.0\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\arm
Create a file directory Start in the project file directory and import the files in the startup file into the project file.
5.2 Copy peripheral register description files and clock files
位于STM32F10x_StdPeriph_Lib_V3.5.0\STM32F10x_StdPeriph_Lib_V3.5.0\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x
Also copied into Start
5.3 Copy memory register file
位于 STM32F10x_StdPeriph_Lib_V3.5.0\STM32F10x_StdPeriph_Lib_V3.5.0\Libraries\CMSIS\CM3\CoreSupport
5.4 Load necessary files into the project
6. Add header file path
7. Test project availability
7.1 Create the User storage main file in the project
Create a group and rename it User
7.2 Add main file
8. Write test code
#include "stm32f10x.h" // Device header
int main(void)
{
while(1)
{
}
}
9. Error handling
9.1 Error 1
Build target 'Target 1'
Start/core_cm3.c(445): error: non-ASM statement in naked function is not supported
uint32_t result=0;
Reason: The compiled version used is too new
9.2 Error 2
.\Objects\study2_1.sct(7): error: L6235E: More than one section matches selector - cannot all be FIRST/LAST.
Reason: All startup files have been loaded.
When the reality is as shown in the figure, the project can be used
10 debug, burning and debugging
10.1 Select descent mode and set download reset execution
11. Programming using library functions
11.1 Copy library functions
Create the Library directory and copy the files in src and inc in \STM32F10x_StdPeriph_Lib_V3.5.0\STM32F10x_StdPeriph_Lib_V3.5.0\Libraries\STM32F10x_StdPeriph_Driver
11.2 Add the Library group as above
11.3 Add library function header files containing related files and interrupt functions
Located in STM32F10x_StdPeriph_Lib_V3.5.0\STM32F10x_StdPeriph_Lib_V3.5.0\Project\STM32F10x_StdPeriph_Template copied to the User file directory