Skip to content

Commit 845e386

Browse files
authored
Fix read efuse (#969)
* Fix and deprecate `read_efuse`, add `read_efuse_le` * Fix efuse definition gen, regen efuse data * Don't use deprecated API ourselves * Un-annoy * Remove unused casts * Changelog entries * CHANGELOG.md * address review comments * Fix rebase * fix
1 parent b01bb71 commit 845e386

File tree

13 files changed

+192
-66
lines changed

13 files changed

+192
-66
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
## [Unreleased]
99

1010
### Added
11+
- `read_efuse_le` should be preferred over `read_efuse` (#969)
1112

1213
- A new CLI argument `rom-elf` was added which will be used for backtraces (#963)
1314

1415
### Changed
16+
- `read_efuse` is deprecated (#969)
1517

1618
### Fixed
1719

1820
- Corrected eFuse BLOCK0 definitions for ESP32-C2, ESP32-C3, and ESP32-S3 (#961)
1921
- Fixed Secure Download Mode detection on ESP32-P4 (#972)
22+
- Several fixes in `read_efuse` (#969)
2023

2124
### Removed
2225

espflash/src/error.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ pub enum Error {
319319
#[error("Invalid `address`({address}) and/or `size`({size}) argument(s)")]
320320
#[diagnostic(
321321
code(espflash::erase_region::invalid_argument),
322-
help("`address` and `size` must be multiples of 0x1000 (4096)")
322+
help("`address` ({address}) and `size` ({size}) must be multiples of 0x1000 (4096)")
323323
)]
324324
InvalidEraseRegionArgument {
325325
/// Address argument
@@ -332,7 +332,9 @@ pub enum Error {
332332
#[error("The firmware was built for {elf}, but the detected chip is {detected}")]
333333
#[diagnostic(
334334
code(espflash::chip_mismatch),
335-
help("Ensure that the device is connected and your host recognizes the serial adapter")
335+
help(
336+
"Ensure that the device is connected and your host recognizes the serial adapter. (File {elf}, detected chip is {detected})"
337+
)
336338
)]
337339
FirmwareChipMismatch {
338340
/// Chip which the ELF file was built for
@@ -357,6 +359,10 @@ pub enum Error {
357359
/// Key is not in the expected section
358360
#[error("Misplaced key, check your configuration file. Key: {0}")]
359361
MisplacedKey(String),
362+
363+
/// The efuse field is larger than 32 bit.
364+
#[error("Requested efuse field is larger than 32 bit. Use `read_efuse_le`.")]
365+
EfuseFieldTooLarge,
360366
}
361367

362368
#[cfg(feature = "serialport")]

espflash/src/target/efuse/esp32.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//!
33
//! This file was automatically generated, please do not edit it manually!
44
//!
5-
//! Generated: 2025-06-25 11:06
5+
//! Generated: 2025-11-19 12:31
66
//! Version: 369d2d860d34e777c0f7d545a7dfc3c4
77
88
#![allow(unused)]

espflash/src/target/efuse/esp32c2.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
//!
33
//! This file was automatically generated, please do not edit it manually!
44
//!
5-
//! Generated: 2025-06-26 09:47
5+
//! Generated: 2025-11-19 12:31
66
//! Version: 897499b0349a608b895d467abbcf006b
77
88
#![allow(unused)]
99

1010
use super::EfuseField;
1111

1212
/// Total size in bytes of each block
13-
pub(crate) const BLOCK_SIZES: &[u32] = &[8, 11, 32, 32];
13+
pub(crate) const BLOCK_SIZES: &[u32] = &[8, 12, 32, 32];
1414

1515
/// Disable programming of individual eFuses
1616
pub const WR_DIS: EfuseField = EfuseField::new(0, 0, 0, 8);

espflash/src/target/efuse/esp32c3.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
//!
33
//! This file was automatically generated, please do not edit it manually!
44
//!
5-
//! Generated: 2025-06-26 09:47
5+
//! Generated: 2025-11-19 12:31
66
//! Version: 4622cf9245401eca0eb1df8122449a6d
77
88
#![allow(unused)]
99

1010
use super::EfuseField;
1111

1212
/// Total size in bytes of each block
13-
pub(crate) const BLOCK_SIZES: &[u32] = &[23, 24, 32, 32, 32, 32, 32, 32, 32, 32, 32];
13+
pub(crate) const BLOCK_SIZES: &[u32] = &[24, 24, 32, 32, 32, 32, 32, 32, 32, 32, 32];
1414

1515
/// Disable programming of individual eFuses
1616
pub const WR_DIS: EfuseField = EfuseField::new(0, 0, 0, 32);

espflash/src/target/efuse/esp32c5.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//!
33
//! This file was automatically generated, please do not edit it manually!
44
//!
5-
//! Generated: 2025-06-26 09:47
5+
//! Generated: 2025-11-19 12:31
66
//! Version: 31c7fe3f5f4e0a55b178a57126c0aca7
77
88
#![allow(unused)]

espflash/src/target/efuse/esp32c6.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//!
33
//! This file was automatically generated, please do not edit it manually!
44
//!
5-
//! Generated: 2025-06-25 11:06
5+
//! Generated: 2025-11-19 12:31
66
//! Version: df46b69f0ed3913114ba53d3a0b2b843
77
88
#![allow(unused)]

espflash/src/target/efuse/esp32h2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//!
33
//! This file was automatically generated, please do not edit it manually!
44
//!
5-
//! Generated: 2025-06-25 11:06
5+
//! Generated: 2025-11-19 12:31
66
//! Version: 44563d2af4ebdba4db6c0a34a50c94f9
77
88
#![allow(unused)]

espflash/src/target/efuse/esp32p4.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//!
33
//! This file was automatically generated, please do not edit it manually!
44
//!
5-
//! Generated: 2025-06-25 11:06
5+
//! Generated: 2025-11-19 12:31
66
//! Version: f7765f0ac3faf4b54f8c1f064307522c
77
88
#![allow(unused)]

espflash/src/target/efuse/esp32s2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//!
33
//! This file was automatically generated, please do not edit it manually!
44
//!
5-
//! Generated: 2025-06-26 09:47
5+
//! Generated: 2025-11-19 12:31
66
//! Version: 888a61f6f500d9c7ee0aa32016b0bee7
77
88
#![allow(unused)]

0 commit comments

Comments
 (0)