ARBI
Documents / docs/decisions/0023-pico-diagnostic-foundation.md

ADR-0023: Pico 2 W diagnostic firmware foundation

Status: accepted when the issue PR merges. Work record: #31.

Select C11 on Pico SDK 2.2.0, RP2350 ARM Cortex-M33, pinned GCC 12.2.1 and an application-local USB CDC diagnostic receiver. The SDK's optional C++ allocation wrapper is excluded from the C application. This is an isolated foundation with no motor outputs or installed physical adapter. ADR-0008's loopback TLS links remain the implemented edge transport; its exact-device allowlist and physical interface amendment are prerequisites to connecting a real edge service.

Local framing version arbi-usb/1.0 carries the existing arbi/1.0 envelope and grants no alternative cloud/job/lease authority. A fixed-memory parser accepts the documented ASCII diagnostic subset, rejects duplicate fields and malformed/oversized/deep input, and supports only authenticated current state.resync with null cursors. There is no actuator executor or advertised measurement capability.

A protected, physically provisioned per-device 256-bit key and current authorized peer identity would be required to call the enrollment API. USB data cannot provision keys, select peers, enroll or change configuration. The target has no provisioning adapter and starts unenrolled. Host tests invoke this boundary explicitly with synthetic material. HMAC-SHA-256 uses SDK-pinned mbedTLS, covers framing/version/current receiver nonce/sequence/payload, and is checked before JSON admission. This supplies integrity/authentication, not confidentiality or a secure-element claim. Fresh sessions require local reset and explicit enrollment; old frames cannot revive authority.

Configuration accepts exact canonical bytes of an immutable admitted profile, bound to its full shared configuration digest. The test-profile generator calls the existing shared schema/semantic validator; the C loader independently verifies bounded length, exact bytes/digest and version/revision/realm/mode/site identities. Only a synthetic test profile is currently admitted; it is excluded from the Pico image. Field configuration editing/persistence belongs to later runtime work, which must extend the same contracts and reviewed authority.

USB disconnect, idle/total timeout, authentication/session/transport-sequence failure and rate overflow clear volatile authority. The bounded main loop refreshes a watchdog and emits public unsigned diagnostic identity at most once per second. USB reset-via-baud and reset-via-vendor interfaces are disabled. Board identity, random boot IDs and fresh reconnect sessions identify epochs; they are not credentials.

Fault, no measurements, no actuator commands and physicalAcceptance: false remain true after valid host configuration/enrollment. Generic output-low and a firmware watchdog do not prove mechanical restraint. Loaded winches, electrical stop interfaces, pulse timing, physical boot/reconnect, grounding/USB isolation and installed recovery still require separate reviewed evidence. The protocol and evidence state those boundaries.