Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Tool to generate native .mpy files from a .elf file (dynamically loadable native code) #5083
This PR adds a tool
Included in this PR are some examples: ex0, ex1 and ex2 are basic examples, and the qr example shows how to take an existing C library "off the shelf" and wrap it up into a .mpy file (to generate QR codes, work done in collaboration with @mattytrentini ).
Currently the tool supports targets of unix x86-64, ARM Thumb2 (Cortex M3 and above, eg stm32 boards), and partial support for esp32. esp32 support is non trivial and the qr example does not work (at this stage I'm unsure why). esp32 support relies on #5082
To try this PR out do the following:
Then try out ex1, ex2 and qr. Also use one of these examples as a template to write your own C-based module.
There's still a bit of work to do to clean this up (eg tool/file naming, directory structure, docs). Also freezing the resulting mpy files won't work at the moment because the code relocates itself (writes to itself) when it is imported, and frozen code is read-only. Eventually this can be fixed.