HAL and Tiers
The Hardware Abstraction Layer (HAL) is how the agent adapts to different companion computers. It reads the board identity at boot, loads the matching YAML profile, and configures the agent’s features based on the board’s capabilities.Board detection
The detection logic lives inados.hal.detect and runs at agent startup:
- Read
/proc/device-tree/model(the Linux device tree model string) - Compare against
model_patternsin each board YAML file - Pick the first profile whose pattern matches as a substring
- If no match, fall back to
generic-arm64.yaml
- Total RAM from
/proc/meminfo - CPU core count from
os.cpu_count() - Architecture from
platform.machine()
Board profile schema
Each profile is a YAML file atsrc/ados/hal/boards/<name>.yaml. Here is the full schema:
Tier mapping
The tier system determines which features are active. The agent picks a tier based on three inputs (in priority order):- Explicit config (
agent.tierin config.yaml) overrides everything - Board profile (
default_tierin the YAML file) is the fallback - RAM-based fallback if running on
generic-arm64with no explicit tier
Tier feature matrix
| Feature | Tier 1 | Tier 2 | Tier 3 | Tier 4 |
|---|---|---|---|---|
| MAVLink proxy | Yes | Yes | Yes | Yes |
| REST API | No | Yes | Yes | Yes |
| Health monitoring | No | Yes | Yes | Yes |
| mDNS discovery | No | Yes | Yes | Yes |
| Video pipeline | No | No | Yes | Yes |
| WFB-ng link | No | No | Yes | Yes |
| Cloud relay | No | No | Yes | Yes |
| Scripting engine | No | No | Yes | Yes |
| OTA updates | No | No | Yes | Yes |
| Peripherals manager | No | No | Yes | Yes |
| Vision engine | No | No | No | Yes |
| Application suites | No | No | No | Yes |
RAM guidelines
| Tier | Minimum RAM | Typical boards |
|---|---|---|
| 1 | 64 MB | Luckfox Pico (RV1103, RV1106) |
| 2 | 256 MB | RV1126B, generic ARM64 |
| 3 | 1 GB | Raspberry Pi 4B/CM4, Jetson Nano, Radxa CM3 |
| 4 | 4 GB | ROCK 5C Lite, RPi 5/CM5, Jetson Orin Nano, Orange Pi 5 |
HAL modules
Beyond board detection, the HAL provides several hardware abstraction modules:| Module | File | Purpose |
|---|---|---|
detect.py | Board identification and profile loading | |
camera.py | Camera detection (CSI, USB V4L2) | |
gpio.py | GPIO pin access for buttons, LEDs | |
usb.py | USB device enumeration and hot-plug | |
hotplug.py | Device hot-plug event handling | |
modem.py | Cellular modem AT commands |
Adding a new board
To add support for a board that is not in the built-in list:Identify the model string
SSH into the board and read the device tree model:This is the string you will match against.
Add bus definitions
List the UART ports the FC might connect to, USB ports, I2C buses, and any other relevant hardware.
Set the right tier
Based on the board’s RAM and capabilities, pick an appropriate default tier. When in doubt, start lower and test.
Test
Install the agent on the board and verify detection:The board name, tier, and features should match your YAML file.