aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlf Lilleengen <[email protected]>2024-07-02 12:37:36 +0200
committerUlf Lilleengen <[email protected]>2024-07-02 12:37:36 +0200
commit8f52ee469eb282d55ed74dc08b71c1e994aa8ba5 (patch)
treeeb87d8ca2e8269f212214d3a3cec52ca7f6edbe6
parent6f21d5e478292352df5cabcc1aa302ae7f8998a3 (diff)
make some embassy-boot asserts const
-rw-r--r--embassy-boot/src/boot_loader.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/embassy-boot/src/boot_loader.rs b/embassy-boot/src/boot_loader.rs
index a38558056..789fa34c1 100644
--- a/embassy-boot/src/boot_loader.rs
+++ b/embassy-boot/src/boot_loader.rs
@@ -235,12 +235,15 @@ impl<ACTIVE: NorFlash, DFU: NorFlash, STATE: NorFlash> BootLoader<ACTIVE, DFU, S
235 /// | DFU | 3 | 4 | 5 | 6 | 3 | 235 /// | DFU | 3 | 4 | 5 | 6 | 3 |
236 /// 236 ///
237 pub fn prepare_boot(&mut self, aligned_buf: &mut [u8]) -> Result<State, BootError> { 237 pub fn prepare_boot(&mut self, aligned_buf: &mut [u8]) -> Result<State, BootError> {
238 const {
239 assert!(Self::PAGE_SIZE % ACTIVE::WRITE_SIZE as u32 == 0);
240 assert!(Self::PAGE_SIZE % ACTIVE::ERASE_SIZE as u32 == 0);
241 assert!(Self::PAGE_SIZE % DFU::WRITE_SIZE as u32 == 0);
242 assert!(Self::PAGE_SIZE % DFU::ERASE_SIZE as u32 == 0);
243 }
244
238 // Ensure we have enough progress pages to store copy progress 245 // Ensure we have enough progress pages to store copy progress
239 assert_eq!(0, Self::PAGE_SIZE % aligned_buf.len() as u32); 246 assert_eq!(0, Self::PAGE_SIZE % aligned_buf.len() as u32);
240 assert_eq!(0, Self::PAGE_SIZE % ACTIVE::WRITE_SIZE as u32);
241 assert_eq!(0, Self::PAGE_SIZE % ACTIVE::ERASE_SIZE as u32);
242 assert_eq!(0, Self::PAGE_SIZE % DFU::WRITE_SIZE as u32);
243 assert_eq!(0, Self::PAGE_SIZE % DFU::ERASE_SIZE as u32);
244 assert!(aligned_buf.len() >= STATE::WRITE_SIZE); 247 assert!(aligned_buf.len() >= STATE::WRITE_SIZE);
245 assert_eq!(0, aligned_buf.len() % ACTIVE::WRITE_SIZE); 248 assert_eq!(0, aligned_buf.len() % ACTIVE::WRITE_SIZE);
246 assert_eq!(0, aligned_buf.len() % DFU::WRITE_SIZE); 249 assert_eq!(0, aligned_buf.len() % DFU::WRITE_SIZE);