lvgl-micropython
PyDevices / lvgl-micropython

lvgl-micropython

Native MicroPython LVGL module: link it into firmware with USER_C_MODULES (Make or CMake). It brings GC-aware allocation, usermod registration, and smoke tests, and consumes lvgl-bindings generated/lvgl_micropython.c (run regenerate_lvmp.sh) so the build gets a native import lvgl.

Clone as a sibling of lvgl-bindings/ and micropython/. CircuitPython is a different path — see lvgl-circuitpython.

Source on GitHub lvgl-bindings

Generate bindings

cd lvgl-bindings
git submodule update --init lvgl
python3 -m venv .venv && .venv/bin/pip install -r requirements.txt
./regenerate_lvmp.sh

Build into MicroPython

Make ports (unix, …)

USER_C_MODULES is the workspace parent containing this repo.

cd micropython/ports/unix
make USER_C_MODULES=../../.. \
  FROZEN_MANIFEST=../../../lvgl-micropython/manifest.py

# Optional bindings override:
# BINDINGS_DIR=/path/to/lvgl-bindings

CMake ports (esp32, rp2)

USER_C_MODULES points at this repo (or its micropython.cmake).

cd micropython/ports/esp32
make BOARD=ESP32_GENERIC_S3 \
  USER_C_MODULES=../../../lvgl-micropython

# Plus other usermods:
make BOARD=ESP32_GENERIC_S3 \
  USER_C_MODULES="/abs/path/to/lvgl-micropython;/abs/path/to/displayif"

Smoke test

./micropython/ports/unix/build-standard/micropython \
  ./lvgl-bindings/tools/test_lvgl_smoke.py

Related