Run statically-compiled WebAssembly apps on any embedded platform

Overview

embedded-wasm-apps

Run native, statically-compiled AssemblyScript, Rust, C/C++, TinyGo, Zig, etc. apps on any platform

How it works

The approach is similar to WasmBoxC:

  1. Compile source code to wasm
  2. Translate wasm to C using wasm2c
  3. Compile produced C, link with a thin runtime implementation using the native platform toolchain

How it works

Benefits

  • Language/toolchain decoupling
  • Moderate runtime overhead (mostly depends on the source language/runtime)
  • Sandboxing
  • Software-based memory virtualization
  • SFI (Software Fault Isolation)

Example

$ make APP=rust
    Finished release [optimized] target(s) in 0.00s
$ pio run -e esp32 -t upload
$ pio device monitor
Initializing WebAssembly...
๐Ÿฆ€ Rust is running!

$ make APP=assemblyscript
    > npm run asbuild:optimized
$ pio run -e esp32 -t upload
$ pio device monitor
Initializing WebAssembly...
๐Ÿš€ AssemblyScript is running!

$ make APP=tinygo
$ pio run -e esp32 -t upload
$ pio device monitor
Initializing WebAssembly...
๐Ÿค– TinyGo is running!

Building WASM apps

Ensure WABT and Binaryen tools are in your PATH.

# AssemblyScript (needs Node.js)
cd apps/assemblyscript
npm install
cd ../..
make APP=assemblyscript

# Rust
rustup target add wasm32-unknown-unknown
make APP=rust

# C/C++ (needs wasienv)
make APP=cpp

# TinyGo (needs TinyGo v0.21.0 and Go v1.17.3)
make APP=tinygo

# TinyGo (needs Zig v0.9.0)
make APP=zig

Building and running with PlatformIO

# For ESP32:
pio run -e esp32 -t upload

# For ESP8266:
pio run -e esp8266 -t upload

# Open serial monitor
pio device monitor --quiet

Building and running with Particle

Requires particle-cli. Should work on all Particle devices i.e. Spark Core, Photon, Electron, Argon, Boron:

particle flash MyDevice ./src/

# Open serial monitor
particle serial monitor --follow
You might also like...
Run WPS PIN attacks (Pixie Dust, online bruteforce, PIN prediction) without monitor mode with the wpa_supplicant

Overview OneShot-C - implementation of OneShot on C OneShot-ะก performs Pixie Dust attack without having to switch to monitor mode. Features Pixie Dust

C++ library for creating an embedded Rest HTTP server (and more)

The libhttpserver reference manual Tl;dr libhttpserver is a C++ library for building high performance RESTful web servers. libhttpserver is built upon

A portable MQTT C client for embedded systems and PCs alike.
A portable MQTT C client for embedded systems and PCs alike.

MQTT-C is an MQTT v3.1.1 client written in C. MQTT is a lightweight publisher-subscriber-based messaging protocol that is commonly used in IoT and net

FreeModbus is a Modbus ASCII/RTU and Modbus TCP implementation for embedded systems

FreeModbus is a Modbus ASCII/RTU and Modbus TCP implementation for embedded systems. It provides an implementation of the Modbus Application Protocol

Open source file system for small embedded systems

STORfs Open Source File System Release Version 1.0.2 Created by: KrauseGLOBAL Solutions, LLC What is STORfs? STORfs is an open source flash file syste

Embedded Linux embedding for Flutter

Embedded Linux embedding for Flutter This project was created to develop non-official embedded Linux embeddings of Flutter. This embedder is focusing

Common utilities useful for embedded systems that are often not included in an RTOS or the standard C library.
Common utilities useful for embedded systems that are often not included in an RTOS or the standard C library.

Welcome to Fitterbap, the Firmware toolkit to enable reliable best architecture practices! Fitterbap provides common utilities useful for embedded systems that are often not included in an RTOS or the standard C library.

WebSockets in C for Embedded Applications

WebSockets in C WIC is a C99 implementation of rfc6455 websockets designed for embedded applications. WIC decouples the websocket protocol from the tr

Hyelicht is an IoT/embedded project for home decoration/automation.
Hyelicht is an IoT/embedded project for home decoration/automation.

Hyelicht is an IoT/embedded project for home decoration/automation. Its software allows you to do colorful painting and animations on a LED-b

Comments
  • Importance of zstack-size

    Importance of zstack-size

    I'm trying to understand what zstack-size does and why it's important.

    Reason I'm trying to investigate his is that I'm almost certain that it causes a stack overflow in my code but I can't say for sure. I've taken the wasm module and run it in the browser I'm getting Maximum call stack size exceeded error. If I'm removing zstack-size then in the browser it runs to infinity but on arduino/wasm3 it doesn't even start.

    Any pointers would be greatly appreciated!

    opened by MendyBerger 0
Owner
Volodymyr Shymanskyy
Co-founder of Blynk
Volodymyr Shymanskyy
Enabling services on your device 81 Jan 6, 2023
Mongoose Embedded Web Server Library - a multi-protocol embedded networking library with TCP/UDP, HTTP, WebSocket, MQTT built-in protocols, async DNS resolver, and non-blocking API.

Mongoose - Embedded Web Server / Embedded Networking Library Mongoose is a networking library for C/C++. It implements event-driven non-blocking APIs

Cesanta Software 9k Jan 1, 2023
SixtyFPS is a toolkit to efficiently develop fluid graphical user interfaces for any display: embedded devices and desktop applications

SixtyFPS is a toolkit to efficiently develop fluid graphical user interfaces for any display: embedded devices and desktop applications. We support multiple programming languages, such as Rust, C++, and JavaScript.

SixtyFPS 5.5k Jan 2, 2023
About Add any Program in any language you like or add a hello world Program โฃ๏ธ if you like give us โญ

Hello-World About Add any Program in any language you like or add a hello world Program โฃ๏ธ if you like give us โญ Give this Project a Star โญ If you lik

Lokesh Jangid 15 Oct 28, 2022
Chocolate Doom WebAssembly port with WebSockets support

Wasm Doom This is a Chocolate Doom WebAssembly port with WebSockets support. Requirements You need to install Emscripten and a few other tools first:

Cloudflare 191 Dec 31, 2022
Package manager for linux that installs windows apps through wine

Winepkg A package manager for linux that installs windows apps through wine. Usage winepkg -Si mspaint Install Dependencies: wine winetricks wget cur

null 2 May 27, 2022
LAN Party VPN - Run VPN on top of Discord. No installation required.

LAN Party VPN - VPN for Virtual LAN Parties Have you ever wanted to play a classic game with your friends but not able to because you or your friends

Yifan Gu 283 Dec 14, 2022
Run SSH on iOS 12 device.

Shelly12 Run SSH on iOS 12 device. Only worked on iPad Air 1, iOS 12.4 Working Get root Set tfp0 to hsp4 Escape Sandbox Restore/Remount RootFS Defeat

null 6 May 11, 2021
Example how to run eBPF probes without a usermode process using fentry

Pinning eBPF Probes Simple example to demonstrate how to pin kernel function and syscall probes. Overview From my reading of the kernel code, KProbe a

pat_h/to/file 3 Jun 7, 2021
C++ TCP/IP and SSH stack with bounded run time and no dynamic memory allocations

Static Network Stack TCP/IP stack with all-static allocations designed for bare metal (no operating system) embedded applications with minimal footpri

Andrew Zonenberg 24 Jul 22, 2022