@@ -208,29 +208,31 @@ pub struct ReadFlashArgs {
208208 pub max_in_flight : u32 ,
209209}
210210
211- /// Save the image to disk instead of flashing to device
211+ /// Save the image to disk instead of flashing to device.
212212#[ derive( Debug , Args ) ]
213213#[ non_exhaustive]
214214#[ group( skip) ]
215215pub struct SaveImageArgs {
216- /// Chip to create an image for
216+ /// Chip to create an image for.
217217 #[ arg( long, value_enum) ]
218218 pub chip : Chip ,
219- /// File name to save the generated image to
219+ /// File name to save the generated image to.
220220 pub file : PathBuf ,
221- /// Boolean flag to merge binaries into single binary
221+ /// Boolean flag to merge binaries into single binary.
222222 #[ arg( long) ]
223223 pub merge : bool ,
224- /// Don't pad the image to the flash size
224+ /// Don't pad the image to the flash size.
225225 #[ arg( long, requires = "merge" ) ]
226226 pub skip_padding : bool ,
227- /// Cristal frequency of the target
227+ /// Crystal frequency of the target.
228228 #[ arg( long, short = 'x' ) ]
229229 pub xtal_freq : Option < XtalFrequency > ,
230230 #[ clap( flatten) ]
231+ /// Image arguments.
231232 pub image : ImageArgs ,
232233}
233234
235+ /// Image arguments needed for image generation.
234236#[ derive( Debug , Args ) ]
235237#[ non_exhaustive]
236238#[ group( skip) ]
@@ -258,6 +260,7 @@ pub struct ImageArgs {
258260 pub check_app_descriptor : Option < bool > ,
259261}
260262
263+ /// Arguments for connection and monitoring
261264#[ derive( Debug , Args ) ]
262265#[ non_exhaustive]
263266pub struct MonitorArgs {
@@ -300,6 +303,7 @@ pub struct MonitorConfigArgs {
300303 processors : Option < String > ,
301304}
302305
306+ /// Arguments for MD5 checksum calculation
303307#[ derive( Debug , Args ) ]
304308#[ non_exhaustive]
305309pub struct ChecksumMd5Args {
@@ -757,6 +761,7 @@ impl ProgressCallbacks for EspflashProgress {
757761 }
758762}
759763
764+ /// Erase the entire flash memory of a target device
760765pub fn erase_flash ( args : EraseFlashArgs , config : & Config ) -> Result < ( ) > {
761766 if args. connect_args . no_stub {
762767 return Err ( Error :: StubRequired . into ( ) ) ;
@@ -777,6 +782,7 @@ pub fn erase_flash(args: EraseFlashArgs, config: &Config) -> Result<()> {
777782 Ok ( ( ) )
778783}
779784
785+ /// Erase a specified region of flash memory
780786pub fn erase_region ( args : EraseRegionArgs , config : & Config ) -> Result < ( ) > {
781787 if args. connect_args . no_stub {
782788 return Err ( Error :: StubRequired ) . into_diagnostic ( ) ;
@@ -1016,6 +1022,7 @@ fn pretty_print(table: PartitionTable) {
10161022 println ! ( "{pretty}" ) ;
10171023}
10181024
1025+ /// Creates `FlashData` from `ImageArgs`, `FlashConfigArgs`, and `Config`.
10191026pub fn make_flash_data (
10201027 image_args : ImageArgs ,
10211028 flash_config_args : & FlashConfigArgs ,
0 commit comments