Repository navigation
Firmware page: Install from a file - #30
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an "Install from a file" section to the firmware page, so you can flash a
.binor.uf2you built yourself. This goes intofirmware-page-staged(#25), notmain.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 absoluteblob:URL is fetched as-is. The vendored files are untouched.The same rules as the release builds. Only the
BROWSER_INSTALLchips 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
.uf2gets 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
.binto a board from this section is still to be tried.