wasm-micro-runtime
wasm-micro-runtime copied to clipboard
Using on ESP32 with Rust
Hello,
I'have tried with WAMR In Rust on linux platform and it worked well (I forked and updated the rust bindgen wamr-sys
which is no longer maintained : https://github.com/AlixANNERAUD/wamr-sys.git). Now, I would like to use it on an ESP32 with Rust (std). I've seen that you already support the ESP-IDF which is great. But how it with Rust ? I've read your warm porting guide but I'm quite lost and don't know where to start.
We are working on an official Rust SDK. You will see details here.
I've found a solution to the problem that's not too bad (thanks to ivmarkov). I use WAMR as an ESP-IDF component by adding the followings options to the cargo.toml
file:
[[package.metadata.esp-idf-sys.extra_components]]
bindings_header = "<path to wamr>/core/iwasm/include/wasm_export"
component_dirs = ["<path to wamr>/build-scripts/esp-idf"]
name = "wamr"
The esp-idf-sys crate will then compile WAMR and provide the (unsafe) bindings needed to use WAMR in Rust. However, this solution is far from being the best, and I think it's possible to do better.