@@ -38,7 +38,7 @@ const FLASH_SECTORS_PER_BLOCK: usize = FLASH_SECTOR_SIZE / FLASH_BLOCK_SIZE;
38
38
/// Supported flash frequencies
39
39
///
40
40
/// Note that not all frequencies are supported by each target device.
41
- #[ derive( Debug , Clone , Copy , Hash , PartialEq , Eq , Display , EnumVariantNames ) ]
41
+ #[ derive( Debug , Default , Clone , Copy , Hash , PartialEq , Eq , Display , EnumVariantNames ) ]
42
42
#[ repr( u8 ) ]
43
43
pub enum FlashFrequency {
44
44
/// 12 MHz
@@ -63,6 +63,7 @@ pub enum FlashFrequency {
63
63
#[ strum( serialize = "30M" ) ]
64
64
Flash30M ,
65
65
/// 40 MHz
66
+ #[ default]
66
67
#[ strum( serialize = "40M" ) ]
67
68
Flash40M ,
68
69
/// 48 MHz
@@ -100,14 +101,15 @@ impl FromStr for FlashFrequency {
100
101
}
101
102
102
103
/// Supported flash modes
103
- #[ derive( Copy , Clone , Debug , EnumVariantNames ) ]
104
+ #[ derive( Copy , Clone , Debug , Default , EnumVariantNames ) ]
104
105
#[ strum( serialize_all = "lowercase" ) ]
105
106
pub enum FlashMode {
106
107
/// Quad I/O (4 pins used for address & data)
107
108
Qio ,
108
109
/// Quad Output (4 pins used for data)
109
110
Qout ,
110
111
/// Dual I/O (2 pins used for address & data)
112
+ #[ default]
111
113
Dio ,
112
114
/// Dual Output (2 pins used for data)
113
115
Dout ,
@@ -132,7 +134,7 @@ impl FromStr for FlashMode {
132
134
/// Supported flash sizes
133
135
///
134
136
/// Note that not all sizes are supported by each target device.
135
- #[ derive( Clone , Copy , Debug , Eq , PartialEq , Display , EnumVariantNames ) ]
137
+ #[ derive( Clone , Copy , Debug , Default , Eq , PartialEq , Display , EnumVariantNames ) ]
136
138
#[ repr( u8 ) ]
137
139
pub enum FlashSize {
138
140
/// 256 KB
@@ -148,6 +150,7 @@ pub enum FlashSize {
148
150
#[ strum( serialize = "2M" ) ]
149
151
Flash2Mb = 0x15 ,
150
152
/// 4 MB
153
+ #[ default]
151
154
#[ strum( serialize = "4M" ) ]
152
155
Flash4Mb = 0x16 ,
153
156
/// 8 MB
@@ -472,7 +475,7 @@ impl Flasher {
472
475
Ok ( size) => size,
473
476
Err ( _) => {
474
477
warn ! (
475
- "Could not detect flash size (FlashID=0x{:02X}, SizeID=0x{:02X}), defaulting to 4MB\n " ,
478
+ "Could not detect flash size (FlashID=0x{:02X}, SizeID=0x{:02X}), defaulting to 4MB" ,
476
479
flash_id,
477
480
size_id
478
481
) ;
@@ -678,7 +681,7 @@ impl Flasher {
678
681
let mut target = self . chip . flash_target ( self . spi_params , self . use_stub ) ;
679
682
target. begin ( & mut self . connection ) . flashing ( ) ?;
680
683
681
- let flash_image = self . chip . into_target ( ) . get_flash_image (
684
+ let image = self . chip . into_target ( ) . get_flash_image (
682
685
& image,
683
686
bootloader,
684
687
partition_table,
@@ -691,7 +694,10 @@ impl Flasher {
691
694
flash_freq,
692
695
) ?;
693
696
694
- for segment in flash_image. flash_segments ( ) {
697
+ #[ cfg( feature = "cli" ) ]
698
+ crate :: cli:: display_image_size ( image. app_size ( ) , image. part_size ( ) ) ;
699
+
700
+ for segment in image. flash_segments ( ) {
695
701
target
696
702
. write_segment ( & mut self . connection , segment)
697
703
. flashing ( ) ?;
0 commit comments