Skip to content

Commit

Permalink
expose rp bootloader state like stm32
Browse files Browse the repository at this point in the history
  • Loading branch information
korbin committed Dec 21, 2024
1 parent c775604 commit 5c4133c
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 5c4133c

Please sign in to comment.