Add esp_image: bootable ESP32 C3/C6/P4 images with Espressif's pinned ROM - #15
Merged
Merged
Conversation
…ressif's pinned mask ROM The ESP32 platforms boot the real mask ROM, so `sim --elf` needs one ELF carrying the ROM plus the whole flash image. That packing lived in three near-identical scripts in mcu-lib, which external users do not have, and each asked the user to find the ROM themselves. simantic.esp_image (and `simantic esp-image` / `simantic esp-rom`): - One layout table for C3 (with its DROM alias), C6 and P4. - ROMs download once from Espressif's own repositories, pinned by commit and SHA-256, cached in ~/.simantic/esp-rom: C3/C6 raw dumps from espressif/qemu pc-bios, the P4 ROM ELF from esp-rom-elfs 20241011. - The P4 ROM window is rebuilt from the ROM ELF in pure Python: code sections, the .data initialisers from the ROM copy table, and the interface table at the top of the window. No objcopy needed. - Flash images merge from OFFSET:PATH parts with 0xFF fill, or pass a merged image. - Refuses the known-bad C3 dump with a zeroed PHY jump table, debug ELFs where a raw dump is needed, and an objcopy-only P4 extract. Verified byte for byte: C3 rebuild of the CrossPoint featble payload, the mcu-lib-esp32p4 hello image, the old mcu-lib scripts for all three chips on identical inputs, and the P4 section layout against riscv32-esp-elf-objcopy. Co-Authored-By: Claude Opus 5 (1M context) <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.
Closes #14
What
simantic.esp_imageplus two CLI commands:simantic esp-image --chip esp32c3 \ --part 0x0:bootloader.bin --part 0x8000:partitions.bin --part 0x10000:firmware.bin \ --flash-size 16MB -o image.elf simantic esp-rom --chip esp32p4 # download ahead of time, print the cached path~/.simantic/esp-rom. C3 and C6 come from espressif/qemupc-biosat febae182. P4 comes from the esp-rom-elfs 20241011 release, with the tarball and member both hash-checked.--romoverrides for offline use.--rom-elfpatch step.esptool merge_bin.Verification
Byte-identical output against real artefacts, with ROMs fetched live from the pinned URLs:
image.elfriscv32-esp-elf-objcopy -O binarypytest tests/: 158 passed, 4 skipped (engine-only session tests). That includesSIMANTIC_NETWORK_TESTS=1downloads for all three chips and the P4 rebuild from a local ESP-IDF install. In CI both of those skip, and every other test is offline.Follow-up, not in this PR
Point mcu-lib's ESP READMEs and
scripts/esp32*_build_image.pyat this module.🤖 Generated with Claude Code