Using STM8S's own BootLoader_1

Publisher:恬淡如云Latest update time:2020-02-02 Source: eefocusKeywords:STM8S Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

This article will record in detail how to use the STM8S built-in BootLoader to implement program updates.


Preparation: 

1. ST support document UM0560 (explains how to use BootLoader) 

2. ST official download software STMFlashLoader Demo.exe 

3. IAR Embedded Workbench 、ST Visual Programmer 

4. 2 STM8S105K6, used to implement the update operation.


Practical operation: 

1. 使用STVP -> OPTION BYTE -> ROP ->Read Out Protection OFF 

STVP -> OPTION BYTE -> BOOTLOADER ENABLE ->BootLoader Enable 

This article only records how to use BootLoader. If read protection is enabled, it is not discussed in this article (UM0560 mentions how to deal with it). Why these two bytes of option words need to be processed is explained in UM0560. If you do not do this, you cannot enter the BootLoader program. After the MCU is reset, if it detects that these two option bytes do not match, it will jump to the user application area 0x8000 address.


Additional notes: 

Enable BootLoader to use library functions to write byte option words.


FLASH_Unlock(FLASH_MEMTYPE_DATA);       //解锁Flash

FLASH_ProgramOptionByte(0x487E, 0x55); //Enable BootLoader

FLASH_Lock(FLASH_MEMTYPE_DATA); //Lock Flash and write code here


Read protection cannot be written using library functions.


Use UART to communicate with PC 

Open STMFlashLoader Demo.exe on the PC and connect the serial port. 

Main interface 

Within 1 second after the MCU is reset, click Next. 

Communication success interface 

If you cannot enter the interface above, check from 3 aspects: 

1. Step 1, whether the two-byte option word has been configured. 

2. Are the serial port TX and RX connected correctly? 

3. Is the MCU power supply normal? 

Select MCU capacity 

Select the MCU density capacity, which corresponds to the firmware version 1.3, which is read from the Boot area by the host computer. Click Next.

Next, enter the erase, download, and update interface. I won’t say much about erase, you will understand what it means after you operate it. Updata means reading the MCU program and saving it as a file. Let’s focus on the download operation. 

Write Operation 

Before downloading, you need to execute label 1. The key point here is label 2, do not load the HEX file. If the HEX file is loaded, label 3 cannot be operated and the write address cannot be selected. The reason is that the HEX file itself contains the write address information, so it cannot be changed. In IAR, you can edit OPTION and select Generate Bin file. Only after the Bin file is generated can you select the address. 

Select download address 

The address I choose here is 0xA000, which is determined by the developer. APP1.bin contains the firmware information to be updated, that is, the program to be copied to the target board slave.


At this point, the BootLoader has completed half of its task. The next article will describe how the host MCU shakes hands with the slave, and then how the host updates the slave's program.


When I was operating, I was thinking about how to put the firmware and application programs into the host's flash separately. I went to various forums for help but didn't get a satisfactory answer. I accidentally loaded a Bin file and the problem was solved. I wrote it down specially, hoping to help people with the same confusion.

Keywords:STM8S Reference address:Using STM8S's own BootLoader_1

Previous article:STM8L051F3 Hardware I2C Slave Example - Newbie Navigation
Next article:ST hardware IIC power check always detects busy state

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

STM8S GPIO simulates the underlying code of I2C
The underlying code Hello! This is the welcome page displayed when you use the Markdown editor for the first time. If you want to learn how to use the Markdown editor, you can read this article carefully to understand the basic syntax knowledge of Markdown. GPIO initialization settings On this STM8S, the pins with t
[Microcontroller]
stm8s timer 1 delay_STM8L1xx uses timers to achieve millisecond and microsecond delays
The timer counter of the microcontroller is used to delay in milliseconds and microseconds, which is more accurate. The flag generated when the overflow is detected is used to determine the delay time. The following takes the STM8L101 chip as an example and the matching code description. 1. Implementation principle:
[Microcontroller]
STM8S study notes 3 (STM8 SysClk)
The STM8S system clock setting is very important for the microcontroller. Different clocks must be used for different purposes. For example, when making AVR, the clock used for high-stability serial communication is generally 3.6864M, mainly because this is the accurate baud rate calculation. STM8S is also important.
[Microcontroller]
stvd+stm8s: #error clnk stm8s_sx1276.lkf:1 segment .ubsct size overflow (313)
STVD compiles the stm8s project and reports the following error: Running Linker clnk -l"C:Program Files (x86)COSMICCXSTM8Lib"  -o Debugstm8s_sx1276.sm8 -mDebugstm8s_sx1276.map Debugstm8s_sx1276.lkf #error clnk Debugstm8s_sx1276.lkf:1 segment .ubsct size overflow (313)  The command: "clnk -l"C:Program Files (x86)COSM
[Microcontroller]
stm8s serial communication source code program (8-bit data, odd parity, 2 stop bits)
The first step of serial port initialization is to configure the baud rate. The baud rate is related to the clock, so the clock must be configured first. For the clock configuration, see the previous blog. If the serial port clock is not turned on during serial port initialization, please turn on the serial port clo
[Microcontroller]
stm8s serial communication source code program (8-bit data, odd parity, 2 stop bits)
stm8s independent watchdog and window watchdog code
void WWDG_INI(void) {         WWDG_WR = 0x60; //Watchdog window value, the window value must be above 0x3F, but must be less than the count value, otherwise the watchdog cannot be fed    WWDG_CR = 0x7F; //Watchdog count value    WWDG_CR |= 0x80; //Enable window watchdog } void Free_WWDG(void) {     if ((WWDG_CR &
[Microcontroller]
STM8S independent watchdog configuration and use
//The clock source of the independent gatekeeper is the internal low-speed clock 128khz divided by 2, which is 64khz //Select IWDG_Prescaler_128 //64/128 = 0.5 khz 2ms period   #define IWDG_500MS_REST (uint8)250 #define IWDG_400MS_REST (uint8)200 #define IWDG_300MS_REST (uint8)150 #define IWDG_250MS_REST (uint8)12
[Microcontroller]
Use of STM8S timer - analysis of how to use stm8s timer tim4
  Overview of stm8s timer TIm4   The timer consists of an 8-bit auto-reloadable up-counter, which can be used as a time-base generator with overflow interrupt function.   The TIM6 clock signal controller is used for timer synchronization and cascading.   The main functions of STM8 general-purpose timer TIM4   TIM4
[Microcontroller]
Use of STM8S timer - analysis of how to use stm8s timer tim4
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号