diff options
| author | kingofpayne <[email protected]> | 2024-09-16 22:07:56 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-09-16 22:07:56 +0200 |
| commit | 6d89f2729ab7a6ee3dd78ccaef1b16677b5a9eee (patch) | |
| tree | 1aa6772a246e777b6e21daefac131b03eacfbf62 | |
| parent | ae8caf3f55d91579234f199458c369536fd39bb1 (diff) | |
boot: flash-erase-zero (#3344)
Allow compatibility with devices whose flash erase set bytes to 0x00
instead of 0xFF, using a new flash-erase-zero feature.
See issue #3342.
| -rw-r--r-- | docs/pages/bootloader.adoc | 2 | ||||
| -rw-r--r-- | embassy-boot/Cargo.toml | 1 | ||||
| -rw-r--r-- | embassy-boot/src/lib.rs | 4 |
3 files changed, 7 insertions, 0 deletions
diff --git a/docs/pages/bootloader.adoc b/docs/pages/bootloader.adoc index 3b0cdb182..d8d50040b 100644 --- a/docs/pages/bootloader.adoc +++ b/docs/pages/bootloader.adoc | |||
| @@ -19,6 +19,8 @@ The bootloader supports | |||
| 19 | 19 | ||
| 20 | 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. | 20 | 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. |
| 21 | 21 | ||
| 22 | STM32L0x1 devices require the `flash-erase-zero` feature to be enabled. | ||
| 23 | |||
| 22 | == Design | 24 | == Design |
| 23 | 25 | ||
| 24 | image::bootloader_flash.png[Bootloader flash layout] | 26 | image::bootloader_flash.png[Bootloader flash layout] |
diff --git a/embassy-boot/Cargo.toml b/embassy-boot/Cargo.toml index d27fe763e..79ba6456a 100644 --- a/embassy-boot/Cargo.toml +++ b/embassy-boot/Cargo.toml | |||
| @@ -47,6 +47,7 @@ ed25519-dalek = { version = "2", default-features = false, features = ["std", "r | |||
| 47 | [features] | 47 | [features] |
| 48 | ed25519-dalek = ["dep:ed25519-dalek", "_verify"] | 48 | ed25519-dalek = ["dep:ed25519-dalek", "_verify"] |
| 49 | ed25519-salty = ["dep:salty", "_verify"] | 49 | ed25519-salty = ["dep:salty", "_verify"] |
| 50 | flash-erase-zero = [] | ||
| 50 | 51 | ||
| 51 | #Internal features | 52 | #Internal features |
| 52 | _verify = [] | 53 | _verify = [] |
diff --git a/embassy-boot/src/lib.rs b/embassy-boot/src/lib.rs index b4f03e01e..8849055e8 100644 --- a/embassy-boot/src/lib.rs +++ b/embassy-boot/src/lib.rs | |||
| @@ -14,7 +14,11 @@ mod test_flash; | |||
| 14 | 14 | ||
| 15 | // The expected value of the flash after an erase | 15 | // The expected value of the flash after an erase |
| 16 | // TODO: Use the value provided by NorFlash when available | 16 | // TODO: Use the value provided by NorFlash when available |
| 17 | #[cfg(not(feature = "flash-erase-zero"))] | ||
| 17 | pub(crate) const STATE_ERASE_VALUE: u8 = 0xFF; | 18 | pub(crate) const STATE_ERASE_VALUE: u8 = 0xFF; |
| 19 | #[cfg(feature = "flash-erase-zero")] | ||
| 20 | pub(crate) const STATE_ERASE_VALUE: u8 = 0x00; | ||
| 21 | |||
| 18 | pub use boot_loader::{BootError, BootLoader, BootLoaderConfig}; | 22 | pub use boot_loader::{BootError, BootLoader, BootLoaderConfig}; |
| 19 | pub use firmware_updater::{ | 23 | pub use firmware_updater::{ |
| 20 | BlockingFirmwareState, BlockingFirmwareUpdater, FirmwareState, FirmwareUpdater, FirmwareUpdaterConfig, | 24 | BlockingFirmwareState, BlockingFirmwareUpdater, FirmwareState, FirmwareUpdater, FirmwareUpdaterConfig, |
