@@ -71,7 +71,7 @@ pub struct ConnectArgs {
7171 #[ arg( short = 'c' , long) ]
7272 pub chip : Option < Chip > ,
7373 /// Require confirmation before auto-connecting to a recognized device.
74- #[ arg( short = 'C' , long) ]
74+ #[ arg( long) ]
7575 pub confirm_port : bool ,
7676 /// List all available ports.
7777 #[ arg( long) ]
@@ -108,11 +108,15 @@ pub struct EraseRegionArgs {
108108 /// Connection configuration
109109 #[ clap( flatten) ]
110110 pub connect_args : ConnectArgs ,
111- /// Offset to start erasing from
112- #[ arg( value_name = "OFFSET" , value_parser = parse_u32) ]
113- pub addr : u32 ,
111+ /// Start address
112+ ///
113+ /// Must be multiple of 4096(0x1000)
114+ #[ arg( value_parser = parse_u32) ]
115+ pub address : u32 ,
114116 /// Size of the region to erase
115- #[ arg( value_name = "SIZE" , value_parser = parse_u32) ]
117+ ///
118+ /// Must be multiple of 4096(0x1000)
119+ #[ arg( value_parser = parse_u32) ]
116120 pub size : u32 ,
117121}
118122
@@ -183,9 +187,9 @@ pub struct PartitionTableArgs {
183187#[ derive( Debug , Args ) ]
184188#[ non_exhaustive]
185189pub struct ReadFlashArgs {
186- /// Offset to start reading from
187- #[ arg( value_name = "OFFSET" , value_parser = parse_u32) ]
188- pub addr : u32 ,
190+ /// Address to start reading from
191+ #[ arg( value_parser = parse_u32) ]
192+ pub address : u32 ,
189193 /// Size of each individual packet of data
190194 ///
191195 /// Defaults to 0x1000 (FLASH_SECTOR_SIZE)
@@ -195,10 +199,9 @@ pub struct ReadFlashArgs {
195199 #[ clap( flatten) ]
196200 connect_args : ConnectArgs ,
197201 /// Size of the region to read
198- #[ arg( value_name = "SIZE" , value_parser = parse_u32) ]
202+ #[ arg( value_parser = parse_u32) ]
199203 pub size : u32 ,
200- /// Name of binary dump
201- #[ arg( value_name = "FILE" ) ]
204+ /// File name to save the read data to
202205 pub file : PathBuf ,
203206 /// Maximum number of un-acked packets
204207 #[ arg( long, default_value = "64" , value_parser = parse_u32) ]
@@ -219,7 +222,7 @@ pub struct SaveImageArgs {
219222 #[ arg( long) ]
220223 pub merge : bool ,
221224 /// Don't pad the image to the flash size
222- #[ arg( long, short = 'P' , requires = "merge" ) ]
225+ #[ arg( long, requires = "merge" ) ]
223226 pub skip_padding : bool ,
224227 /// Cristal frequency of the target
225228 #[ arg( long, short = 'x' ) ]
@@ -236,7 +239,7 @@ pub struct ImageArgs {
236239 #[ arg( long, value_name = "FILE" ) ]
237240 pub bootloader : Option < PathBuf > ,
238241 /// Path to a CSV file containing partition table
239- #[ arg( long, short = 'T' , value_name = "FILE" ) ]
242+ #[ arg( long, value_name = "FILE" ) ]
240243 pub partition_table : Option < PathBuf > ,
241244 /// Partition table offset
242245 #[ arg( long, value_name = "OFFSET" , value_parser = parse_u32) ]
@@ -264,11 +267,11 @@ pub struct MonitorArgs {
264267#[ derive( Debug , Args ) ]
265268#[ non_exhaustive]
266269pub struct MonitorConfigArgs {
267- /// Baud rate at which to communicate with target device
270+ /// Baud rate at which to monitor the target device
268271 #[ arg( short = 'r' , long, env = "MONITOR_BAUD" , default_value = "115_200" , value_parser = parse_u32) ]
269- pub baud_rate : u32 ,
270- /// File name of the ELF image to load the symbols from
271- #[ arg( short = 'e' , long, value_name = "FILE" ) ]
272+ pub monitor_baud : u32 ,
273+ /// ELF image to load the symbols from
274+ #[ arg( long, value_name = "FILE" ) ]
272275 pub elf : Option < PathBuf > ,
273276 /// Avoids asking the user for interactions like resetting the device
274277 #[ arg( long) ]
@@ -277,7 +280,7 @@ pub struct MonitorConfigArgs {
277280 #[ arg( long, requires = "non_interactive" ) ]
278281 no_reset : bool ,
279282 /// Logging format.
280- #[ arg( long, short = 'L' , default_value = "serial" , requires = "elf" ) ]
283+ #[ arg( long, short = 'L' , default_value = "serial" ) ]
281284 log_format : LogFormat ,
282285 /// External log processors to use (comma separated executables)
283286 #[ arg( long) ]
@@ -288,11 +291,11 @@ pub struct MonitorConfigArgs {
288291#[ non_exhaustive]
289292pub struct ChecksumMd5Args {
290293 /// Start address
291- #[ clap( long , value_parser=parse_u32) ]
294+ #[ clap( value_parser=parse_u32) ]
292295 address : u32 ,
293- /// Length
294- #[ clap( short , long , value_parser=parse_u32) ]
295- length : u32 ,
296+ /// Size of the region to check
297+ #[ clap( value_parser=parse_u32) ]
298+ size : u32 ,
296299 /// Connection configuration
297300 #[ clap( flatten) ]
298301 connect_args : ConnectArgs ,
@@ -387,7 +390,7 @@ pub fn board_info(args: &ConnectArgs, config: &Config) -> Result<()> {
387390pub fn checksum_md5 ( args : & ChecksumMd5Args , config : & Config ) -> Result < ( ) > {
388391 let mut flasher = connect ( & args. connect_args , config, true , true ) ?;
389392
390- let checksum = flasher. checksum_md5 ( args. address , args. length ) ?;
393+ let checksum = flasher. checksum_md5 ( args. address , args. size ) ?;
391394 println ! ( "0x{:x}" , checksum) ;
392395
393396 Ok ( ( ) )
@@ -470,10 +473,10 @@ pub fn serial_monitor(args: MonitorArgs, config: &Config) -> Result<()> {
470473 // The 26MHz ESP32-C2's need to be treated as a special case.
471474 if chip == Chip :: Esp32c2
472475 && target. crystal_freq ( flasher. connection ( ) ) ? == XtalFrequency :: _26Mhz
473- && monitor_args. baud_rate == 115_200
476+ && monitor_args. monitor_baud == 115_200
474477 {
475478 // 115_200 * 26 MHz / 40 MHz = 74_880
476- monitor_args. baud_rate = 74_880 ;
479+ monitor_args. monitor_baud = 74_880 ;
477480 }
478481
479482 monitor ( flasher. into_serial ( ) , elf. as_deref ( ) , pid, monitor_args)
@@ -629,10 +632,10 @@ pub fn erase_region(args: EraseRegionArgs, config: &Config) -> Result<()> {
629632
630633 info ! (
631634 "Erasing region at 0x{:08x} ({} bytes)" ,
632- args. addr , args. size
635+ args. address , args. size
633636 ) ;
634637
635- flasher. erase_region ( args. addr , args. size ) ?;
638+ flasher. erase_region ( args. address , args. size ) ?;
636639 flasher
637640 . connection ( )
638641 . reset_after ( !args. connect_args . no_stub ) ?;
@@ -733,7 +736,7 @@ pub fn read_flash(args: ReadFlashArgs, config: &Config) -> Result<()> {
733736 let mut flasher = connect ( & args. connect_args , config, false , false ) ?;
734737 print_board_info ( & mut flasher) ?;
735738 flasher. read_flash (
736- args. addr ,
739+ args. address ,
737740 args. size ,
738741 args. block_size ,
739742 args. max_in_flight ,
0 commit comments