From be5d7651a568fd433251884c480d6056ac8aa240 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Tue, 24 May 2022 09:31:44 +0200 Subject: [PATCH 1/4] Add toolchain override documentation --- README.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4773a707..2d4626c4 100644 --- a/README.md +++ b/README.md @@ -57,11 +57,16 @@ No prerequisites are needed for macOS #### Installation commands ```sh -./install-rust-toolchain.sh +$ git clone https://github.com/esp-rs/rust-build.git +$ cd rust-build +$ ./install-rust-toolchain.sh ``` + > Run `./install-rust-toolchain.sh --help` for more information about arguments. Export variables are displayed at the end of the script. +> **Note** +> If the export variables are added into the shell startup script, the shell may need to be refreshed. ### Windows x64 @@ -125,6 +130,16 @@ rustup target add riscv32i-unknown-none-elf And `SERIAL` is the serial port connected to the target device. > [cargo-espflash](https://github.com/esp-rs/espflash/tree/master/cargo-espflash) also allows opening a serial monitor after flashing with `--monitor` option, see [Usage](https://github.com/esp-rs/espflash/tree/master/cargo-espflash#usage) section for more information about arguments. + + When building for Xtensa targets, we need to [override the `esp` toolchain](https://rust-lang.github.io/rustup/overrides.html), there are several solutions: + - Set `esp` toolchain as default: `rustup default esp` + - Use `cargo +esp` + - Override the project directory: `rustup override set esp` + - Create a file called `rust-toolchain.toml` or `rust-toolchain` with: + ```toml + [toolchain] + channel = "esp" + ``` #### Idf first approach 1. Get example source code From 873122a6bba230354a1819fc16e88a1239973877 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Tue, 24 May 2022 09:35:53 +0200 Subject: [PATCH 2/4] Update installation commands for powershell --- README.md | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 2d4626c4..a67ec850 100644 --- a/README.md +++ b/README.md @@ -90,18 +90,13 @@ choco install cmake git ninja visualstudio2022-workload-vctools windows-sdk-10.0 #### Installation commands for PowerShell ```sh -./Install-RustToolchain.ps1 +$ git clone https://github.com/esp-rs/rust-build.git +$ cd rust-build +$ ./Install-RustToolchain.ps1 ``` Export variables are displayed at the end of the output from the script. -Installation of different version of toolchain: - -``` -./Install-RustToolchain.sh --toolchain-version 1.61.0.0 --export-file Export-EspRust.ps1 -source ./Export-EspRust.ps1 -``` - ## RiscV Installation Following instructions are specific for ESP32-C based on RiscV architecture. From 3822511ca2b6d06d9b1f9ce1d3fcf16c679fc2c1 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Tue, 24 May 2022 09:52:32 +0200 Subject: [PATCH 3/4] Add arguments section --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index a67ec850..e8adbf60 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,22 @@ This repository contains: - [Podman/Docker Rust ESP environment](#podmandocker-rust-esp-environment) - [Devcontainers](#devcontainers) + +## Arguments +- `-b|--build-target`: Comma separated list of targets [`esp32,esp32s2,esp32s3,esp32c3`]. Defaults to: `esp32,esp32s2,esp32s3` +- `-c|--cargo-home`: Cargo path. +- `-d|--toolchain-destination`: Toolchain instalation folder. Defaults to: `/toolchains/esp` +- `-e|--extra-crates`: Extra crates to install. Defaults to: `ldproxy cargo-espflash` +- `-f|--export-file`: Destination of the export file generated. +- `-i|--installation-mode`: Installation mode: [`install, reinstall, uninstall`]. Defaults to: `install` +- `-l|--llvm-version`: LLVM version. +- `-m|--minified-esp-idf`: [Only applies if using `-s|--esp-idf-version`]. Deletes some idf folders to save space. Possible values [`YES, NO`] +- `-n|--nightly-version`: Nightly Rust toolchain version. Defaults to: `nightly` +- `-r|--rustup-home`: Path to .rustup. Defaults to: `~/.rustup` +- `-s|--esp-idf-version`: [ESP-IDF branch](https://github.com/espressif/esp-idf/branches) to install. When empty, no esp-idf is installed. Default: `""` +- `-t|--toolchain-version`: Xtensa Rust toolchain version +- `-x|--clear-cache`: Removes cached distribution files. Possible values: [`YES, NO`] + ## Xtensa Installation Download installer from Release section: https://github.com/esp-rs/rust-build/releases/tag/v1.61.0.0 From 6260e2eeac2dbc0942ee43d7ff9dd8c72022d4a7 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Fri, 27 May 2022 08:39:22 +0200 Subject: [PATCH 4/4] Remove $, add intructions for building a different version --- README.md | 59 +++++++++++++++++++++++++++++++++---------------------- 1 file changed, 35 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index e8adbf60..886492b4 100644 --- a/README.md +++ b/README.md @@ -20,22 +20,6 @@ This repository contains: - [Podman/Docker Rust ESP environment](#podmandocker-rust-esp-environment) - [Devcontainers](#devcontainers) - -## Arguments -- `-b|--build-target`: Comma separated list of targets [`esp32,esp32s2,esp32s3,esp32c3`]. Defaults to: `esp32,esp32s2,esp32s3` -- `-c|--cargo-home`: Cargo path. -- `-d|--toolchain-destination`: Toolchain instalation folder. Defaults to: `/toolchains/esp` -- `-e|--extra-crates`: Extra crates to install. Defaults to: `ldproxy cargo-espflash` -- `-f|--export-file`: Destination of the export file generated. -- `-i|--installation-mode`: Installation mode: [`install, reinstall, uninstall`]. Defaults to: `install` -- `-l|--llvm-version`: LLVM version. -- `-m|--minified-esp-idf`: [Only applies if using `-s|--esp-idf-version`]. Deletes some idf folders to save space. Possible values [`YES, NO`] -- `-n|--nightly-version`: Nightly Rust toolchain version. Defaults to: `nightly` -- `-r|--rustup-home`: Path to .rustup. Defaults to: `~/.rustup` -- `-s|--esp-idf-version`: [ESP-IDF branch](https://github.com/espressif/esp-idf/branches) to install. When empty, no esp-idf is installed. Default: `""` -- `-t|--toolchain-version`: Xtensa Rust toolchain version -- `-x|--clear-cache`: Removes cached distribution files. Possible values: [`YES, NO`] - ## Xtensa Installation Download installer from Release section: https://github.com/esp-rs/rust-build/releases/tag/v1.61.0.0 @@ -73,17 +57,37 @@ No prerequisites are needed for macOS #### Installation commands ```sh -$ git clone https://github.com/esp-rs/rust-build.git -$ cd rust-build -$ ./install-rust-toolchain.sh +git clone https://github.com/esp-rs/rust-build.git +cd rust-build +./install-rust-toolchain.sh ``` -> Run `./install-rust-toolchain.sh --help` for more information about arguments. - Export variables are displayed at the end of the script. > **Note** > If the export variables are added into the shell startup script, the shell may need to be refreshed. +Installation of different version of toolchain: + +``` +./install-rust-toolchain.sh --toolchain-version 1.61.0.0 --export-file export-esp-rust.sh +source export-esp-rust.sh +``` + +#### Arguments +- `-b|--build-target`: Comma separated list of targets [`esp32,esp32s2,esp32s3,esp32c3`]. Defaults to: `esp32,esp32s2,esp32s3` +- `-c|--cargo-home`: Cargo path. +- `-d|--toolchain-destination`: Toolchain instalation folder. Defaults to: `/toolchains/esp` +- `-e|--extra-crates`: Extra crates to install. Defaults to: `ldproxy cargo-espflash` +- `-f|--export-file`: Destination of the export file generated. +- `-i|--installation-mode`: Installation mode: [`install, reinstall, uninstall`]. Defaults to: `install` +- `-l|--llvm-version`: LLVM version. +- `-m|--minified-esp-idf`: [Only applies if using `-s|--esp-idf-version`]. Deletes some idf folders to save space. Possible values [`YES, NO`] +- `-n|--nightly-version`: Nightly Rust toolchain version. Defaults to: `nightly` +- `-r|--rustup-home`: Path to .rustup. Defaults to: `~/.rustup` +- `-s|--esp-idf-version`: [ESP-IDF branch](https://github.com/espressif/esp-idf/branches) to install. When empty, no esp-idf is installed. Default: `""` +- `-t|--toolchain-version`: Xtensa Rust toolchain version +- `-x|--clear-cache`: Removes cached distribution files. Possible values: [`YES, NO`] + ### Windows x64 Following instructions are specific for ESP32 and ESP32-S series based on Xtensa architecture. @@ -106,13 +110,20 @@ choco install cmake git ninja visualstudio2022-workload-vctools windows-sdk-10.0 #### Installation commands for PowerShell ```sh -$ git clone https://github.com/esp-rs/rust-build.git -$ cd rust-build -$ ./Install-RustToolchain.ps1 +git clone https://github.com/esp-rs/rust-build.git +cd rust-build +./Install-RustToolchain.ps1 ``` Export variables are displayed at the end of the output from the script. +Installation of different version of toolchain: + +``` +./Install-RustToolchain.ps1 --toolchain-version 1.61.0.0 --export-file Export-EspRust.ps1 +source ./Export-EspRust.ps1 +``` + ## RiscV Installation Following instructions are specific for ESP32-C based on RiscV architecture.