Skip to main content
The KineticVM runtime does not flash pins itself when the machine is a separate board. It speaks one JSON line per message over serial at 115200 baud. The board answers commands and can also speak first, which is how a keypad, a button, or a scale starts a SOP.

The line protocol

Every message is one JSON object followed by a newline.
The runtime sends a request and waits for the matching id.
A failure uses the same id with "ok": false and an error string.
The commands the reference firmware understands: Unknown commands are ignored. The ESP32 starter in firmware/esp32 answers these four and exposes pins 2 and 13 as outputs.

Sending an event

The ESP32 main loop calls take_host_message whenever the serial line is idle. The starter returns nothing. Replace that function so it returns a message once per real event:
firmware/esp32/src/main.rs
Returning the same message on every idle poll sends it again on every poll. Return it once, then return None until the next event. A SOP matches it like this:
SOP.toml
board is the name in [peripherals], not the chip. signal is the name your firmware chose.

Boards the daemon listens for

With no [peripherals] table, the daemon opens four serial boards: An explicit boards list, including an empty one, replaces that default. Add a board from the CLI:
native is local GPIO on the device itself, used for rpi-gpio. Serial boards get the tools gpio_read and gpio_write. A Raspberry Pi GPIO board gets gpio_rpi_read, gpio_rpi_write, gpio_rpi_blink, and rpi_system_info.

What gets attested

When [chain] is enabled, a successful call to gpio_write, gpio_rpi_write, gpio_rpi_blink, or set_device is attested automatically, with requestURI kinetic://actuator/<tool> and the tool arguments as the parameters. A failed call is not attested.
Plugin tools are not wrapped. If vend drives a motor by calling gpio_write itself, inside the Wasm guest, that call never reaches the host tool and is not attested. Call monad_attest from the SOP after the operation completes, with the record you want to keep.
The reference firmware trees live under firmware/: esp32, pico, nucleo, arduino, and kinetic-fw-protocol, which is the shared parser for commands and host messages.