Install Embedded Rust for ESP32 on Linux Mint 21.3 over VirtualBox/Windows 11 (tested with ESP32-C3-DevKitM-1)

This video show steps to install Embedded Rust for ESP32 on Linux Mint 21.3 over VirtualBox/Windows 11 (tested with ESP32-C3-DevKitM-1). Basically I follow the steps in Rust on ESP Book > Rust Installation, with my try and error and re-try and success experience.


Install Rust

Install Rust using rustup script:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Install espup to install tools for Espressif

Install espup (requirement and espup):
sudo apt-get install -y gcc build-essential curl pkg-config
cargo install espup

Install Toolchains for Espressif targets using espup:
espup install

Install additional software covered in std Development Requirements:
(https://esp-rs.github.io/book/installation/std-requirements.html)
sudo apt-get install git wget flex bison gperf python3 python3-pip python3-venv cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0

Install ldproxy
cargo install ldproxy

Setup the Environment Variables:
cat $HOME/export-esp.sh >> ~/.bashrc
So far espup installed the following tools:
- Espressif Rust fork with support for Espressif targets
- nightly toolchain with support for RISC-V targets
- LLVM fork with support for Xtensa targets
- GCC toolchain that links the final binary

Then install cargo-generate and generating Projects from Templates

 Install cargo-generate:
cargo install cargo-generate
With cargo-generate installed, you can generate project base on:
- esp-template - no_std template.
- esp-idf-template - std template.

Generate a project based on esp-template:
cargo generate esp-rs/esp-template
Create project based on esp-idf-template:
cargo generate esp-rs/esp-idf-template cargo

Switch to project folder, to build/run the project

Compile the project (without flash to device):
cargo build

Before run to compile the project, flash it, and open a serial monitor with target device, you have to:

 - Install espflash:
sudo apt install libudev-dev
cargo install espflash

- Grant permission to user to access serial port if you have not:
sudo usermod -a -G dial <USER&gt:
logout and login.
Then, you can compile the project, flash it, and open a serial monitor with target device:
cargo run
Done.


Related:
Install Rust-embedded on Micro:bit, run on Linux Mint 21.1.

Next:
Rust on ESP (esp-rs), toggle GPIO to control LED on ESP32-C6.

Comments

Popular posts from this blog

480x320 TFT/ILI9488 SPI wih EP32C3 (arduino-esp32) using Arduino_GFX Library

my dev.tools - FNIRSI 2C23T 3-in-1 Dual Channel Oscilloscope/Multimeter/Signal Generator