#xtensa #esp #github-api #cli #esp-rs

程序+库 espup

用于安装和维护 Espressif Rust 生态系统的工具

26 个版本 (10 个破坏性版本)

0.12.2 2024 年 7 月 18 日
0.12.0 2024 年 6 月 12 日
0.11.0 2024 年 2 月 2 日
0.10.0 2023 年 12 月 5 日
0.2.3 2022 年 11 月 17 日

#57 in 开发工具

Download history 267/week @ 2024-05-01 273/week @ 2024-05-08 233/week @ 2024-05-15 313/week @ 2024-05-22 345/week @ 2024-05-29 314/week @ 2024-06-05 608/week @ 2024-06-12 358/week @ 2024-06-19 283/week @ 2024-06-26 297/week @ 2024-07-03 594/week @ 2024-07-10 918/week @ 2024-07-17 437/week @ 2024-07-24 881/week @ 2024-07-31 1141/week @ 2024-08-07 675/week @ 2024-08-14

每月下载量 3,303

MIT/Apache

86KB
2K SLoC

espup

Crates.io MSRV Continuous Integration Security audit Matrix

rustup for esp-rs

espup 是一个用于安装和维护 Espressif SoC 开发 Rust 应用所需工具链的工具。

要更好地了解 espup 安装的软件,请参阅 《Rust on ESP》书籍的安装章节

要求

在运行或安装 espup 之前,请确保已安装 rustup

Linux 系统还需要以下软件包

  • Ubuntu/Debian
    sudo apt-get install -y gcc build-essential curl pkg-config
    
  • Fedora
    sudo dnf -y install perl gcc
    
    • perl 是构建 openssl-sys 所必需的
  • openSUSE Thumbleweed/Leap
    sudo zypper install -y gcc ninja make
    

安装

cargo install espup

还可以使用 cargo-binstall 或直接下载预编译的 发布二进制文件

安装预编译发布二进制文件的命令
  • 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
    

快速入门

有关详细信息,请参阅 使用 部分。

espup install
# Unix
. $HOME/export-esp.sh
# Windows does not require sourcing any file

[!IMPORTANT] 默认情况下生成的导出文件 export-esp 需要在 Unix 系统中的每个终端中导入,才能构建应用程序。在 Windows 上,环境变量将自动注入到您的系统中,无需导入。

使用

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

完成子命令

有关如何启用 Tab 完成的详细说明,请参阅 为 Bash、Fish、Zsh 或 PowerShell 启用 Tab 完成 部分。

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

安装子命令

[!NOTE]

Xtensa Rust 目标路径

安装路径可以通过在运行 install 命令之前设置环境变量 CARGO_HOMERUSTUP_HOME 来修改。默认情况下,工具链将被安装在 <rustup_home>/toolchains/esp 之下,尽管可以使用 -a/--name 选项来更改此设置。

[!NOTE]

GitHub API

在安装过程中,会进行几次GitHub查询,这些查询受到某些限制。除非您在短时间内多次运行 espup install 命令,否则我们的查询次数不应达到限制。我们建议在使用 espup 进行CI时设置 GITHUB_TOKEN 环境变量。如果您想在CI上使用 espup,建议通过 xtensa-toolchain 动作 来使用它,并确保在使用主机机器时没有设置 GITHUB_TOKEN。有关更多详细信息,请参阅 https://github.com/esp-rs/xtensa-toolchain/issues/15

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]

  -n, --nightly-version <NIGHTLY_VERSION>
          Nightly Rust toolchain version

          [default: nightly]

  -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')

卸载子命令

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

更新子命令

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]

  -n, --nightly-version <NIGHTLY_VERSION>
          Nightly Rust toolchain version

          [default: nightly]

  -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')

为Bash、Fish、Zsh或PowerShell启用Tab补全

espup 支持为Bash、Fish、Zsh和PowerShell生成完成脚本。有关完整详细信息,请参阅 espup help completions,但基本步骤如下:

# 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

注意:您可能需要重新启动shell才能使更改生效。

对于 zsh,您必须在 ~/.zshrc 中的 compinit 之前添加以下行:

fpath+=~/.zfunc

许可证

根据您的要求,许可协议为以下之一:

任选其一。

贡献

除非您明确声明,否则您有意提交的任何贡献,根据Apache-2.0许可证定义,应作为上述双重许可,不附加任何额外条款或条件。

依赖关系

~23–42MB
~720K SLoC