Skip to content

About

Verified ESP32-S3 firmware flashing from Go and the browser, powered by a shared Rust core.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

11 Commits

Folders and files

Repository files navigation

CodeCraft Flash

简体中文 · Usage guide · Benchmarks

Flash a merged ESP firmware image from a Go CLI or a Chrome page. Both clients run the same Rust engine, check the image against its manifest and verify the device's MD5 before resetting the board.

Performance against stock flashers

On one Wio Tracker L2, each tool flashed the same 813,792-byte factory BIN three times over native USB at a configured 115200 baud. All runs verified the device MD5 and reset the board. Times are medians within each interface.

Interface Stock baseline CodeCraft Flash rc.8 Less elapsed time
Go CLI Espressif Python esptool 5.7.0 · 6.91 s Native Rust · 6.72 s 2.7%
Chrome Stock npm esptool-js 0.5.7 used by SenseCraft App · 9.08 s Rust WASM · 6.84 s 24.7%

The browser baseline loaded the original npm bundle. It was byte-identical to the installed SenseCraft App dependency, with no application acceleration patch loaded.

For the 385,008-byte Watcher desktop clock, median full-flash time across three runs at 3 Mbaud was 5.67 s in the native CLI and 5.56 s in Chrome. All six device MD5 checks passed. Espressif’s hosted web flasher and stock CLI did not finish the image on this Watcher. Desktop clock measurements

On the 12,482,033-byte Watcher image at 3 Mbaud, median full-flash time across three runs was 78.89 s in the native CLI and 80.99 s in Chrome. All six runs verified the device MD5. Espressif’s hosted web flasher at all four available rates and its stock Python CLI did not complete this image, so a relative Watcher speedup is unavailable. Measurements and reproduction

What you can do

  • Program a complete merged factory BIN, or select sector-aligned ranges for a partial update.
  • Verify selected ranges without writing. Enable full byte readback when you need evidence beyond device MD5.
  • Stream progress and structured diagnostics to a CLI or browser. Retry events identify the affected Flash interval and the protocol error.
  • Generate a manifest from a local BIN or paste a deployment JSON. Firmware that implements serial-json-v1 can accept typed settings after flashing and prove that they survived reboot.

Install the SDKs

The Go SDK includes native cores for macOS and Linux on arm64 and amd64. Native flashing requires cgo and a C compiler. Linux also needs the libudev development files. Install the TypeScript package from the public npm registry.

go get github.com/Seeed-Solution/codecraft-flash/go@v0.2.1
npm install @sensecraft/codecraft-flash

Quick start

From a checkout on macOS arm64 with Rust, Go and a C linker:

bash scripts/build-native.sh
./dist/codecraft-flash targets
./dist/codecraft-flash describe --target esp-idf/wio-tracker-l2 firmware.bin > manifest.json
./dist/codecraft-flash plan manifest.json

After confirming the board and its serial port, set PORT and run:

./dist/codecraft-flash flash --port "$PORT" --progress manifest.json firmware.bin

The usage guide covers the browser test page, installation of @sensecraft/codecraft-flash, the Go SDK, logging, readback and application configuration.

Device coverage

The SDK provides 13 generic chip targets and eight named ESP32-S3 board profiles. Select the named board when available. For a generic board, select the exact chip (for example esp/esp32c3) and its unsigned, unencrypted merged NOR image. The core checks ROM identity, partition layout and physical flash size before writing. Board USB wiring and reliable baud rates require board-specific testing.

Chip targets Go and Web adapter Physical acceptance
ESP32-S3 Implemented Go and Chrome full flash on Sticky, Watcher, L2 and E1001. Quick upgrade and reader-state recovery on Sticky.
ESP32, ESP32-C2/C3/C5/C6/C61 Implemented Pending for these chips
ESP32-H2/H21/H4, ESP32-P4, ESP32-S2/S31 Implemented Pending for these chips

All 13 generic targets passed a simulated ROM write, device MD5 and byte readback using the WebAssembly core. P4 selects the stub by silicon revision. The pinned C2 stub supports revisions after ECO0. A detected C2 ECO0 requires a ROM-only tool. See the target catalog and physical measurements. Watcher uses its bottom USB-C ESP interface. SenseCAP Indicator requires an explicit dx or gx variant. Application configuration requires the firmware's own protocol support.

Manifest schema · Example deployment · Rust CLI · Espressif stub attribution

License

CodeCraft Flash is licensed under Apache-2.0. Third-party components retain their respective licenses. See the Espressif RAM stub attribution.

About

Verified ESP32-S3 firmware flashing from Go and the browser, powered by a shared Rust core.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages