Portability of code compiled with mpy_cross
Posted: Mon Sep 12, 2016 10:30 pm
I want to confirm some assumptions I've made about the portability of code compiled with mpy_cross, based on my understanding of the QSTR interned strings:
- Compiled bytecode stores indices into the QSTR pool of the MicroPython build installed on the pyboard. This is why it's necessary to recompile MicroPython and flash it to the target device (per this thread).
- But, as long as two builds have identical bytecode generators and QSTR pools, a compiled MicroPython program should work on both.
- Therefore, if I modify my build to incorporate some new QSTR strings (changing QSTR pool indexing), I will need to recompile my .py files into new .mpy files.
- If I was sharing a compiled .mpy program with someone, I'd also need to share my MicroPython build for them to install on their hardware.