aboutsummaryrefslogtreecommitdiff
path: root/embassy-boot-rp/src/lib.rs
diff options
context:
space:
mode:
authorkorbin <[email protected]>2024-12-21 09:00:46 -0700
committerkorbin <[email protected]>2024-12-21 09:00:46 -0700
commit5c4133c70e58cc50fa9d7322630304132d095bcb (patch)
tree5aac8b4edf94ff1b5dc1ec5d61c5ea7fc857e786 /embassy-boot-rp/src/lib.rs
parentc77560430ec781d54f3d121e1b0f771262359899 (diff)
expose rp bootloader state like stm32
Diffstat (limited to 'embassy-boot-rp/src/lib.rs')
-rw-r--r--embassy-boot-rp/src/lib.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/embassy-boot-rp/src/lib.rs b/embassy-boot-rp/src/lib.rs
index 3e1731f5e..6ec33a580 100644
--- a/embassy-boot-rp/src/lib.rs
+++ b/embassy-boot-rp/src/lib.rs
@@ -14,7 +14,10 @@ use embassy_time::Duration;
14use embedded_storage::nor_flash::{ErrorType, NorFlash, ReadNorFlash}; 14use embedded_storage::nor_flash::{ErrorType, NorFlash, ReadNorFlash};
15 15
16/// A bootloader for RP2040 devices. 16/// A bootloader for RP2040 devices.
17pub struct BootLoader<const BUFFER_SIZE: usize = ERASE_SIZE>; 17pub struct BootLoader<const BUFFER_SIZE: usize = ERASE_SIZE> {
18 /// The reported state of the bootloader after preparing for boot
19 pub state: State,
20}
18 21
19impl<const BUFFER_SIZE: usize> BootLoader<BUFFER_SIZE> { 22impl<const BUFFER_SIZE: usize> BootLoader<BUFFER_SIZE> {
20 /// Inspect the bootloader state and perform actions required before booting, such as swapping firmware 23 /// Inspect the bootloader state and perform actions required before booting, such as swapping firmware
@@ -36,8 +39,8 @@ impl<const BUFFER_SIZE: usize> BootLoader<BUFFER_SIZE> {
36 ) -> Result<Self, BootError> { 39 ) -> Result<Self, BootError> {
37 let mut aligned_buf = AlignedBuffer([0; BUFFER_SIZE]); 40 let mut aligned_buf = AlignedBuffer([0; BUFFER_SIZE]);
38 let mut boot = embassy_boot::BootLoader::new(config); 41 let mut boot = embassy_boot::BootLoader::new(config);
39 let _state = boot.prepare_boot(aligned_buf.as_mut())?; 42 let state = boot.prepare_boot(aligned_buf.as_mut())?;
40 Ok(Self) 43 Ok(Self { state })
41 } 44 }
42 45
43 /// Boots the application. 46 /// Boots the application.