@@ -49,12 +49,18 @@ pub struct ConnectArgs {
4949 /// Baud rate at which to communicate with target device
5050 #[ arg( short = 'b' , long, env = "ESPFLASH_BAUD" ) ]
5151 pub baud : Option < u32 > ,
52+ /// Target device
53+ #[ arg( short = 'c' , long) ]
54+ pub chip : Option < Chip > ,
55+ /// Require confirmation before auto-connecting to a recognized device.
56+ #[ arg( short = 'C' , long) ]
57+ pub confirm_port : bool ,
58+ /// Do not use the RAM stub for loading
59+ #[ arg( long) ]
60+ pub no_stub : bool ,
5261 /// Serial port connected to target device
5362 #[ arg( short = 'p' , long, env = "ESPFLASH_PORT" ) ]
5463 pub port : Option < String > ,
55- /// Require confirmation before auto-connecting to a recognized device.
56- #[ arg( short = 'c' , long) ]
57- pub confirm_port : bool ,
5864 /// DTR pin to use for the internal UART hardware. Uses BCM numbering.
5965 #[ cfg( feature = "raspberry" ) ]
6066 #[ cfg_attr( feature = "raspberry" , clap( long) ) ]
@@ -63,9 +69,6 @@ pub struct ConnectArgs {
6369 #[ cfg( feature = "raspberry" ) ]
6470 #[ cfg_attr( feature = "raspberry" , clap( long) ) ]
6571 pub rts : Option < u8 > ,
66- /// Do not use the RAM stub for loading
67- #[ arg( long) ]
68- pub no_stub : bool ,
6972}
7073
7174/// Generate completions for the given shell
@@ -89,11 +92,9 @@ pub struct EraseRegionArgs {
8992 /// Connection configuration
9093 #[ clap( flatten) ]
9194 pub connect_args : ConnectArgs ,
92-
9395 /// Offset to start erasing from
9496 #[ arg( value_name = "OFFSET" , value_parser = parse_uint32) ]
9597 pub addr : u32 ,
96-
9798 /// Size of the region to erase
9899 #[ arg( value_name = "SIZE" , value_parser = parse_uint32) ]
99100 pub size : u32 ,
@@ -129,6 +130,9 @@ pub struct FlashArgs {
129130 /// Image format to flash
130131 #[ arg( long, value_enum) ]
131132 pub format : Option < ImageFormatKind > ,
133+ /// Logging format.
134+ #[ arg( long, short = 'L' , default_value = "serial" , requires = "monitor" ) ]
135+ pub log_format : LogFormat ,
132136 /// Open a serial monitor after flashing
133137 #[ arg( short = 'M' , long) ]
134138 pub monitor : bool ,
@@ -144,9 +148,6 @@ pub struct FlashArgs {
144148 /// Load the application to RAM instead of Flash
145149 #[ arg( long) ]
146150 pub ram : bool ,
147- /// Logging format.
148- #[ arg( long, short = 'L' , default_value = "serial" , requires = "monitor" ) ]
149- pub log_format : LogFormat ,
150151}
151152
152153/// Operations for partitions tables
@@ -195,12 +196,12 @@ pub struct SaveImageArgs {
195196/// Open the serial monitor without flashing
196197#[ derive( Debug , Args ) ]
197198pub struct MonitorArgs {
198- /// Optional file name of the ELF image to load the symbols from
199- #[ arg( short = 'e' , long, value_name = "FILE" ) ]
200- elf : Option < PathBuf > ,
201199 /// Connection configuration
202200 #[ clap( flatten) ]
203201 connect_args : ConnectArgs ,
202+ /// Optional file name of the ELF image to load the symbols from
203+ #[ arg( short = 'e' , long, value_name = "FILE" ) ]
204+ elf : Option < PathBuf > ,
204205 /// Logging format.
205206 #[ arg( long, short = 'L' , default_value = "serial" ) ]
206207 pub log_format : LogFormat ,
@@ -247,6 +248,7 @@ pub fn connect(args: &ConnectArgs, config: &Config) -> Result<Flasher> {
247248 port_info,
248249 args. baud ,
249250 !args. no_stub ,
251+ args. chip ,
250252 ) ?)
251253}
252254
0 commit comments