ast1060-mctp-i2c-echo to OpenPRoT (Pigweed)Source: hubris/app/ast1060-mctp-i2c-echo/ A Hubris RTOS application running MCTP-over-I2C echo on an AST1060 RoT.
| Task | Crate | Role |
|---|---|---|
jefe | task-jefe | Supervisor / fault manager |
idle | task-idle | Idle task |
mctp_echo | mctp-echo | Listens for MCTP type-1 requests, echoes payload back |
mctp_server | mctp-server | MCTP transport layer (features: serial_log, transport_i2c) |
uart_driver | drv-ast1060-uart | UART peripheral driver |
i2c_driver | drv-mock-i2c | Mock I2C driver (feature: mock-only) |
Target: openprot/ Cargo workspace + Bazel, targeting the Pigweed kernel (pw_kernel). Existing services follow api/ + server/ + backend-*/ pattern (see services/i2c/). Platform integration is Pigweed-only — the MCTP server will run as a userspace process under pw_kernel, not a Hubris task or Linux process.
Preserve as much of the original Hubris code as possible. Only change what is OS-dependent. The MCTP protocol logic, packet handling, server state management, transport encoding/decoding, and application logic (echo) should be carried over as-is. The only parts that change are:
idol / sys_reply / Leased → Pigweed pw_kernel IPC/channelstask_slot! / sys_recv_open / notifications → Pigweed userspace process event loopdrv-i2c-api / ast1060-uart-api → OpenPRoT services/i2c/ userspace driverapp.toml + build.rs code generation → Bazel BUILD files + system.json5Everything else — the Server struct, Router integration, Sender implementations, handle management, timeout logic, MCTP type definitions — should remain structurally identical to the Hubris originals.
services/mctp/api) — COMPLETECreate the platform-independent MCTP types and traits crate.
services/mctp/api/ directory structureCargo.toml — openprot-mctp-api cratesrc/lib.rs — Handle, RecvMetadata typessrc/error.rs — ResponseCode, MctpError (ported from hubris mctp-api ServerError)src/traits.rs — MctpClient, MctpListener, MctpReqChannel, MctpRespChannelCargo.tomlcargo check passesservices/mctp/server) — COMPLETECreate the platform-independent server logic crate.
services/mctp/server/ directory structureCargo.toml — openprot-mctp-server cratesrc/lib.rs + src/server.rs — Server struct with EID mgmt, pending recv tracking, timeoutsCargo.tomlcargo check passesmctp-stack (mctp-lib) Router as the packet processing enginemctp_stack::Sender trait for transport bindingsServer::inbound() + Server::update()services/mctp/transport-i2c) — COMPLETEPort the I2C transport from hubris mctp-server/src/i2c.rs, using the I2C userspace driver at services/i2c/ as the underlying transport.
services/mctp/transport-i2c/ crateSender for I2C using the services/i2c/ userspace driver (client API + IPC to I2C server)mctp-stack::i2c::MctpI2cHandler)I2cTargetClient from services/i2c/api for slave/target mode receiveDirectClient implementing MctpClient, 2 tests passing)services/mctp/transport-serial) — NOT STARTEDPort the serial transport from hubris mctp-server/src/serial.rs. (Lower priority than I2C.)
services/mctp/transport-serial/ crateSender for serial (using embedded-io::Write, not hubris ast1060-uart-api)mctp-stack::serial::MctpSerialHandler)Port the echo task from hubris task/mctp-echo/.
services/mctp/api/src/wire.rs) — request/response encoding for all MCTP operationsservices/mctp/client/) — IpcMctpClient implementing MctpClient via wire protocol + IPCservices/mctp/server/src/dispatch.rs) — decodes wire requests, calls Servertests/dispatch.rs) — full round-trip through wire encodingtarget/ast1060-evb/mctp/mctp_echo.rs)main.rs)Wire up the MCTP server as a Pigweed userspace process on the AST1060-EVB (target/ast1060-evb/).
main.rs: event loop driven by pw_kernel IPC/channelssys_recv_open / notifications / idol IPC dispatchdispatch_mctp_op for IPC request handlingservices/i2c/server/IpcMctpClient::send_recv to syscall::channel_transact (gated behind pigweed feature)services/i2c/ pattern)system.json5 entry for MCTP server + echo processes (target/ast1060-evb/mctp/)target/ast1060-evb/ platform definition (target.rs, BUILD.bazel)api/src/wire.rs)server/tests/echo.rs)server/tests/dispatch.rs)api/, server/, client/, transport-i2c/)services/i2c/ test pattern)docs/src/specification/middleware/mctp.md with implementation statusPhases 1–3, 5, and 6 mostly complete. All library code, IPC dispatch, Bazel BUILD files, system configuration, and echo binary are written. 11 tests pass. Remaining work: wire up real I2cSender in server main.rs (replace NoopSender), QEMU e2e test, and docs update.
| Crate | Source | Role |
|---|---|---|
mctp | workspace (types crate) | Eid, MsgType, Tag, Error etc. |
mctp-stack / mctp-lib | github.com/9elements/mctp-lib branch buildup | Router, Sender, fragmentation, serial/I2C handlers |
services/i2c/ | I2C userspace driver | I2C client/target/server — MCTP transport-i2c uses this as its underlying I2C transport |
heapless | workspace | no_std collections |
zerocopy | workspace | Zero-copy serialization |
Pigweed (pw_kernel) | Bazel via MODULE.bazel | Userspace processes, IPC channels, system image |