Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Write a board manifest

A board manifest tells nanoflash how to reach a board and what to write to it. Every key is in Board manifest.

Write one board

# boards/esp32-s3.toml
[[board]]
identifier = "esp32-s3-devkitc"
name = "ESP32-S3-DevKitC"
protocol = "espressif"
chip = "esp32-s3"
layout = "../layouts/esp32-s3-8mb.toml"
reset = "espressif-usb-serial-jtag"
application-devices = [{ vendor = 0x303a, product = 0x1001 }]

[[board.image]]
partition = "bootloader"
path = "../build/bootloader.bin"

[[board.image]]
partition = "application"
path = "../build/application.bin"
  1. Set protocol and chip. Supported boards lists the values.
  2. Name the layout. Paths are relative to the manifest.
  3. List the USB identities of the board in application-devices, and in bootloader-devices when the bootloader has another identity. nanoflash then finds the port by itself.
  4. Add one [[board.image]] per image. Give the partition of the layout, or an offset.
  5. Do not add an image for the partition table: nanoflash generates it from the layout.

Pin the images

Add the SHA-256 digest of an image to refuse any other file:

[[board.image]]
partition = "bootloader"
path = "../build/bootloader.bin"
sha256 = "d67c656e01756650d77717b0839985a056ec28ffe174601d690fc407a2ceffca"

Do not pin an image that changes at every build.

Erase a data partition before writing

[[board.erase]]
partition = "nvs"

See Erase the flash.

An Arduino board with a 1200-baud touch

The Nano 33 BLE, the SAMD21 boards and the Leonardo restart into their bootloader after a 1200-baud touch. The bootloader has another USB identity. List both:

[[board]]
identifier = "arduino-nano-33-ble"
name = "Arduino Nano 33 BLE"
protocol = "samba"
chip = "nrf52840"
layout = "layout.toml"
reset = "touch-1200"
application-devices = [{ vendor = 0x2341, product = 0x805a }]
bootloader-devices = [{ vendor = 0x2341, product = 0x005a }]

[[board.image]]
partition = "application"
path = "firmware/hello.ino.bin"

A firmware with its own USB identity, for example the pid.codes identity 0x1209:0x0001, adds it to application-devices next to the identity of the Arduino sketch.

An AVR board takes the .hex file of the Arduino IDE as its image. protocol is stk500v1 (Uno, Nano, Pro Mini), stk500v2 (Mega 2560) or avr109 (Leonardo, Micro, Pro Micro).

Several boards in one manifest

List several [[board]] tables, with different identifiers. They may use different protocols. nanoflash picks the board from the USB identity of the port and the detected chip. --board-identifier picks one by hand.

Use the manifest in the browser

The browser reads JSON. Write the same keys in JSON, with board as an array:

{
  "board": [
    {
      "identifier": "esp32-s3-devkitc-1",
      "protocol": "espressif",
      "chip": "esp32-s3",
      "layout": "layout.toml",
      "reset": "espressif-usb-serial-jtag",
      "application-devices": [{ "vendor": "0x303a", "product": "0x1001" }],
      "image": [
        { "partition": "bootloader", "path": "firmware/bootloader.bin" },
        { "partition": "application", "path": "firmware/hello_world.bin" }
      ]
    }
  ]
}

An existing esp-web-tools manifest also works, with no change.