Compile WebAssembly to native MicroPython modules for running high-performance code on embedded systems.
wasm2mpy is a compiler toolchain that converts WebAssembly modules into native MicroPython modules. It solves the performance limitations of MicroPython on embedded systems by allowing developers to write computationally intensive code in languages like C++, Rust, or Zig and run it efficiently on microcontrollers. This enables applications such as AI models and signal processing algorithms to execute with near‑native speed on devices like ESP32, Raspberry Pi Pico, and STM32.
Embedded systems engineers and IoT developers who use MicroPython but need higher performance for demanding tasks like machine learning, digital signal processing, or real‑time data analysis on constrained hardware.
Developers choose wasm2mpy because it uniquely combines the productivity of MicroPython with the performance of compiled languages, without requiring a full rewrite of their embedded software stack. It provides a seamless path to accelerate specific functions while keeping the flexibility and ease of Python for the rest of the application.
Compile WebAssembly to native MicroPython modules
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Supports compiling code from C++, Rust, Zig, TypeScript (via AssemblyScript), and more, as shown in the status table and Key Features, enabling diverse language choices for embedded development.
CoreMark benchmarks demonstrate efficiency close to native code, with results like 271.573 on ESP32-S3, addressing MicroPython's speed limitations for intensive tasks.
Runs on popular embedded platforms including ESP32, Raspberry Pi Pico, STM32, and RISC-V, as listed in the README, making it versatile for IoT projects.
Allows Python scripts to directly read and write WASM module memory via the _memory attribute, enabling seamless data exchange, as illustrated in the memory access example.
Exporting WASM functions requires manual glue code creation; auto-generation is pending in the TODO list, adding development time and complexity.
Targets like esp8266 lack sufficient memory to run modules without custom page sizes, as noted in the status table, restricting out-of-the-box usability.
Missing WebAssembly features like exceptions and stack switching are listed in the TODO, limiting advanced use cases that rely on these capabilities.