55

GitHub - grassel/wac-esp: Web Assembly Interpreter for ESP32 family of micro con...

 5 years ago
source link: https://github.com/grassel/wac-esp
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md

wac - WebAssembly in C

A Minimal WebAssembly interpreter written in C. Supports the WebAssembly MVP (minimum viable product) version of the WebAssembly specification.

This is a fork of the great works at kanaka/wac focuses on making the WASM Interpreter work on embedded devices compatible with Espressif ESP32 and their ESP-IDF development environment. This environment uses Amazon FreeRTOS.

Please read the intro at kanaka/wac .

Runs simple WASM code generated by Emscipten or CLANG/LLVM V8.

Currently limitations:

  • Only supports a non-interactive variant of wac. No plans to change.
  • WASM binary code is included as a static buffer in wac.c Plan is to support network download by integrating the HTTP client component.
  • Function import's are unsupported, no dynamic DLL loading, no calls to the OS. I might add some support in the future.
  • Systamatic testing has not been done.

Build Instructions for ESP32

Get the ESP-IDF development kit from https://docs.espressif.com/projects/esp-idf/en/stable/index.html and follow the instructions how to download, install, and configure.

The environment variable ESP_PLATFORM indicates we are building for ESP32:

export ESP_PLATFORM=1

Run once, the only thing to do is to adjust the devcie port of your module: make menuconfig

In the root directory ./wac, build everything:

make all

Flash the built image and start the monitor:

make flash monitr

The output is pretty verbouse becasue tracing is enabled (change in platform.h). If everything goes fine it prints the return value, tells its done and reboots to start over. Stop the monitor with CTRL - ].

Build Instructions for Ubuntu

The purpose of the Ubuntu built is to give an easier environment to track down bug, and to study the code.

Follow the instructions at kanaka/wac to install dependencies (works for me on Ubuntu 18.04. and does not work on Mac OS).

Create the out directory

mkdir ./out

Unset ESP_PLATFORM environment variable (otherwise the built will be for ESP)

unset ESP_PLATFORM

Make the executable out/wac

make all

License

MPL-2.0 (see LICENSE).


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK