Hi everybody.
I have an esp32 and i would like to add external C modules.
I followed this instructions : https://docs.micropython.org/en/latest/ ... dules.html
The compilation work but it's impossible to import the module in the prompt microPython.
>>> import example
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: no module named 'example'
If anybody has a solution or a idea, i take it.
Thanks all.
MicroPython external C modules
Re: MicroPython external C modules
Are you able to post your code (e.g. to github).
Can you verify that your module is definitely being linked into the final firmware image (e.g. use nm or objdump).
Can you verify that your module is definitely being linked into the final firmware image (e.g. use nm or objdump).
Re: MicroPython external C modules
I found the solution.
The command : " make USER_C_MODULES=../../../modules CFLAGS_EXTRA=-DMODULE_EXAMPLE_ENABLED=1 all " dosen't work.
You need to add " #define MODULE_EXAMPLE_ENABLED (1) " to the mpconfigport.h and do " " make USER_C_MODULES=../../../modules all" and now it's work !!
Thanks for your answer and sorry to distrubed you.
The command : " make USER_C_MODULES=../../../modules CFLAGS_EXTRA=-DMODULE_EXAMPLE_ENABLED=1 all " dosen't work.
You need to add " #define MODULE_EXAMPLE_ENABLED (1) " to the mpconfigport.h and do " " make USER_C_MODULES=../../../modules all" and now it's work !!
Thanks for your answer and sorry to distrubed you.
Re: MicroPython external C modules
Are you using ESP32 by any chance?
For some reason the ESP32 makefile doesn't use CFLAGS_EXTRA. I don't have an ESP32 board or the ESP32 toolchain set up but maybe you could send a PR?