Building lv_micropython for Raspberry Pi Pico failed

Hi All,

I’m new to this forum, new to LVGL and pretty new to building C code.

What I’m trying to achieve is to get LVGL running on a Raspberry Pi Pico with an ILI9488 display and XPT2046 touch controller (I don’t care too much about the touch functionality for now, because I’m building a console with five rotary encoders and four buttons).

So far I haven’t been able to build lv_micropython. Building mpy-cross worked like a charm, but not the rp2 port. I’ve found to different instructions for how to do it and I’ve tried them both:
The first one I found in README.md:

Raspberry Pi Pico port

This port uses Micropython infrastructure for C modules and USER_C_MODULES must be given:


cd ports/rp2

make USER_C_MODULES=../../lv_bindings/bindings.cmake

This returns the following error:

[ -d build-PICO ] || cmake -S . -B build-PICO -DPICO_BUILD_DOCS=0 -DMICROPY_BOARD=PICO -DUSER_C_MODULES=…/…/lv_bindings/bindings.cmake
/bin/sh: 1: cmake: not found
make: *** [Makefile:18: all] Error 127

The second one I found in ports/mp2/README.md:

Building of the RP2 firmware is done entirely using CMake, although a simple

Makefile is also provided as a convenience. To build the firmware run (from

this directory):

$ make submodules

$ make clean

$ make

‘make submodules’ and ’make clean’ work, but ‘make’ gives the following error:

[ -d build-PICO ] || cmake -S . -B build-PICO -DPICO_BUILD_DOCS=0 -DMICROPY_BOARD=PICO
/bin/sh: 1: cmake: not found
make: *** [Makefile:18: all] Error 127

It seems that both approaches give a similar error, so my questions is: what is the correct approach to make it work?

Another question I have is how to set the flag ‘LV_COLOR_DEPTH=16’ when building for the RPi Pico?

I’m building on a Rapsberry Pi 400 running the latest version of Raspberry OS (Debian Bullseye) and I cloned the repository using ‘git clone --recurse-submodules https://github.com/lvgl/lv_micropython.git’

Hi @Harm , Welcome!

Currently lv_micropython supports RPi Pico, but no one has (yet) integrated and tested ILI9488 display with RPi Pico on lv_micropython. (ILI9488 was integrated only with ESP32).
So I expect some integration/development work would be involved here.

Someone has done this work with Xpt2046 touchschreen and ST7789 LCD. You can find more information here:

Looks like you need to install cmake…
On Ubuntu, Debian and the like you simply run sudo apt-get install cmake.

You provide it in the make command line. But first let’s work towards a display driver for the RPi Pico.

Hi @amirgon,

Thank you for your response.

I’ve installed cmake, but now it seems I’m still missing more things.

make USER_C_MODULES=…/…/lv_bindings/bindings.cmake
returns the following:
[ -d build-PICO ] || cmake -S . -B build-PICO -DPICO_BUILD_DOCS=0 -DMICROPY_BOARD=PICO -DUSER_C_MODULES=…/…/lv_bindings/bindings.cmake
PICO_SDK_PATH is /home/pi/lv_micropython/lib/pico-sdk
Defaulting PICO_PLATFORM to rp2040 since not specified.
Defaulting PICO platform compiler to pico_arm_gcc since not specified.
PICO compiler is pico_arm_gcc
CMake Error at /home/pi/lv_micropython/lib/pico-sdk/cmake/preload/toolchains/find_compiler.cmake:28 (message):
Compiler ‘arm-none-eabi-gcc’ not found, you can specify search path with
“PICO_TOOLCHAIN_PATH”.
Call Stack (most recent call first):
/home/pi/lv_micropython/lib/pico-sdk/cmake/preload/toolchains/pico_arm_gcc.cmake:20 (pico_find_compiler)
/usr/share/cmake-3.18/Modules/CMakeDetermineSystem.cmake:93 (include)
CMakeLists.txt:50 (project)

CMake Error: CMake was unable to find a build program corresponding to “Unix Makefiles”. CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
– Configuring incomplete, errors occurred!
make: *** [Makefile:18: all] Error 1

The lack of display driver worries me more. I had a look at the ILI9488 driver for ESP32: ili9XXX.py It seems that to make it work for the RPi Pico the library espidf.c/ispidf.h needs to be replaced by one written for the RPi Pico. I’m not sure if I would be able to do so (it would take me lot of time, at least, refreshing my C knowledge and getting to understand the ESP32 and RP2040).

To setup a development environment for Rpi Pico you should install all prerequisites such as the toolchain and build tools.
Just search the web for some examples.
Here is one example I found from a quick search: How to setup Raspberry Pi Pico SDK in Ubuntu - EmbeddedTechTips

A different approach is to use a C display driver instead of a MicroPython driver.
You can initialize and register your display in C, and then use Micropython to control it with LVGL.
But you need to find (or develop) a RPi Pico C display driver. If you solve this on the C side, integrating it with Micropython is not hard.

See for example Report of LVGL usage with Raspberry Pi Pico

If you want to keep everything in Micropython, you can use Micropython’s SPI functions to initialize the display and write data to it. (This would be slower than the C driver).

Hi @Harm, and welcome!

To build the rp2 port, you can follow the instructions that @eudoxos wrote here:

Of course you need cmake tools and rp2 SDK.

Here I attached the image I normally use, it is the version 8.1 with 16bpp and byte swap modifications in lv_conf.h
firmware lvgl v8.1.zip (515.0 KB)

I also attach the drivers for the ili9488(with dma) and xtp2046 and main.py as usage example. Maybe you need to adapt a little bit to your hardware and remove spscific stuff from the main.py
lcd_tsc_dma.zip (5.9 KB)

1 Like