Experts teach you how to write STM32 bootloader

Publisher:JFETLatest update time:2018-11-20 Source: eefocusKeywords:STM32  bootloader Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Today I will teach you how to write the bootloader for STM32 . In fact, the main things to do when writing the bootloader are as follows:


1. Select the memory address for your bootloader program, because the STM32 memory FLASH storage program code space is 512K and needs to be divided.


1.jpg


2. If you need to use JTAG online debugging, you need to configure the area:


2.jpg


3. Choose the appropriate storage space for your user program:


3.jpg


At the same time, configure the online debugging area:


4.jpg


4. The basic process of writing the bootloader program is as follows:


1) Check whether there is a flag that needs to be updated, which can be customized by the user. For example, read the byte stored in a certain position of the flash as a flag.


2) If an update is required, call the STM32 FLASH program shoe polishing user code part.


3) Write the new bin file (that is, the binary file is burned directly into it, the hex file generated by Keil needs to be converted into a bin file, and then stored in the external expansion flash) into the FLASH that comes with the STM32 . Remember that it needs to be consistent with the user code storage area set above.


4) After the update is successful, jump to the user program.


5. The user program needs to pay attention to the need to reset the interrupt vector table before the program runs, that is: NVIC_SetVectorTable().


6. When using the STM32 built-in burning software for burning, the items need to be modified as follows:


1) Open the map folder in the target file after installation. The STM32 we use is 512Kflash, so select STM32_High-density_512K.STmap and decompose it into two STmap files (this file can be opened with Notepad)


In the STmap file, sectors are displayed as 2K pages each, so we only need to go to page 7 for the boot area, and we need to go to page 8 to the end for the user area.


After the modification is completed, when you open the software again, you will find two more flash options. You can choose the code area to be stored here.


5.jpg


Then there is one more thing that needs to be modified:


6.jpg


Keywords:STM32  bootloader Reference address:Experts teach you how to write STM32 bootloader

Previous article:How to port uCGUI to STM32, see here!
Next article:Teach you how to use the DSP library of STM32F4

Recommended ReadingLatest update time:2024-11-23 10:33

PIC24 online upgrade via USB -- USB HID bootloader
Development Environment 1. IDE: MPLABX v4.01 2. Compiler: XC16, v1.11 3. Library & Example:  c:/microchip_solutions_v2013-06-15/USB/Device - Bootloaders/HID/Firmware - PIC24FJ256GB110 Family/MPLAB.X This PIC24 HID bootloader is modified based on the Device Bootloader of MLA_v2013-06-15. The space allocation of boo
[Microcontroller]
PIC24 online upgrade via USB -- USB HID bootloader
Several important registers of STM32 general timer
1..The automatic load register part actually contains two registers: Auto-load register buffer and auto-load register shadow The automatic load register buffer register can have an ARPE bit to control whether it works: ARPE = 0 When writing the "automatic load register", the data is directly written to the "automati
[Microcontroller]
STM32 study notes 1 clock and timer
   Since I am preparing for the ocean vehicle competition recently, I took this opportunity to learn about ARM. I saw many classmates around me using 32, so I also bought an STM32F103ZET6 and prepared to study it well.    The clock system of STM32 is quite complex, including 5 clock sources, namely HSI, HSE, LSI, LSE
[Microcontroller]
stm32 CAN LoopBack self-test mode successful
The code in the stm32 peripheral library was ported. //CAN_Polling successful DS1 is on //CAN_Interrupt success DS2 lights up When it fails, DS3 and DS4 will light up respectively. The key code will be displayed below.  main.c =========================== int main(void) { /* Setup STM32 system (clock, PLL
[Microcontroller]
Input filtering mechanism of STM32 timer
The timer input channel of STM32 has a filter unit, which is located on each input path (yellow box in the figure below) and external trigger input path (blue box in the figure below). Their function is to filter out high-frequency interference on the input signal. The specific operating principle is as follows: C
[Analog Electronics]
Input filtering mechanism of STM32 timer
Is the programming protocol of the SWD interface of STM32 public?
You need a good oscilloscope to capture it so that you have enough memory depth to ensure that you can filter out that damn 50clock. According to the Arm manual, each conversion on the sender side requires a TNR, but when I look at the JLINK waveform, there is no damn TNR. The manual says that asynchronous SWD requi
[Microcontroller]
STM32 I2C configuration
First configure I2C 1. Reset I2C through APB and enable I2C clock 2. Enable GPIO clock and  configure GPIO in AF OD mode 3. Enable I2C ( PE="1") 4. Set the speed parameters FREQ CCR F/S DUTY TRISE A: CR2.FREQR = desired I2C clock, usually set to the maximum clock 36 MHz Determined Tck = 1 / FREQ -- similar t
[Microcontroller]
Cortex-M3-based STM32 microcontroller handles advanced motor control methods
The advent of frequency converters and advanced motor control methods have made three-phase brushless motors (AC induction motors or permanent magnet synchronous motors) once a huge success in speed control applications. These high-performance motor drivers were mainly used in factory automation systems and robots.
[Microcontroller]
Cortex-M3-based STM32 microcontroller handles advanced motor control methods
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号