Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve toolchain overriding documentation #75

Merged
merged 4 commits into from
May 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 39 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,36 @@ 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
```
> 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: `<rustup_home>/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

Expand All @@ -85,6 +110,8 @@ 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
```

Expand All @@ -93,7 +120,7 @@ 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
./Install-RustToolchain.ps1 --toolchain-version 1.61.0.0 --export-file Export-EspRust.ps1
source ./Export-EspRust.ps1
```

Expand Down Expand Up @@ -125,6 +152,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
Expand Down