Expand description
How a firmware file is laid out in flash.
ESP toolchains produce two shapes of .bin. An application image is just
the app; the runner writes it at flash.app and starts it directly. A
merged image is what esptool.py merge_bin and micropython.org publish:
the second-stage bootloader at offset 0, the partition table at 0x8000 and
the app at 0x10000, all in one file. Writing that at flash.app corrupts
it — the bootloader bytes land in the app region — so the runner has to
tell them apart before it loads anything.
The test is structural rather than name-based: a file with the bootloader
magic at byte 0 and the partition-table magic at 0x8000 is merged, as is a
file longer than the app offset with an ESP image header at 0x10000. A bare
application image has the header at byte 0 and nothing at 0x8000. ESP-IDF’s
separate bootloader.bin and partition-table.bin are not firmware;
they are named by [sim] bootloader and [sim] partition_table.
Enums§
Constants§
- APP_
OFFSET - BOOTLOADER_
OFFSET - Where the pieces of a merged image sit, from the ESP-IDF layout.
- PARTITION_
TABLE_ OFFSET - PARTITION_
TABLE_ OFFSET_ CLASSIC - The classic ESP32’s bootloader lives at 0x1000, so a factory image for it is the same merged layout shifted by that base: the file starts at flash 0x1000 and its partition table sits at file offset 0x7000.
Functions§
- detect
- Classify a firmware file.