# middleware/

Board-deployable SOA packages (`gf_ara::*`) — the last mile after the bench (virtual world · Foxglove · CI) has passed. SKU perception/planning apps are a **workload** on top of this runtime (robustness, latency, localization of faults) — not the middleware product itself. Trim via SOR / `req.yaml` `runtime_modules[]`.

**与架构 GIF SoC 芯片对齐**（`gallery/Giraffe_Flow/Giraffe_Flow.gif`）：

| GIF 芯片 | 本目录包 | 说明 |
|----------|----------|------|
| com | [com](com/) | 统一通信 |
| EM | [exec](exec/)（EmDaemon） | **入口**；OSAL Spawn / relaunch daemons + apps |
| exec | [exec](exec/) | ExecutionClient |
| phm | [phm](phm/) | Alive / Deadline / Logical |
| sm | [sm](sm/) | Function groups |
| collector | [collector](collector/) | 事件环 / DEM-lite |
| OSAL | [osal](osal/) | 时钟 / 线程 / **process** |
| diag | [diag](diag/) | DoIP 会话（TCP）+ UDS Routine → OTA |
| ucm | [ucm](ucm/) | PackageManager + OtaOrchestrator（SIL） |
| log | [log](log/) | 日志 lite → DLT sink |
| dlt | COVESA `dlt-daemon`（third_party） | platform daemon；**按需**（`log.yaml` sinks 含 `dlt`，由 EM 拉起） |
| per | [per](per/) | 持久化 KV stub（可裁剪） |
| tsync | [tsync](tsync/) | 时间同步骨架（可裁剪；Modules 环内） |

启动（systemd/init 或 `run_sil`）：只起 **EM** → 可选 daemons（dlt?/RouDi?/…）+ SOA apps。  
**sm 不是开机入口**——各 App runtime bring-up / PHM / UCM 调用 `StateClient`（FG：Off/Running/Updating）。  
详见 [Giraffe_Modules.gif](../gallery/Giraffe_Modules/Giraffe_Modules.gif) · [sm/README](sm/README.md) · [DLT_PLAN](../docs/zh/operations/DLT_PLAN.md)。

另有： [core](core/) · [bindings/](bindings/) · [hal](hal/) · [trace](trace/)（偏 debug-path）· [third_party/](third_party/)。

| Package | Role | Phase |
|---------|------|-------|
| [core](core/) | Result / ErrorCode | P0 |
| [com](com/) | Unified communication API | P0 |
| [bindings/](bindings/) | Transport plugins (iceoryx / someip / dds …) | P0+ |
| [osal/](osal/) | OS abstraction (clock / thread / **process**) | P0 |
| [hal/](hal/) | Board sensors / actuators | P1+ |
| [third_party/](third_party/) | Upstream checkouts (gitignored) | P0+ |
| [exec](exec/) | ExecutionClient + **EmDaemon** (OSAL Spawn) | P3 |
| [phm](phm/) | Platform health (`notify_sm` / restart→EM) | P3 |
| [sm](sm/) | Function groups Off/Running/Updating | P3 |
| [collector](collector/) | Event collector (DEM-lite / cp_dem stub) | P3 |
| [log](log/) | Logging lite + DLT sink | P3 |
| [per](per/) | Persistency KV stub（可裁剪） | P3 |
| [tsync](tsync/) | Time sync skeleton（可裁剪） | P3 |
| [trace](trace/) | Trace → VCD / GMT | P2 |
| [ucm](ucm/) | OTA / packages + orchestrator | P3 ●（RAUC stub） |
| [diag](diag/) | ISO 14229 UDS+NRC · 13400 DoIP（依赖）· 插件 0x27/0x29 | P3 ● |

Staging (gitignored): `middleware/.deps-prefix/` after `bash scripts/bootstrap_deps.sh`.

```bash
bash scripts/bootstrap_deps.sh
cmake -B build -DGF_BUILD_TESTS=ON
cmake --build build -j"$(nproc)"
ctest --test-dir build --output-on-failure
# fusa (L1 CASE lines → fusa/runs/):
bash fusa/scripts/run_cases.sh
```

FuSa matrices: [fusa/cases/](../fusa/cases/) · policy: [fusa/POLICY.md](../fusa/POLICY.md).

Unit / component smokes live under each module’s **`testcases/`** directory.
