Lv_micropython import display_driver error

>>> import display driver
Traceback (most recent call last):
  File "<stdin>", line 1
SyntaxError: invalid syntax
>>> import display_driver
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "display_driver.py", line 1, in <module>
  File "display_driver_utils.py", line 5, in <module>
  File "lv_utils.py", line 45, in <module>
RuntimeError: Missing machine.Timer implementation!

Hi @somebodyLi !
Could you provide some context?
What port are you building?
It looks like your port is missing “machine.Timer” module so it’s probably not unix, esp32 or stm32.
Or did you change something in lv_micropython?

Hi @amirgon
I build unix port on macos, the only change I made is like this

- CWARN += -Wextra -Wno-unused-parameter -Wpointer-arith -Wdouble-promotion -Wfloat-conversion
+ CWARN += -Wextra -Wno-unused-parameter -Wpointer-arith -Wdouble-promotion -Wfloat-conversion -Wno-tautological-overlap-compare

and the __attribute__ to make it compiled.
I aware that there is a fallback for machine.Timer lv_timer. I don’t know why it’s doesn’t work.

It looks like something local to your environment.
manifest.py specifies the frozen modules, lv_timer.py among them.

Let’s find out if the problem is specific to lv_timer.py, or general to frozen Python modules.
Even if a module is frozen, maybe it’s not found due to python path.

I can suggest the following:

  • Clean and rebuild lv_micropython. Make sure you update git submodules recursively beforehand.
  • Make sure libffi is not missing. See: https://github.com/micropython/micropython/issues/5224
  • Try to import lv_timer.py explicitly from the REPL. Does it work?
  • Try to import some other frozen modules from the REPL. upip for example. Does it work?

Also, try to add frozen modules to Micropython path.
See:

Hi @amirgon !

  1. submodules update already
  2. libffi is up to date


it seems that the mpython path is fine

You got OSError: [Error 2] ENOENT thrown on lv_timer.py line 18:

It seems that libc.so.6 is not available on mac os.
According to this on mac os it should be libc.dylib, and librt.so should also change.

Could you try changing the shared library names on lv_timer.py and see if it helps?

yep, thanks, I have a try

Hi @amirgon !
here is another problem about librt
See:

It seems that it’s complex to solve, I plane to do it with docker(it works). anyway, thanks a lot @amirgon

So it seems that lv_timer.py cannot be used on Mac. But you don’t have to use it. Both the FB and SDL drivers provide an internal event loop when the external one is missing. Just use them directly instead of importing display_driver.