vemu.

Runtime Introspection

A running emulator can tell you what it is made of: which peripherals are wired, which event kinds each accepts and emits (with payload schemas), which commands it understands, and what its inspector snapshots look like. This is the same reflection data these docs are generated from — exposed to your code and to AI tooling at runtime.

List and inspect peripherals

const emu = new Emulator("nordic,nrf5340-dk-cpuapp", new Uint8Array(), "elf");

// Named peripherals with inspectors:
const names = JSON.parse(emu.peripheral_list());   // ["kmu", "uicr", ...]

// Current inspector state (field map; shape per the peripheral's docs):
const snapshot = JSON.parse(emu.peripheral_snapshot("kmu"));

// Drive a documented command:
emu.peripheral_command("kmu", JSON.stringify({
  name: "write_slot",
  params: { slot: "5", k0: "0xDEADBEEF", k1: "0x1", k2: "0x2", k3: "0x3" },
}));

Command params always travel as strings; integer params accept 0x/0b prefixes. Each peripheral's commands and their parsing are listed on its reference page.

Describe one machine

describe() returns the full reflection document for the constructed machine: its board identity, every wired peripheral (name, base address, capabilities), each peripheral's static metadata — accepted inputs and event kinds, emitted effects and event kinds with payload schemas, commands — plus the builtin event vocabulary:

const description = JSON.parse(emu.describe());
for (const p of description.peripherals) {
  console.log(p.name, p.metadata?.events_out?.map((e) => e.kind));
}

Describe the whole build

The module-level describe_runtime() catalogs every board compiled into the wasm build you installed without constructing them yourself:

import { initVemu, describe_runtime } from "@swedishembedded/vemu";
import type { RuntimeDescription } from "@swedishembedded/vemu";

await initVemu();
const runtime: RuntimeDescription = JSON.parse(describe_runtime());

runtime.boards;          // every board in this build
runtime.peripherals;     // catalog keyed by compatible (e.g. "nordic,nrf-kmu-nvmc")
runtime.global_events;   // builtin in/out event vocabulary

This is the document the runtime reference pages are built from at site-build time — and the right entry point for an AI agent that needs to know what it can and cannot do with a given peripheral before debugging firmware on it.

Note:

Because the metadata is declared inside each peripheral model and extracted from the compiled runtime, describe_runtime() always reflects exactly the build you are running — never a stale document.

Machine-readable docs

The curated reference data for this site's build ships next to these pages:

Both are stable, versioned artifacts — point your tooling at them.