GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - espressif/esp-flasher-stub

BranchesTags
Open more actions menu

Latest commit

 

History

248 Commits
248 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
cmake
cmake
 
 
docs
docs
 
 
esp-stub-lib @ 91e85dc
esp-stub-lib @ 91e85dc
 
 
src
src
 
 
tools
tools
 
 
unittests
unittests
 
 
.astyle-rules.yml
.astyle-rules.yml
 
 
.check_copyright_config.yaml
.check_copyright_config.yaml
 
 
.git-blame-ignore-revs
.git-blame-ignore-revs
 
 
.gitignore
.gitignore
 
 
.gitmodules
.gitmodules
 
 
.pre-commit-config.yaml
.pre-commit-config.yaml
 
 
AGENTS.md
AGENTS.md
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CMakeLists.txt
CMakeLists.txt
 
 
LICENSE-APACHE
LICENSE-APACHE
 
 
LICENSE-MIT
LICENSE-MIT
 
 
README.md
README.md
 
 
pyproject.toml
pyproject.toml
 
 

Repository files navigation

pre-commit.ci status

ESP Flasher Stub

ESP Flasher Stub is a set of small firmware programs (stubs) that run on Espressif ESP chips to enable fast and reliable flash programming via esptool and esp-serial-flasher. When esptool connects to an ESP chip, it uploads the flasher stub into the chip's RAM. The stub then takes over communication, providing faster flash operations and additional features compared to the chip's built-in ROM bootloader.

This project has replaced the deprecated legacy flasher stub of esptool and is the default flasher stub since esptool v5.3.

Documentation

  • Architecture - Firmware architecture, source code structure, modules, and build system internals
  • Development Guide - Contributing guidelines, testing, CI/CD, and release process
  • Plugin System - Runtime-loadable plugin architecture and guide for adding new plugins
  • NAND Flash Support - NAND flash programming support (preview)
  • SPI Transport - SPI slave transport plugin for esp-serial-flasher
  • SDIO Transport - SDIO transport plugin

Supported Chips

Architecture Chips
Xtensa ESP32, ESP32-S2, ESP32-S3
RISC-V ESP32-C2, ESP32-C3, ESP32-C5, ESP32-C6, ESP32-C61, ESP32-H2, ESP32-H21, ESP32-H4, ESP32-P4, ESP32-P4 (rev1), ESP32-S31
Xtensa (LX106) ESP8266

Obtaining Pre-built Stub JSON Files

The pre-built regular stub JSON files are available from two sources:

  • GitHub Releases – Download the JSON files for all supported chips from the releases page.
  • npm – Install the esp-flasher-stub package for use in JavaScript/TypeScript projects.

Build Dependencies

Submodules

The project depends on esp-stub-lib as a git submodule. Make sure to initialize it before building:

git submodule update --init --recursive

Toolchains

The following toolchains must be set up and available in your PATH:

  1. xtensa-lx106-elf-*
  2. xtensa-*-elf-*
  3. riscv32-esp-elf-*

There is a convenience script for AMD64 Linux machines to download and install them into the toolchains directory:

mkdir -p toolchains
cd toolchains
../tools/setup_toolchains.sh

Then source the export script in every terminal where the project is used:

. ./tools/export_toolchains.sh

Python Dependencies

pyelftools is needed for ELF file analysis. Install it in a virtual environment:

python -m venv venv
source venv/bin/activate
pip install pyelftools

Activate the virtual environment in every terminal where the project is used:

source venv/bin/activate

Note

Target tests only: Running or building the target tests in unittests/target/ additionally requires esptool (pip install esptool). It is used to convert compiled ELF files to loadable binaries (elf2image) and to upload them to hardware (load_ram). Host tests (unittests/host/) have no esptool dependency.

How to Build

Build for One Selected Chip Target

mkdir -p build
cmake . -B build -G Ninja -DTARGET_CHIP=esp32s2   # Replace with your desired chip, e.g. esp32, esp8266
ninja -C build

Build for All Supported Chip Targets

./tools/build_all_chips.sh

SPI Transport

The SPI transport lets esp-serial-flasher talk to the stub over the SPI download interface. It is a transport plugin, so the stub carries its code only when the host loads it. The regular build embeds it in <target>.json for every chip that supports it; no build option is needed.

SDIO Transport

The SDIO transport lets a host talk to the stub over the SDIO download interface. Like SPI, it is a transport plugin that the regular build embeds in <target>.json for ESP32-C5, ESP32-C6 and ESP32-C61.

How to Use with Esptool

  1. Install the latest esptool from the master branch as described in Testing the Latest Code.

  2. Obtain the flasher stub binaries as JSON files either from the releases page or from the artifacts of your pull request.

  3. Replace the esptool JSON files in the esptool/targets/stub_flasher directory with the obtained JSON files.

    Example copy command (adjust the path to your esptool directory):

    cp build-*/*.json ~/esptool/esptool/targets/stub_flasher/2/

How It Works

The flasher stub operates through upload, initialization, handshake (OHAI over the selected transport), and a command loop that handles flash, memory, register, and SPI operations. UART and USB transports use SLIP framing; SDIO and SPI use raw command frames. For details, see the Architecture document.

Contributing

Read the Contributing section of the Development Guide before you open an issue or a pull request.

How to Release (for Maintainers Only)

See the Releasing section of the Development Guide.

License

This document and the attached source code are released as Free Software under either the Apache License Version 2 or MIT License at your option.

About

No description, website, or topics provided.

Resources

Readme
Activity
Custom properties

Stars

17 stars

Watchers

7 watching

Forks

18 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.