Skip to content

Commit d6f26b6

Browse files
authored
docs: update installation instructions for 1.54.0 (#20)
* docs: update installation instructions for 1.54.0 * docker: publish idf-rust image under Espressif account
1 parent ff5909f commit d6f26b6

7 files changed

+200
-66
lines changed

.github/workflows/publish-esp-idf-rust-image.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ jobs:
1919
with:
2020
context: .
2121
push: true
22-
tags: georgikrocks/esp-idf-rust:latest
22+
tags: espressif/idf-rust:latest

Dockerfile

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,29 @@ ENV LANG=C.UTF-8
66
ENV RUSTUP_HOME=/opt/rust
77
ENV CARGO_HOME=/opt/cargo
88
ENV PATH=/opt/cargo/bin:/opt/rust/bin:/opt/xtensa-esp32-elf-clang/bin:$PATH
9+
10+
ARG VERSION="1.54.0-dev"
11+
ARG ARCH="x86_64-unknown-linux-gnu"
12+
ARG RUST_DIST="rust-${VERSION}-${ARCH}"
13+
ARG RUST_SRC_DIST="rust-src-${VERSION}"
14+
ARG TOOLCHAIN_DESTINATION_DIR="/opt/esp"
15+
916
RUN curl https://sh.rustup.rs -sSf | bash -s -- --profile minimal --default-toolchain nightly -y
1017
WORKDIR /opt
1118

12-
RUN wget -q https://dl.espressif.com/dl/idf-rust/dist/x86_64-unknown-linux-gnu/rust-1.53.0-dev-x86_64-unknown-linux-gnu.tar.xz \
13-
&& tar xvf rust-1.53.0-dev-x86_64-unknown-linux-gnu.tar.xz \
14-
&& ./rust-1.53.0-dev-x86_64-unknown-linux-gnu/install.sh --destdir=/opt/esp --prefix="" --without=rust-docs \
15-
&& rm -rf rust-1.53.0-dev-x86_64-unknown-linux-gnu*
19+
RUN wget -q https://dl.espressif.com/dl/idf-rust/dist/${ARCH}/${RUST_DIST}.tar.xz \
20+
&& tar xvf ${RUST_DIST}.tar.xz \
21+
&& ./${RUST_DIST}/install.sh --destdir=${TOOLCHAIN_DESTINATION_DIR} --prefix="" --without=rust-docs \
22+
&& rm -rf ${RUST_DIST} ${RUST_DIST}.tar.xz
1623

17-
RUN wget -q https://dl.espressif.com/dl/idf-rust/dist/noarch/rust-src-1.53.0-dev.tar.xz \
18-
&& tar xvf rust-src-1.53.0-dev.tar.xz \
19-
&& ./rust-src-1.53.0-dev/install.sh --destdir=/opt/esp --prefix="" --without=rust-docs \
20-
&& rm -rf rust-src-1.53.0-dev* \
24+
RUN wget -q https://dl.espressif.com/dl/idf-rust/dist/noarch/${RUST_SRC_DIST}.tar.xz \
25+
&& tar xvf ${RUST_SRC_DIST}.tar.xz \
26+
&& ./${RUST_SRC_DIST}/install.sh --destdir=${TOOLCHAIN_DESTINATION_DIR} --prefix="" --without=rust-docs \
27+
&& rm -rf ${RUST_SRC_DIST} ${RUST_SRC_DIST}.tar.xz \
2128
&& rustup toolchain link esp /opt/esp \
2229
&& rustup default esp
2330

24-
RUN wget -q https://dl.espressif.com/dl/idf-rust/dist/x86_64-unknown-linux-gnu/xtensa-esp32-elf-llvm11_0_0-llvmorg-11-init-21249-g36dbc8b-linux-amd64.tar.xz \
31+
RUN wget -q https://dl.espressif.com/dl/idf-rust/dist/${ARCH}/xtensa-esp32-elf-llvm11_0_0-llvmorg-11-init-21249-g36dbc8b-linux-amd64.tar.xz \
2532
&& tar xf xtensa-esp32-elf-llvm11_0_0-llvmorg-11-init-21249-g36dbc8b-linux-amd64.tar.xz \
2633
&& rm xtensa-esp32-elf-llvm11_0_0-llvmorg-11-init-21249-g36dbc8b-linux-amd64.tar.xz
2734

Lines changed: 45 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,69 @@
11
# Rust on Xtensa Installation for macOS M1
22

3+
Following instructions are specific for ESP32 and ESP32-S series based on Xtensa architecture.
4+
5+
Instructions for ESP-C series based on RISC-V architecture are described in document for [ESP32-C3](../README.md#esp32-c3).
6+
37
Tested OS: macOS Big Sur M1
48

59
## Prerequisites
610

711
- rustup - https://rustup.rs/
812

9-
## Commands
13+
## Installation commands
1014

11-
```
15+
```sh
1216
rustup toolchain install nightly
1317

14-
mkdir -p ~/.rustup/toolchains/esp
18+
VERSION="1.54.0-dev"
19+
ARCH="aarch64-apple-darwin"
20+
RUST_DIST="rust-${VERSION}-${ARCH}"
21+
RUST_SRC_DIST="rust-src-${VERSION}"
22+
TOOLCHAIN_DESTINATION_DIR="~/.rustup/toolchains/esp"
23+
24+
mkdir -p ${TOOLCHAIN_DESTINATION_DIR}
1525

16-
wget --continue https://dl.espressif.com/dl/idf-rust/dist/aarch64-apple-darwin/rust-1.53.0-dev-aarch64-apple-darwin.tar.xz
17-
tar xvf rust-1.53.0-dev-aarch64-apple-darwin.tar.xz
18-
./rust-1.53.0-dev-aarch64-apple-darwin/install.sh --destdir=~/.rustup/toolchains/esp --prefix="" --without=rust-docs
26+
wget "https://dl.espressif.com/dl/idf-rust/dist/${ARCH}/${RUST_DIST}.tar.xz"
27+
tar xvf ${RUST_DIST}.tar.xz
28+
./${RUST_DIST}/install.sh --destdir=${TOOLCHAIN_DESTINATION_DIR} --prefix="" --without=rust-docs
1929

20-
wget --continue https://dl.espressif.com/dl/idf-rust/dist/noarch/rust-src-1.53.0-dev.tar.xz
21-
tar xvf rust-src-1.53.0-dev.tar.xz
22-
./rust-src-1.53.0-dev/install.sh --destdir=~/.rustup/toolchains/esp --prefix=""
30+
wget "https://dl.espressif.com/dl/idf-rust/dist/noarch/${RUST_SRC_DIST}.tar.xz"
31+
tar xvf ${RUST_SRC_DIST}.tar.xz
32+
./${RUST_SRC_DIST}/install.sh --destdir=${TOOLCHAIN_DESTINATION_DIR} --prefix="" --without=rust-docs
2333

2434
rustup default esp
2535

26-
wget --continue https://dl.espressif.com/dl/idf-rust/dist/aarch64-apple-darwin/xtensa-esp32-elf-llvm11_0_0-aarch64-apple-darwin.tar.xz
36+
wget --continue "https://dl.espressif.com/dl/idf-rust/dist/${ARCH}/xtensa-esp32-elf-llvm11_0_0-aarch64-apple-darwin.tar.xz"
2737
tar xf xtensa-esp32-elf-llvm11_0_0-aarch64-apple-darwin.tar.xz
2838
export PATH="`pwd`/xtensa-esp32-elf-clang/bin/:$PATH"
2939

3040
wget --continue https://github.com/espressif/rust-esp32-example/archive/refs/heads/main.zip
3141
unzip main.zip
3242
cd rust-esp32-example-main
33-
idf.py build
3443
```
3544

45+
## Select architecture for the build
46+
47+
For the ESP32 - default (Xtensa architecture):
48+
49+
```sh
50+
idf.py set-target esp32
51+
```
52+
53+
For the ESP32-S2 (Xtensa architecture):
54+
55+
```sh
56+
idf.py set-target esp32s2
57+
```
58+
59+
For the ESP32-S3 (Xtensa architecture):
60+
61+
```sh
62+
idf.py set-target esp32s3
63+
```
64+
65+
## Build and flash
66+
67+
```sh
68+
idf.py build flash
69+
```
Lines changed: 45 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,68 @@
11
# Rust on Xtensa Installation for macOS x64
22

3-
Tested OS: macOS Big Sur x64
3+
Following instructions are specific for ESP32 and ESP32-S series based on Xtensa architecture.
4+
5+
Instructions for ESP-C series based on RISC-V architecture are described in document for [ESP32-C3](../README.md#esp32-c3).
46

7+
Tested OS: macOS Big Sur x64
58
## Prerequisites
69

710
- rustup - installed with nightly toolchain - https://rustup.rs/
811

9-
## Commands
12+
## Installation commands
1013

11-
```
14+
```sh
1215
rustup toolchain install nightly
1316

14-
mkdir -p ~/.rustup/toolchains/esp
17+
VERSION="1.54.0-dev"
18+
ARCH="x86_64-apple-darwin"
19+
RUST_DIST="rust-${VERSION}-${ARCH}"
20+
RUST_SRC_DIST="rust-src-${VERSION}"
21+
TOOLCHAIN_DESTINATION_DIR="~/.rustup/toolchains/esp"
22+
23+
mkdir -p ${TOOLCHAIN_DESTINATION_DIR}
1524

16-
wget https://dl.espressif.com/dl/idf-rust/dist/x86_64-apple-darwin/rust-1.53.0-dev-x86_64-apple-darwin.tar.xz
17-
tar xvf rust-1.53.0-dev-x86_64-apple-darwin.tar.xz
18-
./rust-1.53.0-dev-x86_64-apple-darwin/install.sh --destdir=~/.rustup/toolchains/esp --prefix="" --without=rust-docs
25+
wget "https://dl.espressif.com/dl/idf-rust/dist/${ARCH}/${RUST_DIST}.tar.xz"
26+
tar xvf ${RUST_DIST}.tar.xz
27+
./${RUST_DIST}/install.sh --destdir=${TOOLCHAIN_DESTINATION_DIR} --prefix="" --without=rust-docs
1928

20-
wget https://dl.espressif.com/dl/idf-rust/dist/noarch/rust-src-1.53.0-dev.tar.xz
21-
tar xvf rust-src-1.53.0-dev.tar.xz
22-
./rust-src-1.53.0-dev/install.sh --destdir=~/.rustup/toolchains/esp --prefix="" --without=rust-docs
29+
wget "https://dl.espressif.com/dl/idf-rust/dist/noarch/${RUST_SRC_DIST}.tar.xz"
30+
tar xvf ${RUST_SRC_DIST}.tar.xz
31+
./${RUST_SRC_DIST}/install.sh --destdir=${TOOLCHAIN_DESTINATION_DIR} --prefix="" --without=rust-docs
2332

2433
rustup default esp
2534

26-
wget https://dl.espressif.com/dl/idf-rust/dist/x86_64-apple-darwin/xtensa-esp32-elf-llvm11_0_0-x86_64-apple-darwin.tar.xz
35+
wget "https://dl.espressif.com/dl/idf-rust/dist/${ARCH}/xtensa-esp32-elf-llvm11_0_0-x86_64-apple-darwin.tar.xz"
2736
tar xf xtensa-esp32-elf-llvm11_0_0-x86_64-apple-darwin.tar.xz
2837
export PATH="`pwd`/xtensa-esp32-elf-clang/bin/:$PATH"
2938

3039
wget --continue https://github.com/espressif/rust-esp32-example/archive/refs/heads/main.zip
3140
unzip main.zip
3241
cd rust-esp32-example-main
33-
idf.py build
3442
```
3543

44+
## Select architecture for the build
45+
46+
For the ESP32 - default (Xtensa architecture):
47+
48+
```sh
49+
idf.py set-target esp32
50+
```
51+
52+
For the ESP32-S2 (Xtensa architecture):
53+
54+
```sh
55+
idf.py set-target esp32s2
56+
```
57+
58+
For the ESP32-S3 (Xtensa architecture):
59+
60+
```sh
61+
idf.py set-target esp32s3
62+
```
63+
64+
## Build and flash
65+
66+
```sh
67+
idf.py build flash
68+
```
Lines changed: 42 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Rust on Xtensa Installation for Windows x64
22

3+
Following instructions are specific for ESP32 and ESP32-S series based on Xtensa architecture.
4+
5+
Instructions for ESP-C series based on RISC-V architecture are described in document for [ESP32-C3](../README.md#esp32-c3).
6+
37
Tested OS: Windows 10 x64
48

59
## Prerequisites
@@ -8,41 +12,58 @@ Tested OS: Windows 10 x64
812
- rustup - installed with nightly toolchain - https://rustup.rs/
913
- Chocolatey - https://chocolatey.org/
1014

11-
## Commands for PowerShell
15+
## Installation commands for PowerShell
1216

13-
```
17+
```sh
1418
choco install 7zip
1519

1620
rustup toolchain install nightly
1721

18-
mkdir -p ~\.rustup\toolchains\esp
22+
$Version="1.54.0-dev"
23+
$Arch="x86_64-pc-windows-msvc"
24+
$RustDist="rust-${VERSION}-${ARCH}"
1925

20-
Invoke-WebRequest https://dl.espressif.com/dl/idf-rust/dist/x86_64-pc-windows-msvc/rust-1.53.0-dev-x86_64-pc-windows-msvc.tar.xz -OutFile rust-1.53.0-dev-x86_64-pc-windows-msvc.tar.xz
21-
7z e .\rust-1.53.0-dev-x86_64-pc-windows-msvc.tar.xz
22-
7z x .\rust-1.53.0-dev-x86_64-pc-windows-msvc.tar
23-
pushd rust-1.53.0-dev-x86_64-pc-windows-msvc
24-
cp -Recurse .\rustc\bin ~\.rustup\toolchains\esp\
25-
cp -Recurse .\rustc\lib ~\.rustup\toolchains\esp\
26-
cp -Recurse .\rustc\share ~\.rustup\toolchains\esp\
27-
cp -ErrorAction SilentlyContinue -Recurse .\rust-std-x86_64-pc-windows-msvc\lib\* ~\.rustup\toolchains\esp\lib\
28-
popd
26+
mkdir -p ~\.rustup\toolchains\ -ErrorAction SilentlyContinue
27+
pushd ~\.rustup\toolchains\
2928

30-
Invoke-WebRequest https://dl.espressif.com/dl/idf-rust/dist/noarch/rust-src-1.53.0-dev.tar.xz -OutFile rust-src-1.53.0-dev.tar.xz
31-
7z e .\rust-src-1.53.0-dev.tar.xz
32-
7z x .\rust-src-1.53.0-dev.tar
33-
pushd rust-src-1.53.0-dev
34-
cp -ErrorAction SilentlyContinue -Recurse .\rust-src\lib\* ~\.rustup\toolchains\esp\lib\
29+
Invoke-WebRequest "https://dl.espressif.com/dl/idf-rust/dist/${Arch}/${RustDist}.zip" -OutFile "${RustDist}.zip"
30+
7z x .\${RustDist}.zip
3531
popd
3632

3733
rustup default esp
3834

39-
Invoke-WebRequest https://dl.espressif.com/dl/idf-rust/dist/x86_64-pc-windows-msvc/xtensa-esp32-elf-llvm11_0_0-llvmorg-11-init-21249-g36dbc8b-win64.zip -OutFile xtensa-esp32-elf-llvm11_0_0-llvmorg-11-init-21249-g36dbc8b-win64.zip
35+
Invoke-WebRequest https://dl.espressif.com/dl/idf-rust/dist/${Arch}/xtensa-esp32-elf-llvm11_0_0-llvmorg-11-init-21249-g36dbc8b-win64.zip -OutFile xtensa-esp32-elf-llvm11_0_0-llvmorg-11-init-21249-g36dbc8b-win64.zip
4036
7z x xtensa-esp32-elf-llvm11_0_0-llvmorg-11-init-21249-g36dbc8b-win64.zip
41-
$ClangPath=Join-Path -Path (Get-Location) -ChildPath xtensa-esp32-elf-clang\bin
42-
$env:PATH="${ClangPath};$env:PATH"
37+
$env:LIBCLANG_PATH=Join-Path -Path (Get-Location) -ChildPath xtensa-esp32-elf-clang\bin
38+
$env:PATH+=";$env:LIBCLANG_PATH"
4339

4440
Invoke-WebRequest https://github.com/espressif/rust-esp32-example/archive/refs/heads/main.zip -OutFile rust-esp32-example.zip
4541
7z x rust-esp32-example.zip
4642
cd rust-esp32-example-main
47-
idf.py build
43+
```
44+
45+
## Select architecture for the build
46+
47+
For the ESP32 - default (Xtensa architecture):
48+
49+
```sh
50+
idf.py set-target esp32
51+
```
52+
53+
For the ESP32-S2 (Xtensa architecture):
54+
55+
```sh
56+
idf.py set-target esp32s2
57+
```
58+
59+
For the ESP32-S3 (Xtensa architecture):
60+
61+
```sh
62+
idf.py set-target esp32s3
63+
```
64+
65+
## Build and flash
66+
67+
```sh
68+
idf.py build flash
4869
```
Lines changed: 46 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,71 @@
11
# Rust on Xtensa Installation for Linux x64
22

3+
Following instructions are specific for ESP32 and ESP32-S series based on Xtensa architecture.
4+
5+
Instructions for ESP-C series based on RISC-V architecture are described in document for [ESP32-C3](../README.md#esp32-c3).
6+
37
Tested OS: Ubuntu 18 x64, Ubuntu 20 x64, Mint 20 x64, OpenSUSE Thumbleweed
48

59
## Prerequisites
610

711
- rustup - installed with nightly toolchain - https://rustup.rs/
812

9-
## Commands
13+
## Installation commands
1014

11-
```
15+
```sh
1216
sudo apt install gcc wget xz-utils
1317

1418
rustup toolchain install nightly
1519

16-
mkdir -p ~/.rustup/toolchains/esp
20+
VERSION="1.54.0-dev"
21+
ARCH="x86_64-unknown-linux-gnu"
22+
RUST_DIST="rust-${VERSION}-${ARCH}"
23+
RUST_SRC_DIST="rust-src-${VERSION}"
24+
TOOLCHAIN_DESTINATION_DIR="~/.rustup/toolchains/esp"
1725

18-
wget https://dl.espressif.com/dl/idf-rust/dist/x86_64-unknown-linux-gnu/rust-1.53.0-dev-x86_64-unknown-linux-gnu.tar.xz
19-
tar xvf rust-1.53.0-dev-x86_64-unknown-linux-gnu.tar.xz
20-
./rust-1.53.0-dev-x86_64-unknown-linux-gnu/install.sh --destdir=~/.rustup/toolchains/esp --prefix="" --without=rust-docs
26+
mkdir -p ${TOOLCHAIN_DESTINATION_DIR}
2127

22-
wget https://dl.espressif.com/dl/idf-rust/dist/noarch/rust-src-1.53.0-dev.tar.xz
23-
tar xvf rust-src-1.53.0-dev.tar.xz
24-
./rust-src-1.53.0-dev/install.sh --destdir=~/.rustup/toolchains/esp --prefix="" --without=rust-docs
28+
wget https://dl.espressif.com/dl/idf-rust/dist/${ARCH}/${RUST_DIST}.tar.xz
29+
tar xvf ${RUST_DIST}.tar.xz
30+
./${RUST_DIST}/install.sh --destdir=${TOOLCHAIN_DESTINATION_DIR} --prefix="" --without=rust-docs
31+
32+
wget https://dl.espressif.com/dl/idf-rust/dist/noarch/${RUST_SRC_DIST}.tar.xz
33+
tar xvf ${RUST_SRC_DIST}.tar.xz
34+
./${RUST_SRC_DIST}/install.sh --destdir=${TOOLCHAIN_DESTINATION_DIR} --prefix="" --without=rust-docs
2535

2636
rustup default esp
2737

28-
wget https://dl.espressif.com/dl/idf-rust/dist/x86_64-unknown-linux-gnu/xtensa-esp32-elf-llvm11_0_0-llvmorg-11-init-21249-g36dbc8b-linux-amd64.tar.xz
38+
wget https://dl.espressif.com/dl/idf-rust/dist/${ARCH}/xtensa-esp32-elf-llvm11_0_0-llvmorg-11-init-21249-g36dbc8b-linux-amd64.tar.xz
2939
tar xf xtensa-esp32-elf-llvm11_0_0-llvmorg-11-init-21249-g36dbc8b-linux-amd64.tar.xz
3040
export PATH="`pwd`/xtensa-esp32-elf-clang/bin/:$PATH"
3141

3242
wget --continue https://github.com/espressif/rust-esp32-example/archive/refs/heads/main.zip
3343
unzip main.zip
3444
cd rust-esp32-example-main
35-
idf.py build
45+
```
46+
47+
## Select architecture for the build
48+
49+
For the ESP32 - default (Xtensa architecture):
50+
51+
```sh
52+
idf.py set-target esp32
53+
```
54+
55+
For the ESP32-S2 (Xtensa architecture):
56+
57+
```sh
58+
idf.py set-target esp32s2
59+
```
60+
61+
For the ESP32-S3 (Xtensa architecture):
62+
63+
```sh
64+
idf.py set-target esp32s3
65+
```
66+
67+
## Build and flash
68+
69+
```sh
70+
idf.py build flash
3671
```

docs/rust-on-xtensa.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
# Rust on ESP32 (Xtensa)
1+
# Rust on ESP32 and ESP32-S series (Xtensa)
2+
3+
Following instructions are specific for ESP32 and ESP32-S series based on Xtensa architecture.
4+
5+
Instructions for ESP-C series based on RISC-V architecture are described in document for [ESP32-C3](../README.md#esp32-c3).
26

37
## Quick start
48

0 commit comments

Comments
 (0)