Skip to content

Commit

Permalink
doc improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
robamu committed Jan 10, 2025
1 parent 1664fb5 commit 0d114c0
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
17 changes: 10 additions & 7 deletions bootloader/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
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.
2. Check the checksum of App A. If that checksum is valid, it will boot App A. If not, it will
proceed to the next step.
3. Check the checksum of App B. If that checksum is valid, it will boot App B. 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
image, which would be a first step towards an updatable flight software.
2. Read the boot slot from a reserved section at the end of the EEPROM. It is assumed that the full
128 kB are copied from the ST EEPROM to the code RAM at startup. The boot slot is read from
the code RAM directly.
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.

In your actual production application, a command to update the preferred boot slot could be exposed
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
`memory.x` file where the base address of the `FLASH` was adapted according to the base address
Expand Down
2 changes: 2 additions & 0 deletions bootloader/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ fn main() -> ! {
// Check bootloader's CRC (and write it if blank)
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 {
(PREFERRED_SLOT_OFFSET as *const u8)
.read_unaligned()
Expand Down
9 changes: 9 additions & 0 deletions flashloader/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ to write it to slot A.

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
./image-loader.py -c -t a
```
Expand Down

0 comments on commit 0d114c0

Please sign in to comment.