|
| 1 | + |
| 2 | +# Developing C modules for MicroPython |
| 3 | + |
| 4 | +This is a sketch for a presentation about developing |
| 5 | +third-party libraries for MicroPython as C modules. |
| 6 | + |
| 7 | +## Outline |
| 8 | + |
| 9 | +- External C modules, what is it, how does it work. |
| 10 | +- Native .mpy modules, what is it, how does it work. |
| 11 | +Limitations. Fundamental and incidental/current. |
| 12 | +- Supporting both as external C module and native. |
| 13 | +Some #ifdefs and duplication needed. Potential for unified macros? |
| 14 | +- CMake and Makefile setups for external C modules |
| 15 | +- Writing automated tests. |
| 16 | +Mostly like for .py files. pytest-style, use asserts with message |
| 17 | +- Running automated tests against hardware. |
| 18 | +Using mpremote mount. Modify sys.path for architecture specifics |
| 19 | +- Continious Integration setup. |
| 20 | +Using Github Actions. Can reuse ci shell scripts from MicroPython repo. |
| 21 | +- Continious Delivery setup. |
| 22 | +Using Github Actions -> Github pages. .mpy files |
| 23 | +- Supporting browser using Webassembly. |
| 24 | +Standard external C modules build. |
| 25 | +- Supporting running on PC |
| 26 | +! Native modules do not work in Mac OS. |
| 27 | +! Windows only supported using Windows Subsystem for Linux? |
| 28 | +- API refererence documentation. |
| 29 | +Using stub files sphinx with sphinx-autodoc-typehints |
| 30 | +- ?? How to use the stubs for typechecking, like micropython stubs |
| 31 | + |
| 32 | +## Examples |
| 33 | + |
| 34 | +- emlearn-micropython, https://github.com/emlearn/emlearn-micropython/ |
| 35 | +- tamp, https://github.com/BrianPugh/tamp/tree/main/mpy_bindings |
| 36 | +- ulab, https://github.com/v923z/micropython-ulab |
0 commit comments