File tree Expand file tree Collapse file tree 4 files changed +10
-2
lines changed Expand file tree Collapse file tree 4 files changed +10
-2
lines changed Original file line number Diff line number Diff line change 11[alias ]
22xtask = " run --package xtask --"
3+ xrun = " run --package espflash --"
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1616### Fixed
1717
1818- Corrected eFuse BLOCK0 definitions for ESP32-C2, ESP32-C3, and ESP32-S3 (#961 )
19+ - Fixed Secure Download Mode detection on ESP32-P4 (#972 )
1920
2021### Removed
2122
Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ impl SecurityInfo {
8787 ] )
8888 }
8989
90- fn security_flag_status ( & self , flag_name : & str ) -> bool {
90+ pub ( crate ) fn security_flag_status ( & self , flag_name : & str ) -> bool {
9191 if let Some ( & flag) = Self :: security_flag_map ( ) . get ( flag_name) {
9292 ( self . flags & flag) != 0
9393 } else {
Original file line number Diff line number Diff line change @@ -1253,7 +1253,13 @@ impl Flasher {
12531253
12541254#[ cfg( feature = "serialport" ) ]
12551255fn detect_sdm ( connection : & mut Connection ) {
1256- if connection. read_reg ( CHIP_DETECT_MAGIC_REG_ADDR ) . is_err ( ) {
1256+ if let Ok ( security_info) = connection. security_info ( false ) {
1257+ // Newer chips tell us if SDM is enabled.
1258+ connection. secure_download_mode =
1259+ security_info. security_flag_status ( "SECURE_DOWNLOAD_ENABLE" ) ;
1260+ } else if connection. read_reg ( CHIP_DETECT_MAGIC_REG_ADDR ) . is_err ( ) {
1261+ // On older chips, we have to guess by reading something. On these chips, there
1262+ // is always something readable at 0x40001000.
12571263 log:: warn!( "Secure Download Mode is enabled on this chip" ) ;
12581264 connection. secure_download_mode = true ;
12591265 }
You can’t perform that action at this time.
0 commit comments