bytecodealliance / wasmtime

A fast and secure runtime for WebAssembly
https://wasmtime.dev/
Apache License 2.0
15.44k stars 1.31k forks source link

Support for IoT devices #8500

Closed TAOFOR4 closed 6 months ago

TAOFOR4 commented 6 months ago

Hi,

I am wondering if wasmtime supports IoT devices like Raspberry Pico, ESP32 C6, or something similar? Thank you!

bjorn3 commented 6 months ago

The biggest problem is likely going to be architecture support. Cranelift and by extension Wasmtime currently doesn't support any 32bit target. Only x86_64, arm64, riscv64 and s390x are currently supported.

If you have a microcontroller with a supported architecture however, since https://github.com/bytecodealliance/wasmtime/pull/7995 it should be possible to run without an OS assuming you implement the functions of wasmtime-platform.h. The min-platform example takes almost 7MB as it includes not just the WASM runtime, but also the compiler. If you push a wasm module precompiled for the target to the microcontroller instead you can enable just the runtime part of Wasmtime, which cuts down the size to a little over 700k.