Struct probe_rs::flashing::FlashLoader
source · [−]pub struct FlashLoader { /* private fields */ }
Expand description
FlashLoader
is a struct which manages the flashing of any chunks of data onto any sections of flash.
Use add_data() to add a chunk of data.
Once you are done adding all your data, use commit()
to flash the data.
The flash loader will make sure to select the appropriate flash region for the right data chunks.
Region crossing data chunks are allowed as long as the regions are contiguous.
Implementations
sourceimpl FlashLoader
impl FlashLoader
sourcepub fn new(
memory_map: Vec<MemoryRegion>,
source: TargetDescriptionSource
) -> Self
pub fn new(
memory_map: Vec<MemoryRegion>,
source: TargetDescriptionSource
) -> Self
Create a new flash loader.
sourcepub fn add_data(&mut self, address: u64, data: &[u8]) -> Result<(), FlashError>
pub fn add_data(&mut self, address: u64, data: &[u8]) -> Result<(), FlashError>
Stages a chunk of data to be programmed.
The chunk can cross flash boundaries as long as one flash region connects to another flash region.
sourcepub fn load_bin_data<T: Read + Seek>(
&mut self,
file: &mut T,
options: BinOptions
) -> Result<(), FileDownloadError>
pub fn load_bin_data<T: Read + Seek>(
&mut self,
file: &mut T,
options: BinOptions
) -> Result<(), FileDownloadError>
Reads the data from the binary file and adds it to the loader without splitting it into flash instructions yet.
sourcepub fn load_hex_data<T: Read + Seek>(
&mut self,
file: &mut T
) -> Result<(), FileDownloadError>
pub fn load_hex_data<T: Read + Seek>(
&mut self,
file: &mut T
) -> Result<(), FileDownloadError>
Reads the HEX data segments and adds them as loadable data blocks to the loader. This does not create and flash loader instructions yet.
sourcepub fn load_elf_data<T: Read>(
&mut self,
file: &mut T
) -> Result<(), FileDownloadError>
pub fn load_elf_data<T: Read>(
&mut self,
file: &mut T
) -> Result<(), FileDownloadError>
Prepares the data sections that have to be loaded into flash from an ELF file. This will validate the ELF file and transform all its data into sections but no flash loader commands yet.
sourcepub fn commit(
&self,
session: &mut Session,
options: DownloadOptions<'_>
) -> Result<(), FlashError>
pub fn commit(
&self,
session: &mut Session,
options: DownloadOptions<'_>
) -> Result<(), FlashError>
Writes all the stored data chunks to flash.
Requires a session with an attached target that has a known flash algorithm.
If do_chip_erase
is true
the entire flash will be erased.
Auto Trait Implementations
impl RefUnwindSafe for FlashLoader
impl Send for FlashLoader
impl Sync for FlashLoader
impl Unpin for FlashLoader
impl UnwindSafe for FlashLoader
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more