diff options
| author | Rasmus Melchior Jacobsen <[email protected]> | 2023-04-04 21:30:49 +0200 |
|---|---|---|
| committer | Rasmus Melchior Jacobsen <[email protected]> | 2023-04-04 21:30:49 +0200 |
| commit | 53efb029009e3cb92bb19c8ac8f521407aa4d1e2 (patch) | |
| tree | b78038b9b4d38e927692743199100a0034c0da33 /embassy-boot/boot/src/lib.rs | |
| parent | 6c93309df490020f0ae4a515bf404dfd251b9b69 (diff) | |
Allow different erase sizes for active and dfu
Diffstat (limited to 'embassy-boot/boot/src/lib.rs')
| -rw-r--r-- | embassy-boot/boot/src/lib.rs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/embassy-boot/boot/src/lib.rs b/embassy-boot/boot/src/lib.rs index cc812d797..3109f2b47 100644 --- a/embassy-boot/boot/src/lib.rs +++ b/embassy-boot/boot/src/lib.rs | |||
| @@ -7,7 +7,6 @@ mod fmt; | |||
| 7 | 7 | ||
| 8 | mod boot_loader; | 8 | mod boot_loader; |
| 9 | mod firmware_updater; | 9 | mod firmware_updater; |
| 10 | mod large_erase; | ||
| 11 | mod mem_flash; | 10 | mod mem_flash; |
| 12 | mod partition; | 11 | mod partition; |
| 13 | 12 | ||
| @@ -49,7 +48,6 @@ mod tests { | |||
| 49 | use futures::executor::block_on; | 48 | use futures::executor::block_on; |
| 50 | 49 | ||
| 51 | use super::*; | 50 | use super::*; |
| 52 | use crate::large_erase::LargeErase; | ||
| 53 | use crate::mem_flash::MemFlash; | 51 | use crate::mem_flash::MemFlash; |
| 54 | 52 | ||
| 55 | /* | 53 | /* |
| @@ -156,7 +154,7 @@ mod tests { | |||
| 156 | const DFU: Partition = Partition::new(0, 16384); | 154 | const DFU: Partition = Partition::new(0, 16384); |
| 157 | 155 | ||
| 158 | let mut active = MemFlash::<16384, 4096, 8>::random(); | 156 | let mut active = MemFlash::<16384, 4096, 8>::random(); |
| 159 | let mut dfu = LargeErase::<_, 4096>::new(MemFlash::<16384, 2048, 8>::random()); | 157 | let mut dfu = MemFlash::<16384, 2048, 8>::random(); |
| 160 | let mut state = MemFlash::<4096, 128, 4>::random(); | 158 | let mut state = MemFlash::<4096, 128, 4>::random(); |
| 161 | let mut aligned = [0; 4]; | 159 | let mut aligned = [0; 4]; |
| 162 | 160 | ||
| @@ -188,7 +186,7 @@ mod tests { | |||
| 188 | 186 | ||
| 189 | // First DFU page is untouched | 187 | // First DFU page is untouched |
| 190 | for i in DFU.from + 4096..DFU.to { | 188 | for i in DFU.from + 4096..DFU.to { |
| 191 | assert_eq!(dfu.0.mem[i], original[i - DFU.from - 4096], "Index {}", i); | 189 | assert_eq!(dfu.mem[i], original[i - DFU.from - 4096], "Index {}", i); |
| 192 | } | 190 | } |
| 193 | } | 191 | } |
| 194 | 192 | ||
| @@ -200,7 +198,7 @@ mod tests { | |||
| 200 | const DFU: Partition = Partition::new(0, 16384); | 198 | const DFU: Partition = Partition::new(0, 16384); |
| 201 | 199 | ||
| 202 | let mut aligned = [0; 4]; | 200 | let mut aligned = [0; 4]; |
| 203 | let mut active = LargeErase::<_, 4096>::new(MemFlash::<16384, 2048, 4>::random()); | 201 | let mut active = MemFlash::<16384, 2048, 4>::random(); |
| 204 | let mut dfu = MemFlash::<16384, 4096, 8>::random(); | 202 | let mut dfu = MemFlash::<16384, 4096, 8>::random(); |
| 205 | let mut state = MemFlash::<4096, 128, 4>::random(); | 203 | let mut state = MemFlash::<4096, 128, 4>::random(); |
| 206 | 204 | ||
| @@ -208,7 +206,7 @@ mod tests { | |||
| 208 | let update: [u8; DFU.len()] = [rand::random::<u8>(); DFU.len()]; | 206 | let update: [u8; DFU.len()] = [rand::random::<u8>(); DFU.len()]; |
| 209 | 207 | ||
| 210 | for i in ACTIVE.from..ACTIVE.to { | 208 | for i in ACTIVE.from..ACTIVE.to { |
| 211 | active.0.mem[i] = original[i - ACTIVE.from]; | 209 | active.mem[i] = original[i - ACTIVE.from]; |
| 212 | } | 210 | } |
| 213 | 211 | ||
| 214 | let mut updater = FirmwareUpdater::new(DFU, STATE); | 212 | let mut updater = FirmwareUpdater::new(DFU, STATE); |
| @@ -229,7 +227,7 @@ mod tests { | |||
| 229 | ); | 227 | ); |
| 230 | 228 | ||
| 231 | for i in ACTIVE.from..ACTIVE.to { | 229 | for i in ACTIVE.from..ACTIVE.to { |
| 232 | assert_eq!(active.0.mem[i], update[i - ACTIVE.from], "Index {}", i); | 230 | assert_eq!(active.mem[i], update[i - ACTIVE.from], "Index {}", i); |
| 233 | } | 231 | } |
| 234 | 232 | ||
| 235 | // First DFU page is untouched | 233 | // First DFU page is untouched |
