Files
innesco-rs/README.md
T
BobBot 78a84ef248
ci / test (push) Canceled after 0s
ci / build-arm64 (push) Canceled after 0s
Initial Rust port of innesco: ECS protocol, frame decoder, CLI
- innesco-protocol: ECS wire protocol client (port of ecs/protocol.py)
- innesco-decoding: 13-byte frame decoder (port of csrc/decoding.c),
  golden tests mirror tests/test_decode_golden.py (14/14 green)
- innesco-cli: ping / decode subcommands
- scripts/build-arm64.sh: rootless cross build for AMD Kria K26
  (aarch64 via cargo-zigbuild + zig, musl static default)
- zero external dependencies (std only)
2026-11-12 07:06:19 +00:00

66 lines
2.8 KiB
Markdown

# innesco-rs
Rust clone of **innesco** (the IGNITE64 control/DAQ software, `timespot/innesco`
on baltig). This repo is a **separate clean-room-style port**: the original
Python/C repository is untouched, and its license/authorship is respected.
Deployment target: **AMD Kria K26** SOM (Zynq UltraScale+ MPSoC, quad
Cortex-A53, aarch64, Ubuntu 22.04) — the board buffering/timestamping the
IGNITE64 detector data.
## Layout
| crate | ported from | status |
|---|---|---|
| `innesco-protocol` | `innesco/ecs/protocol.py` | ECS wire protocol (Read/Write/Ping, `>BI` headers) + TCP client |
| `innesco-decoding` | `innesco/decoding/csrc/decoding.c` | 13-byte frame decoder, DCO calibration, position map; golden tests |
| `innesco-cli` | — | `ping`, `decode` subcommands (zero-dependency) |
**Zero external dependencies** (pure `std`): cross-compiling for arm64 needs no
cross-linked C libraries, and release binaries are small (`panic = "abort"`, LTO).
## Build (x86_64 host)
```bash
cargo test --workspace # golden tests
cargo build --release # host binary
export CARGO_TARGET_DIR=/tmp/innesco-rs-target # keep artifacts off NFS
```
## Build for arm64 (Kria K26)
```bash
scripts/build-arm64.sh --run-tests # static musl binary (recommended)
scripts/build-arm64.sh --gnu # dynamic, glibc (Ubuntu 22.04 on board)
```
The script bootstraps everything without root: `rustup target add`,
a `ziglang` pip venv as cross linker (via `cargo-zigbuild`), then
`cargo zigbuild --release --target aarch64-unknown-linux-musl`.
Artifacts land in `dist/aarch64-<musl|gnu>/innesco-cli`.
Deploy to the Kria: `scp dist/aarch64-musl/innesco-cli <board>:~/ && ssh <board> ./innesco-cli ping localhost 8888`.
## Porting notes
See `docs/porting-notes.md` for the Python/C → Rust mapping and the
(deliberate) divergences from the C extension (64-bit arithmetic where the C
overflows 32-bit, strict socket reads where Python truncated silently,
skip-and-count instead of abort on malformed packets).
## Open Points
(user-editable — tell me here what to focus on)
1. **Storage layer**: parquet/arrow output (polars-rust or arrow2) to replace
`ParquetStorage` — not ported yet, `decode` prints TSV instead.
2. **REST API**: axum port of `rest_api.py` (`/ping`, `/state`, `/tag`, …) —
planned; needs an HTTP crate dependency decision.
3. **Board/slow-control model**: `Board.py`/`quadrant.py`/`mattonella.py`
register model (supermattonelle 4-7 broadcast-only, FastIN registers) —
domain logic ready to port on request.
4. **Real-board validation**: run `innesco-cli ping` + a decode against the
actual data_server on a Kria board (needs network access to the setup).
5. **CI runner**: `.gitea/workflows/ci.yml` is in place, but this Gitea may
have no Actions runner configured — currently CI runs locally.