Search found 67 matches

by cduran
Tue Mar 24, 2020 1:30 pm
Forum: Development of MicroPython
Topic: Is nlr_jump_fail absolutely necessary?
Replies: 3
Views: 760

Re: Is nlr_jump_fail absolutely necessary?

I'm not quite sure I understand your question. nlr_jump_fail is provided by the port. What's the warning you're seeing? If your port doesn't use NLR (it uses setjmp instead?) then you don't need to provide it in your port. The warning is "noreturn function does return". I misunderstood what was hap...
by cduran
Mon Mar 23, 2020 8:57 pm
Forum: Development of MicroPython
Topic: Is nlr_jump_fail absolutely necessary?
Replies: 3
Views: 760

Is nlr_jump_fail absolutely necessary?

I'm getting a compiler warning on the definition of nlr_jump_fail(). We try to keep our code as clean as possible and I want to remove this warning. I know an easy fix would be to add an exit(0) to the function, but I'd really rather not. I searched the project and found that it was only called with...
by cduran
Thu Mar 12, 2020 6:01 pm
Forum: Development of MicroPython
Topic: Adding External C Modules with external functions to mp as a library
Replies: 15
Views: 2031

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

If it's not one thing it's another lol. So the library along with my c module is sort of working now, however, when calling mp_obj_get_int() there seems to be an overflow problem when using values >= 0x40000000. Values <= 0x3FFFFFFF don't have a problem. Basically it's having issues with numbers gre...
by cduran
Thu Mar 12, 2020 2:02 pm
Forum: Development of MicroPython
Topic: Adding External C Modules with external functions to mp as a library
Replies: 15
Views: 2031

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

I found the problem. MP's UART code was conflicting with our firmware. Simple fix. Which brings back an old question I've had, can the CLI be easily removed, along with the entire hardware layer? Basically have mp run scripts and let my module do all the work. In the process making mp even smaller a...
by cduran
Wed Mar 11, 2020 10:19 pm
Forum: Development of MicroPython
Topic: Adding External C Modules with external functions to mp as a library
Replies: 15
Views: 2031

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

dhylands wrote:
Wed Mar 11, 2020 8:25 pm
For some values, mp_obj_new_int_from_uint will do a heap allocation, so your heap might not be initialized properly.
We are using the lib in a project that already had mp. We haven't changed any of the initialization code, this code has been working since 2016.
by cduran
Wed Mar 11, 2020 7:52 pm
Forum: Development of MicroPython
Topic: Adding External C Modules with external functions to mp as a library
Replies: 15
Views: 2031

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

It's hard to say, especially without seeing the code. The C code is probably corrupting something (likely the stack). I'd probably start by making the C code do nothing and just return. And then start adding functionality back in to figure out where it's messing things up. In particular this line i...
by cduran
Wed Mar 11, 2020 5:13 pm
Forum: Development of MicroPython
Topic: Adding External C Modules with external functions to mp as a library
Replies: 15
Views: 2031

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

You should also look at the linker command line (i.e. build with make V=1). The GNU linker has some peculiarities about the order that object files need to appear in order to resolve symbols. So lets say you have a foo.o file which needs to call some_function and some_function is defined in bar.o T...
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: 2031

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: 2031

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: 2031

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...