Document bin padding and pin the print_summary wiring

This commit is contained in:
J. Nick Koston
2026-08-27 23:59:10 -05:00
parent edf2f7c62a
commit 8ee2f4247e
2 changed files with 25 additions and 1 deletions
+4 -1
View File
@@ -11,7 +11,10 @@ byte-identical to PlatformIO's output:
The format matches ``script/ci_memory_impact_extract.py`` so CI memory
analysis works unchanged on native ESP-IDF builds. RAM usage comes from
the DRAM (or unified DIRAM) region of the linker map; Flash used is the
size of the app ``.bin`` on disk, and Flash total is taken from
size of the app ``.bin`` on disk, which includes esptool's 16-byte
image padding and appended SHA-256, so it reads slightly above the
map-derived ``Total image size`` line and moves in 16-byte steps.
Flash total is taken from
``partitions.csv`` using PlatformIO's rule (first app partition whose
subtype is ``factory`` or ``ota_0``; see
``platform-espressif32/builder/main.py::_update_max_upload_size``).
+21
View File
@@ -638,6 +638,27 @@ def test_run_compile_passes_compile_process_limit(setup_core: Path) -> None:
mock_run.assert_called_once_with("build", "size", jobs=1)
def test_run_compile_passes_size_summary_paths(setup_core: Path) -> None:
"""print_summary receives the size json, partitions.csv, and the firmware
bin from get_firmware_path, which must stay in lockstep with the
project() name in the generated CMakeLists."""
_setup_build(setup_core)
config = {CONF_ESPHOME: {}}
with (
patch.object(toolchain, "need_reconfigure", return_value=False),
patch.object(toolchain, "run_idf_py", return_value=0),
patch.object(toolchain, "print_summary") as mock_summary,
):
assert toolchain.run_compile(config, verbose=False) == 0
mock_summary.assert_called_once_with(
CORE.relative_build_path("build", "esp_idf_size.json"),
CORE.relative_build_path("partitions.csv"),
toolchain.get_firmware_path(),
)
def test_run_compile_without_compile_process_limit(setup_core: Path) -> None:
"""When no compile_process_limit is set, no job limit is passed to idf.py."""
_setup_build(setup_core)