@@ -10,7 +10,7 @@ use espflash::{
10
10
Error as EspflashError ,
11
11
cli:: {
12
12
self ,
13
- config:: { Config , PortConfig } ,
13
+ config:: Config ,
14
14
monitor:: { check_monitor_args, monitor} ,
15
15
* ,
16
16
} ,
@@ -231,27 +231,24 @@ fn main() -> Result<()> {
231
231
// Load any user configuration, if present.
232
232
let config = Config :: load ( ) ?;
233
233
234
- // Load any user ports configuration, if present.
235
- let ports_config = PortConfig :: load ( ) ?;
236
-
237
234
// Execute the correct action based on the provided subcommand and its
238
235
// associated arguments.
239
236
match args {
240
- Commands :: BoardInfo ( args) => board_info ( & args, & config, & ports_config ) ,
241
- Commands :: ChecksumMd5 ( args) => checksum_md5 ( & args, & config, & ports_config ) ,
237
+ Commands :: BoardInfo ( args) => board_info ( & args, & config) ,
238
+ Commands :: ChecksumMd5 ( args) => checksum_md5 ( & args, & config) ,
242
239
Commands :: Completions ( args) => completions ( & args, & mut Cli :: command ( ) , "cargo" ) ,
243
- Commands :: EraseFlash ( args) => erase_flash ( args, & config, & ports_config ) ,
244
- Commands :: EraseParts ( args) => erase_parts ( args, & config, & ports_config ) ,
245
- Commands :: EraseRegion ( args) => erase_region ( args, & config, & ports_config ) ,
246
- Commands :: Flash ( args) => flash ( args, & config, & ports_config ) ,
247
- Commands :: HoldInReset ( args) => hold_in_reset ( args, & config, & ports_config ) ,
248
- Commands :: ListPorts ( args) => list_ports ( & args, & ports_config ) ,
249
- Commands :: Monitor ( args) => serial_monitor ( args, & config, & ports_config ) ,
240
+ Commands :: EraseFlash ( args) => erase_flash ( args, & config) ,
241
+ Commands :: EraseParts ( args) => erase_parts ( args, & config) ,
242
+ Commands :: EraseRegion ( args) => erase_region ( args, & config) ,
243
+ Commands :: Flash ( args) => flash ( args, & config) ,
244
+ Commands :: HoldInReset ( args) => hold_in_reset ( args, & config) ,
245
+ Commands :: ListPorts ( args) => list_ports ( & args, & config . port_config ) ,
246
+ Commands :: Monitor ( args) => serial_monitor ( args, & config) ,
250
247
Commands :: PartitionTable ( args) => partition_table ( args) ,
251
- Commands :: ReadFlash ( args) => read_flash ( args, & config, & ports_config ) ,
252
- Commands :: Reset ( args) => reset ( args, & config, & ports_config ) ,
248
+ Commands :: ReadFlash ( args) => read_flash ( args, & config) ,
249
+ Commands :: Reset ( args) => reset ( args, & config) ,
253
250
Commands :: SaveImage ( args) => save_image ( args, & config) ,
254
- Commands :: WriteBin ( args) => write_bin ( args, & config, & ports_config ) ,
251
+ Commands :: WriteBin ( args) => write_bin ( args, & config) ,
255
252
}
256
253
}
257
254
@@ -270,7 +267,7 @@ pub fn erase_parts(args: ErasePartsArgs, config: &Config) -> Result<()> {
270
267
let partition_table = args
271
268
. partition_table
272
269
. as_deref ( )
273
- . or ( config. partition_table . as_deref ( ) ) ;
270
+ . or ( config. project_config . partition_table . as_deref ( ) ) ;
274
271
275
272
let mut flasher = connect ( & args. connect_args , config, false , false ) ?;
276
273
let chip = flasher. chip ( ) ;
@@ -296,7 +293,6 @@ fn flash(args: FlashArgs, config: &Config) -> Result<()> {
296
293
let mut flasher = connect (
297
294
& args. connect_args ,
298
295
config,
299
- ports_config,
300
296
args. flash_args . no_verify ,
301
297
args. flash_args . no_skip ,
302
298
) ?;
@@ -306,7 +302,7 @@ fn flash(args: FlashArgs, config: &Config) -> Result<()> {
306
302
// we'll override the detected (or default) value with this.
307
303
if let Some ( flash_size) = args. build_args . flash_config_args . flash_size {
308
304
flasher. set_flash_size ( flash_size) ;
309
- } else if let Some ( flash_size) = config. flash . size {
305
+ } else if let Some ( flash_size) = config. project_config . flash . size {
310
306
flasher. set_flash_size ( flash_size) ;
311
307
}
312
308
@@ -333,7 +329,7 @@ fn flash(args: FlashArgs, config: &Config) -> Result<()> {
333
329
let mut flash_config = args. build_args . flash_config_args ;
334
330
flash_config. flash_size = flash_config
335
331
. flash_size // Use CLI argument if provided
336
- . or ( config. flash . size ) // If no CLI argument, try the config file
332
+ . or ( config. project_config . flash . size ) // If no CLI argument, try the config file
337
333
. or_else ( || flasher. flash_detect ( ) . ok ( ) . flatten ( ) ) // Try detecting flash size next
338
334
. or_else ( || Some ( FlashSize :: default ( ) ) ) ; // Otherwise, use a reasonable default value
339
335
@@ -580,7 +576,7 @@ fn save_image(args: SaveImageArgs, config: &Config) -> Result<()> {
580
576
let mut flash_config = args. build_args . flash_config_args ;
581
577
flash_config. flash_size = flash_config
582
578
. flash_size // Use CLI argument if provided
583
- . or ( config. flash . size ) // If no CLI argument, try the config file
579
+ . or ( config. project_config . flash . size ) // If no CLI argument, try the config file
584
580
. or_else ( || Some ( FlashSize :: default ( ) ) ) ; // Otherwise, use a reasonable default value
585
581
586
582
let flash_data = make_flash_data (
0 commit comments