@@ -56,6 +56,7 @@ pub enum CommandType {
5656 EraseFlash = 0xD0 ,
5757 EraseRegion = 0xD1 ,
5858 ReadFlash = 0xD2 ,
59+ ReadFlashSlow = 0x0E , // ROM only, much slower than the stub read_flash
5960 RunUserCode = 0xD3 ,
6061 // Flash encryption debug mode supported command
6162 FlashEncryptedData = 0xD4 ,
@@ -189,6 +190,12 @@ pub enum Command<'a> {
189190 block_size : u32 ,
190191 max_in_flight : u32 ,
191192 } ,
193+ ReadFlashSlow {
194+ offset : u32 ,
195+ size : u32 ,
196+ block_size : u32 ,
197+ max_in_flight : u32 ,
198+ } ,
192199 RunUserCode ,
193200 FlashDetect ,
194201 GetSecurityInfo ,
@@ -218,6 +225,7 @@ impl Command<'_> {
218225 Command :: EraseFlash { .. } => CommandType :: EraseFlash ,
219226 Command :: EraseRegion { .. } => CommandType :: EraseRegion ,
220227 Command :: ReadFlash { .. } => CommandType :: ReadFlash ,
228+ Command :: ReadFlashSlow { .. } => CommandType :: ReadFlashSlow ,
221229 Command :: RunUserCode { .. } => CommandType :: RunUserCode ,
222230 Command :: FlashDetect => CommandType :: FlashDetect ,
223231 Command :: GetSecurityInfo => CommandType :: GetSecurityInfo ,
@@ -417,6 +425,22 @@ impl Command<'_> {
417425 writer. write_all ( & block_size. to_le_bytes ( ) ) ?;
418426 writer. write_all ( & ( max_in_flight. to_le_bytes ( ) ) ) ?;
419427 }
428+ Command :: ReadFlashSlow {
429+ offset,
430+ size,
431+ block_size,
432+ max_in_flight,
433+ } => {
434+ // length
435+ writer. write_all ( & ( 16u16 . to_le_bytes ( ) ) ) ?;
436+ // checksum
437+ writer. write_all ( & ( 0u32 . to_le_bytes ( ) ) ) ?;
438+ // data
439+ writer. write_all ( & offset. to_le_bytes ( ) ) ?;
440+ writer. write_all ( & size. to_le_bytes ( ) ) ?;
441+ writer. write_all ( & block_size. to_le_bytes ( ) ) ?;
442+ writer. write_all ( & ( max_in_flight. to_le_bytes ( ) ) ) ?;
443+ }
420444 Command :: RunUserCode => {
421445 write_basic ( writer, & [ ] , 0 ) ?;
422446 }
0 commit comments