The standard library is actually quite convenient. With a template, if you change the parameters, you don't need to check the manual and redefine the register values.
Part 1, introduction to the stm8 standard library.
The standard library name code of stm8 is stsw-stm8069. According to this code, you can download the latest firmware library from the official website of st.
After decompressing the firmware library, there are several folders. I will just briefly explain the functions of each folder and file here. For specific instructions, please refer to the chm help document in the file package.
Libraries is the driver folder, the inc folder inside is the h file, and the src folder is the c file. These are the most critical things.
Utilities is the EVAL development board program provided by stm. If you don't have this EVAL development board, you can ignore it. If you have it, you can ignore it. Anyway, it's just a very simple LED program.
The Project folder is a project template file, which contains two important folders.
One ends with Example, which is an example program provided by ST. When we write a program, we can directly copy and paste it from here and make some minor modifications before using it. And if you don’t know how to write it, there are many examples here to see.
The other one ends with Template, which means template. It contains three compiler templates. You can use them directly. In addition, there are several important files.
stm8s_conf.h is the configuration file. The official document says that some peripherals can be turned on or off by commenting them out. I use this file just to add my own h file at the end, that's all.
stm8s_it.c is the interrupt handling file. All interrupt handling programs are written here. The template has been written, and you can just fill in the program. The h file with the same name can basically be ignored.
Regarding IAR, you can select the files in the EWSTM8 folder and use them directly. If you don't have a slight obsessive-compulsive disorder like me about program structure, you don't need to read it later.
The second part is IAR settings.
The official st has an IAR template. If you don't delete any files and ignore the official file organization structure, you can use it directly. No other settings are required.
The following content is reset according to the official template after removing files and folders that are not used by your program.
The library files used by our own program are only the inc and src folders and the main.c, stm8s_conf.h, stm8s_it.c, and stm8s_it.h files under Template.
I won’t talk about creating new IAR projects.
After the new project is created, right-click the project name on the left---select option---in the general option----Target----Device select the specific chip model. After testing, I found that the chip model selected when creating a new IAR project is invalid. If you don't change it here, the compiled program may be invalid.
Then add additional header file directories and device models in C/C++ Compier---Proprecessor. Similarly, if you do not use the standard library, you do not need to write anything here. Otherwise, you must write it, or an error will be reported. The model name is shown in the figure. Compared with the above model, the C6 behind it is omitted. The specific name depends on the source code of the firmware library. $PROJ_DIR$ indicates the current working directory.
Set the output hex file, check Output in Output Converter, and select Intel extended format output.
Add the firmware library C file, and do not add the h file. When adding the C file, please note that if the function chip corresponding to the C file does not exist, either do not add it to the project, or after adding it to the project, right-click the C file in the left sidebar and select -option--check extend from build to block it.
Previous article:IAR_FOR_STM8 development DEMO establishment
Next article:Combination of STM8 registers and official libraries
Recommended ReadingLatest update time:2024-11-23 10:19
- Popular Resources
- Popular amplifiers
- IAR fully supports the new industrial-grade PX5 real-time operating system
- STM8 C language programming (1) - basic program and startup code analysis
- Description of the BLDC back-EMF sampling method based on the STM8 official library
- ARM Cortex-M4+Wi-Fi MCU Application Guide (Embedded Technology and Application Series) (Guo Shujun)
- 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
- Intelligent toilet constant temperature circuit
- Second-hand Freescale Freelink
- CCS compiles and generates binary files
- Mobile phone calculators are all dead: What is 10% + 10%? [Have you ever calculated it?]
- 【TI recommended course】# TINA-TI training course#
- Review of "My Life With You 2019"
- Qinhengwei CH549L-Air touch sensitivity debugging
- The structure principle and production of buzzer
- Portable information board
- When the serial port is connected, if the host receives wrong data, it will return to the initial state.