Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new chip detect magic value, ability to read chip revision for ESP32-P4 #686

Merged
merged 2 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Add new chip detect magic value, ability to read chip revision for ESP32-P4 (#686)

### Fixed
- Fixed `partition-table-offset` argument to accept offsets in hexadecimal (#682)

Expand Down
14 changes: 6 additions & 8 deletions espflash/src/targets/esp32p4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::{
targets::{Chip, Esp32Params, ReadEFuse, SpiRegisters, Target, XtalFrequency},
};

const CHIP_DETECT_MAGIC_VALUES: &[u32] = &[0x0];
const CHIP_DETECT_MAGIC_VALUES: &[u32] = &[0x0, 0x0ADDBAD0];

const FLASH_RANGES: &[Range<u32>] = &[
0x4000_0000..0x4C00_0000, // IROM
Expand All @@ -20,7 +20,7 @@ const FLASH_RANGES: &[Range<u32>] = &[
const PARAMS: Esp32Params = Esp32Params::new(
0x2000,
0x1_0000,
0x3f_0000, // TODO: Update
0x3f_0000,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why I had added this originally, seems to work fine for now so just removed the comment.

18,
FlashFrequency::_40Mhz,
include_bytes!("../../resources/bootloaders/esp32p4-bootloader.bin"),
Expand Down Expand Up @@ -52,15 +52,13 @@ impl Target for Esp32p4 {
}

#[cfg(feature = "serialport")]
fn major_chip_version(&self, _connection: &mut Connection) -> Result<u32, Error> {
// TODO: https://github.com/espressif/esptool/blob/master/esptool/targets/esp32p4.py#L96
Ok(0)
fn major_chip_version(&self, connection: &mut Connection) -> Result<u32, Error> {
Ok(self.read_efuse(connection, 19)? >> 4 & 0x03)
}

#[cfg(feature = "serialport")]
fn minor_chip_version(&self, _connection: &mut Connection) -> Result<u32, Error> {
// TODO: https://github.com/espressif/esptool/blob/master/esptool/targets/esp32p4.py#L92
Ok(0)
fn minor_chip_version(&self, connection: &mut Connection) -> Result<u32, Error> {
Ok(self.read_efuse(connection, 19)? & 0x0F)
}

#[cfg(feature = "serialport")]
Expand Down
Loading