1. Install the MDK environment and download the third-party software mcuisp of the program.
Turn the BOOT0 switch to VCC, automatically search the serial port, and start programming. If the program is downloaded successfully, the information in the red box below will be printed out. After the program is downloaded successfully, you need to
turn the BOOT0 switch to GND, and then press our reset button to see the experimental imagination (you can also set it as follows).
When you start programming the button, the MCUISP will be in a connected state, which will cause the program to fail to download, as shown in the screenshot below. The solution is to just press the reset button on the development board.
2. Online debugger, JLINK driver installation and MDK environment construction.
3. How to create a new project template.
Create a new project, select the chip model, and the next window asks us whether we need to copy the STM32 startup code to the project file. This startup code is applicable to the M3 series. Generally, we click Yes, but we are using the ST library here, and the library file also comes with this startup code. So in order to maintain the integrity of the library, we do not need the startup code that comes with the development environment.
Create five subfolders in the folder: FWlib (for storing STM32 library files), CMSIS (ARM_C processor software interface), output (for saving files output after software compilation), Listing (for storing some files generated during the compilation process), and USER (for storing project files and user code). main.c, stm32f10x_conf.h, stm32f10x_it.h, stm32f10x_it.c, system_stm32f10x.c to the \USER directory. The two files stm32f10x_it.h and stm32f10x_it.c contain interrupt functions, which are empty and do not contain any interrupt service routines. stm32f10x_conf.h is a header file that users need to configure. When we need to use the driver of a certain peripheral in the chip, we only need to include the header file of the driver in this file. The driver of the on-chip peripherals is in the src folder, and the inc folder contains their header files. These three files are files that users need to modify when programming, and other library files generally do not need to be modified. system_stm32f10x.c is a library file that complies with the CMSIS standard provided by ARM. We will move this file to the \CMSIS folder later.You need to create a startup folder in CMSIS first to store these startup files written in assembly. Copy core_cm3.c and core_cm3.h to the \CMSIS folder. Copy stm32f10x.h, system_stm32f10x.c, and system_stm32f10x.h to the \CMSIS folder. (These are all STM32 library functions, startup codes, etc.)
Basically done, right-click the project name to open the "Manage Components" window, or click the "Product" icon on the toolbar. Rename the Target under Project Targets to what you want.
Then we need to create user groups. Right-click and select Add Group... to create the four user groups we need.
Next, add files to each user group.
Finally, set up the software: The project has been basically built. Now let's configure the MDK configuration options. Click the magic wand button in the toolbar and select Output in the pop-up window. Then click Select Folder for Objects... to set the location where the compiled output file will be saved. At the same time, check the Create HEX File and Browse information options. (The path folder we set before)
Select the "C++" tab, and enter "use_stdperiph_driver,stm3210x_hd" in define. add use_stdperiph_driver is to shield the default search path of the compiler, and use the st library we added to the project instead. add stm32f10x_hd because the chip we use is large capacity. after adding the stm32f10x_hd macro, we can use the registers defined for large capacity in the library file. add use_stdperiph_driver is to shield the default search path of the compiler, and use the st library we added to the project instead. add stm32f10x_hd because the chip we use is large capacity. after adding the stm32f10x_hd macro, we can use the registers defined for large capacity in the library file.
Click on the Include Paths column and add the search path for library files here, so that the default search path can be blocked. But when the compiler cannot find the path we specify, it will still return to the standard directory to search, just like some ANSI C library files, such as stdin.h and stdio.h. But when the compiler cannot find the path we specify, it will still return to the standard directory to search, just like some ANSI C library files, such as stdin.h and stdio.h.
The last step is to modify the main.c file.
#include "stm32f10x.h"
int main(void)
{
while(1);
// add your code here ^_^。
} At this point, our project template is built.
Previous article:Difference between DSP and STM32
Next article:How to use the DSP library provided by STM32 for FFT
Recommended ReadingLatest update time:2024-11-23 19:19
- Popular Resources
- Popular amplifiers
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- STMicroelectronics discloses its 2027-2028 financial model and path to achieve its 2030 goals
- 2024 China Automotive Charging and Battery Swapping Ecosystem Conference held in Taiyuan
- State-owned enterprises team up to invest in solid-state battery giant
- The evolution of electronic and electrical architecture is accelerating
- The first! National Automotive Chip Quality Inspection Center established
- BYD releases self-developed automotive chip using 4nm process, with a running score of up to 1.15 million
- GEODNET launches GEO-PULSE, a car GPS navigation device
- Should Chinese car companies develop their own high-computing chips?
- Infineon and Siemens combine embedded automotive software platform with microcontrollers to provide the necessary functions for next-generation SDVs
- Continental launches invisible biometric sensor display to monitor passengers' vital signs
- The LM2596 module input voltage is pulled down to 3V
- AnalogicTech launches highly integrated power chip AAT2550
- A talented person actually analyzed power MOS like this, it is very rare information!
- Brief Introduction to Lingshan Scenic Area in Mentougou District, Beijing (Photos)
- MicroPython has made several adjustments to USB functions
- What is this forum talking about?
- Commonly used algorithms for drones - Kalman filter (IV)
- Why does Apple use UWB technology? Learn more about UWB here
- Application of Nortel GSM-R in the Construction of Qinghai-Tibet Railway
- How to use LOTO oscilloscope to draw frequency response characteristic curve?