Crates.io | cargo-espflash |
lib.rs | cargo-espflash |
version | |
source | src |
created_at | 2020-09-15 20:55:21.936076 |
updated_at | 2024-10-18 09:25:21.057369 |
description | Cargo subcommand for flashing Espressif devices |
homepage | |
repository | https://github.com/esp-rs/espflash |
max_upload_size | |
id | 289225 |
Cargo.toml error: | TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
Cross-compiler and Cargo extension for flashing Espressif devices.
Supports the ESP32, ESP32-C2/C3/C6, ESP32-H2, ESP32-P4, and ESP32-S2/S3.
If you are installing cargo-espflash
from source (ie. using cargo install
) then you must have rustc>=1.76.0
installed on your system.
If you are running Linux then libudev must also be installed; this is available via most popular package managers. If you are running Windows or macOS you can ignore this step.
# Debian/Ubuntu/etc.
apt-get install libudev-dev
# Fedora
dnf install systemd-devel
To install:
cargo install cargo-espflash
Alternatively, you can use cargo-binstall to download pre-compiled artifacts from the releases and use them instead:
cargo binstall cargo-espflash
By default, in Unix systems, we use the vendored-openssl
Cargo feature which may require additional tools such as perl
and make
. To disable this feature, use:
OPENSSL_NO_VENDOR=1 cargo install cargo-espflash
Cargo subcommand for flashing Espressif devices
Usage: cargo espflash <COMMAND>
Commands:
board-info Print information about a connected target device
completions Generate completions for the given shell
erase-flash Erase Flash entirely
erase-parts Erase specified partitions
erase-region Erase specified region
flash Flash an application in ELF format to a target device
hold-in-reset Hold the target device in reset
monitor Open the serial monitor without flashing the connected target device
partition-table Convert partition tables between CSV and binary format
read-flash Read SPI flash content
reset Reset the target device
save-image Generate a binary application image and save it to a local disk
checksum-md5 Calculate the MD5 checksum of the given region
help Print this message or the help of the given subcommand(s)
Options:
-h, --help Print help
-V, --version Print version
In Linux, when using any of the commands that requires using a serial port, the current user may not have access to serial ports and a "Permission Denied" or "Port doesn’t exist" errors may appear.
On most Linux distributions, the solution is to add the user to the dialout
group (check e.g. ls -l /dev/ttyUSB0
to find the group) with a command like sudo usermod -a -G dialout $USER
. You can call su - $USER
to enable read and write permissions for the serial port without having to log out and back in again.
Check your Linux distribution’s documentation for more information.
It is not currently possible to use cargo-espflash
from within WSL1. There are no plans to add support for WSL1 at this time.
It is also not possible to flash chips using the built-in USB_SERIAL_JTAG
peripheral when using WSL2, because resetting also resets USB_SERIAL_JTAG
peripheral, which then disconnects the chip from WSL2. Chips can be flashed via UART using WSL2, however.
cargo-espflash
is able to detect if the package being built and flashed depends on esp-idf-sys; if it does, then the bootloader and partition table built by the esp-idf-sys
build script will be used, otherwise the bundled bootloader and partition tables will be used instead.
If the --bootloader
and/or --partition-table
options are provided then these will be used regardless of whether or not the package depends on esp-idf-sys
.
The configuration file allows you to define various parameters for your application:
[connection]
serial = "/dev/ttyUSB0"
[[usb_device]]
vid = "303a"
pid = "1001"
baudrate = 460800
bootloader = "path/to/custom/bootloader.bin"
partition_table = "path/to/custom/partition-table.bin"
[flash]
mode = "qio"
size = "8MB"
frequency = "80MHz"
You can have a local and/or a global configuration file:
espflash.toml
$HOME/.config/espflash/espflash.toml
$HOME/Library/Application Support/rs.esp.espflash/espflash.toml
%APPDATA%\esp\espflash\espflash.toml
ESPFLASH_PORT
or ESPFLASH_BAUD
are set, the will be used instead of the config file value.cargo-espflash
flash
and monitor
subcommands support several logging formats using the -L/--log-format
argument:
serial
: Default logging formatdefmt
: Uses [defmt
] logging framework. With logging format, logging strings have framing bytes to indicate that they are defmt
messages.
defmt
section of esp-println
readme.defmt
in the no_std
ecosystem, see defmt
project of Embedded Rust (no_std) on Espressif book.Licensed under either of:
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.