Skip to content

Commit eb605fb

Browse files
committed
readme: how-to-use
1 parent e05b98b commit eb605fb

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

README.md

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
Customizable Bootloader for STM32 microcontrollers. This example demonstrates how to perform in-application-programming of a firmware located on external SD card with FAT32 file system.
33

44
## Table of Contents
5-
- [Bootloader Features](#bootloader-features)
5+
- [Bootloader features](#bootloader-features)
66
- [Description](#description)
77
- [Source code organization](#source-code-organization)
8-
- [How to Use](#how-to-use)
8+
- [How to use](#how-to-use)
99
- [Configuration](#configuration)
1010
- [References](#references)
1111

12-
## Bootloader Features
12+
## Bootloader features
1313
- Configurable application space
1414
- Checksum verification
1515
- Flash protection check, write protection enable/disable
@@ -19,7 +19,7 @@ Customizable Bootloader for STM32 microcontrollers. This example demonstrates ho
1919
- Easy to customize and port to other microcontrollers
2020

2121
## Description
22-
This demo is implemented on a custom hardware [see FIGURE] equipped with a STM32L476VG microcontroller [[1]](#references). The microSD card is connected to the MCU over SDIO interface. The example software uses the official HAL library of ST [[3]](#references) and is compiled with IAR EWARM. Programming and debugging is performed over SWD with a SEGGER J-Link debug probe.
22+
This demo is implemented on a custom hardware [see FIGURE] equipped with a STM32L476VG microcontroller [[1, 2]](#references). The microSD card is connected to the MCU over SDIO interface. The example software uses the official HAL library of ST [[3]](#references) and is compiled with IAR EWARM. Programming and debugging is performed over SWD with a SEGGER J-Link debug probe.
2323

2424
[FIGURE: system]
2525

@@ -55,10 +55,24 @@ stm32-dma-uart/
5555
|—— Middlewares/
5656
`—— Src/
5757
```
58-
Drivers and Middlewares folders contain the CMSIS, HAL and FatFs libraries for the microcontroller. The source code and corresponding header files can be found in Src and Inc folders respectively.
59-
60-
## How to Use
61-
58+
`Drivers` and `Middlewares` folders contain the CMSIS, HAL and FatFs libraries for the microcontroller. The source code and corresponding header files can be found in `Src` and `Inc` folders respectively.
59+
60+
## How to use
61+
The bootloader can be easily customized and tailored to the required hardware and environment, i.e. to perform application updates over various interfaces and even to implement over-the-air (OTA) updates. In order to perform successful in-application-programming, the following sequence has to be kept:
62+
1. Check for write protection and disable it if necessary.
63+
2. Initialize flash with `Bootloader_Init()`.
64+
3. Erase application space with `Bootloader_Erase()` (optional, but recommended).
65+
4. Prepare for programming with `Bootloader_FlashBegin()`.
66+
5. Perform programming by repeatedly calling the `Bootloader_FlashNext(uint64_t data)` function. The flashing procedure requires 8 bytes of data (double word) to be programmed at once into the flash. This function automatically increases the address where the data is being written.
67+
6. Finalize programming by calling `Bootloader_FlashEnd()`.
68+
69+
The application image has to be in binary format. If the checksum verification is enabled, the binary must include the checksum value at the end of the image. When creating the application image, the checksum has to be calculated over the entire image (except the checksum area) with the following parameters:
70+
- Algorithm: CRC32
71+
- Size: 4 bytes
72+
- Initial value: 0xFFFFFFFF
73+
- Bit order: MSB first
74+
75+
__Important notice__: in order to perform a successful application jump from the bootloader, the vector table of the application should be relocated. By default, the startup code of the microcontroller sets the vector table location to 0x00000000 in the `system_stm32xxxx.c` file. This has to be either disabled (the bootloader can be configured to perform the vector table relocation before the jump) or manually set to the appropriate value which is the start address of the application space.
6276

6377
## Configuration
6478

0 commit comments

Comments
 (0)