emlearn-micropython icon indicating copy to clipboard operation
emlearn-micropython copied to clipboard

CircuitPython support

Open jonnor opened this issue 2 years ago • 4 comments

CircuitPython is a very popular Python-for-microcontrollers. https://circuitpython.org/ It would be nice if that could be supported in addition to MicroPython. Preferably in a way that has minimal divergence/extra ongoing work to support.

jonnor avatar Aug 18 '23 19:08 jonnor

Right now we primarily use MicroPython native modules, and that works quite well. In order to use the same strategy with CircuitPython, we would need https://github.com/adafruit/circuitpython/issues/6040 to go in.

jonnor avatar Aug 18 '23 19:08 jonnor

The only documentation I have found for extending CircuitPython in C is https://learn.adafruit.com/extending-circuitpython and that is not updated since 2019 - with notes that there are known incompatible changes since then. So it will be use-the-source-Luke.

It seems that for user-modules there is still an open issue in CircuitPython, https://github.com/adafruit/circuitpython/issues/2825 Though it is stated that "it is possible". One user has reported a problem with it, unclear if is a blocker for all usages. https://github.com/adafruit/circuitpython/issues/5910

So it seems that in the short-term the officially supported way is to create an in-tree module that is built as part of upstream CircuitPython. It seems possible to have a separate repository that is pulled into the main build process. https://github.com/adafruit/circuitpython-ulab is probably the most relevant example. And the commits there are probably a good indicator of the difference that are needed to adapt to CircuitPython.

jonnor avatar Aug 20 '23 16:08 jonnor

The only documentation I have found for extending CircuitPython in C is https://learn.adafruit.com/extending-circuitpython and that is not updated since 2019 - with notes that there are known incompatible changes since then. So it will be use-the-source-Luke.

We're happy to help you get going on the CP internals. The best place to get guidance is the Adafruit Discord in the #circuitpython-dev channel. Adafruit-funded CP devs are there usually during US business hours. Volunteers are also there at other times.

tannewt avatar Aug 24 '23 18:08 tannewt

Thank you @tannewt ! I am in the Adafruit Discord already. I will make sure to reach out if I find time to work on this :)

jonnor avatar Sep 01 '23 19:09 jonnor