doc improvements

This commit is contained in:
Robin Müller 2025-01-10 16:29:57 +01:00
parent 1664fb5bef
commit 0d114c00b6
Signed by: muellerr
GPG Key ID: A649FB78196E3849
3 changed files with 20 additions and 6 deletions

View File

@ -36,13 +36,16 @@ The bootloader performs the following steps:
1. The application will calculate the checksum of itself if the bootloader CRC is blank (all zeroes 1. The application will calculate the checksum of itself if the bootloader CRC is blank (all zeroes
or all ones). If the CRC is not blank and the checksum check fails, it will immediately boot or all ones). If the CRC is not blank and the checksum check fails, it will immediately boot
application image A. Otherwise, it proceeds to the next step. application image A. Otherwise, it proceeds to the next step.
2. Check the checksum of App A. If that checksum is valid, it will boot App A. If not, it will 2. Read the boot slot from a reserved section at the end of the EEPROM. It is assumed that the full
proceed to the next step. 128 kB are copied from the ST EEPROM to the code RAM at startup. The boot slot is read from
3. Check the checksum of App B. If that checksum is valid, it will boot App B. If not, it will the code RAM directly.
boot App A as the fallback image. 3. Check the checksum of the boot slot. If that checksum is valid, it will boot that slot. If not,
it will proceed to the next step.
4. Check the checksum of the other slot . If that checksum is valid, it will boot that slot. If
not, it will boot App A as the fallback image.
You could adapt and combine this bootloader with a non-volatile memory to select a prefered app In your actual production application, a command to update the preferred boot slot could be exposed
image, which would be a first step towards an updatable flight software. to allow performing software updates in a safe way.
Please note that you *MUST* compile the application at slot A and slot B with an appropriate Please note that you *MUST* compile the application at slot A and slot B with an appropriate
`memory.x` file where the base address of the `FLASH` was adapted according to the base address `memory.x` file where the base address of the `FLASH` was adapted according to the base address

View File

@ -158,6 +158,8 @@ fn main() -> ! {
// Check bootloader's CRC (and write it if blank) // Check bootloader's CRC (and write it if blank)
check_own_crc(&dp.sysconfig, &cp, &mut nvm, &mut timer); check_own_crc(&dp.sysconfig, &cp, &mut nvm, &mut timer);
// This is technically read from the EEPROM. We assume that the full 128 kB were copied
// from the EEPROM to the code RAM and read the boot slot from the code ram directly.
let preferred_app = AppSel::try_from(unsafe { let preferred_app = AppSel::try_from(unsafe {
(PREFERRED_SLOT_OFFSET as *const u8) (PREFERRED_SLOT_OFFSET as *const u8)
.read_unaligned() .read_unaligned()

View File

@ -59,6 +59,15 @@ to write it to slot A.
You can use You can use
```sh
./image-loader.py -s a
```
to select the Slot A as a boot slot. The boot slot is stored in a reserved section in EEPROM
and will be read and used by the bootloader to determine which slot to boot.
You can use
```sh ```sh
./image-loader.py -c -t a ./image-loader.py -c -t a
``` ```