John Youren 53fd571ddb
Only write to the flash what was read from the file
The write method is given the full aligned buffer to write to flash even though it may not be fully populated. This change ensures only what has been read is written to flash. Preventing potential corrupted firmware and additional flash wear.
2025-06-20 14:45:13 +01:00
..
2022-12-02 11:28:33 +01:00
2025-05-22 13:29:55 +08:00
2023-11-19 23:10:11 +01:00
2022-12-02 11:28:33 +01:00

Examples using bootloader

Example for Raspberry Pi Pico demonstrating the bootloader. The example consists of application binaries, 'a' which waits for 5 seconds before flashing the 'b' binary, which blinks the LED.

NOTE: The 'b' binary does not mark the new binary as active, so if you reset the device, it will roll back to the 'a' binary before automatically updating it again.

Prerequisites

  • cargo-binutils
  • cargo-flash
  • embassy-boot-rp

Usage

# Flash bootloader
cargo flash --manifest-path ../../bootloader/rp/Cargo.toml --release --chip RP2040

# Build 'b'
cargo build --release --bin b

# Generate binary for 'b'
cargo objcopy --release --bin b -- -O binary b.bin

# Flash `a` (which includes b.bin)
cargo flash --release --bin a --chip RP2040