fn build_flashloader(target: &Target, path: &Path) -> Result<FlashLoader, CargoFlashError> {
    // Create the flash loader
    let mut loader = FlashLoader::new(target.memory_map.to_vec(), target.source().clone());

    // Add data from the ELF.
    let mut file = File::open(&path).map_err(|error| CargoFlashError::FailedToOpenElf {
        source: error,
        path: format!("{}", path.display()),
    })?;

    // Try and load the ELF data.
    loader
        .load_elf_data(&mut file)
        .map_err(CargoFlashError::FailedToLoadElfData)?;

    Ok(loader)
}
/// Builds a new flash loader for the given target and ELF.
/// This will check the ELF for validity and check what pages have to be flashed etc.
Builds a new flash loader for the given target and ELF.
This will check the ELF for validity and check what pages have to be flashed etc.
Builds a new flash loader for the given target and ELF . This will check the ELF for validity and check what pages have to be flashed etc .
fn build_flashloader(target: &Target, path: &Path) -> Result<FlashLoader, CargoFlashError> {
    // Create the flash loader
    let mut loader = FlashLoader::new(target.memory_map.to_vec(), target.source().clone());
    // Add data from the ELF.
    let mut file = File::open(&path).map_err(|error| CargoFlashError::FailedToOpenElf {
        source: error,
        path: format!("{}", path.display()),
    })?;
    // Try and load the ELF data.
    loader
        .load_elf_data(&mut file)
        .map_err(CargoFlashError::FailedToLoadElfData)?;
    Ok(loader)
}
fn build_flashloader ( target : & Target , path : & Path ) -> Result < FlashLoader , CargoFlashError > { // Create the flash loader let mut loader = FlashLoader :: new ( target . memory_map . to_vec ( ) , target . source ( ) . clone ( ) ) ; // Add data from the ELF. let mut file = File :: open ( & path ) . map_err ( | error | CargoFlashError :: FailedToOpenElf { source : error , path : format ! ( " " path display ( ) ) , } ) ? ; // Try and load the ELF data. loader . load_elf_data ( & mut file ) . map_err ( CargoFlashError :: FailedToLoadElfData ) ? ; Ok ( loader ) }
Builds a new flash loader for the given target and ELF.
Builds a new flash loader for the given target and ELF .
target
&Target
path
&Path