C Library Import Framework

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
Post Reply
User avatar
roy.emmerich
Posts: 3
Joined: Mon Mar 03, 2014 10:42 am

C Library Import Framework

Post by roy.emmerich » Mon Mar 03, 2014 11:46 am

I'm in the process of getting MODBUS working on uPython (using modbus_tk) and am in need of a bit of help on the C side of things.

The modbus_tk code depends on the struct CPython standard library which has yet to be implemented in C for uPython. My plan is to implement the un/pack methods in /micropython/py/struct.c (and whatever else is required to support the modbus_tk python library). I then want to make struct.c an optionally importable uPython library (i.e. import struct) but am unsure how to achieve this.

Can anybody provide a bit of guidance?

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: C Library Import Framework

Post by pfalcon » Tue Mar 04, 2014 2:09 am

I'm travelling now, so didn't have time to answer your previous mails in detail yet, but here's a quick link for the simplest module in the codebase: https://github.com/micropython/micropyt ... nix/time.c (And again, playing with "unix" version is one seamless way to start hacking with micropython ;-) ).
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: C Library Import Framework

Post by pfalcon » Fri Apr 11, 2014 12:48 am

FYI, I started implementing struct module.
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: C Library Import Framework

Post by pfalcon » Sat Apr 19, 2014 2:45 pm

struct module now should have more or less complete functionality.
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

Post Reply