Running uPython script from C and calling C functions from the script #9854
Unanswered
empi91
asked this question in
Using MicroPython
Replies: 2 comments 16 replies
-
Did you look at https://github.com/micropython/micropython/tree/master/examples/embedding? And this pull request hasn't been merged, but could be of interest. |
Beta Was this translation helpful? Give feedback.
13 replies
-
Hello again, another (newbie) question showed up: // call port specific initialization if any
#ifdef MICROPY_PORT_INIT_FUNC
MICROPY_PORT_INIT_FUNC;
#endif inside |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I didn't find anything similar enough in the old topics both here and on forum, so I decided to post a new one, hope that's ok
I have complex C application, where I want to add a functionality of executing external uPython scripts, but at the same time be able to call some defined C functions from this script during the execution.
So basically something like that:
C-based script component:
uPython script:
But while for a standard Python it seems relatively easy:
#include <python.h>
then for uPython it seems more complicated and I got lost.
Here: Building MP as static library and here: Embedding MP as library in C read I have to make a library on my own
Here: Writing C modules there is something about writing modules in C, but I am unable to put it all together
The relatively easy way to do requires creating a .io library file from C file, which I am not very happy with (at least that's what I found) so every help, or just a proper direction will be much appreciated!
I did something similar using Lua and it's working, but now just trying to compare it with uPython
Beta Was this translation helpful? Give feedback.
All reactions