The STM8S MCU development environment consists of three parts, including the development software on the PC (integrated development software, driver, etc.), the debugger & programmer ST-LINK, and the target MCU circuit board. As shown in the figure below:
1. Develop software on PC
The software on the PC includes: ST-LINK driver, IAR integrated development environment, STM8S standard function library, and STVP burning tool.
ST-LINK debugger & programmer requires driver
This driver does not need to be installed separately, it will be installed together with STVP.
IAR Integrated Development Environment
IAR integrated development environment is an integrated development tool that integrates program editing, compiling, program downloading, debugging and other functions. It can download programs to the target STM8S microcontroller through the ST-LINK debugger & programmer, and perform online debugging (including setting breakpoints, single-step execution, viewing internal microcontroller memory data, etc.).
There are many integrated development tools for STM8S. This tutorial uses IAR integrated development tools because it is mature, stable, simple and easy to use. The full name of IAR integrated development tools is "IAR for STM8", and the recommended version is the more mature version 2.10.5.
STM8S standard library functions
The STM8S standard function library is a C language function library originally launched by ST. It encapsulates the basic operations of the STM8S microcontroller into a library, which can greatly improve development efficiency. The full name of the STM8S standard function library is STM8S_StdPeriph_Lib_V2.1.0. Of course, you can also develop microcontroller programs without using standard library functions, but this requires operating each register of the microcontroller yourself, and you need to be very familiar with the internal structure of the microcontroller and the function of the registers to do this, and the development complexity will increase exponentially.
STVP Burning Tool
The STVP (ST Visual Programmer) burning tool is also launched by ST. Although it is generally possible to download programs to the microcontroller using the IAR integrated development environment, it is more convenient to use the STVP burning tool to set the option bytes (OPTION BYTE) of the STM8S microcontroller. The option byte has two most important and most commonly used functions: one is to set the read-out protection switch (ROP). You may encounter that the finished STM8S microcontroller development board you bought cannot be used to download and debug programs using IAR. This is because the ROP is set to on. In this case, you need to use STVP to reset it to off before you can use it; the second is to set the second function of the microcontroller pin. Many pins of the STM8S microcontroller have multiple functions, such as as an SPI interface or as a timer channel, which also needs to be set through the option byte.
Let's talk about the installation of the software on the PC. The installation packages to be used are as follows:
EWSTM8-2105-Autorun.exe
IAR for STM8 2.10.5 registration machine.7z
The above two packages are the installation program and registration machine of IAR for TM8 . You can install the first one directly, and follow the tutorial that comes with the compressed package for the second one.
STM8S_StdPeriph_Lib_V2.1.0.rar
The above package is the STM8S standard library function, which does not need to be installed, just unzip it for later use. Every time you create a new project in IAR, you must first copy the main.c, stm8s_conf.h, stm8s_it.c, stm8s_it.h and other files in the LibrariesSTM8S_StdPeriph_Driver directory of this package and ProjectSTM8S_StdPeriph_Template to the new project directory.
sttoolset.zip
sttoolset_pack24_patch.zip
The two files above are the installation packages of STVP burning tool and ST-LINK driver, which can be directly unzipped and installed. Note that STVD (ST Visual Develop) inheritance development software will be installed at the same time, but STVD only supports assembly language by default, so IAR is generally used. You can just not use it after installation.
As for these installation packages, you can download them from the official website or from Baidu Netdisk (search by file name through Panduoduo). I will not post them here.
2. ST-LINK debug programmer
ST-LINK is a USB interface hardware product that connects the PC to the target STM8S microcontroller. The following is a compatible ST-LINK debugger programmer:
The ST-LINK debugger programmer is usually connected to the target microcontroller circuit board through four Dupont wires. The four wires are power supply (3.3V or 5V optional), ground GND, and SWIM and RST. After the SWIM and RST of the ST-LINK are connected to the SWIM and RST pins of the microcontroller chip, the microcontroller can be debugged and programmed.
3. Target MCU circuit board
The target MCU circuit board is the STM8S MCU system hardware to be developed. As mentioned above, the SWIM and RST pins of the target MCU chip need to be connected to the SWIM and RST ports of ST-LINK. In the later learning process of this tutorial, you can use the STM8S minimum system board (containing only the reset circuit) as the target MCU circuit board for experiments, or you can use the STM8S development board introduced in Part 5 of this tutorial (containing the reset circuit, power switch, lithium battery charging management, Bluetooth communication circuit, etc.) for experiments.
STM8S MCU minimum system board:
STM8S development board:
If you have enough patience, you can also solder the microcontroller IC by yourself and use a breadboard for experiments. As shown below (the small square in the middle is the microcontroller IC, and wires are soldered to its 0.65mm pitch pins and plugged into the breadboard).
The above is an introduction to the development environment. Next, let’s briefly talk about the use of the development environment.
1. Create a new project in IAR
For the process of creating a new project in IAR, it is recommended to refer to this document "Detailed description of standard steps for creating a new project in STM8 under IAR environment": http://wenku.baidu.com/link?url=01T1358oA4Hgs4YgaM-YmLD5lCJwx5c1vokjZGr_c0lAkcos5QJ15B2cJHRBLNwlxhmSPepEbvhC3OlsiMJ7N4w2jRcS7-xheI8jerTaHrS
There are two points that require special attention: 1) After creating the project, you need to set the Debugger Driver to ST-LINK in the project properties (click the project name in the workspace window, right-click and select the Open menu ). Otherwise, the default selection of Simulator will not connect to the target MCU circuit board through the actual ST-LINK.
2) After adding the library files of STM8S_StdPeriph_Lib (all .h and .c files in the LibrariesSTM8S_StdPeriph_Driver directory), the compilation may fail because different MCU sub-models support different functions. There are always unsupported functions. But it doesn’t matter. Just delete the library files with compilation errors from the project.
2. Use STVP to set the MCU chip option byte (OPTION BYTE)
As mentioned above, two settings need to be completed through STVP. One is to set the readout protection switch (ROP); the other is to set the second function of the microcontroller pin. Especially for the first one, it is best to use STVP to set the ROP for newly purchased microcontroller ICs or minimum system boards and development boards, otherwise they cannot be used in IAR. The setting process using STVP is relatively simple, so I will not go into details here.
That’s all about the development environment. Starting from the next piece, I will take the STM8S103F3P6 microcontroller as an example to explain in detail how to use the microcontroller.
Previous article:Understand stm8s MCU to realize multi-channel conversion in three minutes
Next article:Body central control system solution based on STM8A and TI/ROHM
- 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
- Detailed explanation of intelligent car body perception system
- How to solve the problem that the servo drive is not enabled
- Why does the servo drive not power on?
- What point should I connect to when the servo is turned on?
- How to turn on the internal enable of Panasonic servo drive?
- What is the rigidity setting of Panasonic servo drive?
- How to change the inertia ratio of Panasonic servo drive
- What is the inertia ratio of the servo motor?
- Is it better for the motor to have a large or small moment of inertia?
- What is the difference between low inertia and high inertia of servo motors?
- [National Competition Interview] “Three weaklings” won the first prize for question H, and the winners who won by luck are here! ?
- Kuyuan Electric Allegro video training
- What are the differences between precision op amps, instrument op amps, and general-purpose op amps?
- TI Engineer's Annual Review: Selected Q&A on Amplifiers, Interface/Clocking, and More
- Ten key takeaways about the Internet of Things
- Assisting RF chip testing
- Synchronous Rectification and Synchronous Boost
- TEC Controller
- Has anyone seen this usage in C language?
- I would like to ask about the problem of the flyback power supply making noise when the load is small