embassy-rs / embassy

Modern embedded framework, using Rust and async.
https://embassy.dev
Apache License 2.0
5.64k stars 781 forks source link

embassy_boot BlockingFirmwareUpdater::prepare_update() needs more time then possible with Watchdog (RP PicoW) #3568

Open kolbma opened 2 days ago

kolbma commented 2 days ago

I'm stumbling at the moment over some strange stuff.
I've 2 RP PicoW boards.
While board A has no problem with the code:

watchdog.feed();
let writer = updater
    .prepare_update()
    .map_err(|err| {
        error!("flash-update: {:?}", err);
    })
    .unwrap();
debug!("flash-update: writer available");

It is far quicker then the 8 watchdog seconds. (~2 seconds)

The board B hangs in updater.prepare_update() and is reset by watchdog.
With disabled watchdog board B works, too. But it needs indeed about 10 seconds to continue.

Next to this there is no difference detectable for me when writing flash to the 2 boards with the usual tools.

kolbma commented 2 days ago

Is there any tracing I can somehow activate to see what it is doing in the 10 seconds exactly?

I've enabled defmt feature for everything I could find, but there is only the following:

TRACE DFU: 0xe6000 - 0x1c6000
└─ embassy_boot::firmware_updater::blocking::{impl#0}::from_linkerfile_blocking @ .cargo/git/checkouts/embassy-9312dcb0ed774b29/c9abff5/embassy-boot/src/firmware_updater/blocking.rs:68  
TRACE STATE: 0x6000 - 0x7000
└─ embassy_boot::firmware_updater::blocking::{impl#0}::from_linkerfile_blocking @.cargo/git/checkouts/embassy-9312dcb0ed774b29/c9abff5/embassy-boot/src/firmware_updater/blocking.rs:75  
INFO  flash-update: preparing
└─ rp2040w_santas_sleigh::flash_update::flash_update @ src/flash_update.rs:100 
TRACE Reading from 0x10006000 to 0x10006001
└─ embassy_rp::flash::{impl#4}::blocking_read @ .cargo/git/checkouts/embassy-9312dcb0ed774b29/c9abff5/embassy-rp/src/flash.rs:128 
TRACE Erasing from 0x100e6000 to 0x101c6000
└─ embassy_rp::flash::{impl#4}::blocking_erase @ .cargo/git/checkouts/embassy-9312dcb0ed774b29/c9abff5/embassy-rp/src/flash.rs:152 
DEBUG flash-update: writer available

With started watchdog it never comes to the last line, with commented out watchdog start I get the above.