Show HN: Tiny VM sandbox in C with apps in Rust, C and Zig

https://news.ycombinator.com/rss Hits: 21
Summary

馃尡 uvm32 uvm32 is a minimalist, dependency-free virtual machine sandbox designed for microcontrollers and other resource-constrained devices. Single C file, no dynamic memory allocations, asynchronous design, pure C99. On an STM32L0 (ARM Cortex-M0+) the required footprint is under 4KB flash/1KB RAM. uvm32 is a RISC-V emulator, wrapped in a management interface and provided with tools to build efficient code to run in it. What is it for? As a no-frills alternative to embedded script engines (Lua, Duktape, MicroPython, etc) As a sandbox to isolate untrusted or unreliable elements of a system As a way to allow development in modern systems programming languages where a compiler for the target may not be available (rust-hello) As a way to write once, run anywhere and avoid maintaining multiple software variants Features Bytecode example apps written in C, Zig, Rust and assembly Non-blocking design, preventing misbehaving bytecode from stalling the host No assumptions about host IO capabilities (no stdio) Simple, opinionated execution model Safe minimally typed FFI Small enough for "if this then that" scripts/plugins, capable enough for much more Aims for safety over speed, bad code running in the VM should never be able to crash the host Although based on a fully fledged CPU emulator, uvm32 is intended for executing custom script like logic, not for simulating hardware. How does it compare to the alternatives? Many scripting languages and virtual machines are available for embedding in small systems and they all make tradeoffs in different dimensions. uvm32 aims for: Small footprint (suitable for embedded devices, games and apps) Support well-known programming languages for VM code (with high quality dev tools) Ease of integration into existing software Flexibility of paradigm (event driven, polling, multi-processor) Robustness against misbehaving VM code uvm32 does not aim for: Frictionless FFI (no direct function calls between host and VM code) Maximum possible efficie...

First seen: 2025-12-12 22:49

Last seen: 2025-12-13 18:52