diff options
| author | Kaitlyn Kenwell <[email protected]> | 2023-12-13 14:42:14 -0500 |
|---|---|---|
| committer | Kaitlyn Kenwell <[email protected]> | 2023-12-13 14:42:14 -0500 |
| commit | 2afec225e3eddb5738bbc995baf04e13dd1df9e7 (patch) | |
| tree | 7a4490c42f63480ab7485227ac72e44b15152451 /embassy-boot/boot/src | |
| parent | 976a7ae22aa222213861c12d515115aac87bd2e0 (diff) | |
| parent | 1279a1b7f6bc9c965f8d8da3a9c7449195b6a663 (diff) | |
Merge branch 'main' into feature/embassy-usb-dfu
Diffstat (limited to 'embassy-boot/boot/src')
| -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 c0deca22b..340962a7a 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 |
| @@ -400,6 +401,7 @@ fn assert_partitions<ACTIVE: NorFlash, DFU: NorFlash, STATE: NorFlash>( | |||
| 400 | ) { | 401 | ) { |
| 401 | assert_eq!(active.capacity() as u32 % page_size, 0); | 402 | assert_eq!(active.capacity() as u32 % page_size, 0); |
| 402 | assert_eq!(dfu.capacity() as u32 % page_size, 0); | 403 | assert_eq!(dfu.capacity() as u32 % page_size, 0); |
| 404 | // DFU partition has to be bigger than ACTIVE partition to handle swap algorithm | ||
| 403 | assert!(dfu.capacity() as u32 - active.capacity() as u32 >= page_size); | 405 | assert!(dfu.capacity() as u32 - active.capacity() as u32 >= page_size); |
| 404 | assert!(2 + 2 * (active.capacity() as u32 / page_size) <= state.capacity() as u32 / STATE::WRITE_SIZE as u32); | 406 | assert!(2 + 2 * (active.capacity() as u32 / page_size) <= state.capacity() as u32 / STATE::WRITE_SIZE as u32); |
| 405 | } | 407 | } |
