The startup process of STM8 microcontroller

Publisher:数字狂想Latest update time:2018-09-08 Source: eefocusKeywords:STM8 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

When I was in college, I studied STM8 microcontrollers for one semester. I put a lot of effort into it. I used a textbook from a teacher I admired very much, which was taught in assembly language. However, I admired it very much. Now I think about it, some basic things in this book are not very clear. For example, in the first chapter, the implementation principle of microcontrollers was explained by 51 microcontrollers, and the code of 51 microcontrollers was also used. But this book is about STM8, okay? I have to say that the 51 was used. It is obvious that the book was published in a hurry. There are also some typos in the book, which is a bit strange for someone like me with obsessive-compulsive disorder. Of course, the good thing is that there are many practical engineering things in it, and it also talks about examples of using STM8 assembly to implement multi-tasking, and digital filtering and other things that seemed very interesting to me at the time. I still admire him (Pan Yongxiong) very much. This is the truth. I have read this book many times and I have been reluctant to donate it. Other circuits, analog electronics, and digital electronics have all been donated to others. 
Write the picture description here
Okay, let's get to the point. Before talking about the boot process of STM8 microcontroller, we must first have a basic understanding of STM8 memory map, which can be found in the STM8 data sheet. The following is a screenshot (of course, this is the memory map of one series of STM8, and others may be different): 
stm8s 
You can see a storage area called "2 Kbyte boot Rom", and the reset vector of hardware reset (from shutdown to startup) is in this area. This is very special because there is a storage area called "32 interrupt vectors" below, and all other interrupt vectors (see the table below) are in this area, only the hardware reset vector is not. 
Write the picture description here 
So after the hardware reset, that is, after the STM8 is turned off and on, the first code executed is the code on the boot Rom. The code on the boot Rom is called bootloader. The main function of the bootloader is to burn the microcontroller program into the microcontroller through the integrated peripherals (UART, SPI, CAN) of the microcontroller without using ST-Link. However, this can only be burned when the microcontroller is burned for the first time or the BL and NBL bytes in the Option bytes (this is also in the storage mapping diagram) are set to 55 and AA respectively and the read protection of the memory is not enabled. If the conditions are not met, you can use ST-Link to connect the microcontroller and set the Option bytes in STVP to meet them. The specific flow chart after starting from the boot Rom can be seen in the figure below (the figure comes from the official UM0560), or you can read the text directly. 
Write the picture description here 
After meeting the conditions mentioned above, STM8 will detect whether there is a synchronization signal from the host (usually the computer end). If there is a synchronization signal, STM8 will hand over control to the host, and the host can download the program to STM8 (after downloading, the host specifies the address where the program starts to execute). If the STM8 does not detect the synchronization signal of the host, it will wait for 1 second and then time out. After the timeout, it will determine whether the microcontroller has not been programmed. If so, it will return to the hardware reset state and repeat the process from the hardware reset. If the program has been programmed before, find the entry of the reset vector in "32 interrupt vectors", enter the address pointed by the vector (usually what we call the main function) to start executing the program. 
What if the bootloader does not meet the conditions for programming when it starts executing? It also finds the entry of the reset vector in "32 interrupt vectors", enters the address pointed by the vector to start executing the program. 
The above is the startup process of the STM8 microcontroller.

Keywords:STM8 Reference address:The startup process of STM8 microcontroller

Previous article:Implementing absolute address jump in STM8 FOR IAR
Next article:STM8 EEPROM unlocking is repeatable

Recommended ReadingLatest update time:2024-11-16 13:25

Several programs that must be written to learn 51 single-chip microcomputer
I learned 51 single-chip microcomputer completely by myself, because when I wanted to learn it, it was still a long time before the school started. Now that I have finished learning single-chip microcomputer, the school class has also finished, and I have gained a lot. Now I write down my learning experience for everyo
[Microcontroller]
Several programs that must be written to learn 51 single-chip microcomputer
[MCU framework][bsp layer][AT32F415][bsp_pwm] PWM configuration and use
9.1.3.6 PWM Input Mode This mode is a special case of input capture mode and operates the same as input capture mode except for the following differences: Both ICx signals are mapped to the same TIx input. These two ICx signals are edge-active but have opposite polarities. One of the TIxFP signals is used as a trigg
[Microcontroller]
[MCU framework][bsp layer][AT32F415][bsp_pwm] PWM configuration and use
C language program using DS18B20 temperature sensor in single chip microcomputer (reference 1)
C language program using DS18B20 temperature sensor in single chip microcomputer (reference 1) /********************************************************************************                                DS18B20 temperature measurement program     Hardware: AT89S52      (1) Single-wire ds18b20 connected to P2.
[Microcontroller]
How to obtain CRC check code in single chip microcomputer program
In industrial detection and data acquisition systems composed of single-chip embedded systems and microcomputers, data communication is often required between computers and single-chip microcomputers. In the process of digital communication, interference may cause the received binary number to be inconsistent with the
[Microcontroller]
How to obtain CRC check code in single chip microcomputer program
8051 MCU Tutorial Lesson 28: Design of MCU Music Program
Using a single-chip microcomputer (or single-board computer) to play music is probably one of the issues that radio enthusiasts are interested in. This article starts with the basic experiment of single-chip microcomputers, discusses the design principles of music programs, and gives specific examples for reference.
[Microcontroller]
8051 MCU Tutorial Lesson 28: Design of MCU Music Program
PIC microcontroller memory bank 0 or 1 selection instructions (program)
  The data memory of the intermediate product PIC16C6X of the PIC microcontroller is usually divided into two banks, namely, bank 0 (Bank0) and bank 1 (Bank1). Each bank consists of two parts: dedicated registers and general registers. Some register units in the two banks are actually the same register unit, but have
[Microcontroller]
How to use the AVR microcontroller's integrated ADC to take analog readings from the surrounding environment
Schematic A Quick Review of ADCs Most people think that the analog world has lagged behind them, but the truth is that analog has never been stronger! With the rise of the Internet of Things and the production of sensors, billions of analog readings are being taken every second around the world. This is just one of
[Microcontroller]
How to use the AVR microcontroller's integrated ADC to take analog readings from the surrounding environment
External memory expansion based on single chip microcomputer
1. Experimental purpose 1. Learn the method of expanding off-chip memory. 2. Learn different methods of reading and writing data memory. 3. Learn the method of reading off-chip program memory. 2. Experimental content 1. Experimental principle diagram: 2. Experimental content (1) Us
[Microcontroller]
External memory expansion based on single chip microcomputer
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号