GitHub - esp-rs/espup: Tool for installing and maintaining Espressif Rust ecosystem. (original) (raw)
espup
rustup
for esp-rs
espup
is a tool for installing and maintaining the required toolchains for developing applications in Rust for Espressif SoC's.
To better understand what espup
installs, see the installation chapter of The Rust on ESP Book
Requirements
Before running or installing espup
, make sure that rustup is installed.
Linux systems also require the following packages:
- Ubuntu/Debian
sudo apt-get install -y gcc build-essential curl pkg-config - Fedora
sudo dnf -y install perl gccperl
is required to buildopenssl-sys
- openSUSE Thumbleweed/Leap
sudo zypper install -y gcc ninja make
Installation
cargo install espup --locked
It's also possible to use cargo-binstall or to directly download the pre-compiled release binaries.
Commands to install pre-compiled release binaries
- Linux aarch64
curl -L https://github.com/esp-rs/espup/releases/latest/download/espup-aarch64-unknown-linux-gnu -o espup
chmod a+x espup - Linux x86_64
curl -L https://github.com/esp-rs/espup/releases/latest/download/espup-x86_64-unknown-linux-gnu -o espup
chmod a+x espup - macOS aarch64
curl -L https://github.com/esp-rs/espup/releases/latest/download/espup-aarch64-apple-darwin -o espup
chmod a+x espup - macOS x86_64
curl -L https://github.com/esp-rs/espup/releases/latest/download/espup-x86_64-apple-darwin -o espup
chmod a+x espup - Windows MSVC
Invoke-WebRequest 'https://github.com/esp-rs/espup/releases/latest/download/espup-x86_64-pc-windows-msvc.exe' -OutFile .\espup.exe
Quickstart
See Usage section for more details.
Environment Variables Setup
After installing the toolchain, on Unix systems, you need to source a file that will export the environment variables. This file is generated by espup
and is located in your home directory by default. There are different ways to source the file:
- Source this file in every terminal:
- Source the export file:
. $HOME/export-esp.sh
This approach requires running the command in every new shell.
- Source the export file:
- Create an alias for executing the
export-esp.sh
:- Copy and paste the following command to your shell’s profile (
.profile
,.bashrc
,.zprofile
, etc.):alias get_esprs='. $HOME/export-esp.sh'
- Refresh the configuration by restarting the terminal session or by running
source [path to profile]
, for example,source ~/.bashrc
.
This approach requires running the alias in every new shell.
- Copy and paste the following command to your shell’s profile (
- Add the environment variables to your shell profile directly:
- Add the content of
$HOME/export-esp.sh
to your shell’s profile:cat <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>H</mi><mi>O</mi><mi>M</mi><mi>E</mi><mi mathvariant="normal">/</mi><mi>e</mi><mi>x</mi><mi>p</mi><mi>o</mi><mi>r</mi><mi>t</mi><mo>−</mo><mi>e</mi><mi>s</mi><mi>p</mi><mi mathvariant="normal">.</mi><mi>s</mi><mi>h</mi><mo>></mo><mo>></mo><mo stretchy="false">[</mo><mi>p</mi><mi>a</mi><mi>t</mi><mi>h</mi><mi>t</mi><mi>o</mi><mi>p</mi><mi>r</mi><mi>o</mi><mi>f</mi><mi>i</mi><mi>l</mi><mi>e</mi><mo stretchy="false">]</mo><mi mathvariant="normal">‘</mi><mo separator="true">,</mo><mi>f</mi><mi>o</mi><mi>r</mi><mi>e</mi><mi>x</mi><mi>a</mi><mi>m</mi><mi>p</mi><mi>l</mi><mi>e</mi><mo separator="true">,</mo><mi mathvariant="normal">‘</mi><mi>c</mi><mi>a</mi><mi>t</mi></mrow><annotation encoding="application/x-tex">HOME/export-esp.sh >> [path to profile]
, for example,cat </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal" style="margin-right:0.08125em;">H</span><span class="mord mathnormal" style="margin-right:0.05764em;">OME</span><span class="mord">/</span><span class="mord mathnormal">e</span><span class="mord mathnormal">x</span><span class="mord mathnormal">p</span><span class="mord mathnormal" style="margin-right:0.02778em;">or</span><span class="mord mathnormal">t</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:0.8889em;vertical-align:-0.1944em;"></span><span class="mord mathnormal">es</span><span class="mord mathnormal">p</span><span class="mord">.</span><span class="mord mathnormal">s</span><span class="mord mathnormal">h</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">>></span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mopen">[</span><span class="mord mathnormal">p</span><span class="mord mathnormal">a</span><span class="mord mathnormal">t</span><span class="mord mathnormal">h</span><span class="mord mathnormal">t</span><span class="mord mathnormal">o</span><span class="mord mathnormal">p</span><span class="mord mathnormal">ro</span><span class="mord mathnormal" style="margin-right:0.10764em;">f</span><span class="mord mathnormal">i</span><span class="mord mathnormal" style="margin-right:0.01968em;">l</span><span class="mord mathnormal">e</span><span class="mclose">]</span><span class="mord">‘</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathnormal" style="margin-right:0.10764em;">f</span><span class="mord mathnormal">ore</span><span class="mord mathnormal">x</span><span class="mord mathnormal">am</span><span class="mord mathnormal" style="margin-right:0.01968em;">pl</span><span class="mord mathnormal">e</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord">‘</span><span class="mord mathnormal">c</span><span class="mord mathnormal">a</span><span class="mord mathnormal">t</span></span></span></span>HOME/export-esp.sh >> ~/.bashrc
. - Refresh the configuration by restarting the terminal session or by running
source [path to profile]
, for example,source ~/.bashrc
.
- Add the content of
Important
On Windows, environment variables are automatically injected into your system and don't need to be sourced.
Usage
Usage: espup <COMMAND>
Commands:
completions Generate completions for the given shell
install Installs Espressif Rust ecosystem
uninstall Uninstalls Espressif Rust ecosystem
update Updates Xtensa Rust toolchain
help Print this message or the help of the given subcommand(s)
Options:
-h, --help Print help
-V, --version Print version
Completions Subcommand
For detailed instructions on how to enable tab completion, see Enable tab completion for Bash, Fish, Zsh, or PowerShell section.
Usage: espup completions [OPTIONS] <SHELL>
Arguments:
<SHELL> Shell to generate completions for [possible values: bash, elvish, fish, powershell, zsh]
Options:
-l, --log-level <LOG_LEVEL> Verbosity level of the logs [default: info] [possible values: debug, info, warn, error]
-h, --help Print help
Install Subcommand
Note
Xtensa Rust destination path
Installation paths can be modified by setting the environment variables CARGO_HOME and RUSTUP_HOME before running the install
command. By default, toolchains will be installed under <rustup_home>/toolchains/esp
, although this can be changed using the -a/--name
option.
Usage: espup install [OPTIONS]
Options:
-d, --default-host <DEFAULT_HOST>
Target triple of the host
[possible values: x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu, x86_64-pc-windows-msvc, x86_64-pc-windows-gnu, x86_64-apple-darwin, aarch64-apple-darwin]
-r, --esp-riscv-gcc
Install Espressif RISC-V toolchain built with croostool-ng
Only install this if you don't want to use the systems RISC-V toolchain
-f, --export-file <EXPORT_FILE>
Relative or full path for the export file that will be generated. If no path is provided, the file will be generated under home directory (https://docs.rs/dirs/latest/dirs/fn.home_dir.html)
[env: ESPUP_EXPORT_FILE=]
-e, --extended-llvm
Extends the LLVM installation.
This will install the whole LLVM instead of only installing the libs.
-l, --log-level <LOG_LEVEL>
Verbosity level of the logs
[default: info]
[possible values: debug, info, warn, error]
-a, --name <NAME>
Xtensa Rust toolchain name
[default: esp]
-b, --stable-version <STABLE_VERSION>
Stable Rust toolchain version.
Note that only RISC-V targets use stable Rust channel.
[default: stable]
-k, --skip-version-parse
Skips parsing Xtensa Rust version
-s, --std
Only install toolchains required for STD applications.
With this option, espup will skip GCC installation (it will be handled by esp-idf-sys), hence you won't be able to build no_std applications.
-t, --targets <TARGETS>
Comma or space separated list of targets [esp32,esp32c2,esp32c3,esp32c6,esp32h2,esp32s2,esp32s3,esp32p4,all]
[default: all]
-v, --toolchain-version <TOOLCHAIN_VERSION>
Xtensa Rust toolchain version
-h, --help
Print help (see a summary with '-h')
Uninstall Subcommand
Usage: espup uninstall [OPTIONS]
Options:
-l, --log-level <LOG_LEVEL> Verbosity level of the logs [default: info] [possible values: debug, info, warn, error]
-a, --name <NAME> Xtensa Rust toolchain name [default: esp]
-h, --help Print help
Update Subcommand
Usage: espup update [OPTIONS]
Options:
-d, --default-host <DEFAULT_HOST>
Target triple of the host
[possible values: x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu, x86_64-pc-windows-msvc, x86_64-pc-windows-gnu, x86_64-apple-darwin, aarch64-apple-darwin]
-f, --export-file <EXPORT_FILE>
Relative or full path for the export file that will be generated. If no path is provided, the file will be generated under home directory (https://docs.rs/dirs/latest/dirs/fn.home_dir.html)
[env: ESPUP_EXPORT_FILE=]
-e, --extended-llvm
Extends the LLVM installation.
This will install the whole LLVM instead of only installing the libs.
-l, --log-level <LOG_LEVEL>
Verbosity level of the logs
[default: info]
[possible values: debug, info, warn, error]
-a, --name <NAME>
Xtensa Rust toolchain name
[default: esp]
-b, --stable-version <STABLE_VERSION>
Stable Rust toolchain version.
Note that only RISC-V targets use stable Rust channel.
[default: stable]
-k, --skip-version-parse
Skips parsing Xtensa Rust version
-s, --std
Only install toolchains required for STD applications.
With this option, espup will skip GCC installation (it will be handled by esp-idf-sys), hence you won't be able to build no_std applications.
-t, --targets <TARGETS>
Comma or space separated list of targets [esp32,esp32c2,esp32c3,esp32c6,esp32h2,esp32s2,esp32s3,all]
[default: all]
-v, --toolchain-version <TOOLCHAIN_VERSION>
Xtensa Rust toolchain version
-h, --help
Print help (see a summary with '-h')
Enable Tab Completion for Bash, Fish, Zsh, or PowerShell
espup
supports generating completion scripts for Bash, Fish, Zsh, and PowerShell. See espup help completions
for full details, but the gist is as simple as using one of the following:
Bash
$ espup completions bash > ~/.local/share/bash-completion/completions/espup
Bash (macOS/Homebrew)
$ espup completions bash > $(brew --prefix)/etc/bash_completion.d/espup.bash-completion
Fish
$ mkdir -p ~/.config/fish/completions $ espup completions fish > ~/.config/fish/completions/espup.fish
Zsh
$ espup completions zsh > ~/.zfunc/_espup
PowerShell v5.0+
$ espup completions powershell >> $PROFILE.CurrentUserCurrentHost
or
$ espup completions powershell | Out-String | Invoke-Expression
Note: you may need to restart your shell in order for the changes to take effect.
For zsh
, you must then add the following line in your ~/.zshrc
beforecompinit
:
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
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.