The purpose of this repository is to serve as a proof of concept of a potential WASI and I2C integration.
Currently, the setup is as follows: Raspberry Pi 4 Model B → I2C Interface → HD44780 LCD. It is my intention to switch out the Pi for a Pi Pico microcontroller, to have a proof of concept for a more constrained piece of hardware. I also have a Pi 3 Model B hooked up with a HTS221.
The embedded-hal crate is the main inspiration for the design of the API. To embed a crate that uses this HAL as a guest component wasi-embedded-hal can be used.
For this criterion.rs is used. Sadly, it isn't possible to use this in conjunction with a binary crate, thus the crate is split up into a library and a binary.
Benchmarks can be found in the benches/ directory inside the hosts and native implementations.
The executable is built via cargo bench --no-run. Afterwards it can be scp'ed and run using ./sensor_read-a3122c62d6d7e506 --bench. The results are stored inside target/criterion/sensor\\\ read/report and are then scp'ed back into report/.
The used memory is collected via dhat-rs. This gives output of the following format after execution:
dhat: Total: xxx bytes in y blocks
dhat: At t-gmax: xxx bytes in y blocks
dhat: At t-end: xxx bytes in y blocks
To build run cargo build --target aarch64-unknown-linux-gnu --release --features dhat-heap.
This work has been partially supported by the ELASTIC project, which received funding from the Smart Networks and Services Joint Undertaking (SNS JU) under the European Union’s Horizon Europe research and innovation programme under Grant Agreement No 101139067. Views and opinions expressed are however those of the author(s) only and do not necessarily reflect those of the European Union. Neither the European Union nor the granting authority can be held responsible for them.