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.
This commit is contained in:
Rasmus Melchior Jacobsen
2023-04-03 14:50:41 +02:00
parent 0909a6cd3f
commit b1e2195b49
3 changed files with 12 additions and 76 deletions

View File

@ -7,12 +7,10 @@ mod fmt;
mod boot_loader;
mod firmware_updater;
mod firmware_writer;
mod partition;
pub use boot_loader::{BootError, BootFlash, BootLoader, Flash, FlashConfig, MultiFlashConfig, SingleFlashConfig};
pub use firmware_updater::{FirmwareUpdater, FirmwareUpdaterError};
pub use firmware_writer::FirmwareWriter;
pub use partition::Partition;
pub(crate) const BOOT_MAGIC: u8 = 0xD0;
@ -109,7 +107,7 @@ mod tests {
let mut updater = FirmwareUpdater::new(DFU, STATE);
let mut offset = 0;
for chunk in update.chunks(4096) {
block_on(updater.write_firmware(offset, chunk, &mut flash, 4096)).unwrap();
block_on(updater.write_firmware(offset, chunk, &mut flash)).unwrap();
offset += chunk.len();
}
block_on(updater.mark_updated(&mut flash, &mut aligned)).unwrap();
@ -182,7 +180,7 @@ mod tests {
let mut offset = 0;
for chunk in update.chunks(2048) {
block_on(updater.write_firmware(offset, chunk, &mut dfu, chunk.len())).unwrap();
block_on(updater.write_firmware(offset, chunk, &mut dfu)).unwrap();
offset += chunk.len();
}
block_on(updater.mark_updated(&mut state, &mut aligned)).unwrap();
@ -235,7 +233,7 @@ mod tests {
let mut offset = 0;
for chunk in update.chunks(4096) {
block_on(updater.write_firmware(offset, chunk, &mut dfu, chunk.len())).unwrap();
block_on(updater.write_firmware(offset, chunk, &mut dfu)).unwrap();
offset += chunk.len();
}
block_on(updater.mark_updated(&mut state, &mut aligned)).unwrap();