From 273a36ef3dbcf7c5e06ecb9c43301273984679a8 Mon Sep 17 00:00:00 2001 From: deadprogram Date: Sun, 12 Jul 2026 11:37:59 +0200 Subject: [PATCH] all: prepare for release 0.7.0 Signed-off-by: deadprogram --- README.md | 34 +++++++++++++++++++++++++++++++++- pkg/espflasher/version.go | 2 +- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1190185..16d62ff 100644 --- a/README.md +++ b/README.md @@ -111,15 +111,21 @@ func main() { - **Multi-image support**: Flash bootloader, partition table, and application in one operation - **Progress callbacks**: Monitor flash progress in real-time - **MD5 verification**: Verifies written data integrity after flashing +- **Flash readback**: Read flash contents back with byte-accurate progress reporting +- **GPIO access**: Read, drive, and release GPIO pins over the ROM/stub connection on ESP32, ESP32-S2, ESP32-C3, and ESP32-S3 +- **Connection hooks**: Display connection-phase status updates or override serial port opening when integrating with monitors or custom transports - **Configurable**: Customize baud rate, compression, reset mode, and more - **USB-JTAG/Serial**: Native USB support for boards like ESP32-S3 and ESP32-C3 that expose a built-in USB-JTAG/Serial interface (typically `/dev/ttyACM0` on Linux, `cu.usbmodem*` on macOS) - **Stubs**: Use stubs for higher-speed downloads and other advanced processor features -- **NVS support**: Generate and parse ESP-IDF NVS (Non-Volatile Storage) partition images in pure Go +- **Stub control**: Opt out of loading the stub for register-level workflows that only need ROM functionality +- **NVS support**: Generate and parse ESP-IDF NVS (Non-Volatile Storage) partition images in pure Go, including lossless read-modify-write of unknown and chunked entries ## NVS Package The `nvs` package provides a pure-Go implementation for generating and parsing [ESP-IDF NVS (Non-Volatile Storage)](https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-reference/storage/nvs_flash.html) partition images in the v2 binary format. +It is suitable for read-modify-write workflows: `ParseNVS` preserves unknown entry types and ESP-IDF chunked blob entries so `GenerateNVS` can round-trip them without data loss. + ### Installation ```bash @@ -196,6 +202,13 @@ flasher, err := espflasher.New("/dev/ttyUSB0", opts) // For boards with native USB-JTAG/Serial (ESP32-S3, ESP32-C3, etc.) opts.ResetMode = espflasher.ResetUSBJTAG flasher, err := espflasher.New("/dev/ttyACM0", opts) + +// Surface connection phases and skip the stub for ROM-only workflows. +opts.ConnectStatus = func(phase espflasher.ConnectPhase, attempt, maxAttempts int, message string) { + fmt.Printf("[%s] %s\n", phase, message) +} +opts.SkipStub = true +flasher, err := espflasher.New("/dev/ttyUSB0", opts) ``` ### Flashing a Single Binary @@ -230,6 +243,25 @@ err := flasher.EraseFlash(func(current, total int) { fmt.Printf("erasing... %dms / %dms\n", current, total) }) +// Read back flash with byte-accurate progress +data, err := flasher.ReadFlash(0x10000, 0x20000, func(current, total int) { + fmt.Printf("read %d / %d bytes\n", current, total) +}) + +// Ask the device to compute an MD5 for a flash region +sum, err := flasher.GetFlashMD5(0x10000, uint32(len(data)), func(current, total int) { + fmt.Printf("md5... %dms / %dms\n", current, total) +}) + +// Probe and temporarily drive a GPIO on supported chips +reserved, reason := flasher.GPIOReserved(2) +if reserved { + fmt.Printf("GPIO2 is reserved: %s\n", reason) +} +level, err := flasher.ReadGPIO(2) +err = flasher.SetGPIO(2, !level) +err = flasher.ReleaseGPIO(2) + // Read a hardware register val, err := flasher.ReadRegister(0x3FF00050) diff --git a/pkg/espflasher/version.go b/pkg/espflasher/version.go index 2c92781..f6caa6d 100644 --- a/pkg/espflasher/version.go +++ b/pkg/espflasher/version.go @@ -1,4 +1,4 @@ package espflasher // Version is the current version of the espflasher library. -const Version = "0.6.0" +const Version = "0.7.0"