File tree Expand file tree Collapse file tree 3 files changed +19
-0
lines changed Expand file tree Collapse file tree 3 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -158,9 +158,17 @@ fn flash(args: FlashArgs, config: &Config) -> Result<()> {
158
158
let cargo_config = CargoConfig :: load ( & metadata. workspace_root , & metadata. package_root ) ;
159
159
160
160
let mut flasher = connect ( & args. connect_args , config) ?;
161
+
162
+ // If the user has provided a flash size via a command-line argument, we'll
163
+ // override the detected (or default) value with this.
164
+ if let Some ( flash_size) = args. build_args . flash_config_args . flash_size {
165
+ flasher. set_flash_size ( flash_size) ;
166
+ }
167
+
161
168
let chip = flasher. chip ( ) ;
162
169
let target = chip. into_target ( ) ;
163
170
let target_xtal_freq = target. crystal_freq ( flasher. connection ( ) ) ?;
171
+
164
172
flasher. disable_watchdog ( ) ?;
165
173
166
174
let build_ctx =
Original file line number Diff line number Diff line change @@ -119,6 +119,13 @@ fn main() -> Result<()> {
119
119
120
120
fn flash ( args : FlashArgs , config : & Config ) -> Result < ( ) > {
121
121
let mut flasher = connect ( & args. connect_args , config) ?;
122
+
123
+ // If the user has provided a flash size via a command-line argument, we'll
124
+ // override the detected (or default) value with this.
125
+ if let Some ( flash_size) = args. flash_config_args . flash_size {
126
+ flasher. set_flash_size ( flash_size) ;
127
+ }
128
+
122
129
print_board_info ( & mut flasher) ?;
123
130
124
131
let chip = flasher. chip ( ) ;
Original file line number Diff line number Diff line change @@ -401,6 +401,10 @@ impl Flasher {
401
401
Ok ( flasher)
402
402
}
403
403
404
+ pub fn set_flash_size ( & mut self , flash_size : FlashSize ) {
405
+ self . flash_size = flash_size;
406
+ }
407
+
404
408
pub fn disable_watchdog ( & mut self ) -> Result < ( ) , Error > {
405
409
let mut target = self . chip . flash_target ( self . spi_params , self . use_stub ) ;
406
410
target. begin ( & mut self . connection ) . flashing ( ) ?;
You can’t perform that action at this time.
0 commit comments