embassy-stm32

Crates

git

Versions

stm32n655x0

Flavors

Skip to main content

EcBinary

Struct EcBinary 

Source
pub struct EcBinary<'a> { /* private fields */ }
Expand description

A parsed, read-only view of an Epoch Controller binary container.

Implementations§

Source§

impl<'a> EcBinary<'a>

Source

pub fn new(binary: &'a [u64]) -> Result<Self, EcError>

Parse an EC binary stored as u64 words (the layout ST Edge AI generates in <network>_ecblobs.h).

Source

pub fn from_words(words: &'a [u32]) -> Result<Self, EcError>

Parse an EC binary from raw u32 words.

Source

pub fn blob_len(&self) -> Result<usize, EcError>

Size of the blob in u64 words, including its magic/length header — i.e. the minimum length of the buffer passed to Self::load_blob.

Source

pub fn load_blob(&self, dest: &mut [u64]) -> Result<usize, EcError>

Copy the blob (magic + length + instructions) into dest, returning the number of u64 words used. dest may then be relocated/patched and handed to Npu::run_epoch_blob.

Source

pub fn num_relocs(&self) -> usize

Number of relocations described by this binary.

Source

pub fn reloc_id(&self, idx: usize) -> Option<&'a str>

Identifier of relocation idx (e.g. "_user_io_input_0").

Source

pub fn reloc( &self, blob: &mut [u64], idx: usize, base: u32, prev_base: &mut u32, ) -> Result<(), EcError>

Apply relocation idx to a loaded blob: adds base - *prev_base to every blob word listed in the relocation, then stores base in prev_base. Call with *prev_base == 0 the first time; subsequent calls with an unchanged base are no-ops, matching ST’s ec_reloc.

Source

pub fn reloc_by_id( &self, blob: &mut [u64], id: &str, base: u32, prev_base: &mut u32, ) -> Result<(), EcError>

Apply the relocation with identifier id. See Self::reloc.

Source

pub fn num_patches(&self) -> usize

Number of patches described by this binary.

Source

pub fn patch_id(&self, idx: usize) -> Option<&'a str>

Identifier of patch idx.

Source

pub fn patch( &self, blob: &mut [u64], idx: usize, value: u64, ) -> Result<(), EcError>

Apply patch idx to a loaded blob: replaces the masked bit-field of every listed blob word with value (shifted/masked as encoded in the patch table).

Source

pub fn patch_by_id( &self, blob: &mut [u64], id: &str, value: u64, ) -> Result<(), EcError>

Apply the patch with identifier id. See Self::patch.

Trait Implementations§

Source§

impl<'a> Clone for EcBinary<'a>

Source§

fn clone(&self) -> EcBinary<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for EcBinary<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for EcBinary<'a>

§

impl<'a> RefUnwindSafe for EcBinary<'a>

§

impl<'a> Send for EcBinary<'a>

§

impl<'a> Sync for EcBinary<'a>

§

impl<'a> Unpin for EcBinary<'a>

§

impl<'a> UnsafeUnpin for EcBinary<'a>

§

impl<'a> UnwindSafe for EcBinary<'a>

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, I> Binding<I, NoHandler<I>> for T
where T: Copy, I: Interrupt,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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.