Live data from Hacker News

Wasm2Mpy: Compiling WASM to MicroPython so it can run on Raspberrys

github.com

1–10 of 41 posts

Re: Wasm2Mpy: Compiling WASM to MicroPython so it can run on Raspberrys

#2
I feel like this project is a classic example of the README missing a "Why?" section. Not to justify the project, it just makes it hard to evaluate without understanding why they choose implementing a transpiler rather than an embedded WASM VM. Or why not transpile to native assembly? I'm sure they have good reasons but they aren't listed here.

Re: Wasm2Mpy: Compiling WASM to MicroPython so it can run on Raspberrys

#3
post #2

I feel like this project is a classic example of the README missing a "Why?" section. Not to justify the project, it just makes it hard to evaluate without understanding why they choose implementing a transpiler rather than an embedded WASM VM. Or why not transpile to native assembly? I'm sure they have good reasons but they aren't listed here.

Probably at least one of "it's cool" or "I'm already using MicroPython"

Re: Wasm2Mpy: Compiling WASM to MicroPython so it can run on Raspberrys

#7
post #2

I feel like this project is a classic example of the README missing a "Why?" section. Not to justify the project, it just makes it hard to evaluate without understanding why they choose implementing a transpiler rather than an embedded WASM VM. Or why not transpile to native assembly? I'm sure they have good reasons but they aren't listed here.

i think your questions are implicitly answered in the top page of the readme, but by showing rather than telling

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

Re: Wasm2Mpy: Compiling WASM to MicroPython so it can run on Raspberrys

#8
post #7
post #2

I feel like this project is a classic example of the README missing a "Why?" section. Not to justify the project, it just makes it hard to evaluate without understanding why they choose implementing a transpiler rather than an embedded WASM VM. Or why not transpile to native assembly? I'm sure they have good reasons but they aren't listed here.

i think your questions are implicitly answered in the top page of the readme, but by showing rather than telling 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…

> 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?

Re: Wasm2Mpy: Compiling WASM to MicroPython so it can run on Raspberrys

#9
post #7

Earlier quoted context omitted.

i think your questions are implicitly answered in the top page of the readme, but by showing rather than telling 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…

> 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?

In this case, the modules contain native code compiled for the target architecture. Micropython has something approximating a dynamic linker to load them.

https://docs.micropython.org/en/latest/develop/natmod.html

Re: Wasm2Mpy: Compiling WASM to MicroPython so it can run on Raspberrys

#10
post #7

Earlier quoted context omitted.

i think your questions are implicitly answered in the top page of the readme, but by showing rather than telling 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…

> 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?

.mpy modules can contain MicroPython bytecode and/or native machine code. In this case, WASM is compiled (via C) to native code. So the performance is very good, much better than interpreting either MicroPython bytecode or WASM bytecode.

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.

Post reply on HN