Step 1: Download the standard peripheral firmware library.
Download link: http://www.st.com/stonline/stappl/resourceSelector/app?page=resourceSelector&doctype=FIRMWARE&ClassID=1734
Download the STM32F2xx Standard Peripherals library. The latest version is V1.1.0, but it is recommended to download V1.0.0 because the latest version V1.1.0 on the official website lacks the cm3.c file.
It is recommended to use Thunder to download, because if you download using a browser, the download will stop at 99%, but you can complete the download using Thunder.
After downloading, unzip it, as shown below:
figure 1
--STM32F2xx_StdPeriph_Lib_V1.0.0
|--_htmresc
|--Libraries
|--CMSIS
|--STM32F2xx_StdPeriph_Driver
| --Project
|--Utilities
|--Release_Notes.html
|--stm32f2xx_stdperiph_lib_um.chm
|--stm32f2xx_stdperiph_lib_um.chw
Step 2: Organize the project directory
Create a new directory anywhere on your computer, such as APP, and then create two new directories, Project and User, under the APP directory.
Next, copy the Libaries directory under the standard peripheral firmware library that you downloaded and unzipped earlier to the APP directory.
Then create two new directories, Obj and List, under the Project directory.
Finally, select a template source file from the previously unzipped files and copy it to the User directory. Here, for example, .\STM32F2xx_StdPeriph_Lib_V1.0.0\Project\STM32F2xx_StdPeriph_Examples\GPIO
Copy the source code in the directory to the Usr directory.
Once you have these prepared you can proceed to the next step.
The following figure shows the directory of APP:
figure 2
Step 3: Create MDK project
Open MDK, click Project->New uVision Project..., then a dialog box pops up and asks you to select the project directory. Select APP/Project here and name the project Demo, as shown below:
image 3
After clicking Save, a dialog box will pop up to select the MCU type. Here, select STM32F207VC from STMicroeletronics, as shown below:
Figure 4
After clicking OK, a dialog box pops up, select whether to let MDK automatically generate the startup file startup_stm32f2xx.s to the project. Here, because there is already a startup file, select No here.
Step 4: Add project files
First, rename the project to Demo, and then click the Manage Conponents... button on the toolbar, as shown in the red circle in the figure below:
Figure 5
Open the following interface:
Figure 6
The next step is to add groups and source files to the project. First, add four groups: Lib, User, CMSIS, and StartUp.
Then add source files for each group:
Lib->Add all source files under APP\Libraries\STM32F2xx_StdPeriph_Driver\src. Of course, you can also select only some files as needed.
User->Add all source files in the APP\User directory, except system_stm32f2xx.c, because this file will be added in the next CMSIS group.
CMSIS->Add the core_cm3.c file in the APP\Libraries\CMSIS\CM3\CoreSupport directory
Add the system_stm32f2xx.c file in the APP\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F2xx directory.
StartUp->Add the startup_stm32f2xx.s file in the APP\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F2xx\startup\arm directory.
This will add all the files.
Step 5: Add header files
Click the Target Options.. button on the toolbar, as shown in the red circle in the figure below:
Figure 7
The following dialog box pops up, select the C/C++ tab, add the USE_STDPERIPH_DRIVER macro in the Define: column under Preprocess Symbols, and add the include path under Include Paths, as shown below:
Note: The macro USE_STDPERIPH_DRIVER can be found in the header file stm32f2xx.h. It means to open the standard peripheral firmware library. Of course, you can also modify stm32f2xx.h to open this macro, but it is not recommended.
Figure 8
The paths included are all directories of header files, as shown below:
Fig. 9
Then set the output directory and the listing directory.
Under the Output tab, click the Select Folder for Objects.. button, and then select the APP\Project\Obj directory as the output directory.
Under the Listing tab, click the Select Folder for Listings... button, and then select the APP\Project\List directory as the list directory.
At this point, all the project settings are basically set up, and the next step is to compile and burn.
Step 6: Compile the project
Click Compile and find an error. Comment out #include "stm32_eval.h" in the main.c file.
//#include "stm32_eval.h"
Then you can compile it.
complete!
Previous article:Cotex-M3 core LPC17xx series clock and its configuration method
Next article:STM32 CAN --- Analysis of working/testing modes
Recommended ReadingLatest update time:2024-11-16 04:15
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- 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
- Introduction to the mobile station development board: ultra-low power python board
- USB to JTAG
- DSP28335 SCI communication problem summary and problem summary
- Beetle ESP32-C3 test (IV) IDF method to provide AP connection
- Several questions about 7S3P battery pack circuit
- MSP430G2553 clock system configuration
- Award-winning live broadcast: Microchip&avnet series live broadcast third collection
- [Vicor White Paper Recommendation] Power Averaging Design Method with Voltage Regulation: Ideal Power Supply Solution for Pulse Loads
- Bear Pie Huawei IoT Operating System LiteOS Kernel Tutorial - IoT-Studio Introduction and Installation
- How to use C language to find the corresponding value in the table in the microcontroller