Ⅰ. Write in front
This article uses the latest version (November 2016) of Keil (MDK-ARM) V5.21a development environment and takes the STM32 processor as an example to describe the detailed process of creating a new software project.
Keil (MDK-ARM) V4 and V5 new software projects are basically the same, this article is also suitable for new software projects with V4 version.
The processor used in this article is ST's STM32F1 series chip. The process of creating a new software project for other series of ST (such as F4, etc.) and other companies (such as TI) is the same.
To facilitate the majority of STM32 learners, I will provide you with the newly built Demo software projects, related tools and documents for each series of STM32F0 - F4 chips for download below.
The content of this article has been organized into a PDF file and is available for download:
http://pan.baidu.com/s/1nuJ0RDR
Author:strongerHuang
Any other commercial use is prohibited without permission!!!
II. Main Points
As the title of this article shows, the focus is on the process of creating a new software project. However, as a software project developed by ARM, it generally contains some source code (such as libraries), which means that you need to prepare some source code files included in the project.
This article takes the STM32F1 series chip as an example (other series chips are similar). It will briefly describe the preparation of the STM32F1 standard peripheral library and Demo source code (LED flashing routine).
After the preparation work, creating a new software project is the main point of this article. The process of creating a new software project is mainly for beginners. The configuration of most projects is the default. If you want to view more detailed configuration of the software project, you can enter the blog or follow the WeChat public account to view it.
III. Preparation
As the saying goes, "sharpening the knife does not delay the chopping of wood." Although the preparation work is not closely related to the topic, it is also the focus of this article. If the preparation work is done well, the subsequent work of building a new software project will be easily accomplished.
1. Install Keil (MDK-ARM) software tools
This article requires tools, so I won't go into details here. For details, please see my other article [Introduction, download, installation and registration of Keil (MDK-ARM):
Blog: http://blog.csdn.net/ybhuangfugui/article/details/51501781
PDF: http://pan.baidu.com/s/1nuJ0RDR
2. Download STM32 standard peripheral library
Official website download link (ST account required to log in):
http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software.html?querycriteria=productId=SC961
Download the corresponding standard peripheral library according to the chip model (for example, if the chip is STM32F103ZE, download the corresponding STM32F10x_StdPeriph_Lib), as shown below:
You can also download it from my Baidu network disk (same as the official website):
http://pan.baidu.com/s/1qYbBKMK
3. Organize project folders
The content of this section can be organized according to your own habits. The file and folder structure I organized is based on the conventional organization method. If you think it is reasonable, you can quote it; if you feel uncomfortable with this structure, you can organize it yourself.
First, create a folder to store the project files: STM32F103ZE (Keil)_Demo
A. Extract ST standard peripheral library files
There are many source code files in the standard peripheral library downloaded from the ST official website, but we only need to use some files. Therefore, we need to extract the used files and folders into our project.
Unzip "STM32F10x_StdPeriph_Lib", you can see four folders under the main directory:
_htmresc: picture folder (not extracted)
Libraries: Library folder (extract most of it)
Project: Sample project (extract a small part)
Utilities: Public code, evaluation board code (not extracted)
The main files we extract using the standard peripheral library are the files under Libraries, but some files and folders are redundant. Therefore, I remove the redundant files and folders and keep the required files and folders.
B. Create new files and folders
In addition to the standard peripheral library files, we need to create files and folders to store our own code. I mainly need to create three folders here:
App: Application code
Bsp: underlying part of the code
Doc: Documentation
You also need to create your own file under the newly created folder and add the source code to the file. The demo project we provide has a relatively simple function, which is to make an LED flash. I won't describe it here, but you can download it at the end for details.
After completing the above two steps, we can see the folders organized under "STM32F103ZE (Keil) _Demo":
At this point, the preparation work is complete. Please download the Demo project to view the specific contents of the files extracted above and the newly created files.
IV. New Software Project
Creating a simple, basic software project requires about three steps: creating a project, adding files, and configuring the project.
After completing the above preparations, you can create your own software project. The following will describe the detailed process of creating a new software project from scratch step by step.
1. Create a project
The steps to create a project are basic and relatively simple.
A. Open the software and create a new project (Project -> New uVision Project)
B. Select the path and save the name
C. Select chip model
D. Foundation Engineering
A basic project has been completed, but it is not enough to use it, the following steps are required.
2. Add files
To be precise, it should be adding groups (folders) and adding files. To put it more directly, it is to add your own source code (libraries extracted earlier, newly created files, etc.) to the project.
The engineering project management here can be defined according to your own ideas (similar to classifying and naming folders and files by yourself). I manage projects in the conventional way here.
Add step by step until you are done
3.Configure the project
For beginners, most of the configuration items can be left as default. Here are just a few common configurations that can meet basic functions. For more configurations, please visit my WeChat public account or blog.
A. Click "Project Target Options" to enter the configuration (or Project -> Options for Target)
B. Output Hex file
Many beginner friends will ask how to output Hex (a file that can be downloaded directly). Just check [Project -> Options for Target -> Output] "Create HEX File".
CC/C++ Configuration
This option has many configuration parameters, which is more important for large projects, but for beginners, you only need to configure two simple items.
The first configuration---predefined:
[This only applies to the STM32F103 large-capacity chip, other chips depend on the situation]
STM32F10X_HD is predefined, and some projects also predefine USE_STDPERIPH_DRIVER. Since they all use the "standard peripheral library", I personally like to define USE_STDPERIPH_DRIVER in the stm32f10x.h file, so I can't see the one I defined here.
The second configuration --- includes the path:
Since there are many folders in our previous project, we need to add the corresponding paths so that the compiler can find them.
Add step by step until you are done
D. Select Download Debug Tool
This option is selected according to your download debugger (for example: ST-Link)
E. Download reset and run setup
Some beginner friends asked, "Why do I need to press the reset button to run the program after downloading it?" You can do this by simply checking "Reset and Run" in the project. The program will run immediately after downloading.
At this point, a newly created project is completed (of course, the correct source code is added to the new file I created). You only need to compile it, connect it to the downloader, and you can download and run it.
Previous article:Interrupt-button control LED light
Next article:Keil (MDK-ARM) series tutorial (II)_Toolbar detailed description
Recommended ReadingLatest update time:2024-11-16 12:27
- Popular Resources
- Popular amplifiers
- MCU C language programming and Proteus simulation technology (Xu Aijun)
- Single-chip microcomputer C language programming and simulation
- 100 Examples of Microcontroller C Language Applications (with CD-ROM, 3rd Edition) (Wang Huiliang, Wang Dongfeng, Dong Guanqiang)
- Single chip microcomputer control technology (Li Shuping, Wang Yan, Zhu Yu, Zhang Xiaoyun)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Will the GaN RF market be big?
- [RVB2601 Creative Application Development] 1 Unboxing and Environment Setup
- Practical tips on HGI MCU HC32L110
- Introduction to RF and Wireless Technology
- Help
- ODX-based diagnostic application software INTEWORK-OBT
- Share the MSP430F5529 clock UCS programming considerations
- RK3288 Information
- FFT based on C2000 series DSP
- Occupy the posting position, ESP32---WS2812 16*16 dot matrix drawing points, lines and surfaces