Skip to content

Repository files navigation

LVGL PlatformIO Template / LVGL PlatformIO 模板

CI

English | 中文

Overview / 项目简介

EN: A template project for running LVGL with PlatformIO. It supports a desktop SDL2 emulator and the STM32F429 Discovery board, with a clean structure that can be used as a starting point for embedded UI projects.

中文:一个用于在 PlatformIO 中运行 LVGL 的模板工程,支持桌面 SDL2 模拟器和 STM32F429 Discovery 开发板,可作为嵌入式 UI 项目的起点。

Features / 功能特性

  • LVGL demo wired for both PC (SDL2) and STM32F429 Discovery. / LVGL 示例同时适配 PC(SDL2) 与 STM32F429 Discovery。
  • PlatformIO environments preconfigured for emulator and hardware builds. / 已预配置模拟器与硬件构建环境。
  • HAL adapters and SDL2 drivers organized under hal/. / HAL 适配层与 SDL2 驱动统一放在 hal/ 目录。
  • CI build on Linux, macOS, and Windows. / 支持 Linux、macOS、Windows 的 CI 构建。

Requirements / 环境要求

  • Visual Studio Code + PlatformIO extension / VS Code + PlatformIO 扩展
  • Python 3
  • SDL2 for desktop emulator / 桌面模拟器需要 SDL2

Quick Start / 快速开始

  1. Open this folder in VS Code. / 在 VS Code 中打开本目录。
  2. Install the PlatformIO extension when prompted. / 按提示安装 PlatformIO 扩展。
  3. Build or run from the PlatformIO sidebar. / 从 PlatformIO 侧边栏构建或运行。

Screenshot / 截图

PlatformIO Explorer

Build/Run with CLI / 命令行构建与运行

pio run -e emulator_64bits
pio run -e emulator_64bits -t execute
pio run -e stm32f429_disco

Install SDL2 / 安装 SDL2

Linux (Ubuntu, Debian, ...) / Linux(Ubuntu、Debian 等)

sudo apt-get install libsdl2-dev

macOS (Homebrew) / macOS(Homebrew)

brew install sdl2

On Apple Silicon, if you see x86_64/arm64 linker mismatches, either add -arch arm64 to build_flags or run the emulator via system Python. / 在 Apple Silicon 上,如果遇到 x86_64/arm64 链接架构不匹配,可在 build_flags 中加入 -arch arm64,或通过系统 Python 运行模拟器。

pio run -e emulator_64bits -t execute

Windows (MSYS2) / Windows(MSYS2)

pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-SDL2

Then add the MSYS2 mingw64/bin path to your system PATH. / 然后将 MSYS2 的 mingw64/bin 路径加入系统 PATH

Project Structure / 项目结构

.
├─ hal/           # Hardware/SDL2 adapters / 硬件与 SDL2 适配层
├─ lib/           # Local libraries / 本地库
├─ src/           # Application code / 应用代码
├─ support/       # Helper scripts/assets / 辅助脚本与资源
├─ test/          # PlatformIO tests / PlatformIO 测试
└─ platformio.ini # Build environments / 构建环境配置

Notes / 备注

  • The emulator environment uses SDL2 and compiles LVGL demos by default. / 模拟器环境使用 SDL2,并默认编译 LVGL demo。
  • Remove demo build flags if you want a clean application skeleton. / 如果需要干净的应用骨架,可移除 demo 构建参数。

License and Credits / 许可与致谢

MIT License. This project is based on the LVGL PlatformIO example and includes LVGL under its own license. See LICENSE for details. / MIT License。本项目基于 LVGL PlatformIO 示例,并包含按其自身许可发布的 LVGL。详见 LICENSE

About

LVGL PlatformIO 嵌入式 UI 模板 / LVGL PlatformIO template with SDL2 emulator and STM32F429 Discovery support.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages