diff options
| author | Dario Nieuwenhuis <[email protected]> | 2023-07-28 22:56:33 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-07-28 22:56:33 +0000 |
| commit | eb097b9d03fe906c4ee4cbe0f3eb3dbbe621d56f (patch) | |
| tree | bd5e8f050930e660006f85099ede9376214a77c8 /tests | |
| parent | bdc4aa4a3beeeecb9860644f8421bba6c8ab0cf2 (diff) | |
| parent | 7ed9e29326e42bf286b4f7c5883ef216cfb21531 (diff) | |
Merge pull request #1710 from Sizurka/rp-async-flash
rp: add async flash
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/rp/src/bin/flash.rs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/tests/rp/src/bin/flash.rs b/tests/rp/src/bin/flash.rs index cf9b86df5..c31d6decf 100644 --- a/tests/rp/src/bin/flash.rs +++ b/tests/rp/src/bin/flash.rs | |||
| @@ -6,11 +6,11 @@ mod common; | |||
| 6 | 6 | ||
| 7 | use defmt::*; | 7 | use defmt::*; |
| 8 | use embassy_executor::Spawner; | 8 | use embassy_executor::Spawner; |
| 9 | use embassy_rp::flash::{ERASE_SIZE, FLASH_BASE}; | 9 | use embassy_rp::flash::{Async, ERASE_SIZE, FLASH_BASE}; |
| 10 | use embassy_time::{Duration, Timer}; | 10 | use embassy_time::{Duration, Timer}; |
| 11 | use {defmt_rtt as _, panic_probe as _}; | 11 | use {defmt_rtt as _, panic_probe as _}; |
| 12 | 12 | ||
| 13 | const ADDR_OFFSET: u32 = 0x4000; | 13 | const ADDR_OFFSET: u32 = 0x8000; |
| 14 | 14 | ||
| 15 | #[embassy_executor::main] | 15 | #[embassy_executor::main] |
| 16 | async fn main(_spawner: Spawner) { | 16 | async fn main(_spawner: Spawner) { |
| @@ -23,7 +23,7 @@ async fn main(_spawner: Spawner) { | |||
| 23 | // https://github.com/knurling-rs/defmt/pull/683 | 23 | // https://github.com/knurling-rs/defmt/pull/683 |
| 24 | Timer::after(Duration::from_millis(10)).await; | 24 | Timer::after(Duration::from_millis(10)).await; |
| 25 | 25 | ||
| 26 | let mut flash = embassy_rp::flash::Flash::<_, { 2 * 1024 * 1024 }>::new(p.FLASH); | 26 | let mut flash = embassy_rp::flash::Flash::<_, Async, { 2 * 1024 * 1024 }>::new(p.FLASH, p.DMA_CH0); |
| 27 | 27 | ||
| 28 | // Get JEDEC id | 28 | // Get JEDEC id |
| 29 | let jedec = defmt::unwrap!(flash.jedec_id()); | 29 | let jedec = defmt::unwrap!(flash.jedec_id()); |
| @@ -60,6 +60,14 @@ async fn main(_spawner: Spawner) { | |||
| 60 | defmt::panic!("unexpected"); | 60 | defmt::panic!("unexpected"); |
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | let mut buf = [0u32; ERASE_SIZE / 4]; | ||
| 64 | |||
| 65 | defmt::unwrap!(flash.background_read(ADDR_OFFSET, &mut buf)).await; | ||
| 66 | info!("Contents after write starts with {=u32:x}", buf[0]); | ||
| 67 | if buf.iter().any(|x| *x != 0xDADADADA) { | ||
| 68 | defmt::panic!("unexpected"); | ||
| 69 | } | ||
| 70 | |||
| 63 | info!("Test OK"); | 71 | info!("Test OK"); |
| 64 | cortex_m::asm::bkpt(); | 72 | cortex_m::asm::bkpt(); |
| 65 | } | 73 | } |
