Issues when building rp2 port for micropython

I got some issues when I build rp2 micropython according to readme file .
Error information as follows :
“lv_micropython/py/objmodule.c.obj:(.rodata.mp_builtin_module_table+0xe4): undefined reference to mp_module_lvgl'" "objmodule.c.obj:(.rodata.mp_builtin_module_table+0xec): undefined reference to mp_module_lodepng’”
May I ask for some help .

I got the same issue. I´m pretty sure it´s something trivial and that gen_mpy.py is involved in the solution, yet I cannot find how to solve this.
Like you, i followed exactly the README.md to build microypthon on Pi PICO, starting from cloning the github repo https://github.com/lvgl/lv_micropython

I´m not familiar enough with the CMake and LVGL Micropython bindings to be able to solve this. It would be nice if anybody would have a look at this problem!

Hi @alphaalpha and @ACBIAS

Please follow these steps:

  • Update LVGL git submodules recursively (git submodule update --init --recursive lib/lv_bindings)
  • Initialize Micropython git submodules (make -C ports/rp2 BOARD=PICO submodules)
  • Build mpy-cross (make -j $(nproc) -C mpy-cross)
  • Build PICO port with LVGL user module (make -j $(nproc) -C ports/rp2 BOARD=PICO USER_C_MODULES=../../lib/lv_bindings/bindings.cmake)

You can see the expected build log in the CI.

If this works for you please let me know and I’ll update the README file.

1 Like

Thanks a lot @amirgon it worked perfectly.
Building the micropython submodules first, then mpy-cross solved it, and the linker happily put the pieces together, resulting in a firmware file.

I´ll give a test to the firmware in the next days, with a couple of different displays drivers, and will give my feedback here.

It does really good. Building process has pass ! Thanks a lot.

Hi borther, I completely compile micropython environment of rp2 and unix port. Thands a lot . Well, I got another issue here when I try to run examples in ‘unix port’. error information like this :slight_smile:
"Traceback (most recent call last):
File “test_rp2_lvgl.py”, line 2, in
File “lv_utils.py”, line 45, in
RuntimeError: Missing machine.Timer implementation!
"
It seems micropython interpreter loss part of machine lib. I try to download machine lib again , but issuse still does . Could you give me some help ?

hello @alphaalpha
Without seeing your code, it´s hard to debug, but I think it´s not related to lvgl_micropython.

Open the python interpreter on the Pico and try:

from machine import Timer
import lvgl as lv
lv.init()

this should works flawlessly.

1 Like

The built-in “machine” module contains Timer class

What do you mean by “download machine lib”? Download from where? “machine” is a built in module, you are not supposed to download it from anywhere.

The following should run with no errors on rp2:

from machine import Timer
1 Like