Toolchain Installation
Rust Installation
Make sure you have Rust installed. If not, see the instructions on the rustup website.
🚨 Warning: When using Unix based systems, installing Rust via a system package manager (e.g.
brew,apt,dnf, etc.) can result in various issues and incompatibilities, so it’s best to use rustup instead.
When using Windows, make sure you have installed one of the ABIs listed below. For more details, see the Windows chapter in The rustup book.
-
MSVC: Recommended ABI, included in the list of
rustupdefault requirements. Use it for interoperability with the software produced by Visual Studio.When in doubt, this is what you want to use.
-
GNU: ABI used by the GCC toolchain. Install it yourself for interoperability with the software built with the MinGW/MSYS2 toolchain.
See also alternative installation methods.
RISC-V Devices
To build Rust applications for the Espressif chips based on RISC-V architecture (if you’re unsure what your device is, see hardware overview), do the following:
-
Install the proper toolchain with the
rust-srccomponent:- You can use either
stableornightly:
orrustup toolchain install stable --component rust-srcrustup toolchain install nightly --component rust-src
⚠️ Note: Other components such as
rustfmt,clippyorrust-analyzerare not required, but they are highly recommended. - You can use either
-
Install the target:
rustup target add riscv32imc-unknown-none-elf # For ESP32-C2 and ESP32-C3 rustup target add riscv32imac-unknown-none-elf # For ESP32-C6 and ESP32-H2Those targets are currently Tier 2. Note the different flavors of
riscv32targets in Rust covering different RISC-V extensions.
If you are not going to use ESP32, ESP32-S2 or ESP32-S3 you are done and can skip to Tooling Installation.
Xtensa Devices
As mentioned in hardware overview ESP32, ESP32-S2 and ESP32-S3 are based on Xtensa architecture. If you are going to target these chips you will need to use a fork of the Rust compiler for now.
espup is a tool that simplifies installing and maintaining the toolchains required to develop Rust applications for these targets.
- Install
espup:
You can also directly download pre-compiled release binaries or usecargo install espup --lockedcargo-binstall. - Install all necessary toolchains for all supported Espressif targets by running:
espup install - On Unix systems, set up the Environment Variables: See the different methods in
espupReadme. Windows users don’t need to do anything else.
What espup Installs
To enable support for Espressif targets, espup installs:
- Espressif Rust fork with support for Espressif targets
stabletoolchain with support for RISC-V targets- LLVM fork with support for Xtensa targets
- GCC toolchain that links the final binary
The forked compiler can coexist with the standard Rust compiler, allowing both to be installed on your system. The forked compiler is invoked when using any of the available overriding methods.