Wasm2Mpy: Compiling WASM to MicroPython so it can run on Raspberrys
github.com
github.com
esp32 and stm32 run three different native assembly instruction sets (though this only supports two of them, the others listed in the first line of the readme are all arm)
the coremark results seem like an adequate answer to why you'd use a compiler rather than an interpreter
i do think it would be clearer, though, to explain up front that the module being built is not made of python code, but rather callable from python code
I know nothing about micropython. Do the modules contain bytecode?
tools/mpy-tool.py lists opcodes: https://github.com/micropython/micropython/blob/master/tools...
Can the same be done with .pyc files; what are the advantages of MicroPython native modules?
Why does it need wasm2c?
- compile any language to wasm
- translate wasm to C99
- use the native target toolchain to compile C99 to .mpy
- run that on the device
But that doesn't solve for WASM on a MicroPython device.
And that is why smart contracts without costed opcodes could not be built on Python.
The conventional way of creating native modules for MicroPython is to write them in C. This work allows to use any language that supports WASM output target.
WASM is an almost "ideal" bytecode target for embedded AOT native compilation as well, though yeah, you'd have to implement all of the backend targets.
That makes me feel the end goal here is not what's described ("make wasm so it can run on a raspberry"), but rather "make wasm run in micropython".
Am I missing something?
https://github.com/wasm3/wasm3? https://github.com/espressif/esp-wasmachine ? https://github.com/bytecodealliance/wasm-micro-runtime/tree/... ? https://github.com/TOPLLab/WARDuino ?
It obviously depends on your needs/goals.
P.S. I'm also the author of wasm3
Is it in terms of maturity? Speed? Memory footprint? Safety?
In that case which approach / library would you recommend to embedd a WASM VM?
These .mpy files are dynamically loaded into MicroPython using a regular python import.