diff options
| author | Ulf Lilleengen <[email protected]> | 2024-01-07 16:12:58 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-01-07 16:12:58 +0000 |
| commit | 8e7f477b01507044471b0b247aea1db52716a765 (patch) | |
| tree | 0916d6309d5c33f3f631ecbfef7aa117922e7241 | |
| parent | 294046cddbdd485a99f7531c29af92c326124123 (diff) | |
| parent | b28629822b001a76d2d2dd3747774dad394a6590 (diff) | |
Merge pull request #2411 from uzytkownik/reading-from-async-firmware-updater
boot: Take maximum of READ_SIZE and WRITE_SIZE when checking sizes, fixes #2382
| -rw-r--r-- | embassy-boot/boot/src/firmware_updater/asynch.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/embassy-boot/boot/src/firmware_updater/asynch.rs b/embassy-boot/boot/src/firmware_updater/asynch.rs index 64a4b32ec..2e43e1cc1 100644 --- a/embassy-boot/boot/src/firmware_updater/asynch.rs +++ b/embassy-boot/boot/src/firmware_updater/asynch.rs | |||
| @@ -224,10 +224,10 @@ impl<'d, STATE: NorFlash> FirmwareState<'d, STATE> { | |||
| 224 | /// | 224 | /// |
| 225 | /// # Safety | 225 | /// # Safety |
| 226 | /// | 226 | /// |
| 227 | /// The `aligned` buffer must have a size of STATE::WRITE_SIZE, and follow the alignment rules for the flash being read from | 227 | /// The `aligned` buffer must have a size of maximum of STATE::WRITE_SIZE and STATE::READ_SIZE, |
| 228 | /// and written to. | 228 | /// and follow the alignment rules for the flash being read from and written to. |
| 229 | pub fn new(state: STATE, aligned: &'d mut [u8]) -> Self { | 229 | pub fn new(state: STATE, aligned: &'d mut [u8]) -> Self { |
| 230 | assert_eq!(aligned.len(), STATE::WRITE_SIZE); | 230 | assert_eq!(aligned.len(), STATE::WRITE_SIZE.max(STATE::READ_SIZE)); |
| 231 | Self { state, aligned } | 231 | Self { state, aligned } |
| 232 | } | 232 | } |
| 233 | 233 | ||
