You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+22-8Lines changed: 22 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,14 +2,14 @@
2
2
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.
@@ -19,7 +19,7 @@ Customizable Bootloader for STM32 microcontrollers. This example demonstrates ho
19
19
- Easy to customize and port to other microcontrollers
20
20
21
21
## 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.
23
23
24
24
[FIGURE: system]
25
25
@@ -55,10 +55,24 @@ stm32-dma-uart/
55
55
|—— Middlewares/
56
56
`—— Src/
57
57
```
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.
0 commit comments