mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-25 00:02:28 +00:00
make some embassy-boot asserts const
This commit is contained in:
parent
6f21d5e478
commit
8f52ee469e
@ -235,12 +235,15 @@ impl<ACTIVE: NorFlash, DFU: NorFlash, STATE: NorFlash> BootLoader<ACTIVE, DFU, S
|
|||||||
/// | DFU | 3 | 4 | 5 | 6 | 3 |
|
/// | DFU | 3 | 4 | 5 | 6 | 3 |
|
||||||
///
|
///
|
||||||
pub fn prepare_boot(&mut self, aligned_buf: &mut [u8]) -> Result<State, BootError> {
|
pub fn prepare_boot(&mut self, aligned_buf: &mut [u8]) -> Result<State, BootError> {
|
||||||
|
const {
|
||||||
|
assert!(Self::PAGE_SIZE % ACTIVE::WRITE_SIZE as u32 == 0);
|
||||||
|
assert!(Self::PAGE_SIZE % ACTIVE::ERASE_SIZE as u32 == 0);
|
||||||
|
assert!(Self::PAGE_SIZE % DFU::WRITE_SIZE as u32 == 0);
|
||||||
|
assert!(Self::PAGE_SIZE % DFU::ERASE_SIZE as u32 == 0);
|
||||||
|
}
|
||||||
|
|
||||||
// Ensure we have enough progress pages to store copy progress
|
// Ensure we have enough progress pages to store copy progress
|
||||||
assert_eq!(0, Self::PAGE_SIZE % aligned_buf.len() as u32);
|
assert_eq!(0, Self::PAGE_SIZE % aligned_buf.len() as u32);
|
||||||
assert_eq!(0, Self::PAGE_SIZE % ACTIVE::WRITE_SIZE as u32);
|
|
||||||
assert_eq!(0, Self::PAGE_SIZE % ACTIVE::ERASE_SIZE as u32);
|
|
||||||
assert_eq!(0, Self::PAGE_SIZE % DFU::WRITE_SIZE as u32);
|
|
||||||
assert_eq!(0, Self::PAGE_SIZE % DFU::ERASE_SIZE as u32);
|
|
||||||
assert!(aligned_buf.len() >= STATE::WRITE_SIZE);
|
assert!(aligned_buf.len() >= STATE::WRITE_SIZE);
|
||||||
assert_eq!(0, aligned_buf.len() % ACTIVE::WRITE_SIZE);
|
assert_eq!(0, aligned_buf.len() % ACTIVE::WRITE_SIZE);
|
||||||
assert_eq!(0, aligned_buf.len() % DFU::WRITE_SIZE);
|
assert_eq!(0, aligned_buf.len() % DFU::WRITE_SIZE);
|
||||||
|
Loading…
Reference in New Issue
Block a user