Embedded
Slint runs on many embedded platforms.
The platform descriptions below cover what has been tested for deployment. For the development environment, we recommend using a recent desktop operating system and compiler version.
Embedded Linux
Slint runs on a variety of embedded Linux platforms. Generally speaking, Slint requires a modern Linux userspace with working OpenGL ES 2.0 (or newer) or Vulkan drivers. We’ve had success running Slint on
- Yocto based distributions.
- BuildRoot based distributions.
- Torizon.
For C++ applications see meta-slint ↗ for recipes.
Rust application work out of the box with Yocto’s Rust support.
Toradex provides TorizonCore ↗, a Linux based platform for its embedded devices that packages applications in docker containers.
We provide our demos compiled for Toradex as docker containers.
Prerequisites
- A device running Torizon
- A running weston container ↗
- SSH access to the Torizon device
Running
Our pre-compiled demos are available in four different variants:
- Compiled for ARM 32-bit as
armhf
and compiled for ARM 64-bit asarm64
- Compiled with Linux DRI or with support for Vivante GPUs (
-vivante
suffix)
A complete list of all containers can be found at
https://github.com/orgs/slint-ui/packages?q=torizon&tab=packages&q=torizon ↗
For example, to run the container on an i.MX8 board with Vivante GPU, use the following command line:
Selecting Demos
By default, the printer demo from /usr/bin is run. The containers however package multiple demos:
- printerdemo
- slide_puzzle
- gallery
- opengl_underlay
- carousel
- todo
- energy-monitor
- home-automation
Run then by specifying them as parameter to docker run
, for example:
Microcontrollers
Slint’s platform abstraction allows for integration into any Rust or C++ based Microcontroller development environment. Developers need to implement functionality to feed input events such as touch or keyboard, as well as displaying the pixels rendered by Slint into a frame- or linebuffer.
We provide templates for a few off-the-shelf development boards from some of the silicon vendors.
You will need to use the mcu-board-support
crate. This crate re-export a entry
attribute macro to apply to the main
function, and a init()
function that should be called before creating the Slint UI.
In order to use this backend, the final program must depend on both slint
and mcu-board-support
.
The main.rs will look something like this
Since mcu-board-support is at the moment an internal crate not uploaded to crates.io, you must use the git version of slint, slint-build, and mcu-board-support
In your build.rs, you must include a call to slint_build::print_rustc_flags().unwrap()
to set some of the flags.
Espressif (ESP32)
To use Slint with your C++ application, you can follow the instructions on the Espressif Documentation site ↗
Prerequisites
- ESP Rust Toolchain: https://esp-rs.github.io/book/installation/installation.html ↗
espflash
: Install viacargo install espflash
.
When flashing, with espflash
, you will be prompted to select a USB port. If this port is always the same, then you can also pass it as a parameter on the command line to avoid the prompt. For example if
/dev/ttyUSB1
is the device file for your port, the command line changes to espflash --monitor /dev/ttyUSB1 path/to/binary/to/flash_and_monitor
.
ESP32-S2-Kaluga-1
To compile and run the Slint Printer demo:
The device needs to be connected with the two USB cables (one for power, one for data)
ESP32-S3-Box
To compile and run the Slint Printer demo:
ST (STM32)
STM32H735G-DK
You can start with the template slint-cpp-template-stm32h735g-dk.zip ↗
STM32H747I-DISCO
You can start with the template slint-cpp-template-stm32h747i-disco.zip ↗
Raspberry Pi (Pico)
Only Rust programs are currently supported on the Raspberry Pi Pico.
On the Raspberry Pi Pico
Build the Slint Printer demo with:
The resulting file can be flashed conveniently with elf2uf2-rs ↗. Install it using cargo install
:
Then upload the demo to the Raspberry Pi Pico: push the “bootsel” white button on the device while connecting the micro-usb cable to the device, this connect some storage where you can store the binary.
Or from the command on linux: (connect the device while pressing the “bootsel” button.
On the Raspberry Pi Pico2
Build the Slint Printer demo with:
The resulting file can be flashed conveniently with picotool ↗. You should build it from source.
Then upload the demo to the Raspberry Pi Pico: push the “bootsel” white button on the device while connecting the micro-usb cable to the device, this connects some USB storage on your workstation where you can store the binary.
Or from the command on linux (connect the device while pressing the “bootsel” button):
Using probe-rs
This requires probe-rs ↗ and to connect the pico via a probe (for example another pico running the probe).
Then you can simply run with cargo run
Flashing and Debugging the Pico with probe-rs
’s VSCode Plugin
Install probe-rs-debugger
and the VSCode plugin as described here ↗.
Add this build task to your .vscode/tasks.json
:
The release-with-debug
profile is needed, because the debug build does not fit into flash.
You can define it like this in your top level Cargo.toml
:
Now you can add the launch configuration to .vscode/launch.json
:
This was tested using a second Raspberry Pi Pico programmed as a probe with DapperMime ↗.
Other Platforms
Contact us ↗ if you want to use Slint on other platforms/versions.
© 2024 SixtyFPS GmbH