I'm on Micropython 1.9.3. I know how to use mpy-cross
to turn a .py
into a compiled python .mpy
that can be executed by the Micropython virtual machine.
The problem is that if I try to compile using @micropython.native
i.e. compile the Python script to native code instead of bytecode, I get an error:
../../mpy-cross/mpy-cross -o build/frozen_mpy/./frozentest.mpy -s frozentest.py frozentest.py
ValueError: can only save bytecode
On the following .py
@micropython.native
def native_add(a,b):
return (a+b)
c = native_add(2342,4542)
QUESTION
Is it not possible to embed native code in .mpy
format? Did I miss some option in mpy-cross/mpconfigport.h
?
Only thing I changed is:
#define MICROPY_EMIT_THUMB (0) // changed it to 1