feat: expose MAC, chip revision, and chip features via eFuse reads - #57
Merged
Merged
Conversation
Add Flasher.MAC()/ChipRevision()/ChipFeatures(), reading the factory-programmed base MAC, silicon revision, and feature list straight from eFuse registers, mirroring esptool's read_mac()/ get_major_chip_version()/get_minor_chip_version()/get_chip_features() per chip. - add ReadMAC/ReadChipRevision/ReadChipFeatures func-pointer fields to chipDef, with thin nil-checking dispatchers on Flasher - implement per-chip decoders for ESP32 (classic, lookup-table major revision), S2, S3 (including the ECO0 block-version workaround), C2, C3, C5, C6, H2, and P4-rev1; ESP8266 leaves all three nil - ReadRegister has no isStub() gate, so these work pre- and post-stub (no_reset/SkipStub included) - table-driven host tests per chip covering every decoder branch, plus dispatcher nil-chip/unsupported-chip cases
Member
|
Thank you very much for the awesome addition @jgangemi now merging! |
jgangemi
added a commit
to dangernoodle-io/pogopin
that referenced
this pull request
Jul 29, 2026
v0.8.0 adds MAC/chip-revision/chip-features readers (upstream tinygo-org/espflasher#57) plus flash-write reliability fixes. Note: it caps classic-ESP32 UART flash baud at 230400 (FIFO-overflow fix), so flashing an ESP32 over a UART bridge downshifts from pogopin's 460800 default to 230400 — slower but more reliable. Other chip families are unaffected. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds three methods to
Flasherfor reading chip identity from eFuse:MAC() (net.HardwareAddr, error)— factory-programmed base MACChipRevision() (ChipRevision, error)— silicon revision (Major/Minor,String()→"vX.Y")ChipFeatures() ([]string, error)— human-readable feature list (Wi-Fi/BT, core count, clock, embedded flash/PSRAM, coding scheme, …)Dispatch is via three optional func-pointer fields on
chipDef(ReadMAC/ReadChipRevision/ReadChipFeatures), matching the existingPostConnect/HardResetOTGpattern; per-chip decoders and register constants live in eachtarget_esp32*.go. Chips without a decoder returnUnsupportedCommandError.Supported: ESP32, ESP32-S2, ESP32-S3, ESP32-C2, ESP32-C3, ESP32-C5, ESP32-C6, ESP32-H2, ESP32-P4. ESP8266 is left unsupported (its OTP layout is a different scheme).
Why
These read plain eFuse registers via
READ_REG(0x0A), which — unlikeGET_SECURITY_INFO— is implemented by both the ROM loader and the stub. So they work whether or not the stub is loaded (includingSkipStub/ no-reset flows). All decode logic mirrors esptool's per-chipread_mac(),get_major_chip_version()/get_minor_chip_version(), andget_chip_features().Testing
MAC,ChipRevision(v3.1), andChipFeaturesall matchesptool chip-idoutput exactly. The remaining chip families are esptool-source-verified and host-tested; on-silicon validation for those is still pending.