This is the Rust Slint Template for ESP32-S3-BOX-3B based on ESP-IDF.
Clone this template with:
cargo generate https://github.com/WilstonOreo/slint-esp-workshopIf required, please install cargo-generate beforehand:
cargo install cargo-generate- Rust (minimum version 1.80)
- An IDE, we will use VSCode and the Slint extension for this workshop
winit- Application code forwinitbased platforms, e.g. desktop environments.esp32- Application code for ESP32-S3-BOX-3B based on ESP-IDF. This isui- Shared Slint code for the UI.common- Crate with shared Rust code for the ESP32 and desktop applications.
The winit build target is located in the winit directory.
No special requirements. Simply install Rust on your system and choose any IDE or text editor you like.
Do not forget to install the Rust extension for your IDE.
To build for the ESP32 box, you need to switch into the esp32 directory, because due to some limitations of the ESP-IDF build system, it cannot be part of the Cargo workspace.
The following steps are required to set up the environment for the ESP32-S3-BOX-3B.
Follow the prerequisites for esp-idf-template.
Assuming you have installed Rust (minimum version 1.80), please install the following packages via apt:
sudo apt install make gcc g++ libssl-dev pkg-config libudev-dev python3 python3-pip python3-venv
sudo apt install wget flex bison gperf cmake ninja-build ccache libffi-dev dfu-util libusb-1.0-0 usbutilscargo install espup # ESP toolchain setup
cargo install ldproxy # A tool to find a suitable linker on the system
cargo install espflash # Flashing toolChange the directory to the root of this repository. You need to set up the ESP toolchain and initialize the environment:
espup install # Installs the toolchain. Only has to be done once.
. ${HOME}/export-esp.sh # This step has to be done for each shell sessionYou should now be able to build the project with cargo build and run it with cargo run.
If not done already, open a PowerShell as administrator and install WSL:
wsl --installOpen a new WSL shell and do the following steps:
sudo apt update && sudo apt upgrade -ycurl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shsudo apt install gcc g++ libssl-dev pkg-config libudev-dev make flex bison gperf cmake ccache ninja-build
sudo apt install git wget libxkbcommon-x11-dev python3 python3-pip python3-venv python3.12-venv libffi-dev dfu-util libusb-1.0-0 usbutilsInstall these dependencies required to set up the ESP toolchain:
cargo install espup # ESP toolchain setup
cargo install ldproxy # A tool to find a suitable linker on the system
cargo install espflash # Flashing tool
cargo install cargo-generate # Required to actually check out the templateChange the directory to the root of this repository. You need to set up the ESP toolchain and initialize the environment:
espup install # Installs the toolchain. Only has to be done once.
. ${HOME}/export-esp.sh # This step has to be done for each shell sessionYou should now be able to build the project with cargo build.
- Download the installer at: https://github.com/dorssel/usbipd-win/releases/
- Assuming your ESP32 is connected to your computer, open a PowerShell as administrator and list the USB devices:
usbipd listIf everything is correctly connected and installed, a list of the something similar on the console:
2-9 303a:1001 USB Serial Device (COM8), USB JTAG/serial debug unit Not sharedThe id 2-9 on the left is the bus number. It might be different on your machine.
First, bind the bus to the usbipd service:
usbipd bind --busid 2-9 # This only has to be done onceAfter that, attach the bus to WSL:
usbipd attach --wsl --busid 2-9 # This has to be done for each WSL session and each time the device is disconnectedIn your WSL shell, test with lusb if you can see the ESP32 in the list.
The list in the console output must contain:
Bus 001 Device 003: ID 303a:1001 Espressif USB JTAG/serial debug unitNow, your device can be flashed and you can run your application via cargo run.