This article mainly consists of two parts: one is the introduction and installation of the STM32 development environment MDK-ARM, and the other is the download and configuration of the STM32 official library files.
1. Development environment installation
1. Introduction to the development environment
KEIL currently has four independent embedded software development tools, namely MDK, KEIL C51, KEIL C166, and KEIL C251. They are all products under the KEIL brand and are based on the uVision integrated development environment. MDK is a member of the RealView series. MDK-ARM, KEIL MDK, RealView MDK, and KEIL For ARM are all the same thing. ARM now uniformly uses the name MDK-ARM.
KEIL MDK development tool is from Keil of Germany. It has been verified and used by more than 100,000 embedded development engineers worldwide. It is the latest software development tool for various embedded processors launched by ARM. KEIL MDK integrates the most advanced technologies in the industry, including µVision5 integrated development environment and RealView compiler. It supports ARM7, ARM9 and the latest Cortex-M3/M1/M0 core processors, automatically configures startup code, integrates Flash burning module, powerful Simulation device simulation, performance analysis and other functions. Compared with ARM's previous toolkit ADS, the latest version of RealView compiler can improve performance by more than 20%. KEIL MDK has outstanding price and function advantages and has become the standard of ARM software development tools. At present, KEIL MDK has reached 90% of the market share in the domestic ARM development tool market. The latest version 5.4 is used here.
As can be seen from the above figure, MDKCore is divided into four parts: uVisionIDE with Editor, ARMC/C++ Compiler, PackInstaller, and uVisionDebugger with Trace. uVision IDE has added practical functions such as code prompts and dynamic syntax detection since MDK4.7, which is a great improvement over previous IDEs. SoftwarePacks (package installer) is divided into three small parts: Device (chip support), CMSIS (ARMCortex microcontroller software interface standard) and Mdidleware (intermediate library). Through the package installer, we can install the latest components to support new devices, provide new device driver libraries and the latest routines, etc., to accelerate product development progress. Unlike the previous MDK, which included all components in one installation package, which was very "bulky", MDK5 is different. MDKCore is an independent installation package, which does not include components such as device support and device drivers, but generally includes CMSIS components, with a size of about 350M, which is much smaller than MDK4.70A's 500M. It is also worth mentioning that after MDK5 is installed, in order to make MDK5 support the development of STM32F103, we also need to install the STM32F1 device support package: Keil.STM32F1xx_DFP.1.0.5.pack (STM32F1 device package).
(II) Development environment installation
1 Download MDK5 integrated development environment
(1) Download from the official website
(2) Third-party downloads
(3) Online cracked version
2 Installing the Integrated Development Environment
(1) Click the executable file and the following page will pop up.
(2) Select the installation path as shown below. It is best not to use the Chinese path.
(3) Finally, the following interface pops up, indicating that the CMSIS and MDK intermediate software packages have been successfully downloaded. The progress indicator below indicates that the program is automatically downloading various support packages from the KEIL official website (if the support package download fails, proceed to the next step)
(4) Download and install the STM32F1xx support library. Select STMicroelectronics STM32F1 Series Device Support, Drivers and Examples.
3 If it is a cracked version, crack it
2. STM32 firmware library
1 STM32 library download , select STSW-STM32054, STM32F10x standard peripheral library
2 After decompression, the following file directory is obtained
Libraries standard peripheral libraries include CMSIS and STM32F10x_StdPeriph_Driver. CMSIS is a vendor-independent hardware abstraction layer for the Cortex-M processor series, which provides a simple processor software interface for chip manufacturers and middleware suppliers, simplifies software reuse, reduces the difficulty of porting operating systems on Cortex-M, and reduces the learning curve and time to market for new microcontroller developers. STM32F10x_StdPeriph_Driver includes driver functions corresponding to all peripherals, which are written in C language and provide a unified, easy-to-call function interface for developers to use.
The Project folder includes all ST official routines and project templates based on different compilers. These routines are important references for learning and using STM32.
Utilities contains sample programs and driver functions for related evaluation boards for developers using official evaluation boards. Many driver functions can also serve as important references for learning.
3 STM32 library usage architecture
The STM32F10xxx standard peripheral library architecture is shown in the figure below. The figure shows the connection between each layer and specific files.
The specific functions of each file in the figure are described in the following table
file name | Functional Description | Specific function description |
core_cm3.h core_cm3.c | Cortex-M3 core and its device files Libraries\CMSIS\CM3\CoreSupport | Access to the Cortex-M3 core and its devices: NVIC, SysTick, etc. Functions for accessing the Cortex-M3 CPU registers and core peripherals
|
stm32f10x.h | Microcontroller-specific header files Libraries\CMSIS\CM3\DeviceSupport \ST\STM32F10x | This file contains the definition of all peripheral registers of the STM32F10x series (base address and layout of registers), bit definition, interrupt vector table, address mapping of storage space, etc.
|
system_stm32f10x.h system_stm32f10x.c | Microcontroller-specific system files Libraries\CMSIS\CM3\DeviceSupport \ST\STM32F10x | Function SystemInit, used to initialize the microcontroller Function Sysem_ExtMemCtl, used to configure the external memory controller |
startup_stm32f10x_Xd.s | Compiler startup code Libraries\CMSIS\CM3\DeviceSupport \ST\STM32F10x\startup\arm | List of interrupt handlers specific to the microcontroller (consistent with the header file)
|
stm32f10x_conf.h | Firmware library configuration file Project\STM32F10x_StdPeriph_Template | The peripherals used by the firmware library are selected by changing the included peripheral header files. The corresponding configuration should be modified first before creating a new program and making functional changes.
|
stm32f10x_it.h stm32f10x_it.c | Peripheral interrupt function file Project\STM32F10x_StdPeriph_Template | Users can add their own interrupt program code accordingly. For multiple different interrupt requests pointing to the same interrupt vector, users can determine the exact interrupt source by judging the interrupt flag bit of the peripheral and execute the corresponding interrupt service function.
|
stm32f10x_ppp.h stm32f10x_ppp.c | Peripheral driver function file Libraries\STM32F10x_StdPeriph_Driver | It includes the initialization configuration of related peripherals and some functional application functions, which is an important part of realizing programming functions.
|
Application.c | User documentation | User program files perform corresponding peripheral configuration and function design through the interfaces provided by the standard peripheral library. |
4 STM32 peripheral library configuration
(1) Create a new directory, a new application project directory, and add the following files from the peripheral library.
Table of contents | Overview | Copy directories and files |
User | main.c | |
Sys | Project\STM32F10x_StdPeriph_Template \stm32f10x_it.h | |
Project\STM32F10x_StdPeriph_Template\ stm32f10x_it.c | ||
Project\STM32F10x_StdPeriph_Template\ stm32f10x_conf.h | ||
Libraries\CMSIS\CM3\DeviceSupport \ST\STM32F10x\stm32f10x.h | ||
Libraries\CMSIS\CM3\DeviceSupport \ST\STM32F10x \system_stm32f10x.h | ||
Libraries\CMSIS\CM3\DeviceSupport \ST\STM32F10x \system_stm32f10x.c | ||
Lib | STM32 library functions | Libraries\STM32F10x_StdPeriph_Driver/src |
Libraries\STM32F10x_StdPeriph_Driver/inc | ||
Core | System Files | Libraries\CMSIS\CM3\DeviceSupport \ST\STM32F10x\startup\arm\startup_stm32f10x_ld.s |
Libraries\CMSIS\CM3\CoreSupport \core_cm3.h | ||
Libraries\CMSIS\CM3\CoreSupport \core_cm3.c | ||
Bin | Compile and generate files |
(2) New construction projects and new application projects
(3) File configuration
Open the project management interface
Modify project options (optional)
Corresponding to the directory in (1), add a file group
In the file group, add the source files corresponding to the folder in (1)
5 Project Configuration
(1) Target configuration
(2) Output configuration
(3) Macro definition and header file reference
Previous article:STM32 study notes clock analysis
Next article:The difference between various clocks of STM32
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
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
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
- AD 20.2.5.213
- Use Solve
- [Raspberry Pi 4B Review] + Building a file server
- Capacitor connected between GS
- RS485 MODBUS RTU Communication Protocol
- [Online Live Broadcast] E-sports veterans say | As preparations for the e-sports competitions are underway, RIGOL will meet you in the air
- PPT materials
- Arduino's new product Nicla Vision
- The STM8S003F3P6 chip is very interesting
- 【Wireless closed-loop feedback system for desktop robotic arms】