diff options
| author | Rasmus Melchior Jacobsen <[email protected]> | 2023-04-03 14:50:41 +0200 |
|---|---|---|
| committer | Rasmus Melchior Jacobsen <[email protected]> | 2023-04-03 14:50:41 +0200 |
| commit | b1e2195b49129bcccf42121a6f39248bab9e341f (patch) | |
| tree | 5fe54f8b0271b56e5e7abedc105b9dbd8aba73a9 /embassy-boot/boot/src/lib.rs | |
| parent | 0909a6cd3ff6fb953aa2d83fb5da37384ad7dae2 (diff) | |
Remove FirmwareWriter
FirmwareWriter currently has a "max-write-size" parameter, but this is a limitation that should be handled by chunking inside the NorFlash driver, and not "up here" in user code. In case that the driver (e.g. qspi driver) is unaware of any max-write limitations, one could simply add an intermediate NorFlash adapter providing the chunk'ing capability.
Diffstat (limited to 'embassy-boot/boot/src/lib.rs')
| -rw-r--r-- | embassy-boot/boot/src/lib.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/embassy-boot/boot/src/lib.rs b/embassy-boot/boot/src/lib.rs index 4c28d7aa4..428e7ca2b 100644 --- a/embassy-boot/boot/src/lib.rs +++ b/embassy-boot/boot/src/lib.rs | |||
| @@ -7,12 +7,10 @@ mod fmt; | |||
| 7 | 7 | ||
| 8 | mod boot_loader; | 8 | mod boot_loader; |
| 9 | mod firmware_updater; | 9 | mod firmware_updater; |
| 10 | mod firmware_writer; | ||
| 11 | mod partition; | 10 | mod partition; |
| 12 | 11 | ||
| 13 | pub use boot_loader::{BootError, BootFlash, BootLoader, Flash, FlashConfig, MultiFlashConfig, SingleFlashConfig}; | 12 | pub use boot_loader::{BootError, BootFlash, BootLoader, Flash, FlashConfig, MultiFlashConfig, SingleFlashConfig}; |
| 14 | pub use firmware_updater::{FirmwareUpdater, FirmwareUpdaterError}; | 13 | pub use firmware_updater::{FirmwareUpdater, FirmwareUpdaterError}; |
| 15 | pub use firmware_writer::FirmwareWriter; | ||
| 16 | pub use partition::Partition; | 14 | pub use partition::Partition; |
| 17 | 15 | ||
| 18 | pub(crate) const BOOT_MAGIC: u8 = 0xD0; | 16 | pub(crate) const BOOT_MAGIC: u8 = 0xD0; |
| @@ -109,7 +107,7 @@ mod tests { | |||
| 109 | let mut updater = FirmwareUpdater::new(DFU, STATE); | 107 | let mut updater = FirmwareUpdater::new(DFU, STATE); |
| 110 | let mut offset = 0; | 108 | let mut offset = 0; |
| 111 | for chunk in update.chunks(4096) { | 109 | for chunk in update.chunks(4096) { |
| 112 | block_on(updater.write_firmware(offset, chunk, &mut flash, 4096)).unwrap(); | 110 | block_on(updater.write_firmware(offset, chunk, &mut flash)).unwrap(); |
| 113 | offset += chunk.len(); | 111 | offset += chunk.len(); |
| 114 | } | 112 | } |
| 115 | block_on(updater.mark_updated(&mut flash, &mut aligned)).unwrap(); | 113 | block_on(updater.mark_updated(&mut flash, &mut aligned)).unwrap(); |
| @@ -182,7 +180,7 @@ mod tests { | |||
| 182 | 180 | ||
| 183 | let mut offset = 0; | 181 | let mut offset = 0; |
| 184 | for chunk in update.chunks(2048) { | 182 | for chunk in update.chunks(2048) { |
| 185 | block_on(updater.write_firmware(offset, chunk, &mut dfu, chunk.len())).unwrap(); | 183 | block_on(updater.write_firmware(offset, chunk, &mut dfu)).unwrap(); |
| 186 | offset += chunk.len(); | 184 | offset += chunk.len(); |
| 187 | } | 185 | } |
| 188 | block_on(updater.mark_updated(&mut state, &mut aligned)).unwrap(); | 186 | block_on(updater.mark_updated(&mut state, &mut aligned)).unwrap(); |
| @@ -235,7 +233,7 @@ mod tests { | |||
| 235 | 233 | ||
| 236 | let mut offset = 0; | 234 | let mut offset = 0; |
| 237 | for chunk in update.chunks(4096) { | 235 | for chunk in update.chunks(4096) { |
| 238 | block_on(updater.write_firmware(offset, chunk, &mut dfu, chunk.len())).unwrap(); | 236 | block_on(updater.write_firmware(offset, chunk, &mut dfu)).unwrap(); |
| 239 | offset += chunk.len(); | 237 | offset += chunk.len(); |
| 240 | } | 238 | } |
| 241 | block_on(updater.mark_updated(&mut state, &mut aligned)).unwrap(); | 239 | block_on(updater.mark_updated(&mut state, &mut aligned)).unwrap(); |
