Name |
Date |
Size |
#Lines |
LOC |
||
---|---|---|---|---|---|---|
.. | 29-Oct-2021 | - | ||||
.gitignore | A D | 29-Oct-2021 | 10 | 2 | 1 | |
Makefile | A D | 29-Oct-2021 | 1.5 KiB | 63 | 36 | |
README.md | A D | 29-Oct-2021 | 1.1 KiB | 32 | 20 | |
gccollect.c | A D | 29-Oct-2021 | 1.5 KiB | 43 | 11 | |
main.c | A D | 29-Oct-2021 | 13.5 KiB | 351 | 278 | |
mpconfigport.h | A D | 29-Oct-2021 | 5.8 KiB | 169 | 115 | |
mphalport.h | A D | 29-Oct-2021 | 63 | 3 | 1 | |
mpy-cross.vcxproj | A D | 29-Oct-2021 | 5.5 KiB | 106 | 106 | |
qstrdefsport.h | A D | 29-Oct-2021 | 31 | 2 | 0 |
README.md
1MicroPython cross compiler 2========================== 3 4This directory contains the MicroPython cross compiler, which runs under any 5Unix-like system and compiles .py scripts into .mpy files. 6 7Build it as usual: 8 9 $ make 10 11The compiler is called `mpy-cross`. Invoke it as: 12 13 $ ./mpy-cross foo.py 14 15This will create a file foo.mpy which can then be copied to a place accessible 16by the target MicroPython runtime (eg onto a pyboard's filesystem), and then 17imported like any other Python module using `import foo`. 18 19Different target runtimes may require a different format of the compiled 20bytecode, and such options can be passed to the cross compiler. For example, 21the unix port of MicroPython requires the following: 22 23 $ ./mpy-cross -mcache-lookup-bc foo.py 24 25If the Python code contains `@native` or `@viper` annotations, then you must 26specify `-march` to match the target architecture. 27 28Run `./mpy-cross -h` to get a full list of options. 29 30The optimisation level is 0 by default. Optimisation levels are detailed in 31https://docs.micropython.org/en/latest/library/micropython.html#micropython.opt_level 32