# WAMR — WebAssembly Micro Runtime for Embedded and IoT > WAMR (WebAssembly Micro Runtime) is a lightweight, high-performance WebAssembly runtime by the Bytecode Alliance. It supports interpreter, ahead-of-time, and JIT compilation modes, targeting resource-constrained devices from MCUs to cloud edge nodes. ## Install Save in your project root: # WAMR — WebAssembly Micro Runtime for Embedded and IoT ## Quick Use ```bash # Build WAMR git clone https://github.com/bytecodealliance/wasm-micro-runtime.git cd wasm-micro-runtime/product-mini/platforms/linux mkdir build && cd build cmake .. && make # Run a WASM module ./iwasm test.wasm ``` ## Introduction WAMR is a compact WebAssembly runtime developed under the Bytecode Alliance. It brings the portability and sandboxing of WebAssembly to environments where Wasmtime or V8 would be too large, including microcontrollers, RTOS-based systems, and edge computing platforms. ## What WAMR Does - Executes WebAssembly modules on devices with as little as 50KB RAM - Offers three execution modes: interpreter, ahead-of-time (AOT) compilation, and JIT - Provides WASI (WebAssembly System Interface) support for file and socket access - Supports multi-threading with the WASM threads proposal - Embeds into C/C++ host applications via a clean native API ## Architecture Overview WAMR includes a stack-based interpreter for minimal footprint, an AOT compiler that translates WASM to native code offline, and an optional LLVM-based JIT for runtime compilation. The runtime manages linear memory, tables, and module instances inside a sandboxed execution environment. A built-in app management framework supports dynamic loading and lifecycle control of WASM apps. ## Self-Hosting & Configuration - Build with CMake; select execution mode via cmake flags (-DWAMR_BUILD_INTERP, -DWAMR_BUILD_AOT) - Cross-compile for Zephyr, NuttX, RT-Thread, or bare-metal ARM targets - Use wamrc to ahead-of-time compile WASM to native for production deployment - Enable WASI for filesystem and network access in supported environments - Embed in a host app by linking libiwasm and calling wasm_runtime_* APIs ## Key Features - Runs on devices with as little as 50KB RAM (interpreter mode) - Three execution modes cover the spectrum from MCU to server - WASI support for portable system access - Dynamic module loading and unloading at runtime - Hardware-sandboxed execution isolates untrusted code ## Comparison with Similar Tools - **Wasmtime** — full-featured Bytecode Alliance runtime; WAMR targets smaller footprint - **Wasmer** — developer-friendly with package registry; WAMR focuses on embedded constraints - **wasm3** — pure interpreter with tiny footprint; WAMR adds AOT and JIT for higher throughput - **WasmEdge** — cloud-native WASM runtime; WAMR targets deeper embedded use cases ## FAQ **Q: What is the minimum hardware for WAMR?** A: The interpreter runs on Cortex-M4 with 50KB RAM. AOT mode needs more flash but runs faster. **Q: Can I use WAMR in a cloud environment?** A: Yes. WAMR runs on Linux, macOS, and Windows and is used in edge computing and serverless platforms. **Q: What languages can I compile to WASM for WAMR?** A: C, C++, Rust, Go (TinyGo), AssemblyScript, and any language with a WASM compilation target. **Q: Is WAMR production-ready?** A: Yes. It is used in production by Intel, Xiaomi, Midea, and other companies for IoT and edge workloads. ## Sources - https://github.com/bytecodealliance/wasm-micro-runtime - https://bytecodealliance.org/ --- Source: https://tokrepo.com/en/workflows/asset-d19392cd Author: AI Open Source