Run JavaScript scripts on microcontrollers and embedded hardware with very limited memory.
Compile JavaScript programs to bytecode files for persistent storage and direct execution on embedded devices.
Embed a lightweight scripting engine into a C application running on an ARM processor.
Requires a cross-compilation toolchain (e.g. ARM GCC) targeting the specific embedded architecture.
MicroQuickJS (also written MQuickJS) is a JavaScript engine written in C for use on embedded systems, devices that have very limited memory. It can run JavaScript programs using as little as 10 kilobytes of RAM, and the whole engine fits in roughly 100 kilobytes of read-only memory when compiled for ARM processors. Its speed is described as comparable to QuickJS, the full-featured sibling engine created by the same author. MQuickJS supports a subset of JavaScript close to the ES5 standard rather than modern JavaScript in its entirety. It runs in what the README calls a stricter mode, where patterns that are common sources of bugs or that consume extra memory are simply not allowed. Arrays cannot have holes, global eval is the only form of eval supported, and value boxing such as new Number(1) is not available. Some ES5 extensions are included, such as typed arrays, the exponentiation operator, and a handful of additional string and math functions. The internal design differs from standard JavaScript engines to reduce memory use. The garbage collector is a tracing, compacting collector, meaning objects can move in memory during a collection pass. The virtual machine does not use the CPU stack, and strings are stored in UTF-8. Because objects can move, the C API requires specific reference-management calls to keep pointers valid across allocations. The standard library is compiled into C data structures that reside in ROM, so loading it at runtime requires almost no RAM. A command-line tool called mqjs provides an interactive read-eval-print loop and can also compile a script to bytecode saved to a file, which the engine can then load and run later without recompiling. This allows programs to be stored in persistent storage on embedded hardware and executed directly from there.
← bellard on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.