pub struct MemorySection { /* private fields */ }

Implementations§

source§

impl MemorySection

source

pub fn new(name: &str, origin: u64, length: u64) -> MemorySection

source

pub fn offset(self, offset: u64) -> MemorySection

source

pub fn pagesize(self, pagesize: u64) -> MemorySection

source

pub fn slot(self, slot: usize, num_slots: usize) -> MemorySection

Divide memory section into slots.

This can be used to divide a memory section into multiple slots of equal size, e.g., for an active / passive image scheme on MCUs.

slot starts at zero for the first slot.

source

pub fn from_env(self) -> MemorySection

Read options from environment

This will evaluate the following environment variables:

VariableDefault
LDMEMORY_OFFSET0
LDMEMORY_PAGESIZE1
LDMEMORY_NUM_SLOTS2
LDMEMORY_SLOT_OFFSET0
LDMEMORY_SLOTNone

If an offset is given, the whole section will be offset and shortened by the given value. If a pagesize is given, the slots will start and end will be aligned at the pagesize. If a slot number is given, the remaining section will be divided into <prefix>_NUM_SLOTS slots, aligned to <prefix>_PAGESIZE, and the <prefix>_SLOTth (starting at 0) will be returned. If a slot offset is given, each slot will be offset and shortened by that value.

Note: from_env_with_prefix can be used to use a different prefix than the default prefix LDMEMORY_.

source

pub fn from_env_with_prefix(self, prefix: &str) -> MemorySection

Read slot options from environment with custom prefix

See from_env().

source

pub fn attrs(self, attrs: &str) -> MemorySection

source

pub fn to_string(&self) -> String

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.