After understanding the standard library file of STM32, we can use it to set up the project, because the library new project steps more, we generally use the library to create an empty project, as a project template. A copy of the project template will be copied and developed on top of it.
1. New Project
1) Create a new local project folder
Create a new Template project template folder on your local computer, and then create a new 6 folder underneath it.
After you have created a new folder locally, add the prepared library file to the appropriate folder:
2) New Project
3) Select the CPU model
4) Add library files online (here we manually add the library files)
Click Cancel Directly
5) Add Group folder
6) Add File
First copy the above mentioned files from the St standard library to the catalog of the corresponding folder in the project template, then add these files in the new project, double-click the Group folder will appear the path to add files, and then select the file.
7) Set whether the file is added to the compilation
8) Configure the Magic wand tab
This step of the configuration work is very important , many people do not use the serial port printf function, compile a problem, download a problem, are the configuration of this step is wrong.
A) target selects the micro-Library "use MicroLib" so that the printf function can be used when writing a serial port driver later. And in some applications if you use the STM32 floating-point unit FPU, it is important to open the micro-Library at the same time, or sometimes there will be a variety of strange phenomena. The switch option for the FPU is on by default in "Use single Precision" under the micro-Library configuration option.
b) In the Output tab, locate the Export folder to the "output" folder in our project directory, and if you want to generate hex files during compilation, then the Create hex file option is ticked.
c) In the Listing tab, locate the output folder in the "Listing" folder in our project directory.
d) Add the path to the header file to be looked up when processing macros and compiler compilation in the C + + tab.
e) Download Configuration
②st-link Configuration
③ULINK2 Configuration
To install the ULINK2 driver first, the configuration can be downloaded, both of which are indispensable. Note that it is set to ULINK2 instead of Ulink.
f) Select the CPU model
New Project-Library function Edition