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-15 07:36

Stm32 SWD download debug configuration
    I found a good article about stm32 SWD mode download debugging configuration and organized it as follows:       We usually use Jlink downloader, but one disadvantage of this downloader is that it uses Jtag 20PIN interface. Too many PINs will make some small PCB boards crowded and increase the difficulty of wiring.
[Microcontroller]
STM32 peripheral driver - DHT11 temperature and humidity sensor
This example has been tested on STM32. This example uses the PC0 pin to connect the data pin of DHT11. Just call the DTH11_test function in the following code in the main function. //Data definition:       //----The following variables are all global variables--------       //----High 8 bits of temperature == U8T
[Microcontroller]
The most convenient timer Systick on stm32 [operation register + library function]
Systick is a very useful internal device on stm32. All arm-cortex m3 based chips have this timer, so when considering the portability of the platform, you can use Systick more.   Systick is a 24-bit data width countdown timer, whose counting range can only reach 1677215 (2^24). When the count reaches 0, it will automa
[Microcontroller]
Discussion on AC and DC sampling of STM32 ADC
cutting edge Regarding the STM32 sampling problem, I believe many people have encountered such a problem, whether it is about the underlying configuration of the ADC or the choice of the ADC sampling solution, or the ADC software and hardware filtering algorithm. Here, the blogger will extend the training questions he
[Microcontroller]
Discussion on AC and DC sampling of STM32 ADC
STM32 library function development project template
After reading a lot of information and writing a lot of programs myself, I found that although they are all developed with library functions, the organization of files is different. For example, some people like to have OBJ, while others use LISTING. So which one is better? The organization of files is really a headac
[Microcontroller]
Use STM32 to control the passive buzzer to play music (STM32_07)
1. Passive buzzer and active buzzer The active buzzer contains an oscillation source and will make a sound as long as it is powered on, but the frequency is fixed and the tone is single; the passive buzzer does not contain an oscillation source, and its internal structure is equivalent to an electromagnetic field sp
[Microcontroller]
Use STM32 to control the passive buzzer to play music (STM32_07)
STM32 uses a structure to define the address of FSMC
LCD Address Setting     The figure only shows the data line and the address line. I didn't draw the other lines. Please think about it. If you really can't help, please look at the LCD schematic diagram provided by Atom. The LCD has a pin called the D/C pin, which is used to distinguish whether the data written t
[Microcontroller]
STM32 uses a structure to define the address of FSMC
Engineer's STM32 MCU Learning Basic Notes (4): Using PWM to implement firefly lights (VI)
     DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;   DMA_InitStructure.DMA_Priority = DMA_Priority_High;   DMA_InitStructure.DMA_M2M = DMA_M2M_Disable;   The following is the initialization setting code for DMA in stm32f10x_dma.c   tmpreg |= DMA_InitStruct-》DMA_DIR | DMA_InitStruct-》DMA_Mode |   DMA_In
[Analog Electronics]
Engineer's STM32 MCU Learning Basic Notes (4): Using PWM to implement firefly lights (VI)
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号