Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose rp bootloader state like stm32 #3675

Merged
merged 1 commit into from
Dec 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading