MoonbootManager

Struct MoonbootManager 

Source
pub struct MoonbootManager<InternalMemory: Storage, HardwareState: State, CPU: Processor, const INTERNAL_PAGE_SIZE: usize> { /* private fields */ }
Expand description

Implementations for use in the firmware Instantiate this in your application to enable mutation of the State specified in this and jump to the bootloader to apply any updates.

Implementations§

Source§

impl<InternalMemory: Storage, HardwareState: State, CPU: Processor, const INTERNAL_PAGE_SIZE: usize> MoonbootManager<InternalMemory, HardwareState, CPU, INTERNAL_PAGE_SIZE>

Source

pub fn new( config: Config, internal_memory: InternalMemory, state: HardwareState, processor: CPU, ) -> MoonbootManager<InternalMemory, HardwareState, CPU, INTERNAL_PAGE_SIZE>

Source

pub fn destroy(self) -> (InternalMemory, HardwareState, CPU)

Destroy this instance of the boot manager and return access to the hardware peripheral

Source

pub fn mark_boot_successful(&mut self) -> Result<(), ()>

Run this immediately after booting your new image successfully to mark the boot as succesful. If you do not do this, any reset will cause the bootloader to restore to the previous firmware image.

Source

pub fn update(&mut self) -> Result<Void, ()>

Trait Implementations§

Source§

impl<InternalMemory: Storage, HardwareState: State, CPU: Processor, const INTERNAL_PAGE_SIZE: usize> AsRef<[u8]> for MoonbootManager<InternalMemory, HardwareState, CPU, INTERNAL_PAGE_SIZE>

Easily get read access to the update bank

Source§

fn as_ref(&self) -> &[u8]

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<InternalMemory: Storage, HardwareState: State, CPU: Processor, const INTERNAL_PAGE_SIZE: usize> ReadStorage for MoonbootManager<InternalMemory, HardwareState, CPU, INTERNAL_PAGE_SIZE>

Read Access to the current update target slot

Source§

type Error = ()

An enumeration of storage errors
Source§

fn read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Self::Error>

Read a slice of data from the storage peripheral, starting the read operation at the given address offset, and reading bytes.len() bytes. Read more
Source§

fn capacity(&self) -> usize

The capacity of the storage peripheral in bytes.
Source§

impl<InternalMemory: Storage, HardwareState: State, CPU: Processor, const INTERNAL_PAGE_SIZE: usize> Storage for MoonbootManager<InternalMemory, HardwareState, CPU, INTERNAL_PAGE_SIZE>

Write Access to the current update target slot

Source§

fn write(&mut self, offset: u32, bytes: &[u8]) -> Result<(), Self::Error>

Write a slice of data to the storage peripheral, starting the write operation at the given address offset (between 0 and self.capacity()). Read more

Auto Trait Implementations§

§

impl<InternalMemory, HardwareState, CPU, const INTERNAL_PAGE_SIZE: usize> Freeze for MoonbootManager<InternalMemory, HardwareState, CPU, INTERNAL_PAGE_SIZE>
where InternalMemory: Freeze, HardwareState: Freeze, CPU: Freeze,

§

impl<InternalMemory, HardwareState, CPU, const INTERNAL_PAGE_SIZE: usize> RefUnwindSafe for MoonbootManager<InternalMemory, HardwareState, CPU, INTERNAL_PAGE_SIZE>
where InternalMemory: RefUnwindSafe, HardwareState: RefUnwindSafe, CPU: RefUnwindSafe,

§

impl<InternalMemory, HardwareState, CPU, const INTERNAL_PAGE_SIZE: usize> Send for MoonbootManager<InternalMemory, HardwareState, CPU, INTERNAL_PAGE_SIZE>
where InternalMemory: Send, HardwareState: Send, CPU: Send,

§

impl<InternalMemory, HardwareState, CPU, const INTERNAL_PAGE_SIZE: usize> Sync for MoonbootManager<InternalMemory, HardwareState, CPU, INTERNAL_PAGE_SIZE>
where InternalMemory: Sync, HardwareState: Sync, CPU: Sync,

§

impl<InternalMemory, HardwareState, CPU, const INTERNAL_PAGE_SIZE: usize> Unpin for MoonbootManager<InternalMemory, HardwareState, CPU, INTERNAL_PAGE_SIZE>
where InternalMemory: Unpin, HardwareState: Unpin, CPU: Unpin,

§

impl<InternalMemory, HardwareState, CPU, const INTERNAL_PAGE_SIZE: usize> UnwindSafe for MoonbootManager<InternalMemory, HardwareState, CPU, INTERNAL_PAGE_SIZE>
where InternalMemory: UnwindSafe, HardwareState: UnwindSafe, CPU: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.