diff options
Diffstat (limited to 'imxrt1170evk/examples/smoke.rs')
| -rw-r--r-- | imxrt1170evk/examples/smoke.rs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/imxrt1170evk/examples/smoke.rs b/imxrt1170evk/examples/smoke.rs new file mode 100644 index 0000000..df91789 --- /dev/null +++ b/imxrt1170evk/examples/smoke.rs @@ -0,0 +1,35 @@ +#![no_main] +#![no_std] + +use defmt_rtt as _; +use imxrt1170evk::{self, Algorithm}; +use panic_probe as _; + +const LAST_SECTOR: usize = Algorithm::flash_size_bytes() - Algorithm::sector_size_bytes(); + +#[imxrt_rt::entry] +fn main() -> ! { + for _ in 0..5 { + let mut is25wp = Algorithm::initialize(); + + let mut sector = [0_u8; Algorithm::sector_size_bytes()]; + is25wp.flash_read(0x400, &mut sector[..4]); + defmt::assert!(0x42464346 == u32::from_le_bytes(sector[..4].try_into().unwrap())); + + is25wp.flash_erase_sector(LAST_SECTOR + 256); + + sector.fill(0); + is25wp.flash_write(LAST_SECTOR, §or); + + sector.fill(u8::MAX); + is25wp.flash_read(LAST_SECTOR, &mut sector); + defmt::assert!(sector.iter().all(|byte| *byte == 0)); + + is25wp.flash_erase_sector(LAST_SECTOR + 123); + + is25wp.flash_read(LAST_SECTOR, &mut sector); + defmt::assert!(sector.iter().all(|byte| *byte == u8::MAX)); + } + defmt::println!("Pass"); + loop {} +} |
