Skip to content

Commit

Permalink
Merge pull request #3675 from korbin/expose-rp-boot-state
Browse files Browse the repository at this point in the history
Expose `rp` bootloader state like `stm32`
  • Loading branch information
lulf authored Dec 21, 2024
2 parents c775604 + 5c4133c commit e88adb6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions embassy-boot-rp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ use embassy_time::Duration;
use embedded_storage::nor_flash::{ErrorType, NorFlash, ReadNorFlash};

/// A bootloader for RP2040 devices.
pub struct BootLoader<const BUFFER_SIZE: usize = ERASE_SIZE>;
pub struct BootLoader<const BUFFER_SIZE: usize = ERASE_SIZE> {
/// The reported state of the bootloader after preparing for boot
pub state: State,
}

impl<const BUFFER_SIZE: usize> BootLoader<BUFFER_SIZE> {
/// Inspect the bootloader state and perform actions required before booting, such as swapping firmware
Expand All @@ -36,8 +39,8 @@ impl<const BUFFER_SIZE: usize> BootLoader<BUFFER_SIZE> {
) -> Result<Self, BootError> {
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.
Expand Down

0 comments on commit e88adb6

Please sign in to comment.