How to build micropython with PlatformIO and ESP-IDF?
Posted: Mon Jul 20, 2020 3:57 pm
Hi, it's me again.
I want to use micropython as a library so I can execute python script in my ESP-IDF C++ project.
I am using the latest PlatformIO and ESP-IDF framework. The ESP-IDF version is 4.0.
I am leveraging on the PlatformIO library and dependency resolving system instead of writing cmakelist file myself, the micopython seem not compatible with the CMake system out of box. I copied \extmod, \lib, \py to the platformIO global library folder:core_dir/lib/micropythoi. I built a UNIX port on my desktop and copied the \genhdr to that fodler as well.
I copied the :"mpconfigport.h, mpconfigboard.h, mphalport.h, mphalport.c mpthread.h, mpthread.c, gccollect.h, gccollect.c" to that folder as well.
When I build, I got all kinds of error. The compiler seems found all the libraries and tried to compile every single .c file. This gives me lots of undeclared errors. I remove those file that giving such errors one by one, until I cannot do this to reduce error.
Now I get :C:\users\zheng\.platformio\lib\MycroPythonEmbedded\lib\utils\pyexec.c:99:9: error: implicit declaration of function 'mp_hal_set_interrupt_char'; did you mean 'mp_hal_stdin_rx_chr'? [-Werror=implicit-function-declaration]
and
C:\users\zheng\.platformio\lib\MycroPythonEmbedded\mpthreadport.c:132:130: error: 'MP_TASK_COREID' undeclared (first use in this function); did you mean 'pdTASK_CODE'?
And many similar implicit declaration of function error. And I assume there are many more error waiting.
Can someone give me a right way of doing this?
Really need your help.
I want to use micropython as a library so I can execute python script in my ESP-IDF C++ project.
I am using the latest PlatformIO and ESP-IDF framework. The ESP-IDF version is 4.0.
I am leveraging on the PlatformIO library and dependency resolving system instead of writing cmakelist file myself, the micopython seem not compatible with the CMake system out of box. I copied \extmod, \lib, \py to the platformIO global library folder:core_dir/lib/micropythoi. I built a UNIX port on my desktop and copied the \genhdr to that fodler as well.
I copied the :"mpconfigport.h, mpconfigboard.h, mphalport.h, mphalport.c mpthread.h, mpthread.c, gccollect.h, gccollect.c" to that folder as well.
When I build, I got all kinds of error. The compiler seems found all the libraries and tried to compile every single .c file. This gives me lots of undeclared errors. I remove those file that giving such errors one by one, until I cannot do this to reduce error.
Now I get :C:\users\zheng\.platformio\lib\MycroPythonEmbedded\lib\utils\pyexec.c:99:9: error: implicit declaration of function 'mp_hal_set_interrupt_char'; did you mean 'mp_hal_stdin_rx_chr'? [-Werror=implicit-function-declaration]
and
C:\users\zheng\.platformio\lib\MycroPythonEmbedded\mpthreadport.c:132:130: error: 'MP_TASK_COREID' undeclared (first use in this function); did you mean 'pdTASK_CODE'?
And many similar implicit declaration of function error. And I assume there are many more error waiting.
Can someone give me a right way of doing this?
Really need your help.