Skip to content

Firmware page: Install from a file - #30

Merged
bdbarnett merged 1 commit into
firmware-page-stagedfrom
firmware-install-from-file
Oct 22, 2026
Merged

bdbarnett merged 1 commit into
firmware-page-stagedfrom
firmware-install-from-file

Conversation

@bdbarnett

Copy link
Copy Markdown
Contributor

Adds an "Install from a file" section to the firmware page, so you can flash a .bin or .uf2 you built yourself. This goes into firmware-page-staged (#25), not main.

A .bin. You pick the file and the chip. If the file starts with an image header, the page reads the chip from it and selects it for you. The offset matches what the release manifests use: 0x2000 for a merged ESP32-P4 image, 0x0 for the ESP32-S3 and for any whole-flash image (the CircuitPython P4 build is one of those). The page builds an ESP Web Tools manifest in memory as a Blob URL, with one part that's a Blob URL of your file, and gives it to the vendored install button. Nothing is uploaded.

ESP Web Tools 10.4.0 handles this without changes. When the manifest path starts with blob: it resolves parts against the page, so a part whose path is an absolute blob: URL is fetched as-is. The vendored files are untouched.

The same rules as the release builds. Only the BROWSER_INSTALL chips get the Install button, and only in a browser with Web Serial. Everywhere else you get the esptool steps, written with your file's name and the right offset. A file built for a different chip than the one you chose is refused. So is an application image (micropython.bin), which would boot-loop if written at the bootloader offset.

A .uf2 gets the copy-to-the-drive steps instead.

Both kinds also show the terminal route: mpftp firmware flash --port esp32 --artifact <file> -d COM3, or --port rp2 --uf2 --artifact <file> for a UF2.

Checked in Chromium and WebKit with Playwright, against every file in the staged set. For each ESP file, the in-memory manifest's chipFamily and offset match that build's release manifest. Its part, fetched the way ESP Web Tools resolves it, has the same sha256 as firmware.json. The esptool line names the release offset and the file. There were no console errors. WebKit, which has no Web Serial, shows the "use Chrome or Edge" text. Setting the P4 offset to 0x0 fails the check on both MicroPython P4 files. Pressing Install with a fake serial port opens ESP Web Tools' own dialog, which fetches the Blob manifest and offers to install the file.

Not yet done: a real flash. Web Serial's port chooser needs a person at Chrome, so writing a locally built .bin to a board from this section is still to be tried.

Pick a .bin or .uf2 you built and the page writes it the way it writes
the release builds. A .bin gets a chip choice, preset from the image
header, and the release manifests' offset: 0x2000 for a merged ESP32-P4
image, 0x0 for the S3 and for any whole-flash image. The page builds an
ESP Web Tools manifest as a Blob URL whose part is a Blob URL of the
file, and hands it to the vendored install button, which resolves blob:
manifests and parts as they are. Chips outside BROWSER_INSTALL, and
browsers without Web Serial, get the esptool steps with the file's name.
An application image is refused, since it would boot-loop at the
bootloader offset. A .uf2 gets the copy-to-drive steps. Both show the
mpftp line for flashing from a terminal.
@bdbarnett
bdbarnett merged commit b5391f8 into firmware-page-staged Oct 22, 2026
@bdbarnett
bdbarnett deleted the firmware-install-from-file branch October 22, 2026 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant