@@ -5,7 +5,7 @@ use strum_macros::Display;
5
5
use std:: thread:: sleep;
6
6
7
7
use crate :: elf:: RomSegment ;
8
- use crate :: error:: { ConnectionError , ResultExt } ;
8
+ use crate :: error:: { ConnectionError , ElfError , ResultExt } ;
9
9
use crate :: {
10
10
chip:: Chip , connection:: Connection , elf:: FirmwareImage , encoder:: SlipEncoder , error:: RomError ,
11
11
Error , PartitionTable ,
@@ -469,7 +469,7 @@ impl Flasher {
469
469
///
470
470
/// Note that this will not touch the flash on the device
471
471
pub fn load_elf_to_ram ( & mut self , elf_data : & [ u8 ] ) -> Result < ( ) , Error > {
472
- let image = FirmwareImage :: from_data ( elf_data) . map_err ( |_| Error :: InvalidElf ) ?;
472
+ let image = FirmwareImage :: from_data ( elf_data) . map_err ( ElfError :: from ) ?;
473
473
474
474
let mut target = self . chip . ram_target ( ) ;
475
475
target. begin ( & mut self . connection , & image) . flashing ( ) ?;
@@ -500,7 +500,7 @@ impl Flasher {
500
500
bootloader : Option < Vec < u8 > > ,
501
501
partition_table : Option < PartitionTable > ,
502
502
) -> Result < ( ) , Error > {
503
- let mut image = FirmwareImage :: from_data ( elf_data) . map_err ( |_| Error :: InvalidElf ) ?;
503
+ let mut image = FirmwareImage :: from_data ( elf_data) . map_err ( ElfError :: from ) ?;
504
504
image. flash_size = self . flash_size ( ) ;
505
505
506
506
let mut target = self . chip . flash_target ( self . spi_params ) ;
0 commit comments