Skip to content

Add esp32h4 support - #1063

Merged
playfulFence merged 4 commits into
esp-rs:mainfrom
playfulFence:chip/h4
Aug 18, 2026
Merged

Add esp32h4 support#1063
playfulFence merged 4 commits into
esp-rs:mainfrom
playfulFence:chip/h4

Conversation

@playfulFence

Copy link
Copy Markdown
Member

No description provided.

@playfulFence
playfulFence marked this pull request as ready for review August 14, 2026 11:50
Comment thread espflash/src/target/mod.rs Outdated
Chip::Esp32c6 => [0x2CE0_806F].contains(&value),
Chip::Esp32c61 => [0x7211_606f].contains(&value),
Chip::Esp32h2 => [0xD7B7_3E80].contains(&value),
Chip::Esp32h4 => [0x0].contains(&value),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Both P4 and H4 have 0 magic number, since they rely on security info. Since H4 is matched first, fallback detection can misidentify P4 as H4 when security_info() fails. Not sure if we should cover this case

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'd honestly just write "return" on both of them. 0 is not the real magic number IIRC, it's just that it doesn't exist and things are preferably done via security info 🤷🏼

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Agreed, esptool treats H4 and P4 as not using magic values. We should just return false for them so a failed security_info() produces an error.

@playfulFence

Copy link
Copy Markdown
Member Author

HIL tests are failing independently from this PR, the changes here do not touch anything failure-related for any other chip (PR that intents to resolve this)

Comment on lines +74 to +75
- CONFIG_ESPTOOLPY_FLASHSIZE_64MB=y
- CONFIG_ESPTOOLPY_FLASHSIZE="64MB"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Per datasheet and TRM this should be 32MB

@playfulFence playfulFence Aug 17, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

that tool we have is wrong, both esptool and espflash detect 8MBs of flash size on the chip which corresponds to 64KB MMU page size
image

I'd leave everything as is here, what I'm doing here looks the most correct.

@playfulFence
playfulFence merged commit feb3cc7 into esp-rs:main Aug 18, 2026
87 of 93 checks passed
@playfulFence playfulFence mentioned this pull request Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants