Methods and precautions for using the standard firmware library of IAR for stm8

Publisher:温暖拥抱Latest update time:2018-06-01 Source: eefocusKeywords:IAR Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.


Keywords:IAR Reference address:Methods and precautions for using the standard firmware library of IAR for stm8

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

IAR hardware simulation to view the running time
I'm working on a STM8 project recently, and I'm not used to the change from Keil to IAR IDE, just like going from VS to VC. I debugged the software delay function and wanted to see the running effect, but I didn't know where to start (Keil has a window to view the running time). The Simulator software simulation is us
[Microcontroller]
IAR hardware simulation to view the running time
stm8 io port remapping
STM8S003F3 ports can be remapped. For example, the PC6 pin of pin16, which has the SPI_MOSI function by default, can be remapped to TIM1_CH1, which is channel 1 of timer1. The mapping method is not configured by an AFR register like STM32, but by configuring the Option bytes, as shown below. That is the OPT2 regi
[Microcontroller]
stm8 io port remapping
STM8L151 redirects printf function under STVD/IAR
I have been programming STM8L151 under IAR before, because there are many reference examples in IAR, and the key is that there are many configurations to refer to. It was mainly developed with reference to Fengchi's STM8 example. I would like to express my gratitude here. Recently, I need to program STM8L151 under STV
[Microcontroller]
Functions of IAR for stm8 memory window
After entering debug mode, click the menu view-Memory Can view online, RAM, FLASH, OPTION, etc.
[Microcontroller]
Functions of IAR for stm8 memory window
Simulation setup using IAR for MSP430 and Proteus
The first experiment is to use timer A to realize the running light. If you don't have money to buy a board, just simulate it. Create a new project. Many softwares are like this, as shown below: Then, click project- options or ALT + F7 to enter the options bar. Click General Options, select the device model in Targe
[Microcontroller]
STM8 study notes---light up the LED
There are generally three steps to operate a single-chip microcomputer: 1. System clock selection. 2. Single-chip microcomputer peripheral initialization. 3. Main program writing. To light up the LED light, follow these steps. First select the system clock, open the STM8S Chinese reference manual, and find the clock
[Microcontroller]
STM8 gets voltage value
STM8 gets voltage value   (1) Port definition static void ADC_POWER_Config() {   /*  Init GPIO for ADC1 */   GPIO_Init(GPIOB, GPIO_PIN_2, GPIO_MODE_IN_FL_NO_IT); //Variable resistor   ADC1_DeInit();   ADC1_Init(ADC1_CONVERSIONMODE_SINGLE, ADC1_CHANNEL_2, ADC1_PRESSEL_FCPU_D2, ADC1_EXTTRIG_TIM, DISABLE, ADC1_ALIGN_RIGH
[Microcontroller]
STM8's TIM4 timer 1ms enters interrupt
TIM4 — 8-bit basic timer ● 8-bit auto-load adjustable prescaler, the ratio can be selected as any power of 2 between 1 and 128 ● Clock source: CPU clock ● Interrupt source: 1 overflow/update interrupt It is necessary to implement an interrupt once every 1ms, which can be used as a system timer TIM4 initialization
[Microcontroller]
Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号