Skip to content

Commit cc5d739

Browse files
committed
Add a README for stm32-lvgl
1 parent fe246b7 commit cc5d739

File tree

1 file changed

+41
-2
lines changed

1 file changed

+41
-2
lines changed

stm32-lvgl/README.md

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,46 @@
11
# stm32-lvgl
22

3-
...
3+
<img src="assets/video.mov" />
4+
5+
This sample code is demonstrating a "full" graphical firmware running on an STM32 microcontroller board, concretely the STM32F746G "Discovery" board. It shows using:
6+
7+
- **ELF file format**, linking with lld, with a custom simple linker script (and thus it builds identically on both macOS and Linux hosts)
8+
- **LLVM Embedded Toolchain for ARM**
9+
- **LVGL** graphical/input/animation library
10+
- The **DRAM, LCD, touch panel, GPIO pins and interrupts** on the STM32F746G
11+
- **No other SDKs or library dependencies** -- all the startup code, including MCU, board and peripheral initialization is done in Swift source code
12+
13+
Additionally, this sample code:
14+
15+
- Has **LSP integration** set up via the `.sourcekit-lsp/config.json` file, confirmed to work in multiple code editors (VS Code, Sublime Text, Zed)
16+
- Uses **SwiftPM's toolset.json** to define compiler and linker flags
17+
- Has a host OS (macOS, Linux) **"simulator" using SDL** that can use the same "business logic" code to render the same LVGL UI.
418

519
## How to build and run this example:
620

7-
...
21+
1. Connect the STM32F746G-DISCO board via the ST-LINK USB port to your Mac.
22+
2. Install a recent nightly "main" Swift toolchain. This is best done using `swiftly`, for example with:
23+
```console
24+
$ swiftly install main-snapshot-2025-04-12
25+
$ swiftly use main-snapshot-2025-04-12 -g
26+
```
27+
3. Install the `stlink` (https://github.com/stlink-org/stlink) command line tools, e.g. via `brew install stlink`.
28+
4. Run a provided shell script that fetches the LVGL and LLVM dependencies:
29+
```console
30+
$ ./fetch-dependencies.sh
31+
```
32+
5. Build the firmware by running make:
33+
```console
34+
$ make
35+
```
36+
6. Flash the built firmware by running make with the following target:
37+
```console
38+
$ make flash
39+
```
40+
41+
You should now see the UI animating on the board's LCD display, and the touch screen should react to inputs.
42+
43+
Optionally, you can also run build and run the code in a desktop OS SDL "simulator" by:
44+
```console
45+
$ make simulator
46+
```

0 commit comments

Comments
 (0)