Micropython firmware - GaudiLabs/OpenDrop GitHub Wiki

Options for porting OpenDrop firmware to Micropython

OpenDropV3 is based on the SAMD21 microcontroller which is supported by Micropython via the adafuit fork, CircuitPython. Implementing the OpenDrop firmware in Micropython would allow users to write simple python protocols/scripts and drag them onto the USB drive that appears when an OpenDrop is plugged into any computer. The big advantage to this approach is that it is cross platform and doesn’t require users to install any custom software or build tools.

There several options for porting the existing OpenDrop firmware to python:

1. Write C wrappers for the existing C++ libraries/firmware

  • In standard CPython, this is commonly done using tools like SWIG or Boost.Python, however, there doesn’t seem to be anything similar available for MicroPython.
  • There was one project that looked promising, but it only includes Makefiles for Windows/Unix (no ports to any microcontrollers).
  • We could potentially fork Micropython/CircuitPython and modify the Makefile to compile all of the C++ code and manually write C wrappers. This is probably non trivial and I couldn’t find any examples online.

2. Port libraries from C++ to C and write a python wrapper

  • This is the supported method for integrating C code into Micropython. It involves creating a fork of Micropython/CircuitPython and adding a custom module written in C with the necessary C wrappers.

3. Port libraries to Python

  • Another option would be to completely rewrite the OpenDrop firmware/libraries in Python. Any code that is performance critical could be written C and integrated as in 2.