Skip to content

Firmware

Status: prototype. This is new and incomplete: its commands, files and behavior may change or be removed in any release.

termapy ships the device-side sources a monitor compiles in to speak its protocols, so getting them is one command, not a trip to the repository. /firmware lists what ships; .copy writes it into the config's firmware/ folder, which has the file commands every data folder has.

Target Language Files Guide
mem C termapy_mem.c, termapy_mem.h Memory
json C termapy_json.c, termapy_json.h JSON integration
monitor C termapy_monitor.c, termapy_monitor.h Boards

mem and json drop into a monitor you already have. monitor is a whole one for a device that has none: a table of commands with one-line help, help, json on|off and JSON requests, on top of json (and mem for the MEM commands). It is the C twin of the monitor the MicroPython board starters run, on the same wire, and the Arduino board starters are built on it.

/firmware                              what ships: target, language, files, size (same as /firmware.lib)
/firmware.copy                         every module of the shipped language into the config's firmware/
/firmware.copy lang=c                  the same, naming the language
/firmware.copy mem folder=fw           one module into fw/ under the config's folder, created if missing
/firmware.lib.show json                open the shipped termapy_json.c in the system viewer
/firmware.lib.dump mem termapy_mem.h   print one shipped file to the terminal
/firmware.list                         the copies in this config's firmware/, newest first
/firmware.edit termapy_mem.c           open a copy in the system editor (also /edit.firmware)
/firmware.show, .dump, .rename, .delete   the folder's file commands, as /run has for run/

What ships is /firmware.lib, the noun beside the folder as /dev.lib is beside dev/, so the plain verbs (.list, .show, .dump) always mean this config's own files (per-folder file commands).

A module's files follow its language: in C a module is a .c and its .h, so mem is termapy_mem.c and termapy_mem.h; a language with one file per module ships one. Like everything termapy writes for a config, the copy lands in that config's folder: its firmware/ by default, and a relative folder= is under the config's folder too, never wherever termapy was started. An absolute folder= puts it in your firmware project instead; over MCP that needs host-wide file access. The reply names the full path. .copy never overwrites: a file already in the folder fails the whole copy before anything is written, so a module you have edited stays yours. lang= names the language when the sources ship in several; today everything ships in C, so it is never needed. Over MCP, /firmware.lib.dump is how an agent reads a shipped source, and /firmware.dump a copied one: the file's text is the command's value.

Each module is strict C99 with no dependency beyond the standard headers. The suite compiles each against a host harness (tests/test_firmware_mem.py, tests/test_firmware_json.py, tests/test_firmware_monitor.py), so the shipped source is the tested source; the monitor's tests also run every line through the MicroPython monitor and require the same bytes back.