pub struct FlashAlgorithm {Show 19 fields
pub name: String,
pub default: bool,
pub load_address: u64,
pub instructions: Vec<u32>,
pub pc_init: Option<u64>,
pub pc_uninit: Option<u64>,
pub pc_program_page: u64,
pub pc_erase_sector: u64,
pub pc_erase_all: Option<u64>,
pub pc_verify: Option<u64>,
pub pc_read: Option<u64>,
pub static_base: u64,
pub stack_top: u64,
pub stack_size: u64,
pub stack_overflow_check: bool,
pub page_buffers: Vec<u64>,
pub rtt_control_block: Option<u64>,
pub flash_properties: FlashProperties,
pub transfer_encoding: TransferEncoding,
}
Expand description
A flash algorithm, which has been assembled for a specific chip.
To create a FlashAlgorithm, call the assemble_from_raw
function.
Fields§
§name: String
The name of the flash algorithm.
default: bool
Whether this flash algorithm is the default one or not.
load_address: u64
Memory address where the flash algo instructions will be loaded to.
instructions: Vec<u32>
List of 32-bit words containing the position-independent code for the algo.
pc_init: Option<u64>
Address of the Init()
entry point. Optional.
pc_uninit: Option<u64>
Address of the UnInit()
entry point. Optional.
pc_program_page: u64
Address of the ProgramPage()
entry point.
pc_erase_sector: u64
Address of the EraseSector()
entry point.
pc_erase_all: Option<u64>
Address of the EraseAll()
entry point. Optional.
pc_verify: Option<u64>
Address of the Verify()
entry point. Optional.
pc_read: Option<u64>
Address of the (non-standard) ReadFlash()
entry point. Optional.
static_base: u64
Initial value of the R9 register for calling flash algo entry points, which determines where the position-independent data resides.
stack_top: u64
Initial value of the stack pointer when calling any flash algo API.
stack_size: u64
The size of the stack in bytes.
stack_overflow_check: bool
Whether to check for stack overflows.
page_buffers: Vec<u64>
A list of base addresses for page buffers. The buffers must be at
least as large as the region’s page_size
attribute. If at least 2 buffers are included in
the list, then double buffered programming will be enabled.
rtt_control_block: Option<u64>
Location of optional RTT control block.
If this is present, the flash algorithm supports debug output over RTT.
flash_properties: FlashProperties
The properties of the flash on the device.
transfer_encoding: TransferEncoding
The encoding format accepted by the flash algorithm.
Implementations§
Source§impl FlashAlgorithm
impl FlashAlgorithm
Sourcepub fn sector_info(&self, address: u64) -> Option<SectorInfo>
pub fn sector_info(&self, address: u64) -> Option<SectorInfo>
Try to retrieve the information about the flash sector
which contains address
.
If the address
is not part of the flash, None will
be returned.
Sourcepub fn page_info(&self, address: u64) -> Option<PageInfo>
pub fn page_info(&self, address: u64) -> Option<PageInfo>
Returns the necessary information about the page which address
resides in
if the address is inside the flash region.
Sourcepub fn iter_sectors(&self) -> impl Iterator<Item = SectorInfo> + '_
pub fn iter_sectors(&self) -> impl Iterator<Item = SectorInfo> + '_
Iterate over all the sectors of the flash.
Sourcepub fn iter_pages(&self) -> impl Iterator<Item = PageInfo> + '_
pub fn iter_pages(&self) -> impl Iterator<Item = PageInfo> + '_
Iterate over all the pages of the flash.
Sourcepub fn is_erased(&self, data: &[u8]) -> bool
pub fn is_erased(&self, data: &[u8]) -> bool
Returns true if the entire contents of the argument array equal the erased byte value.
Sourcepub fn get_max_algorithm_header_size() -> u64
pub fn get_max_algorithm_header_size() -> u64
When the target architecture is not known, and we need to allocate space for the header, this function returns the maximum size of the header of supported architectures.
Sourcepub fn assemble_from_raw(
raw: &RawFlashAlgorithm,
ram_region: &RamRegion,
target: &Target,
) -> Result<Self, FlashError>
pub fn assemble_from_raw( raw: &RawFlashAlgorithm, ram_region: &RamRegion, target: &Target, ) -> Result<Self, FlashError>
Constructs a complete flash algorithm, tailored to the flash and RAM sizes given.
Sourcepub fn assemble_from_raw_with_data(
raw: &RawFlashAlgorithm,
ram_region: &RamRegion,
data_ram_region: &RamRegion,
target: &Target,
) -> Result<Self, FlashError>
pub fn assemble_from_raw_with_data( raw: &RawFlashAlgorithm, ram_region: &RamRegion, data_ram_region: &RamRegion, target: &Target, ) -> Result<Self, FlashError>
Constructs a complete flash algorithm, tailored to the flash and RAM sizes given.
Trait Implementations§
Source§impl Clone for FlashAlgorithm
impl Clone for FlashAlgorithm
Source§fn clone(&self) -> FlashAlgorithm
fn clone(&self) -> FlashAlgorithm
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for FlashAlgorithm
impl Debug for FlashAlgorithm
Source§impl Default for FlashAlgorithm
impl Default for FlashAlgorithm
Source§fn default() -> FlashAlgorithm
fn default() -> FlashAlgorithm
Auto Trait Implementations§
impl Freeze for FlashAlgorithm
impl RefUnwindSafe for FlashAlgorithm
impl Send for FlashAlgorithm
impl Sync for FlashAlgorithm
impl Unpin for FlashAlgorithm
impl UnwindSafe for FlashAlgorithm
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.