Skip to content

miloudbagaa/WAIT

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WAIT: Bringing WebAssembly to Resource-constrained IoT Devices

WAIT is a lightweight WebAssembly AOT compiler for resource-constrained IoT devices.

WAIT is conditionally accepted by ACM MobiSys'22, see MobiSys homepage for more details.

Introduction

we propose WAIT, a lightweight WebAssembly runtime on resource-constrained IoT devices for device-cloud integrated applications. WAIT is the first work to enable the Ahead-of-Time (AOT) compilation of WebAssembly on resource-constrained devices by leveraging several approaches to reduce memory usage.

Usage

We implemented WAIT for AVR ATMega128 MCU. To facilitate easy build and test, we present a simulated execution environment for ATMega128 MCU (based on Avrora simulation framework) along with our WAIT's implementationin this repository.

Preparation

  1. We suggest you use Ubuntu 20.04 LTS to run the simulation of WAIT.
  2. Clone this repo
  3. Install dependencies for building WAIT:
apt install git build-essential wget curl unzip gcc-multilib xxd cmake wabt python3
apt install gcc-avr avr-libc avrdude gdb-avr openjdk-11-jdk

Compile the WebAssembly module

  1. First, download the WASI SDK to compile *.c to WebAssembly. Go into third-party folder, and
wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-linux.tar.gz
tar xvf wasi-sdk-12.0-linux.tar.gz 

The WASI SDK should reside in third-party folder.

  1. Go into the example folder, and compile the example WebAssembly helloworld module using:
./compile.sh
  1. (Optional) python 3.7
pip3 install wasmer wasmer_compiler_cranelift
python3.7 instance.py helloworld

Run WAIT with avrora

  1. Compile WAIT In root
rm -rf build
mkdir build&&cd build
cmake ..
make
  1. Run WAIT with avrora
bash third-party/runwait.sh

You can see the avrora output.

(Optional) Run your own WebAssembly module

  1. Go to example folder, modify the CMakeLists.txt to compile your WebAssembly module, and compile it.
    • The compilation will generate a xxxx.wasm.h, which is the WebAssembly module (using a C array to save the WebAssembly binary format).
  2. Modify the src/main.c to cope with the xxxx.wasm.h header to bring the WebAssembly with WAIT.

TODOs

  • Code comments in the src
  • Tree layout of this folder
  • Compiling WASM do not generate the native benchmark
  • Complete gitignore
  • wasmer test for helloworld
  • (maybe) docker env?
  • finalize this readme
  • stub.txt what for?
  • abstract the modifications scattered in the code (e.g., example/Cmakelist, src/main.c)
  • what wasmbench.sh for?

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 97.6%
  • CMake 1.5%
  • Shell 0.9%