Go to file
JurajSadel a7282ddbaa
docs: Update LLVM installation instructions for Windows and Linux (#28)
Co-authored-by: Juraj Sadel <juraj.sadel@espressif.com>
2021-08-30 10:11:56 +02:00
.cargo run cargo from CMake, remove hardcoded target from .cargo/config (#5) 2021-06-14 08:51:26 +02:00
.github/workflows docker: split images to idf-rust and idf-rust-examples (#22) 2021-08-13 06:46:05 +02:00
components Fix esp32c3 build by moving to the new upstream target, riscv32imc-esp-espidf. 2021-08-20 14:21:24 +01:00
docs docs: Update LLVM installation instructions for Windows and Linux (#28) 2021-08-30 10:11:56 +02:00
main Simple inline assembly addition example (#24) 2021-08-17 11:08:22 +02:00
support docker: split images to idf-rust and idf-rust-examples (#22) 2021-08-13 06:46:05 +02:00
.gitignore docker: split images to idf-rust and idf-rust-examples (#22) 2021-08-13 06:46:05 +02:00
CMakeLists.txt Create components for Rust and C integration (#10) 2021-06-25 13:57:03 +02:00
Dockerfile docker: split images to idf-rust and idf-rust-examples (#22) 2021-08-13 06:46:05 +02:00
LICENSE tools: initial commit 2021-06-09 08:31:52 +02:00
README.md Update Readme.md with link to new Docker image 2021-08-18 10:36:52 +02:00
sdkconfig.defaults run cargo from CMake, remove hardcoded target from .cargo/config (#5) 2021-06-14 08:51:26 +02:00

README.md

Rust ESP32 Example

An example project demonstrating integration with Rust for the ESP32-S2 and ESP32-C3 microcontrollers.

This example starts a FreeRTOS task to call a function in Rust and display the results in C.

Setup

First, install the ESP-IDF SDK as shown in the Get Started guides. For best support of the ESP32-C3, install the SDK from the master branch.

ESP32 and ESP32-S series

To support the Xtensa instruction set, build and install custom LLVM and Rust toolchains as shown in the Rust On Xtensa guide.

Alternatively you might build the project in the container where image already contains pre-installed Rust and ESP-IDF:

docker run -it espressif/idf-rust-examples

Then follow instructions displayed on the screen.

ESP32-C3

Install the RISCV target for Rust:

rustup target add riscv32i-unknown-none-elf

Configure

First ensure that the environment variables for the ESP32 SDK are properly set up. If you have followed the instructions in the Getting Started guide, activate the environment with the get_idf alias:

get_idf

Next, configure the project for the desired MCU.

For the ESP32:

idf.py set-target esp32
idf.py menuconfig

For the ESP32-S2:

idf.py set-target esp32s2
idf.py menuconfig

For the ESP32-C3:

idf.py set-target esp32c3
idf.py menuconfig

Build

Build the project by running:

idf.py build

This also runs Cargo internally, building a static library out of Rust code.

Flash

Flash the compiled binary by running:

idf.py -p /dev/cu.SLAB_USBtoUART flash

Monitor

Connect to the UART over USB port to monitor the application console:

idf.py -p /dev/cu.SLABtoUART monitor

To exit the monitor, press Ctrl-].

Debugging on ESP32-WROVER-KIT

openocd -f board/esp32-wrover-kit-3.3v.cfg