wasm-micro-runtime icon indicating copy to clipboard operation
wasm-micro-runtime copied to clipboard

Using on ESP32 with Rust

Open AlixANNERAUD opened this issue 1 year ago • 2 comments

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.

AlixANNERAUD avatar Nov 09 '23 18:11 AlixANNERAUD

We are working on an official Rust SDK. You will see details here.

lum1n0us avatar Nov 11 '23 09:11 lum1n0us

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.

AlixANNERAUD avatar Nov 16 '23 18:11 AlixANNERAUD