lv_binding_micropython icon indicating copy to clipboard operation
lv_binding_micropython copied to clipboard

missing espidf MicroPython module

Open selcukgun opened this issue 9 months ago • 6 comments

I'm encountering an issue where the espidf MicroPython module is not generated during the normal build process documented in lv_micropython repo.

Steps to Reproduce (under lv_micropython repo root directory):

  1. Run the following command: make -C ports/esp32 BOARD=ESP32_GENERIC_C6 LV_CFLAGS="-DLV_COLOR_DEPTH=16" PORT=/dev/ttyACM0 deploy
  2. Attempt to import the module in MicroPython: from ili9XXX import st7789
  3. This results in:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "ili9XXX.py", line 19, in <module>
ImportError: no module named 'espidf'

Additional Context:

I attempted to generate the bindings using the gen_mpy.py tool manually by passing hundreds of include flags, but I encountered dependency issues (e.g., missing headers) and the process still failed to produce the complete module.

It appears that the espidf module is not being generated as expected. is there any other way to use st7789 display?

Request:

  1. Is there a build option or flag within the default build system that ensures the espidf MicroPython module is generated?
  2. Alternatively, can the generation of the espidf module be integrated into the standard build process (i.e., via the make command above) without needing to manually invoke gen_mpy.py?

Any guidance or fixes would be greatly appreciated, as manual generation with gen_mpy.py has proven to be error-prone due to the large number of dependencies.

selcukgun avatar Mar 21 '25 05:03 selcukgun

It longer longer works with the ESP32.. I am not sure why all of the esp32 related build stuff was removed but it was.

kdschlosser avatar Mar 25 '25 06:03 kdschlosser

Hello!

This is a known issue, the file espidf.c is currently not compiled into an MicroPython module, as it needs to be updated. The issue is that CONFIG_IDF_TARGET_* is not defined during compilation, and esp32/clk.h is not found. This is on my list to fix. Till then it is not possible to use drivers from ili9xxx.py. My plan is also to include LVGL builtin display drivers instead of this ili9xxx.py, but gen_mpy.py generator has a bug when those are included in build process.

So, please patient till espidf.c issue is fixed, or go with older lv_micropython version.

PGNetHun avatar Mar 25 '25 07:03 PGNetHun

I have also encountered the same problem. When can it be solved?

celiu-2000 avatar Mar 29 '25 14:03 celiu-2000

I gave a try to this project: https://github.com/lvgl-micropython/lvgl_micropython

The following one liner worked great.

python3 make.py esp32 BOARD=ESP32_GENERIC_C6 DISPLAY=st7789

it will print esptool commad at the end like the following:

/home/selcuk/.espressif/python_env/idf5.2_py3.10_env/bin/python -m esptool --chip esp32c6 -p /dev/ttyACM0 -b 460800 --before default_reset --after hard_reset write_flash --flash_mode dio --flash_size 4MB --flash_freq 80m --erase-all 0x0 /home/selcuk/projects/esp32/lvgl_micropython/build/lvgl_micropy_ESP32_GENERIC_C6-4.bin

After this you can use the sample code for LVGL in the repo after setting your pins for SPI etc.

@kdschlosser Thank you for this smooth solution!

selcukgun avatar Mar 30 '25 18:03 selcukgun

me too..... make USER_C_MODULES="../../user_modules" LV_CFLAGS="-DLV_COLOR_DEPTH=16 -DLV_COLOR_16_SWAP=1" BOARD=ESP32_GENERIC_S3 (master) in esp32-s3-box-3: get error ImportError: no module named 'ili9xxx'

culionbear avatar May 26 '25 02:05 culionbear

Is there any timetable for addressing this? I am up for investigating it further if there's more information to go on.

If not, which versions of lv_micropython are unaffected by this?

thatbudakguy avatar Aug 25 '25 18:08 thatbudakguy