Optional workspace wrapper for building MicroPython with multiple user C modules.
This repo does not include MicroPython or any user modules — clone them into this directory, then run the build scripts. It is not required for LVGL or any other module; each module repo documents direct builds without cmods.
git clone https://github.com/PyDevices/cmods.git
cd cmods
git clone https://github.com/micropython/micropython.git micropython
cd micropython && git submodule update --init --recursive && cd ..
# Optional — only for LVGL; skip and clone other user C modules instead
git clone https://github.com/PyDevices/lv_micropython_cmod.git lv_micropython_cmod
git clone https://github.com/PyDevices/lv_bindings.git lv_bindings
cd lv_bindings && git submodule update --init lvgl && cd ..
./lv_bindings/regenerate_lvmp.sh
./build_mp.sh --port unix --variant standardThe LVGL clone and regenerate_lvmp.sh steps are optional — use them only when building with LVGL. For other user C modules, clone those repos as siblings instead (see below).
Add more user C modules by cloning them as siblings (each needs micropython.mk and optional manifest.py).
USER_C_MODULES=$(pwd)— MicroPython discovers*/micropython.mkin immediate subdirectoriesmanifest.py— aggregates*/manifest.pyfrom subdirectoriesmicropython.cmake— aggregates*/micropython.cmakefor CMake ports (ESP32, RP2)
| Script | Port |
|---|---|
build_mp.sh |
Any MicroPython port (interactive or --port / --board / --variant) |
Examples:
./build_mp.sh # interactive
./build_mp.sh --port unix --variant standard
./build_mp.sh --port rp2 --board RPI_PICO2_W
./build_mp.sh --port esp32 --board ESP32_GENERIC_P4 --variant C6_WIFI| Repo | Role |
|---|---|
| lv_micropython_cmod | LVGL MicroPython glue |
| lv_bindings | LVGL binding generator |
| lv_circuitpython_mod | LVGL CircuitPython glue (separate workflow) |
CircuitPython does not use USER_C_MODULES. Clone lv_circuitpython_mod into this workspace if you want CP and MP trees side by side.
usdl2 is a native module exposing a pydisplay-sized subset of libSDL2 as import usdl2. Builds on MicroPython unix and windows ports. Clone into this workspace as usdl2/.
git clone https://github.com/PyDevices/usdl2.git
sudo apt install libsdl2-dev # Debian/Ubuntu — unix port onlyMicroPython unix (no patching):
./build_mp.sh --port unix --variant standard
./micropython/ports/unix/build-standard/micropython ./usdl2/test_usdl2.pyMicroPython windows (static SDL2; SDL2 not vendored — use the official MinGW dev ZIP):
# Download SDL2-devel-*-mingw.zip from https://github.com/libsdl-org/SDL/releases
# Unpack outside the repo, e.g. ~/SDL2-2.30.10
export SDL2_DEV=~/SDL2-2.30.10
sudo apt install gcc-mingw-w64 # cross-build from Linux/WSL
./build_mp.sh --port windows --variant standardSee usdl2/README.md for PKG_CONFIG_PATH, MSYS2, and runtime notes.
CircuitPython (requires patch script; see lv_circuitpython_mod README for CP clone setup):
./usdl2/apply_cp_unix_usdl_patches.sh --apply
./lv_circuitpython_mod/build_cp.sh --port unix --variant standard
./circuitpython/ports/unix/build-standard/micropython ./usdl2/test_usdl2.pyCreate any workspace directory, clone micropython, lv_micropython_cmod, and lv_bindings as siblings, and build from micropython/ with USER_C_MODULES pointing at the workspace root. See lv_micropython_cmod README.