diff options
| author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2023-04-04 21:00:11 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-04-04 21:00:11 +0000 |
| commit | 064ec9581e33fdd42f89ff75984254ccfec3f6c2 (patch) | |
| tree | 55438e15f173ab3ce23f48ede11876e1a8aab23e /embassy-boot/boot/src/mem_flash.rs | |
| parent | 5923e143e35547b1972f2e48082e93dfbe1dadac (diff) | |
| parent | 84bfe9b8c93ea8634ce2192fb719034b5c13e5da (diff) | |
Merge #1329
1329: Reduce bootloader memory usage r=rmja a=rmja
By not requiring that the provided buffer must be able to contain one "erase-size" bytes.
This PR is the successor of #1314 and replaces it entirely.
Co-authored-by: Rasmus Melchior Jacobsen <[email protected]>
Diffstat (limited to 'embassy-boot/boot/src/mem_flash.rs')
| -rw-r--r-- | embassy-boot/boot/src/mem_flash.rs | 9 |
1 files changed, 0 insertions, 9 deletions
diff --git a/embassy-boot/boot/src/mem_flash.rs b/embassy-boot/boot/src/mem_flash.rs index 828aad9d9..dd85405c8 100644 --- a/embassy-boot/boot/src/mem_flash.rs +++ b/embassy-boot/boot/src/mem_flash.rs | |||
| @@ -5,8 +5,6 @@ use core::ops::{Bound, Range, RangeBounds}; | |||
| 5 | use embedded_storage::nor_flash::{ErrorType, NorFlash, NorFlashError, NorFlashErrorKind, ReadNorFlash}; | 5 | use embedded_storage::nor_flash::{ErrorType, NorFlash, NorFlashError, NorFlashErrorKind, ReadNorFlash}; |
| 6 | use embedded_storage_async::nor_flash::{NorFlash as AsyncNorFlash, ReadNorFlash as AsyncReadNorFlash}; | 6 | use embedded_storage_async::nor_flash::{NorFlash as AsyncNorFlash, ReadNorFlash as AsyncReadNorFlash}; |
| 7 | 7 | ||
| 8 | use crate::Flash; | ||
| 9 | |||
| 10 | pub struct MemFlash<const SIZE: usize, const ERASE_SIZE: usize, const WRITE_SIZE: usize> { | 8 | pub struct MemFlash<const SIZE: usize, const ERASE_SIZE: usize, const WRITE_SIZE: usize> { |
| 11 | pub mem: [u8; SIZE], | 9 | pub mem: [u8; SIZE], |
| 12 | pub pending_write_successes: Option<usize>, | 10 | pub pending_write_successes: Option<usize>, |
| @@ -44,13 +42,6 @@ impl<const SIZE: usize, const ERASE_SIZE: usize, const WRITE_SIZE: usize> Defaul | |||
| 44 | } | 42 | } |
| 45 | } | 43 | } |
| 46 | 44 | ||
| 47 | impl<const SIZE: usize, const ERASE_SIZE: usize, const WRITE_SIZE: usize> Flash | ||
| 48 | for MemFlash<SIZE, ERASE_SIZE, WRITE_SIZE> | ||
| 49 | { | ||
| 50 | const BLOCK_SIZE: usize = ERASE_SIZE; | ||
| 51 | const ERASE_VALUE: u8 = 0xFF; | ||
| 52 | } | ||
| 53 | |||
| 54 | impl<const SIZE: usize, const ERASE_SIZE: usize, const WRITE_SIZE: usize> ErrorType | 45 | impl<const SIZE: usize, const ERASE_SIZE: usize, const WRITE_SIZE: usize> ErrorType |
| 55 | for MemFlash<SIZE, ERASE_SIZE, WRITE_SIZE> | 46 | for MemFlash<SIZE, ERASE_SIZE, WRITE_SIZE> |
| 56 | { | 47 | { |
