@@ -7,7 +7,12 @@ use std::{
7
7
use cargo_metadata:: { Message , MetadataCommand } ;
8
8
use clap:: { Args , CommandFactory , Parser , Subcommand } ;
9
9
use espflash:: {
10
- cli:: { self , config:: Config , monitor:: monitor, * } ,
10
+ cli:: {
11
+ self ,
12
+ config:: Config ,
13
+ monitor:: { check_monitor_args, monitor} ,
14
+ * ,
15
+ } ,
11
16
flasher:: FlashSize ,
12
17
logging:: initialize_logger,
13
18
targets:: { Chip , XtalFrequency } ,
@@ -313,6 +318,11 @@ fn flash(args: FlashArgs, config: &Config) -> Result<()> {
313
318
// Read the ELF data from the build path and load it to the target.
314
319
let elf_data = fs:: read ( build_ctx. artifact_path . clone ( ) ) . into_diagnostic ( ) ?;
315
320
321
+ let mut monitor_args = args. flash_args . monitor_args ;
322
+ monitor_args. elf = Some ( build_ctx. artifact_path . clone ( ) ) ;
323
+
324
+ check_monitor_args ( & args. flash_args . monitor , & monitor_args) ?;
325
+
316
326
print_board_info ( & mut flasher) ?;
317
327
ensure_chip_compatibility ( chip, Some ( elf_data. as_slice ( ) ) ) ?;
318
328
@@ -348,7 +358,6 @@ fn flash(args: FlashArgs, config: &Config) -> Result<()> {
348
358
349
359
if args. flash_args . monitor {
350
360
let pid = flasher. usb_pid ( ) ;
351
- let mut monitor_args = args. flash_args . monitor_args ;
352
361
353
362
// The 26MHz ESP32-C2's need to be treated as a special case.
354
363
if chip == Chip :: Esp32c2
0 commit comments