Skip to content

Commit

Permalink
boot: flash-erase-zero (#3344)
Browse files Browse the repository at this point in the history
Allow compatibility with devices whose flash erase set bytes to 0x00
instead of 0xFF, using a new flash-erase-zero feature.
See issue #3342.
  • Loading branch information
kingofpayne authored Sep 16, 2024
1 parent ae8caf3 commit 6d89f27
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/pages/bootloader.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ The bootloader supports

In general, the bootloader works on any platform that implements the `embedded-storage` traits for its internal flash, but may require custom initialization code to work.

STM32L0x1 devices require the `flash-erase-zero` feature to be enabled.

== Design

image::bootloader_flash.png[Bootloader flash layout]
Expand Down
1 change: 1 addition & 0 deletions embassy-boot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ ed25519-dalek = { version = "2", default-features = false, features = ["std", "r
[features]
ed25519-dalek = ["dep:ed25519-dalek", "_verify"]
ed25519-salty = ["dep:salty", "_verify"]
flash-erase-zero = []

#Internal features
_verify = []
4 changes: 4 additions & 0 deletions embassy-boot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ mod test_flash;

// The expected value of the flash after an erase
// TODO: Use the value provided by NorFlash when available
#[cfg(not(feature = "flash-erase-zero"))]
pub(crate) const STATE_ERASE_VALUE: u8 = 0xFF;
#[cfg(feature = "flash-erase-zero")]
pub(crate) const STATE_ERASE_VALUE: u8 = 0x00;

pub use boot_loader::{BootError, BootLoader, BootLoaderConfig};
pub use firmware_updater::{
BlockingFirmwareState, BlockingFirmwareUpdater, FirmwareState, FirmwareUpdater, FirmwareUpdaterConfig,
Expand Down

0 comments on commit 6d89f27

Please sign in to comment.