@@ -5,7 +5,7 @@ use strum_macros::Display;
55use std:: thread:: sleep;
66
77use crate :: elf:: RomSegment ;
8- use crate :: error:: { ConnectionError , ResultExt } ;
8+ use crate :: error:: { ConnectionError , ElfError , ResultExt } ;
99use crate :: {
1010 chip:: Chip , connection:: Connection , elf:: FirmwareImage , encoder:: SlipEncoder , error:: RomError ,
1111 Error , PartitionTable ,
@@ -469,7 +469,7 @@ impl Flasher {
469469 ///
470470 /// Note that this will not touch the flash on the device
471471 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 ) ?;
473473
474474 let mut target = self . chip . ram_target ( ) ;
475475 target. begin ( & mut self . connection , & image) . flashing ( ) ?;
@@ -500,7 +500,7 @@ impl Flasher {
500500 bootloader : Option < Vec < u8 > > ,
501501 partition_table : Option < PartitionTable > ,
502502 ) -> 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 ) ?;
504504 image. flash_size = self . flash_size ( ) ;
505505
506506 let mut target = self . chip . flash_target ( self . spi_params ) ;
0 commit comments