diff options
| author | Rasmus Melchior Jacobsen <[email protected]> | 2023-04-04 21:57:28 +0200 |
|---|---|---|
| committer | Rasmus Melchior Jacobsen <[email protected]> | 2023-04-04 21:57:28 +0200 |
| commit | e962fe794ce3c83b094e22523d0c59264983b036 (patch) | |
| tree | 9197bcbc03524642e51bea160219d4edb378dfb6 /embassy-boot | |
| parent | 78e6b4d26134887b50e3ff3239a20f9b3002e8a0 (diff) | |
Add assertions about the aligned_buf % write sizes
Diffstat (limited to 'embassy-boot')
| -rw-r--r-- | embassy-boot/boot/src/boot_loader.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/embassy-boot/boot/src/boot_loader.rs b/embassy-boot/boot/src/boot_loader.rs index ccd74b237..2412427c0 100644 --- a/embassy-boot/boot/src/boot_loader.rs +++ b/embassy-boot/boot/src/boot_loader.rs | |||
| @@ -179,10 +179,12 @@ impl BootLoader { | |||
| 179 | // Ensure we have enough progress pages to store copy progress | 179 | // Ensure we have enough progress pages to store copy progress |
| 180 | assert_eq!(0, P::page_size() % aligned_buf.len()); | 180 | assert_eq!(0, P::page_size() % aligned_buf.len()); |
| 181 | assert_eq!(0, P::page_size() % P::ACTIVE::WRITE_SIZE); | 181 | assert_eq!(0, P::page_size() % P::ACTIVE::WRITE_SIZE); |
| 182 | assert_eq!(0, P::page_size() % P::DFU::WRITE_SIZE); | ||
| 183 | assert_eq!(0, P::page_size() % P::ACTIVE::ERASE_SIZE); | 182 | assert_eq!(0, P::page_size() % P::ACTIVE::ERASE_SIZE); |
| 183 | assert_eq!(0, P::page_size() % P::DFU::WRITE_SIZE); | ||
| 184 | assert_eq!(0, P::page_size() % P::DFU::ERASE_SIZE); | 184 | assert_eq!(0, P::page_size() % P::DFU::ERASE_SIZE); |
| 185 | assert!(aligned_buf.len() >= P::STATE::WRITE_SIZE); | 185 | assert!(aligned_buf.len() >= P::STATE::WRITE_SIZE); |
| 186 | assert_eq!(0, aligned_buf.len() % P::ACTIVE::WRITE_SIZE); | ||
| 187 | assert_eq!(0, aligned_buf.len() % P::DFU::WRITE_SIZE); | ||
| 186 | assert_partitions(self.active, self.dfu, self.state, P::page_size(), P::STATE::WRITE_SIZE); | 188 | assert_partitions(self.active, self.dfu, self.state, P::page_size(), P::STATE::WRITE_SIZE); |
| 187 | 189 | ||
| 188 | // Copy contents from partition N to active | 190 | // Copy contents from partition N to active |
