WebAssembly Micro Runtime (WAMR)
Go to file
2020-02-23 22:23:40 +08:00
assembly-script support app framework base library in assemblyscript (#164) 2020-02-13 15:51:22 +08:00
build-scripts Enable AoT and wamr-sdk, and change arguments of call wasm API (#157) 2020-01-21 13:26:14 +08:00
core Merge two levels of hash cache of branch block address into one (#173) 2020-02-22 21:05:08 +08:00
doc sdk build tools and app framework updates (#171) 2020-02-22 10:12:26 +08:00
product-mini Add SGX AOT support with SGX SDKv2.8 unpublic sgx_rsrv_mem_mngr.h (#169) 2020-02-19 15:11:12 +08:00
samples fix sample littlevgl build.sh issue (#174) 2020-02-23 22:23:40 +08:00
test-tools Merge two levels of hash cache of branch block address into one (#173) 2020-02-22 21:05:08 +08:00
wamr-compiler Refine wasm loader and interpreter, enhance wamrc to support SGX (#167) 2020-02-18 15:15:24 +08:00
wamr-sdk fix sample littlevgl build.sh issue (#174) 2020-02-23 22:23:40 +08:00
.gitignore Add build configuration for Mac (#110) 2019-09-06 16:51:36 +08:00
ATTRIBUTIONS.md Enable AoT and wamr-sdk, and change arguments of call wasm API (#157) 2020-01-21 13:26:14 +08:00
CODE_OF_CONDUCT.md Restore some files and fix minor issues of SGX platform (#144) 2019-11-21 10:30:57 +08:00
CONTRIBUTING.md Restore some files and fix minor issues of SGX platform (#144) 2019-11-21 10:30:57 +08:00
Dockerfile Initial Dockerfile (#97) 2019-08-14 10:34:36 +08:00
LICENSE Remove unused files and update license header of some files (#138) 2019-11-11 20:38:49 -06:00
ORG_CODE_OF_CONDUCT.md Recover files deleted accidentally in last commit (#143) 2019-11-20 21:31:43 +08:00
README.md sdk build tools and app framework updates (#171) 2020-02-22 10:12:26 +08:00
SECURITY.md Recover files deleted accidentally in last commit (#143) 2019-11-20 21:31:43 +08:00

WebAssembly Micro Runtime

Building WAMR VM core | Embedding WAMR VM core | Building WASM applications | Samples and demos

A Bytecode Alliance project

WebAssembly Micro Runtime (WAMR) is a standalone WebAssembly (WASM) runtime with small footprint. It includes a few parts as below:

  • The "iwasm" VM core, supporting WebAssembly interpreter, ahead of time compilation (AoT) and Just-in-Time compilation (JIT)

  • The application framework and the supporting API's for the WASM applications

  • The dynamic management of the WASM applications

iwasm VM core

key features

  • Embeddable with the supporting C API's
  • Small runtime binary size (85K for interpreter and 50K for AoT) and low memory usage
  • Near to native speed by AoT
  • AoT module loader works for both embedded OS and Linux system
  • Choices of WASM application libc support: the built-in libc subset for embedded environment or WASI for standard libc
  • The mechanism for exporting native API's to WASM applications

Supported architectures and platforms

The iwasm supports following architectures:

  • X86-64, X86-32
  • ARM, THUMB
  • MIPS
  • XTENSA

Following platforms are supported:

Refer to WAMR porting guide for how to port WAMR to a new platform.

Build wamrc AoT compiler

Execute following commands to build wamrc compiler:

cd wamr-compiler
./build_llvm.sh
mkdir build
cd build
cmake ..
make

After build is completed, create a symbolic link /usr/bin/wamrc to the generated wamrc.

Build the mini product

WAMR supports building the iwasm VM core only (no app framework) to the mini product. The WAMR mini product takes the WASM application file name as input, and then executes it. For the detailed procedure, see build WAMR VM core and build and run WASM application.

Embed WAMR VM core

WAMR provides a set of C API for loading the WASM module, instantiating the module and invoking a WASM function from a native call. For the details, see embed WAMR VM core.

Application framework

By using the iwasm VM core, we are flexible to build different application frameworks for the specific domains, although it would take quite some efforts.

The WAMR has offered a comprehensive framework for programming WASM applications for device and IoT usages. The framework supports running multiple applications, which are based on the event driven programming model. Here are the supporting API sets by the WAMR application library :

  • Timer
  • Micro service (Request/Response) and Pub/Sub inter-app communication
  • Sensor
  • Connectivity and data transmission
  • 2D graphic UI (based on littlevgl)

Every subfolder under WAMR application framework folder is a compilation configurable component. The developers can copy the template folder to create new components to the application framework. If a component needs to export native functions to the WASM application, refer to the export_native_api.md .

Remote application management

The WAMR application manager supports remote application management from host environment or the cloud through any physical communications such as TCP, UPD, UART, BLE, etc. Its modular design makes it able to support application management for different managed runtimes.

The tool host_tool communicates to the WAMR app manager for installing/uninstalling the WASM applications on companion chip from host system. And the IoT App Store Demo shows the conception of remotely managing the device applications from cloud.

WAMR SDK

The wamr-sdk tools build the WAMR to both runtime SDK for embedding by your native codes and APP SDK for developing the WASM applications. A SDK profile presents a configuration of build parameters for the selection of CPU arch, software platforms, execution mode, libc and application framework components.

Note: WASI-SDK version 7 and above should be installed before building the WAMR SDK.

Menu configuration for building SDK

Menu configuration is supported for easy integration of runtime components and application libraries for the target architecture and platform.

cd wamr-sdk
./build_sdk.sh -i -n [profile name]
wamr build menu configuration

After the menu configuration is finished, the building process is automatically started. When the building gets successful, the SDK package is generated under folder $wamr-sdk/out/{profile}, and the header files of configured components were copied into the SDK package.

The directory structure of a SDK package with profile name "simple":

simple/
├── app-sdk
│   ├── libc-builtin-sysroot
│   │   ├── include
│   │   └── share
│   └── wamr-app-framework
│       ├── include
│       │   ├── bi-inc
│       │   └── wa-inc
│       ├── lib
│       └── share
└── runtime-sdk
    ├── include
    │   └── bi-inc
    └── lib

Use Runtime SDK

The folder "runtime-sdk" contains all the header files and library files for integration with project native code.

Build WASM applications with APP-SDK

The folder “app-sdk” contains all the header files and WASM library for developing the WASM application. For C/C++ based WASM applications, the developers can use conventional cross-compilation procedure to build the WASM application. Refer to build WASM applications for the details.

Samples and demos

The WAMR samples integrate the iwasm VM core, application manager and selected application framework components. The samples are located in folder samples:

  • Simple: The runtime is integrated with most of the WAMR APP libraries, and a few WASM applications are provided for testing the WAMR APP API set. It uses built-in libc and executes apps in interpreter mode by default.
  • littlevgl: Demonstrating the graphic user interface application usage on WAMR. The whole LittlevGL 2D user graphic library and the UI application is built into WASM application. It uses WASI libc and executes apps in AoT mode by default.
  • gui: Moved the LittlevGL library into the runtime and defined a WASM application interface by wrapping the littlevgl API. It uses WASI libc and executes apps in interpreter mode by default.

The graphic user interface demo photo:

WAMR samples diagram

Releases and acknowledgments

WAMR is a community effort. Since Intel Corp contributed the first release of this open source project, this project has received many good contributions from the community.

See the major features releasing history and contributor names

Roadmap

See the roadmap to understand what major features are planned or under development.

Please submit issues for any new feature request, or your plan for contributing new features.

License

WAMR uses the same license as LLVM: the Apache 2.0 license with the LLVM exception. See the LICENSE file for details. This license allows you to freely use, modify, distribute and sell your own products based on WAMR. Any contributions you make will be under the same license.

Submit issues and contact the maintainers

Click here to submit. Your feedback is always welcome!

Contact the maintainers: imrt-public@intel.com