From 5c4133c70e58cc50fa9d7322630304132d095bcb Mon Sep 17 00:00:00 2001 From: korbin Date: Sat, 21 Dec 2024 09:00:46 -0700 Subject: [PATCH] expose rp bootloader state like stm32 --- embassy-boot-rp/src/lib.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/embassy-boot-rp/src/lib.rs b/embassy-boot-rp/src/lib.rs index 3e1731f5e3..6ec33a580f 100644 --- a/embassy-boot-rp/src/lib.rs +++ b/embassy-boot-rp/src/lib.rs @@ -14,7 +14,10 @@ use embassy_time::Duration; use embedded_storage::nor_flash::{ErrorType, NorFlash, ReadNorFlash}; /// A bootloader for RP2040 devices. -pub struct BootLoader; +pub struct BootLoader { + /// The reported state of the bootloader after preparing for boot + pub state: State, +} impl BootLoader { /// Inspect the bootloader state and perform actions required before booting, such as swapping firmware @@ -36,8 +39,8 @@ impl BootLoader { ) -> Result { let mut aligned_buf = AlignedBuffer([0; BUFFER_SIZE]); let mut boot = embassy_boot::BootLoader::new(config); - let _state = boot.prepare_boot(aligned_buf.as_mut())?; - Ok(Self) + let state = boot.prepare_boot(aligned_buf.as_mut())?; + Ok(Self { state }) } /// Boots the application.