WebAssembly Micro Runtime (WAMR)
Go to file
2023-02-09 07:49:07 +08:00
.devcontainer Upgrade toolkits (#1878) 2023-02-02 09:42:25 +08:00
.github Add gh api call for fetching llvm version (#1942) 2023-02-09 07:49:07 +08:00
assembly-script Minor fix in assembly script library (#1597) 2022-10-14 12:54:25 +08:00
build-scripts Add gh api call for fetching llvm version (#1942) 2023-02-09 07:49:07 +08:00
ci Dockerfile lint errors fix (#1493) 2022-09-22 13:06:11 +08:00
core Fix terminating stale threads on trap/proc_exit (#1929) 2023-02-07 20:56:23 +08:00
doc Enable specifying out-of-source platform configuration cmake file (#1941) 2023-02-07 22:10:59 +08:00
language-bindings Fix go language binding build on macos arm64 (#1875) 2023-01-10 09:15:49 +08:00
product-mini Enable running mode control for runtime and module instance (#1923) 2023-02-02 18:16:01 +08:00
samples Upgrade toolkits (#1878) 2023-02-02 09:42:25 +08:00
test-tools Upgrade toolkits (#1878) 2023-02-02 09:42:25 +08:00
tests wamr-test-suites: Save .wasm/.aot file to the report dir if test failed (#1937) 2023-02-06 11:04:28 +08:00
wamr-compiler Make memory profiling show native stack usage (#1917) 2023-02-01 11:52:15 +08:00
wamr-sdk Add some missing macros for int literals in wamr-sdk libc-builtin-sysroot stdint.h (#1888) 2023-01-17 15:25:57 +08:00
zephyr zephyr: add module.yml and fix riscv compile error (#763) 2021-09-24 17:43:02 +08:00
.clang-format Customize clang-format coding styles based on Mozilla template (#770) 2021-10-06 09:54:36 +08:00
.clang-tidy Customize clang-format coding styles based on Mozilla template (#770) 2021-10-06 09:54:36 +08:00
.gitignore Upgrade toolkits (#1878) 2023-02-02 09:42:25 +08:00
ATTRIBUTIONS.md Fix AOT debug for macOS (#1494) 2022-09-16 18:54:04 +08:00
CMakeLists.txt Use boringssl instead of openssl to implement wasm cache loading (#1804) 2022-12-13 14:23:37 +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
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 Update README.md to add link for document website (#1722) 2022-11-21 18:02:02 +08:00
RELEASE_NOTES.md Update release notes and fix issues reported by Coverity (#1813) 2022-12-16 14:16:58 +08:00
SConscript Add ia32 support and fix compiling issue for RT-Thread (#730) 2021-09-07 10:20:14 +08:00
SECURITY.md Refer to BA security policy (#635) 2021-05-19 19:59:23 +08:00
TSC_Charter.md Implement most missing wasm-c-api APIs (#303) (#676) 2021-07-28 21:53:37 +08:00

WebAssembly Micro Runtime

A Bytecode Alliance project

GuideWebsiteChat

Build WAMR | Build AOT Compiler | Embed WAMR | Export Native API | Build WASM Apps | Samples

WebAssembly Micro Runtime (WAMR) is a lightweight standalone WebAssembly (WASM) runtime with small footprint, high performance and highly configurable features for applications cross from embedded, IoT, edge to Trusted Execution Environment (TEE), smart contract, cloud native and so on. It includes a few parts as below:

  • The "iwasm" VM core to run WASM applications, supporting interpreter mode, AOT mode (Ahead-of-Time compilation) and JIT modes (Just-in-Time compilation, LLVM JIT and Fast JIT are supported)

  • The "wamrc" AOT compiler to compile WASM file into AOT file for best performance and smaller runtime footprint, which is run by "iwasm" VM Core

  • The application framework and the supporting APIs for the WASM applications

  • The dynamic management of the WASM applications

Getting started

iwasm VM core

Key features

WASM post-MVP features

Supported architectures and platforms

The iwasm supports the following architectures:

  • X86-64, X86-32
  • ARM, THUMB (ARMV7 Cortex-M7 and Cortex-A15 are tested)
  • AArch64 (Cortex-A57 and Cortex-A53 are tested)
  • RISCV64, RISCV32 (RISC-V LP64 and RISC-V LP64D are tested)
  • XTENSA, MIPS, ARC

The following platforms are supported, click each link below for how to build iwasm on that platform. Refer to WAMR porting guide for how to port WAMR to a new platform.

Build iwasm VM core (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 or AOT file name as input and then executes it. For the detailed procedure, please see build WAMR VM core and build and run WASM application. Also we can click the link of each platform above to see how to build iwasm on it.

Build wamrc AOT compiler

Both wasm binary file and AOT file are supported by iwasm. The wamrc AOT compiler is to compile wasm binary file to AOT file which can also be run by iwasm. Execute following commands to build wamrc compiler for Linux:

cd wamr-compiler
./build_llvm.sh (or "./build_llvm_xtensa.sh" to support xtensa target)
mkdir build && cd build
cmake .. (or "cmake .. -DWAMR_BUILD_PLATFORM=darwin" for MacOS)
make
# wamrc is generated under current directory

For Windows

cd wamr-compiler
python build_llvm.py
mkdir build && cd build
cmake ..
cmake --build . --config Release
# wamrc.exe is generated under .\Release directory

Performance and Footprint

User cases

WAMR is widely used in a lot areas, here are some cases:

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 effort.

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

  • Timer, Inter-app communication (request/response and pub/sub), Sensor, Connectivity and data transmission, 2D graphic UI

Browse the folder core/app-framework for how to extend the application framework.

Remote application management

The WAMR application manager supports remote application management from the 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 the host system. And the IoT App Store Demo shows the conception of remotely managing the device applications from the cloud.

WAMR SDK

Usually there are two tasks for integrating the WAMR into a particular project:

  • Select what WAMR components (vmcore, libc, app-mgr, app-framework components) to be integrated, and get the associated source files added into the project building configuration
  • Generate the APP SDK for developing the WASM apps on the selected libc and framework components

The WAMR SDK tools is helpful to finish the two tasks quickly. It supports menu configuration for selecting WAMR components and builds the WAMR to a SDK package that includes runtime SDK and APP SDK. The runtime SDK is used for building the native application and the APP SDK should be shipped to WASM application developers.

Samples

The WAMR samples integrate the iwasm VM core, application manager and selected application framework components.

  • basic: Demonstrating how to use runtime exposed API's to call WASM functions, how to register native functions and call them, and how to call WASM function from native function.
  • 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.
  • file: Demonstrating the supported file interaction API of WASI. This sample can also demonstrate the SGX IPFS (Intel Protected File System), enabling an enclave to seal and unseal data at rest.
  • littlevgl: Demonstrating the graphic user interface application usage on WAMR. The whole LVGL 2D user graphic library and the UI application are built into WASM application. It uses WASI libc and executes apps in AOT mode by default.
  • gui: Move the LVGL library into the runtime and define a WASM application interface by wrapping the littlevgl API. It uses WASI libc and executes apps in interpreter mode by default.
  • multi-thread: Demonstrating how to run wasm application which creates multiple threads to execute wasm functions concurrently, and uses mutex/cond by calling pthread related API's.
  • spawn-thread: Demonstrating how to execute wasm functions of the same wasm application concurrently, in threads created by host embedder or runtime, but not the wasm application itself.
  • multi-module: Demonstrating the multiple modules as dependencies feature which implements the load-time dynamic linking.
  • ref-types: Demonstrating how to call wasm functions with argument of externref type introduced by reference types proposal.
  • wasm-c-api: Demonstrating how to run some samples from wasm-c-api proposal and showing the supported API's.
  • socket-api: Demonstrating how to run wasm tcp server and tcp client applications, and how they communicate with each other.
  • workload: Demonstrating how to build and run some complex workloads, e.g. tensorflow-lite, XNNPACK, wasm-av1, meshoptimizer and bwa.
  • sgx-ra: Demonstrating how to execute Remote Attestation on SGX with librats, which enables mutual attestation with other runtimes or other entities that support librats to ensure that each is running within the TEE.

Project Technical Steering Committee

The WAMR PTSC Charter governs the operations of the project TSC. The current TSC members:

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.

More resources

Check out the Wiki documents for more resources: