Page 1 of 1

Porting to Zephyr RTOS (zephyrproject.org)

Posted: Sun Oct 02, 2016 11:24 am
by mishka27
I'd like to add support I2c to boards, running zephyr OS
I have MicroPython running on Galileo for example
Is there any reference how to add - import machine?
Then I would connect zephyr calls, but don't understand the flow yet
import machine returns error, even I've added to config file
#define MICROPY_PY_MACHINE (1)

Please help, any document or readme how to add import and maybe "machine" specific

Thanks

Re: Porting to Zephyr RTOS (zephyrproject.org)

Posted: Wed Oct 05, 2016 5:04 pm
by pfalcon
Hello mishka27, thanks for bringing this discussion to forum from the email, and sorry for delay with the response and for confusion your post may have caused.

So, the current situation with Zephyr RTOS port is that:
One of the issues we had is that is wasn't easy to integrate (non-trivial) 3rd-party project with Zephyr build system, and it required hacks of various levels. This is now largely resolved with https://gerrit.zephyrproject.org/r/#/c/4915/ . Given that there're now 2 diverged branches, and few people expressed interest in the port, I submitted RFC for merging it to MicroPython master: https://github.com/micropython/micropython/issues/2481 . So, over coming weeks we'll work with @daniel-thompson on reconciling our branches and gradually spooling code to the master.

Now answering your question, if you don't want to wait and would like to play with something now, you may want to look at Daniel Thompson's fork, specifically this is a commit which implements machine.Pin class: https://github.com/daniel-thompson/micr ... 74225dbba4 . Note that it will need rework before being merged to master. You can look at any other port to see how machine.I2C is implemented: stmhal, esp8266. If you're interested to learn basics of how to implement a module for MicroPython, looking in extmod/ subdir would give you few easy to follow, mostly self-contained modules, https://github.com/micropython/micropyt ... binascii.c is a good example.

Re: Porting to Zephyr RTOS (zephyrproject.org)

Posted: Wed Oct 26, 2016 3:31 pm
by pfalcon
Some updates on Zephyr port: 1.8.5 release went with basic support for Zephyr port. Since then, "utime" module implementation was merged. machine.Pin support is next in queue.

Re: Porting to Zephyr RTOS (zephyrproject.org)

Posted: Thu Oct 11, 2018 9:39 am
by pfalcon
Just as an update: Zephyr port is updated in mainline (should build with each last released Zephyr version), and maintained in my fork (https://github.com/pfalcon/micropython). There wasn't too much development of the port over last couple of years, but some was, e.g. Zephyr's Sensor API was wrapped into port-specific "zsensor" module. That for example allows to develop sensor devices communicating over network.

Here's example demo of an STM32 demo running a webserver with webapp showing sensor output:

https://www.youtube.com/watch?v=_CC6JJCSJiY