News for hackers. Stuff that matters.
Re:Wasm2Mpy: Compiling WASM to MicroPython so it can run on ... by HALtheWise on Tuesday September 24, 2024 @06:01PM (#41641434)
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 ... by westurner on Tuesday September 24, 2024 @09:39PM (#41642816)
tools/mpy_ld.py: https://github.com/micropython/micropython/blob/master/tools...

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?

Re:Wasm2Mpy: Compiling WASM to MicroPython so it can run on ... by vshymanskyy on Wednesday September 25, 2024 @02:04AM (#41644152)
I don't think .pyc files can contain native code, but .mpy can! And that's exactly what I'm using here:

- compile any language to wasm

- translate wasm to C99

- use the native target toolchain to compile C99 to .mpy

- run that on the device

Re:Wasm2Mpy: Compiling WASM to MicroPython so it can run on ... by westurner on Thursday September 26, 2024 @01:51PM (#41661198)
If they're both Turing-complete opcodes instruction sets, Church-Turing says it is possible with just .pyc, too.

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.