aboutsummaryrefslogtreecommitdiff
path: root/examples/rp/src/bin/flash.rs
diff options
context:
space:
mode:
authorMathias <[email protected]>2022-10-27 07:10:27 +0200
committerMathias <[email protected]>2022-10-27 07:10:35 +0200
commit3c6c382465131c6f76567f976198b77e327df4b2 (patch)
tree570c0cbf8b69fbc22c6ff81102d0cab31a9d84e9 /examples/rp/src/bin/flash.rs
parent1669e395654430dff6dffda0cef9522f9ccfd213 (diff)
Remove random delay from example, and move flash functions to allow using without embedded-storage in scope
Diffstat (limited to 'examples/rp/src/bin/flash.rs')
-rw-r--r--examples/rp/src/bin/flash.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/examples/rp/src/bin/flash.rs b/examples/rp/src/bin/flash.rs
index d4dfca759..8d6b379f4 100644
--- a/examples/rp/src/bin/flash.rs
+++ b/examples/rp/src/bin/flash.rs
@@ -6,7 +6,7 @@ use defmt::*;
6use embassy_executor::Spawner; 6use embassy_executor::Spawner;
7use embassy_rp::flash::{ERASE_SIZE, FLASH_BASE}; 7use embassy_rp::flash::{ERASE_SIZE, FLASH_BASE};
8use embassy_rp::peripherals::FLASH; 8use embassy_rp::peripherals::FLASH;
9use embedded_storage::nor_flash::{NorFlash, ReadNorFlash}; 9use embassy_time::{Duration, Timer};
10use {defmt_rtt as _, panic_probe as _}; 10use {defmt_rtt as _, panic_probe as _};
11 11
12const ADDR_OFFSET: u32 = 0x100000; 12const ADDR_OFFSET: u32 = 0x100000;
@@ -17,6 +17,12 @@ async fn main(_spawner: Spawner) {
17 let p = embassy_rp::init(Default::default()); 17 let p = embassy_rp::init(Default::default());
18 info!("Hello World!"); 18 info!("Hello World!");
19 19
20 // add some delay to give an attached debug probe time to parse the
21 // defmt RTT header. Reading that header might touch flash memory, which
22 // interferes with flash write operations.
23 // https://github.com/knurling-rs/defmt/pull/683
24 Timer::after(Duration::from_millis(10)).await;
25
20 let mut flash = embassy_rp::flash::Flash::<_, FLASH_SIZE>::new(p.FLASH); 26 let mut flash = embassy_rp::flash::Flash::<_, FLASH_SIZE>::new(p.FLASH);
21 erase_write_sector(&mut flash, 0x00); 27 erase_write_sector(&mut flash, 0x00);
22 28