diff options
Diffstat (limited to 'embassy-boot/boot')
| -rw-r--r-- | embassy-boot/boot/src/boot_loader.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/embassy-boot/boot/src/boot_loader.rs b/embassy-boot/boot/src/boot_loader.rs index a8c19197b..1663f4f2c 100644 --- a/embassy-boot/boot/src/boot_loader.rs +++ b/embassy-boot/boot/src/boot_loader.rs | |||
| @@ -224,6 +224,7 @@ impl<ACTIVE: NorFlash, DFU: NorFlash, STATE: NorFlash> BootLoader<ACTIVE, DFU, S | |||
| 224 | assert_eq!(0, aligned_buf.len() % ACTIVE::WRITE_SIZE); | 224 | assert_eq!(0, aligned_buf.len() % ACTIVE::WRITE_SIZE); |
| 225 | assert_eq!(0, aligned_buf.len() % DFU::WRITE_SIZE); | 225 | assert_eq!(0, aligned_buf.len() % DFU::WRITE_SIZE); |
| 226 | 226 | ||
| 227 | // Ensure our partitions are able to handle boot operations | ||
| 227 | assert_partitions(&self.active, &self.dfu, &self.state, Self::PAGE_SIZE); | 228 | assert_partitions(&self.active, &self.dfu, &self.state, Self::PAGE_SIZE); |
| 228 | 229 | ||
| 229 | // Copy contents from partition N to active | 230 | // Copy contents from partition N to active |
| @@ -398,6 +399,7 @@ fn assert_partitions<ACTIVE: NorFlash, DFU: NorFlash, STATE: NorFlash>( | |||
| 398 | ) { | 399 | ) { |
| 399 | assert_eq!(active.capacity() as u32 % page_size, 0); | 400 | assert_eq!(active.capacity() as u32 % page_size, 0); |
| 400 | assert_eq!(dfu.capacity() as u32 % page_size, 0); | 401 | assert_eq!(dfu.capacity() as u32 % page_size, 0); |
| 402 | // DFU partition has to be bigger than ACTIVE partition to handle swap algorithm | ||
| 401 | assert!(dfu.capacity() as u32 - active.capacity() as u32 >= page_size); | 403 | assert!(dfu.capacity() as u32 - active.capacity() as u32 >= page_size); |
| 402 | assert!(2 + 2 * (active.capacity() as u32 / page_size) <= state.capacity() as u32 / STATE::WRITE_SIZE as u32); | 404 | assert!(2 + 2 * (active.capacity() as u32 / page_size) <= state.capacity() as u32 / STATE::WRITE_SIZE as u32); |
| 403 | } | 405 | } |
