|
| 1 | +--- |
| 2 | +title: "Slint with Rust on ESP32 Workshop - no_std and std" |
| 3 | +date: 2025-06-03T00:00:00+01:00 |
| 4 | +tags: ["Workshop", "Slint", "Rust", "ESP32", "no_std", "std", "Embedded UI"] |
| 5 | +--- |
| 6 | + |
| 7 | +Welcome to the **Slint with Rust on ESP32** workshop! |
| 8 | + |
| 9 | +## About this workshop |
| 10 | + |
| 11 | +This hands-on workshop is designed to introduce embedded developers to designing modern graphical user interfaces using the [Slint UI Toolkit](https://slint.dev) in Rust for the ESP32 platform. The workshop supports **both `no_std` (bare-metal) and `std` (ESP-IDF) approaches**, with **`no_std` as the primary and recommended path** due to its simplicity, better performance, and official Espressif support. |
| 12 | + |
| 13 | +Unlike traditional workflows that start directly on embedded hardware, this training emphasizes a **desktop-first** approach: you begin by developing and testing the UI on your desktop, then port the same code to an embedded platform. This is made possible thanks to Slint's cross-platform design and support for Rust in both `no_std` and `std` environments. |
| 14 | + |
| 15 | +While Slint supports other languages such as C++ or Python, this workshop is focused entirely on **pure Rust**. |
| 16 | + |
| 17 | +> Although the examples run on the ESP32-S3, the concepts can be ported to other [ESP32 targets with display capability](https://github.com/espressif/esp-bsp). |
| 18 | +
|
| 19 | +## Choosing Your Development Approach |
| 20 | + |
| 21 | +This workshop supports both development approaches with **`no_std` (bare-metal) as the primary recommendation**: |
| 22 | + |
| 23 | +### `no_std` (Bare-Metal) - **RECOMMENDED** ✅ |
| 24 | + |
| 25 | +**Why choose `no_std`:** |
| 26 | +- ✅ **Much simpler setup** - No C/C++ toolchain required |
| 27 | +- ✅ **Pure Rust** - No ESP-IDF complexity |
| 28 | +- ✅ **Official Espressif support** - First-class citizen in esp-hal ecosystem |
| 29 | +- ✅ Smaller binary size and memory footprint |
| 30 | +- ✅ Better performance and lower latency |
| 31 | +- ✅ Direct hardware control with esp-hal |
| 32 | +- ✅ Faster compilation times |
| 33 | +- ✅ More predictable behavior |
| 34 | +- ✅ **Highly portable code** - Works across different embedded platforms |
| 35 | + |
| 36 | +**When to choose `no_std`:** Recommended for most embedded projects, especially when you want a pure Rust experience. |
| 37 | + |
| 38 | +### `std` (ESP-IDF) - Alternative Approach |
| 39 | + |
| 40 | +**When to choose `std`:** |
| 41 | +- You specifically need existing ESP-IDF C/C++ components |
| 42 | +- You have a large existing C/C++ codebase to integrate |
| 43 | +- You require std-only crates that don't have no_std alternatives |
| 44 | + |
| 45 | +**Considerations with `std`:** |
| 46 | +- ❌ **Complex setup** - Requires full C/C++ ESP-IDF toolchain |
| 47 | +- ❌ Larger binary size and higher memory usage |
| 48 | +- ❌ Slower compilation times |
| 49 | +- ❌ Platform-specific code - harder to port to other embedded platforms |
| 50 | + |
| 51 | +**Default Choice:** Start with **`no_std`** for the best embedded Rust experience. Only switch to `std` if you have specific requirements that necessitate it. |
| 52 | + |
| 53 | +## Agenda |
| 54 | + |
| 55 | +With the prerequisites in place, follow the assignments in order: |
| 56 | + |
| 57 | +- [Assignment 1: Environment Setup](assignment-1) — install Rust toolchain, dependencies, and tools for Slint and ESP32. |
| 58 | +- [Assignment 2: Run GUI on Desktop](assignment-2) — create a simple two-tab UI with the Slint logo and a placeholder for Wi-Fi list. |
| 59 | +- [Assignment 3: Run GUI on ESP32-S3](assignment-3) — port the same app to embedded hardware such as M5Stack CoreS3, ESoPe Board (SLD_C_W_S3), ESP32-S3-BOX-3, or ESP32-S3-LCD-EV-Board. |
| 60 | +- [Assignment 4: Add Wi-Fi list on Desktop](assignment-4) — populate the placeholder list with available networks using the OS backend. |
| 61 | +- [Assignment 5: Add Wi-Fi scan on ESP32](assignment-5) — replace the desktop data source with live Wi-Fi scan results from the ESP32. |
| 62 | +- [Assignment 6: Explore more Slint examples](assignment-6) — interactive demos and links to advanced usage patterns. |
| 63 | + |
| 64 | +## Prerequisites |
| 65 | + |
| 66 | +**Hardware:** |
| 67 | + |
| 68 | +- **[M5Stack CoreS3](https://shop.m5stack.com/products/m5stack-cores3-esp32s3-lotdevelopment-kit)** (recommended - touchscreen, speakers, microphone) |
| 69 | +- [ESoPe Board SLD_C_W_S3 with Schukat Smartwin display-concept](https://esope.de) (RGB interface) |
| 70 | +- Alternative boards: [ESP32-S3-BOX-3](https://github.com/espressif/esp-bsp/tree/master/bsp/esp32_s3_box_3), [ESP32-S3-LCD-EV-Board](https://github.com/espressif/esp-bsp/tree/master/bsp/esp32_s3_lcd_ev_board) |
| 71 | +- USB-C cable for M5Stack CoreS3 and ESP32-S3-BOX-3, or USB micro cable with [ESP-Prog](https://docs.espressif.com/projects/esp-iot-solution/en/latest/hw-reference/ESP-Prog_guide.html) for ESoPe board |
| 72 | + |
| 73 | +**Software:** |
| 74 | + |
| 75 | +- [Rust toolchain](https://rustup.rs) (stable channel is sufficient) |
| 76 | +- [`espup`](https://github.com/esp-rs/espup) to install and configure `esp-rust` toolchain (**recommended method**) |
| 77 | +- `espflash` for flashing firmware |
| 78 | +- `cargo-generate` for creating project templates |
| 79 | +- [JetBrains RustRover](https://www.jetbrains.com/rust/) or [CLion](https://www.jetbrains.com/clion/) — **recommended IDEs**, available free for students and open source projects |
| 80 | +- Alternatively, VS Code with Rust Analyzer, or any terminal-based Rust development setup |
| 81 | + |
| 82 | +JetBrains IDEs (CLion or RustRover) are highly recommended and provide excellent Rust tooling out of the box. These tools are available free of charge for students and open source contributors. |
| 83 | + |
| 84 | +Follow [Slint Embedded Setup Instructions](https://docs.slint.dev/latest/docs/slint/) for more details. |
| 85 | + |
| 86 | +## Time Estimate |
| 87 | + |
| 88 | +{{< alert icon="mug-hot">}} |
| 89 | +**Estimated time: 2–3 hours** |
| 90 | +{{< /alert >}} |
| 91 | + |
| 92 | +Pacing depends on your experience with embedded Rust and Slint. |
| 93 | + |
| 94 | +## Target Audience |
| 95 | + |
| 96 | +This workshop is suitable for: |
| 97 | + |
| 98 | +- Embedded developers with C/C++ background exploring Rust |
| 99 | +- Rust developers curious about no_std embedded development |
| 100 | +- Anyone interested in building fast, modern GUIs for microcontrollers |
| 101 | + |
| 102 | +Basic knowledge of embedded systems and Rust syntax is helpful but not required. |
| 103 | + |
| 104 | +## Support and Feedback |
| 105 | + |
| 106 | +If you get stuck or have feedback, please open a [discussion on GitHub](https://github.com/espressif/developer-portal/discussions) or reach out to the [Slint Discord](https://slint.dev/community.html). |
| 107 | + |
| 108 | +## Feedback and Contributions |
| 109 | + |
| 110 | +This workshop is available on GitHub and welcomes contributions and improvements. If you encounter issues or want to propose updates, feel free to [open a discussion or pull request](https://github.com/espressif/developer-portal/discussions). |
| 111 | + |
| 112 | +## Goals |
| 113 | + |
| 114 | +By the end of this workshop, you will: |
| 115 | + |
| 116 | +- Be able to create a UI with Slint in Rust using `no_std` |
| 117 | +- Deploy graphical apps to ESP32-S3 boards with display and optional touch |
| 118 | +- Understand how to separate logic from presentation with properties and callbacks |
| 119 | +- Integrate the Slint runtime with an embedded framebuffer and event loop |
| 120 | + |
| 121 | +--- |
| 122 | + |
| 123 | + |
| 124 | +## Credits |
| 125 | + |
| 126 | +This workshop was created in collaboration between [Espressif Systems](https://www.espressif.com), [Slint](https://slint.dev/esp32), [M5Stack](https://m5stack.com), [ESoPe](https://esope.de), and [Schukat](https://shop.schukat.com/de/de/EUR/search/esope). |
| 127 | + |
| 128 | +If you are interested in organizing a workshop or need support, we recommend reaching out to the trainer: [Michael Winkelmann](https://winkelmann.site/). |
| 129 | + |
| 130 | +Let's get started: [Assignment 1](assignment-1) |
0 commit comments