Skip to content

Add from-partitions to draw ESP-IDF partition tables - #10

Merged
iharhl merged 1 commit into
mainfrom
feature/esp-idf-partitions
Nov 14, 2026
Merged

iharhl merged 1 commit into
mainfrom
feature/esp-idf-partitions

Conversation

@iharhl

@iharhl iharhl commented Nov 14, 2026

Copy link
Copy Markdown
Owner

Summary

memmap from-partitions TABLE writes a config from an ESP-IDF partition table, then checks it like memmap check. TABLE is the project's CSV or the partition-table.bin the build writes.

  • Placement follows ESP-IDF's gen_esp32part.py. A blank offset follows the previous partition, aligned to 64K for apps and 4K otherwise, starting after the partition table. Negative sizes, bootloader/partition_table entries, flags and custom types are handled.
  • One flash column:
    • a Reserved block below the bootloader on chips whose bootloader doesn't start at 0;
    • the bootloader and the partition table;
    • each partition, with its type and subtype as a note;
    • Free blocks for the gaps.
  • Settings: --sdkconfig gives the flash size and the partition table and bootloader offsets. --flash-size, --table-offset and --bootloader-offset stand in without one. The config's header comments say where each value came from.
  • Errors: a table that can't be drawn stops the import with a hint, naming the CSV line: overlaps, a partition past the end of the flash, size 0, or a binary table that disagrees with the sdkconfig.
  • New W113: a CSV that breaks a rule of ESP-IDF's own table check: alignment, a small read-write NVS, the otadata size, duplicate names or an unknown subtype.
  • Other changes: quote, item_lines and usage_title in memmap/from_elf/writer.py are now public, so the new writer can reuse them.

Testing

  • Ground truth: 121 ESP-IDF builds on GitHub that committed their sdkconfig and the partition-table.bin the build wrote. memmap placed the CSV exactly as the binary in 117. Two differed only because older ESP-IDF read a blank subtype as 0. The other two had a binary built from a different table (stale builds).
  • Corpus: all 196 tables in ESP-IDF, Arduino-ESP32 and MicroPython, and 314 community CSVs, ran through the importer. Every failure was checked by hand: files that aren't ESP-IDF tables, tables with real overlaps, or 32 MB tables tried on a 16 MB flash.
  • Committed fixtures: 5 of those builds (CSV, trimmed sdkconfig and .bin) and 5 tables, each covering a case the others don't. Every fixture has a golden config, and two have golden SVGs.
  • Review: reviewed by a second model. Its findings are fixed and covered by tests.
  • uv run pytest (747 passed), uv run mypy and uv run ruff check are clean.

Docs: docs/from-partitions.md (new), README and AGENTS.md (the new task section and W113).

🤖 Generated with Claude Code

`memmap from-partitions TABLE` writes a config from an ESP-IDF partition
table, the CSV or the partition-table.bin the build writes, then checks it.
It places partitions as ESP-IDF's gen_esp32part.py does, and draws one flash
column with the bootloader, the partition table, each partition and the free
space. --sdkconfig gives the flash size and the partition table and bootloader
offsets; --flash-size, --table-offset and --bootloader-offset stand in for it.

A CSV that breaks a rule of ESP-IDF's table check gets the new W113.

Tests run on five real ESP-IDF builds, whose partition-table.bin is the ground
truth for placing their CSV, and five tables from ESP-IDF, Arduino-ESP32 and
MicroPython. docs/from-partitions.md describes the command and its limits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@iharhl
iharhl merged commit 91e250c into main Nov 14, 2026
3 checks passed
@iharhl
iharhl deleted the feature/esp-idf-partitions branch November 14, 2026 10:42
@iharhl iharhl mentioned this pull request Nov 14, 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.

1 participant