espflash
espflash
is a serial flasher utility, based on esptool.py, for Espressif SoCs and modules.
The espflash
repository contains two crates, cargo-espflash
and espflash
. For more information on these crates, see the respective sections below.
⚠️ Note: The
espflash
andcargo-espflash
commands shown below, assume that version2.0
or greater is used.
cargo-espflash
Provides a subcommand for cargo
that handles cross-compilation and flashing.
To install cargo-espflash
, ensure that you have the necessary dependencies installed, and then execute the following command:
cargo install cargo-espflash
This command must be run within a Cargo project, ie. a directory containing a Cargo.toml
file. For example, to build an example named 'blinky', flash the resulting binary to a device, and then subsequently start a serial monitor:
cargo espflash flash --example=blinky --monitor
For more information, please see the cargo-espflash
README.
espflash
Provides a standalone command-line application that flashes an ELF file to a device.
To install espflash
, ensure that you have the necessary dependencies installed, and then execute the following command:
cargo install espflash
Assuming you have built an ELF binary by other means already, espflash
can be used to download it to your device and monitor the serial port. For example, if you have built the getting-started/blinky
example from ESP-IDF using idf.py
, you might run something like:
espflash flash build/blinky --monitor
For more information, please see the espflash
README.
espflash
can be used as a Cargo runner by adding the following to your project's .cargo/config.toml
file:
[target.'cfg(any(target_arch = "riscv32", target_arch = "xtensa"))']
runner = "espflash flash --monitor"
With this configuration, you can flash and monitor your application using cargo run
.