ADR 0016 — SITL vs. KPU is one build flag, confined to the Rust HAL
Status: Accepted
Date: 2026-05-21
Source: docs/arch/cortex-repo.md, Abstracting the Memory Source in Rust and the master CMake build; CLAUDE.md
Related: ADR-0008
Context
Section titled “Context”Development and CI run on host x86 (software-in-the-loop, SITL) long before
silicon exists. The real target uses kernel-driver DMA on the KPU. If the
hardware distinction leaks into algorithms, every operator grows #ifdef
branches and the SITL build stops testing the code that ships.
Decision
Section titled “Decision”- One CMake option,
BUILD_TARGET_KPU(defaultOFF), selects the target. It definesTARGET_KPU/TARGET_SITLfor C++ and exportsRUST_HAL_TARGET=KPU|SITLto the Rust build. - The distinction is confined to the Rust
MemoryProviderHAL (core/src/memory_provider.rs): a SITL provider emulates DMA memory with POSIX shared memory, and a KPU provider talks to the kernel driver. - Operators (
sdk/), math (math/), and CV (cv/) never branch on the build target.
Consequences
Section titled “Consequences”- The SITL build exercises exactly the operator code that ships on the KPU.
- Hardware-specific work goes into
core/; extend the HAL trait there, not in C++. - The cross-compile preset (
kpu-cross) builds the same tree for aarch64.