Board manifest
A board manifest lists the boards of a project, how to reset them and what to write to them. It is
TOML or JSON with the same keys. The command tells them apart by their content. The browser reads
JSON only: convert a TOML manifest to JSON with the same keys, with board as an array. Unknown
keys are refused.
# boards/esp32-s3.toml
[[board]]
identifier = "esp32-s3-devkitc" # selected with --board-identifier
name = "ESP32-S3-DevKitC"
protocol = "espressif"
chip = "esp32-s3"
layout = "../layouts/esp32-s3-8mb.toml" # paths are relative to the manifest
reset = "espressif-usb-serial-jtag"
application-devices = [{ vendor = 0x303a, product = 0x1001 }]
[[board.image]]
partition = "bootloader" # or offset = 0x0
path = "../build/bootloader.bin"
sha256 = "d67c656e01756650d77717b0839985a056ec28ffe174601d690fc407a2ceffca" # optional
[[board.image]]
partition = "application"
path = "../build/application.bin"
[[board.erase]] # optional: erased before writing
partition = "nvs"
Top level
| Key | Required | Value |
|---|---|---|
board | yes | The boards, at least one. Each identifier is unique. |
prompt-erase | no | true makes the web component offer a checkbox to erase the whole flash. Default false. |
[[board]]
| Key | Required | Value |
|---|---|---|
identifier | yes | The board, as --board-identifier, boardIdentifier and board-identifier of the Cargo metadata name it. |
name | no | A name for people. |
protocol | yes | espressif, samba, stk500v1 (alias arduino), stk500v2 (alias wiring) or avr109. The aliases are the names of Arduino’s boards.txt. |
chip | yes | The chip. See Supported boards. |
layout | no | The layout file, relative to the manifest, or a URL in the browser. Without a layout, images are placed by offset only. |
reset | no | The reset sequence. See Reset sequences. |
application-devices | no | The USB identities of the board when it runs its application. |
bootloader-devices | no | The USB identities of the board in its bootloader, when they differ. |
image | no | The images to write. |
erase | no | The regions to erase before writing. |
A board needs at least one image or one erase entry to flash (nothing-to-flash). A manifest for
nanoflash run may list no image: the runner supplies it.
Device filters
application-devices and bootloader-devices are lists of tables:
| Key | Required | Value |
|---|---|---|
vendor | yes | The USB vendor identifier, such as 0x2341. |
product | no | The USB product identifier. Without it, any product of the vendor matches. |
serial-number | no | The USB serial number. Without it, any device matches. The browser package ignores it: Web Serial does not give the serial number. |
The USB identity of the selected port picks the board among the boards of the manifest. The application and bootloader identities also let nanoflash find the board again after a reset that changes its USB identity (a 1200-baud touch). See How nanoflash works.
[[board.image]]
| Key | Required | Value |
|---|---|---|
partition | one of the two | The partition of the layout that the image goes to. |
offset | one of the two | The flash offset that the image goes to. |
path | yes | The image file, relative to the manifest, or a URL in the browser. The command refuses URLs: download the file next to the manifest. |
sha256 | no | The SHA-256 digest of the file, 64 hexadecimal digits. A file with another digest is refused. |
Image formats:
- Binary, written as it is.
- Intel HEX (
.hex,.ihex, by extension), as Arduino, PlatformIO andobjcopywrite it. It is decoded for every protocol, after the SHA-256 check and the verifier, which see the file as read. The image is the span from the lowest to the highest address,0xFFin the gaps. Its lowest address is an address of the memory map: it must equal the offset of the image plus thebase-addressof the flash of the layout (misplaced-intel-hex)..eepfiles (EEPROM) are refused. - ELF, found by its content (the magic
7f 45 4c 46) whatever its name. It is decoded after the SHA-256 check, the verifier and the.eeprefusal. The check for ELF content comes before the check for the.hexextension. A file named.elfthat is not an ELF file is refused. Reading ELF files needs theelffeature of the library: without it, an ELF image is refused (elf-not-enabled). The command has it. The WebAssembly modules of the browser package do not.- For every protocol but Espressif, the image is the
PT_LOADsegments that have file data, at their physical address (p_paddr, where.datais stored in the flash), from the lowest to the highest byte with0xFFin the gaps, as for an Intel HEX image. The bytes that a segment has only in memory (.bss) are not written. The segments must not overlap and must lie in the flash window: from thebase-addressof the layout for the size of its flash, or without a layout, from 0 for the address limit of the protocol, spanning at most 32 MiB. The lowest address must equal the offset of the image plus thebase-address(misplaced-elf). The segments of an AVR file from0x800000(the data, EEPROM, fuse and lock spaces of avr-gcc) are not written and are named in anelf-segments-not-writtenwarning. This applies to the three AVR protocols and to any file whose machine is AVR. - On the Espressif protocol, the bootloader boots application images, not flat segments. The ELF
file is checked, then the image source builds its application image through
ImageSource::application_image. The default refuses (application-image). The file may go only to afirmwareorupdatepartition, or by offset to a board without layout, or to an offset that starts such a partition (elf-not-an-application). It goes at a multiple of0x10000and not below0x10000(misaligned-application-image). The check runs again after the layout is resolved for the chip. The image is placed by its partition, not by its addresses: it follows adetectlayout like a binary image. - The
nanoflashcommand builds the Espressif application image withespflash4.7. It writes a partition table with onefactoryapplication partition, at the offset and with the size of the partition of the layout, to a temporary file in the temporary directory of the system (TMPDIRon Unix,TMPorTEMPon Windows), and removes the file afterward. A panic ofespflashon a malformed ELF file becomes an error. The library, the browser package and other programs that use the library refuse, because they provide noapplication_image.
- For every protocol but Espressif, the image is the
The partition table is generated from the layout and written with the images, unless an image replaces it.
[[board.erase]]
An erase entry names a partition, or an offset and a size (at least one byte), not both.
[[board.erase]]
partition = "nvs"
[[board.erase]]
offset = 0x9000
size = "24 KiB"
Reset sequences
| Value | Sequence |
|---|---|
espressif-classic | DTR and RTS through a UART bridge, as on most ESP32 boards. |
espressif-usb-serial-jtag | The USB-Serial-JTAG peripheral of the ESP32-S3, ESP32-C3 and later chips. |
touch-1200 | Open the port at 1200 baud and clear DTR: the sketch restarts into its bootloader, which appears as another USB device. SAM-BA and AVR109 boards. |
uf2-touch-1200 | The same touch, for UF2 bootloaders, which no backend supports yet. |
none | No reset: the board is already in its bootloader. |
{ custom = [...] } | A list of steps, each { dtr = true, rts = false, wait = "100 ms" }. wait is a number of milliseconds or text such as "100 ms" or "2 s", at most 10 s. |
Without reset, the backend chooses the usual sequence of its protocol: touch-1200 on SAM-BA and
AVR109,
and on Espressif espressif-usb-serial-jtag for the USB identity 303a:1001, else
espressif-classic. The STK500 boards (Uno, Nano, Pro Mini,
Mega 2560) are reset by a pulse on DTR. A sequence that does not apply to the protocol is refused
(unsupported-reset).
Several boards in one manifest
A manifest may list several boards, of one protocol or of several. flash picks the one whose
chip matches what the backend detects (as esp-web-tools does with chipFamily), or the one that
--board-identifier names. A port that suits no board fails with no-matching-board, and one that
suits boards of several protocols fails with several-protocols.
esp-web-tools manifests
An esp-web-tools manifest (JSON with
builds[].chipFamily) is detected and converted on load:
- protocol
espressif, chip fromchipFamily, one board per build; - images from
parts, at their offsets, withpathrelative to the manifest or a URL; - no layout (offsets only);
- the reset from
serialType(cdcoruart) or from the detected port; new_install_prompt_erasemaps to the erase option of the web component (prompt-erase).
Only the fields that affect flashing are honoured. Improv Wi-Fi provisioning and
home_assistant_domain are ignored. ESP8266 builds are refused with a clear error: the ESP8266
is not supported. The fields of the format are listed in Prior art and
licences.