Search found 80 matches

by cduran
Wed Mar 11, 2020 5:07 pm
Forum: Development of MicroPython
Topic: Adding External C Modules with external functions to mp as a library
Replies: 15
Views: 9389

Re: Adding External C Modules with external functions to mp as a library

Aha, looks like you found a bug. I don't know why, but the culprit is defining MODULE_HELPERS_ENABLED in mpconfigport: if you remove that line and instead use CFLAGS_EXTRA=-DMODULE_HELPERS_ENABLED=1 on the commandline it works. Tried with the unix port and it doesn't have that problem though. I act...
by cduran
Wed Mar 11, 2020 1:37 pm
Forum: Development of MicroPython
Topic: Adding External C Modules with external functions to mp as a library
Replies: 15
Views: 9389

Re: Adding External C Modules with external functions to mp as a library

The code you show doesn't contain a definition of helpers_c_helper, only a declaration, hence the undefined reference? Also I don't know all effects of declaring static functions in header files, but least to say is that it's unusual and probably not intended? I updated my code as follows and still...
by cduran
Tue Mar 10, 2020 11:29 pm
Forum: Development of MicroPython
Topic: Adding External C Modules with external functions to mp as a library
Replies: 15
Views: 9389

Adding External C Modules with external functions to mp as a library

I have a unique problem that I am trying to solve. I'm currently building mp 1.12 as a library which I then import into my existing project. My project is arm based and has no OS so I'm using the minimal build as a start. So far I'm able to build an mp lib and run script strings just fine. Where I'm...
by cduran
Mon Mar 02, 2020 4:45 pm
Forum: Development of MicroPython
Topic: I would like to know how to build micropython as a lib
Replies: 5
Views: 3865

Re: I would like to know how to build micropython as a lib

Do I absolutely need a main to build the lib? Why the unix port, I'm more likely to use the minimal port since my application will be cross platform with no file system? Hi, sorry for the delay replying. You're absolutely right -- you do not need the unix port's main.c (in fact there's a duplicate ...
by cduran
Thu Feb 27, 2020 7:26 pm
Forum: Development of MicroPython
Topic: I would like to know how to build micropython as a lib
Replies: 5
Views: 3865

I would like to know how to build micropython as a lib

I'm trying to build mp as a stand alone library. I'm trying to make sense of the embedded example in the examples folder. I tried to build it but I'm getting the following make error: make[1]: *** No rule to make target 'ports/unix/main.c', needed by 'build/genhdr/qstr.i.last'. Do I absolutely need ...
by cduran
Thu Feb 27, 2020 2:47 pm
Forum: General Discussion and Questions
Topic: Using the C API?
Replies: 18
Views: 19417

Re: Using the C API?

I've been using this sample for a while but now I'm getting build errors and even when I fix the build errors I'm getting crashes. I recently updated to mp 1.12. Is there an updated sample for this? Thank you.
by cduran
Mon Feb 24, 2020 6:43 pm
Forum: Development of MicroPython
Topic: How can I manually add a C module without micropython.mk?
Replies: 9
Views: 5163

Re: How can I manually add a C module without micropython.mk?

Oh, cool. In that case then what you want to do should be relatively straightforward -- you can treat your custom module just like any of the built-in ones, and register it in mpconfigport.h in MICROPY_PORT_BUILTIN_MODULES and included it in the list of C sources. (That way you don't need to worry ...
by cduran
Wed Jan 29, 2020 9:33 pm
Forum: Development of MicroPython
Topic: How can I manually add a C module without micropython.mk?
Replies: 9
Views: 5163

Re: How can I manually add a C module without micropython.mk?

Oh, cool. In that case then what you want to do should be relatively straightforward -- you can treat your custom module just like any of the built-in ones, and register it in mpconfigport.h in MICROPY_PORT_BUILTIN_MODULES and included it in the list of C sources. (That way you don't need to worry ...
by cduran
Tue Jan 28, 2020 3:31 pm
Forum: Development of MicroPython
Topic: How can I manually add a C module without micropython.mk?
Replies: 9
Views: 5163

Re: How can I manually add a C module without micropython.mk?

I don't want to tinker too much with my codes makefile. At least no more than just adding the files I need to build. How did you integrate MicroPython core then? Do you separately build libmicropython (i.e. like the examples/embeddeding example) and link against that? I include all of MP's files in...
by cduran
Wed Jan 22, 2020 4:01 pm
Forum: Development of MicroPython
Topic: How can I manually add a C module without micropython.mk?
Replies: 9
Views: 5163

Re: How can I manually add a C module without micropython.mk?

This sounds like it might require a lot more knowledge of your codebase to answer. But when you say "I don't want to tinker with the existing makefile" -- is that the existing makefile for your codebase, or for MicroPython's makefile. If it's the former, surely you had to modify your makefile to ad...