Warning
This is a Proof-of-Concept, not optimized or ready for actual use.
You'll need:
- Python 3
pip install --upgrade pyelftools ar
wasm2c
from WABT- Latest MicroPython source code
- Target architecture toolchain
Set up the environment and build the .mpy
module from .wasm
:
export MPY_DIR=/path/to/micropython
export PATH=/opt/wabt/bin:$PATH
export PATH=/opt/xtensa-lx106-elf/bin:$PATH
export PATH=/opt/xtensa-esp32-elf/bin:$PATH
pip install -U pyelftools
make ARCH=xtensawin APP=zig # x86, x64, armv6m, armv7m, armv7emsp, armv7emdp, xtensa, xtensawin
Output:
W2C test/zig.wasm
GEN build/zig.config.h
CC runtime/runtime.c
CC runtime/wasm-rt-mem-impl.c
CC runtime/wasm-rt-impl.c
CC .wasm/wasm.c
LINK build/runtime/runtime.o
arch: EM_XTENSA
text size: 3524
rodata size: 850
bss size: 144
GOT entries: 57
GEN zig.mpy