From bc21b6efafe607e6ed582b048baedb7803483ee7 Mon Sep 17 00:00:00 2001 From: Mathias Date: Thu, 27 Oct 2022 12:41:06 +0200 Subject: [PATCH] Add delay to flash test to allow time to parse RTT header --- tests/rp/src/bin/flash.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/rp/src/bin/flash.rs b/tests/rp/src/bin/flash.rs index 51371963e..897e3804f 100644 --- a/tests/rp/src/bin/flash.rs +++ b/tests/rp/src/bin/flash.rs @@ -5,6 +5,7 @@ use defmt::*; use embassy_executor::Spawner; use embassy_rp::flash::{ERASE_SIZE, FLASH_BASE}; +use embassy_time::{Duration, Timer}; use {defmt_rtt as _, panic_probe as _}; const ADDR_OFFSET: u32 = 0x4000; @@ -14,6 +15,12 @@ async fn main(_spawner: Spawner) { let p = embassy_rp::init(Default::default()); info!("Hello World!"); + // add some delay to give an attached debug probe time to parse the + // defmt RTT header. Reading that header might touch flash memory, which + // interferes with flash write operations. + // https://github.com/knurling-rs/defmt/pull/683 + Timer::after(Duration::from_millis(10)).await; + let mut flash = embassy_rp::flash::Flash::<_, { 2 * 1024 * 1024 }>::new(p.FLASH); let mut buf = [0u8; ERASE_SIZE];