---
title: "Architecture"
description: "The Alp SDK is a thin unification layer on top of three OS backends and three (today) vendor SDKs. This page explains the layering, the boundaries, and how a single board.yaml flows through the build."
source: https://docs.alplab.ai/sdk/architecture
---

# Architecture

The Alp SDK is a thin **unification layer** on top of three OS backends and three (today) vendor SDKs. This page explains the layering, the boundaries, and how a single `board.yaml` flows through the build.

## Stack overview

```mermaid
flowchart TB
  classDef layer fill:#0f1424,stroke:#475569,color:#e2e8f0
  classDef sdk fill:#1e3a8a,stroke:#2f57d6,color:#ffffff
  classDef hw fill:#161b2e,stroke:#7dd3fc,color:#e2e8f0

  APP["Application code<br/>(yours, or alp-studio codegen)"]:::layer
  SDK["Alp SDK &lt;alp/*.h&gt;<br/>public surface (handles, error codes, instance IDs)<br/>&lt;alp/soc_caps.h&gt; — generated per SoC<br/>&lt;alp/e1m_pinout.h&gt; — portable instance IDs<br/>&lt;alp/chips/*&gt; — 20+ opt-in chip drivers"]:::sdk
  BE["Backend implementations — src/zephyr/, src/baremetal/, src/yocto/<br/>one .c per public class, per OS<br/>thin wrappers calling the OS's driver model"]:::layer
  OS["OS layer<br/>Zephyr device drivers / Linux ioctls / Alif HAL"]:::layer
  HAL["Vendor HAL — vendors/&lt;vendor&gt;/<br/>Alif Ensemble · Renesas RZ/V2N · DEEPX DX-M1"]:::layer
  HW["E1M / E1M-X hardware"]:::hw

  APP --> SDK --> BE --> OS --> HAL --> HW
```

## Why a wrapper, not a re-implementation

ADR [0001](https://github.com/alplabai/alp-sdk/blob/main/docs/adr/0001-wrapper-on-top-of-zephyr.md) records the decision: the SDK **wraps** the OS's driver model rather than reimplementing peripheral access. On Zephyr that means `alp_i2c_*` forwards to Zephyr's `i2c_*` API; on Yocto it forwards to `i2c-dev` ioctls; on bare-metal it calls the vendor HAL directly.

The win: the SDK gets every OS's driver fix, security patch, and silicon enablement for free. The cost: the public API can never assume features the underlying OS doesn't expose — the wrapper layer must stay shallow.

## Yocto layer

The Yocto backend ships as the [`meta-alp-sdk`](https://github.com/alplabai/alp-sdk/tree/main/meta-alp-sdk) Yocto layer at the top of the SDK repo. The layer carries **per-cluster** `MACHINE` confs (`e1m-v2n101-a55`, `e1m-v2n102-a55`, `e1m-v2n103-a55`, `e1m-v2m101-a55`, `e1m-v2m102-a55`, `e1m-v2m103-a55`, plus the non-buildable AEN placeholders `e1m-aen701-a32` and `e1m-aen801-a32`), the per-SKU recipes for Alp chip drivers + libraries, the userspace remoteproc helper (`alp-remoteproc_0.6.bb`), the generated `reserved-memory:` fragment (`alp-dts-reservations_0.6.bb`), and userspace bindings for `<alp/storage.h>` / `<alp/iot.h>` / `<alp/inference.h>` / `<alp/rpc.h>`.

Per-cluster MACHINE naming (not per-SoM) became normative in v0.6 — the M-class peer on a V2N is no longer implied to be part of the same MACHINE as the A55 cluster.

Add `BBLAYERS += "${TOPDIR}/../alp-sdk/meta-alp-sdk"` to `bblayers.conf` and pick the right MACHINE; the orchestrator emits the supporting `IMAGE_INSTALL` deltas from your `board.yaml` automatically.

> **Migration note.** The old `yocto/meta-alp/` tree was deleted in v0.6 — its content was absorbed into `meta-alp-sdk/`. Customers consuming the old layer name should re-point at `meta-alp-sdk`.

The AEN A32 MACHINEs do not build today: there is no Scarthgap-compatible Alif Yocto base for them, and `e1m-aen501-a32`, `e1m-aen601-a32` and `e1m-aen803-a32` have no conf at all. The planner refuses to emit `bitbake` for any of them and reports a `yocto-machine-unbuildable` build-plan warning instead. alp-sdk v0.17.0 also removed `e1m-nx9101-a55` together with the E1M-NX9101 module.

### Packaging (alp-sdk v0.17.0)

- **SONAME carries the minor while the SDK is 0.x.** The shared library is installed as `libalp_sdk.so.0.17.0` with the SONAME `libalp_sdk.so.0.17`, because a 0.x minor may remove public symbols; from 1.0 the SONAME will be the major alone. Anything linked against `libalp_sdk.so.0` must be relinked.
- **The recipe version tracks the release.** The `alp-sdk` recipe's `PV` is now the SDK release (`0.17.0`) instead of a stale `0.6.0`, and the recipe sets `PACKAGE_ARCH = "${MACHINE_ARCH}"`, because the build content differs per machine. Each MACHINE gets its own package lane.
- **`alp-chips` installs only the chip library.** The chips-only build behind the `alp-chips` recipe installs just `libalp_chips.a` and the `<alp/chips/*.h>` headers. The static `alp-sdk.pc` install rules below do not apply to it, so it never ships files that belong to the `alp-sdk` package.
- **Static Linux links outside CMake.** A static `ALP_OS=yocto` build installs `alp-sdk.pc` beside `libalp_sdk.a`, carrying the linker options that keep every Linux backend in the link. A Makefile or recipe links with `cc app.c $(pkg-config --cflags --libs alp-sdk)`. Before this, a plain `-lalp_sdk` silently dropped the Linux backends. The `meta-alp-sdk` recipe itself still builds the shared library.
- **Signed opkg dev-kit feed (opt-in).** An image built with `require conf/distro/include/alp-devkit-feed.inc` in `local.conf` ships opkg with GPG and HTTPS support, `/etc/opkg/alp-devkit-feed.conf` with `option check_signature 1`, and the Alp feed public key, so `opkg update && opkg upgrade alp-sdk` works against the signed feed for the image's release line and MACHINE (a GitHub Release tagged `feed-v<major.minor>-<MACHINE>`, e.g. `feed-v0.17-e1m-v2n101-a55`). The fragment switches the build to the ipk packager (`PACKAGE_CLASSES = "package_ipk"`), so a dev-kit image is a different build from a stock one. **Dev kits only.** It is not a field-update channel; field devices stay on Mender A/B. Because the minor is in the SONAME, moving to the next release line means a new image, not `opkg upgrade`.

## Vendor SDK / HAL integration

The SDK doesn't re-implement vendor HALs — it pulls them in as Zephyr modules pinned in `west.yml`:

- **Alif Ensemble** — upstream `sdk-alif` HAL via the AEN board files in `alplabai/alp-zephyr-modules`.
- **Renesas RZ/V2N** — Zephyr's `hal_renesas` already mirrors the RZ/V FSP for the N44 SoC; `west update` pulls it automatically.
- **DEEPX DX-M1** — userland from upstream `github.com/DEEPX-AI/dx_rt`; Yocto layer via `github.com/DEEPX-AI/meta-deepx-m1`.

The on-module TI CC3501E Wi-Fi/BT coprocessor on AEN is **not** a vendor SDK dependency — its firmware ships pre-built (with a `.sha256` and `.sig` beside each image) from [`alplabai/cc3501e-bridge-firmware`](https://github.com/alplabai/cc3501e-bridge-firmware). The orchestrator lists it under the system manifest's `helper_mcus:` with `flash_policy: recovery_only` and `update_channel: alp_ota_spi_otp`: Alp Lab programs it in production, and `tan flash` skips it. A customer reflash is only for recovering a bricked device, with Alp Lab-supplied binaries; `tan flash` refuses a `recovery_only` helper unless it is named with `--helper <name>` and armed with `--recover`. Host code talks to it through the documented inter-chip protocol; no TI SimpleLink SDK is built into the SDK.

Per-vendor integration status, license terms, and example pins live in [`docs/vendor-partnerships.md`](https://github.com/alplabai/alp-sdk/blob/main/docs/vendor-partnerships.md).

## ABI stability annotations

Every public header that declares ABI symbols carries an `@par ABI status:` tag of `[ABI-STABLE]` or `[ABI-EXPERIMENTAL]`. Per-release header snapshots live under `docs/abi/` in the SDK repo (`v0.17-snapshot.json` is the latest), and the `pr-abi-snapshot.yml` job diffs the headers; it is the post-1.0 enforcement gate. Experimental headers (e.g. `<alp/gpu2d.h>`, the wave-2 `<alp/dsp.h>` chain types, `<alp/power.h>`'s system-mode setter and SoM power-domain calls) may change shape in any minor before v1.0, so pin to a specific SDK release if you depend on them.

Since v0.17.0 the **compiled** library is gated too. `scripts/check_abidiff.py` builds `libalp_sdk.so` from the latest release (or rc) tag of the current minor and from the change under review, and fails on any `abidiff` ABI change inside that minor line. Together with the minor-carrying SONAME (`libalp_sdk.so.0.17`), this means a patch release within one minor is safe for an in-place package upgrade, and a new minor is a relink.

Symbols a release removes are recorded in `docs/abi/removed-symbols.json` (for v0.17.0 that includes the `pca9451a` and `<alp/ext/nxp/storage.h>` symbols and `ALP_CAP_HW_LCDIF`; the two enumerator removals below are not listed there). v0.17.0 is a case to read before upgrading: removing the E1M-NX9101 dropped `ALP_CAP_ID_HW_LCDIF` from the middle of `alp_cap_id_t`, so every later enumerator (`ALP_CAP_ID_XSPI_DMA` through `ALP_CAP_ID_HW_I3C`, and `ALP_CAP_ID_COUNT`) is now **one lower**. Rebuild anything that stores or compares those numeric IDs. It also removed `ALP_CORE_M33` from `alp_core_id_t` (the other enumerators keep their values), `<alp/chips/pca9451a.h>` and `<alp/ext/nxp/storage.h>`.

The full annotation policy lives in [`docs/abi-markers.md`](https://github.com/alplabai/alp-sdk/blob/main/docs/abi-markers.md).

## Error model

Every `alp_*_open()` returns a handle or `NULL`. Every operation returns an `alp_status_t` (0 = `ALP_OK`). When a handle is `NULL`, **`alp_last_error()`** — a thread-local — tells you why:

| Error                | Meaning                                                        |
|----------------------|----------------------------------------------------------------|
| `ALP_ERR_NOSUPPORT`  | Peripheral / feature not implemented for this OS / SoM yet.    |
| `ALP_ERR_OUT_OF_RANGE` | Requested config exceeds the SoC's documented caps.         |
| `ALP_ERR_NOT_READY`  | Chip not populated (ACK-probe failed) or rail not up.          |
| `ALP_ERR_TIMEOUT`    | Hardware did not respond within the configured window.         |
| `ALP_ERR_IO`         | Bus / link error (also: AEAD tag mismatch on decrypt).         |

ADR [0002](https://github.com/alplabai/alp-sdk/blob/main/docs/adr/0002-error-mechanism.md) covers the full contract. The point of `alp_last_error()` is that hand-written firmware can diagnose `NULL` returns without changing the API shape — no out-parameters, no global state on a successful path.

## Capability validation

Three layers protect against asking for hardware features that don't exist:

- **Validate-time, advisory** — `tan validate` cross-checks every entry in each `cores.<id>.peripherals:` against the SoC's `metadata/socs/<vendor>/<family>/<part>.json` capability profile **scoped to that core**. A `board.yaml` asking for `i2s` on a core that doesn't route I²S is reported as an **`ALP-B010` warning**, not an error: `scripts/validate_board_yaml.py` still **exits 0**. The check is deliberately advisory because SoC peripheral metadata is incomplete for some parts (some counts are still listed under a SoC file's `peripherals_unverified`) and some peripheral categories surface board-side rather than on the SoC — a false-positive `ALP-B010` must not block a build. **`tan build` does not re-run this cross-check at all**; it plans in-process and never spawns the SDK validator. `cores:` keys *are* still hard-checked against the SoM preset's `topology:` block — a typo in a core ID fails.

  :::caution[Corrected in alp-sdk v0.16.0]
  This site previously said a `peripherals:` / SoC-caps mismatch failed at `tan build` time with **exit code 3**. That conflated two different checks. Exit **3** in `scripts/validate_board_yaml.py` is `EXIT_SDK_REVISION_UNSUPPORTED` — the `hw_rev` / SDK-version compatibility window, nothing to do with peripherals. The sibling codes are **4** = `EXIT_SDK_REVISION_UNKNOWN` and **5** = `EXIT_SDK_REVISION_NOT_BUILDABLE`. Run `tan validate` first for the full picture, including this advisory cross-check.
  :::
- **Capability-keyed library bindings** — each library that depends on a hardware accelerator declares its priority list with a `requires_cap:` matcher (e.g. `ethos_u85_count`). The loader reads each SoM preset's `capabilities:` block and emits the matching `CONFIG_*` for the highest-priority capability the SKU actually has. The Ethos-U55 → U85 split on Alif Ensemble (E4 / E6 / E8 carry both; E3 / E5 / E7 carry only U55) is driven entirely by this mechanism — application code never names the NPU.
- **Runtime** — `<alp/soc_caps.h>` is generated from the same `metadata/socs/` JSON and consulted by `*_open()`. E.g. `alp_adc_open` with `resolution_bits = 16` on a 12-bit SoC returns `NULL` and stamps `ALP_ERR_OUT_OF_RANGE`.

## E1M portability bound

`ALP_E1M_<CLASS>_COUNT` macros in `<alp/e1m_pinout.h>` document the **cross-SoM-portable** instance count per peripheral class. An app that opens `ALP_E1M_I2C0` and `ALP_E1M_I2C1` (with the count below 2) works on every conformant SoM. ADR [0004](https://github.com/alplabai/alp-sdk/blob/main/docs/adr/0004-e1m-portability-bound.md).

If your app needs more instances than the portable bound, it stays correct on the SoMs that route them — it just isn't portable to ones that don't.

## OS backend selection

`board.yaml` declares the backend **per on-die core** under `cores.<id>.os`. The SDK ships three runtimes; one project can use all three simultaneously:

| Backend     | Selected by               | Implementation lives in           | Comments                                   |
|-------------|---------------------------|-----------------------------------|--------------------------------------------|
| Zephyr      | `os: zephyr`              | `src/zephyr/`                     | First-class on the AEN M55 cores and the V2N / V2N-M1 M33 system-manager. Zephyr v4.4.1 pinned. |
| Yocto       | `os: yocto`               | `src/yocto/`                      | First-class on the V2N / V2N-M1 A55 clusters. The AEN E5..E8 A32 MACHINEs are not buildable yet (see [Yocto layer](#yocto-layer)). Uses `i2c-dev`, `spidev`, GPIO chardev v2, ALSA, OpenSSL, libmosquitto. |
| Bare-metal  | `os: baremetal`           | `src/baremetal/`                  | Calls vendor HAL directly. Coverage lands per the [test plan](https://github.com/alplabai/alp-sdk/blob/main/docs/test-plan.md). |
| (skip core) | `os: off`                 | —                                 | Explicit "leave this core dark in this project". |

A bare `som: { sku: <MPN> }` with no `cores:` overrides inherits the SoM preset's `topology:` defaults — every heterogeneous SoM produces a working dual-image build out of the box.

## Two consumer paths, same API

ADR [0005](https://github.com/alplabai/alp-sdk/blob/main/docs/adr/0005-alp-sdk-vs-alp-studio-boundary.md) records the SDK ↔ Studio boundary.

### Hand-written

You write `<alp/...>` calls directly. Instance IDs come from `<alp/e1m_pinout.h>`. The build is `tan build → tan image → tan flash` — the same pipeline whatever the core count, since `tan build` runs every buildable slice of a single-slice project just as it does a heterogeneous one.

### alp-studio codegen

[Studio](https://studio.alplab.ai) reads its block library + your project document, runs a pin allocator against the active SoM, and emits C that calls the **same** `<alp/...>` API. Switching between paths is non-destructive — Studio's generated code coexists with hand-written code in the same project.

## Orchestrator — `scripts/alp_orchestrate/` {#orchestrator}

The orchestrator is the SDK's central build **planner** — it replaced the single-slice `alp_project.py` loader when heterogeneous OS orchestration landed. Since ADR [0020](https://github.com/alplabai/alp-sdk/blob/main/docs/adr/0020-sdk-owns-build-execution.md) Phase 4 the SDK is **plans-only**: the orchestrator emits, `tan` materialises the emitted artefacts to disk and executes the build. Inputs:

- `board.yaml` at the app root
- `metadata/e1m_modules/<MPN>.yaml` (SoM preset — carries `topology:`, `memory_map:`, `mailbox:`, `helper_firmware:`, `capabilities:` blocks)
- `metadata/boards/<preset>.yaml` (board preset — `e1m-evk`, `e1m-x-evk`, or a customer-authored fork)
- `metadata/socs/<vendor>/<family>/<part>.json` (silicon capability profile; `cores[].id` set is the topology key set)
- `metadata/library-profiles/<lib>/` (compile-time tuning + per-class accelerator binding for libraries)
- `metadata/e1m_modules/<family>/core-ownership.yaml` (schema `core-ownership-v1`, V2N family today: which core drives each module resource; its `assignable:` entries are the only ones a `board.yaml` `ownership:` block can override)

Generated artefacts (byte-stable across rebuilds; the orchestrator emits them, `tan` writes them to disk):

| Path                                          | What it carries                                                                |
|-----------------------------------------------|--------------------------------------------------------------------------------|
| `build/system-manifest.yaml`                  | Per-slice status, log paths, artefact paths, flash recipe, boot order, helper MCUs, blocked storage rows; since v0.17.0 also the resolved `ownership:` map (when the SoM declares assignable resources) and a `memory:` view of the SoM's memory regions. |
| `build/generated/alp/system_ipc.h`            | Endpoint IDs, addresses, mailbox channel macros — shared by all slices.        |
| `build/generated/dts-reservations.dtsi`       | `reserved-memory:` carve-outs shipped into Linux + Zephyr DTs.                 |
| `build/generated/dts-partitions.dtsi`         | `fixed-partitions` overlay from the resolved `storage:` block.                 |
| `build/sysbuild/tfm/tfm.conf`                 | TF-M sysbuild child-image overlay (when `security.psa.tfm: true`).             |
| `build/generated/storage_mount_table.c`       | Mount table for the resolved `storage:` block, only when a partition is mountable (a `mount:` on a non-`raw` fs). Nothing in the build reads it; apps that want it include it. |
| `build/<core>-zephyr/alp.conf`                | Kconfig fragment layered onto each Zephyr slice's `prj.conf`.                  |
| `build/<core>-yocto/conf/alp-generated.conf`  | `local.conf` snippet consumed by bitbake (`MACHINE=…`, `IMAGE_INSTALL`).       |
| `--emit build-plan` (JSON, stdout — not a file) | The write-free per-slice build recipe (command, inline config-artefact contents, app dir, toolchain, output paths) that `tan` consumes as its sole build input. |

The system manifest is consumed downstream by `tan image`, `tan flash`, and OTA.

### SoM-family metadata sources

Alongside the per-SKU presets, alp-sdk keeps hand-authored, schema-validated **per-family** sources that generators turn into headers and devicetree:

| File | Schema | What it drives |
|---|---|---|
| `metadata/e1m_modules/v2n/power-tree.yaml` | `power-tree-v1` | The V2N / V2N-M1 on-module power tree (per-rail net, target, guard window, sequence owner), generated into `<alp/chips/v2n_power_tree.h>` by `scripts/gen_power_tree.py`. |
| `metadata/e1m_modules/v2n/core-ownership.yaml` | `core-ownership-v1` | A55 / M33 ownership of V2N resources. The planner projects it into the system manifest's `ownership:` block and the generated Linux ownership devicetree. Every `assignable:` instance currently defaults to, and only accepts, `a55`. |
| `metadata/e1m_modules/v2n/supervisor-links.yaml` | `supervisor-links-v1` | Generation source for the V2N / V2M M33 Zephyr board's pinctrl and defconfig (`scripts/gen_zephyr_board.py`). |
| `metadata/e1m_modules/aen/on-module-links.yaml` | `on-module-links-v2` | AEN on-module wiring plus, since v2, the `power_domains:` block behind the [SoM power domains](#som-power-domains) runtime. |

These are module-internal sources. Use the generated headers and the portable `<alp/*.h>` calls rather than designing against their contents, because the E1M edge is the contract.

## CLI split — `tan` and the surviving west commands

ADR-0020 Phase 4 retired the SDK-side fan-out executor along with the `west alp-{build,image,flash,clean,size,renode}` extensions. **`tan` is now the sole user-facing CLI** — there is no `alp` binary installed anywhere. For the build surface `tan` is its own executor: it consumes `alp_orchestrate --emit build-plan` / `--emit system-manifest` and drives `west` / `bitbake` / `cmake` per slice itself.

| Command       | Purpose                                                                            |
|---------------|------------------------------------------------------------------------------------|
| `tan build`   | Fan board.yaml out into per-core slices, run each slice's build, write `system-manifest.yaml`. |
| `tan image`   | Consume the manifest, assemble a flashable bundle (`build/image-bundle/`).         |
| `tan flash`   | Walk the manifest's `boot_order:` and program each piece with the right backend.   |
| `tan clean`   | Tear down per-slice build dirs idempotently.                                       |
| `tan run`     | Run one built image headless under `native_sim`, or (`--flash`) build, flash and open the console. |
| `tan size`    | Report per-slice flash/RAM footprint against the SoM budget.                        |
| `tan generate`| Write the board-derived config files — no build. Nine targets are in the default (`--all`) set: `zephyr-conf`, `dts-overlay`, `native-sim-overlay`, `cmake-args`, `yocto-conf`, `carrier-netlist`, `west-libraries`, `hw-info-h`, `os-topology`. Three more are explicit-only: `zephyr-board` (requires `--core`), `composed-route-table`, `ipc-contract-h`. |

There is **no `tan emit` verb**; a single artefact is `tan generate --target <target>`.

`tan` ships from its own repo ([`alplabai/tan-cli`](https://github.com/alplabai/tan-cli)) on its own version line — currently **`0.7.0`**, which requires **alp-sdk v0.17.0 or newer** — and is installed separately from the SDK:

```bash
curl -fsSL https://raw.githubusercontent.com/alplabai/tan-cli/main/install.sh | sh
# Windows PowerShell: irm https://raw.githubusercontent.com/alplabai/tan-cli/main/install.ps1 | iex
```

### The execution model

Since **v0.5.0-rc1 `tan` is a Python program**, released as self-contained PyInstaller `--onedir` freezes. That is the whole shape of the thing: the freeze bundles its own interpreter, so a host needs **no Rust toolchain, no rustup, and no Python interpreter** to run it — and, symmetrically, `tan` no longer reaches back into the SDK's venv to do its work.

Concretely, **no verb forwards to `python -m alp_cli` any more**. The subprocess boundary that used to sit between a Rust front-end and a Python backend is gone; what used to cross it now runs as ordinary in-process Python:

- `model`, `monitor`, `faultdecode` and `new-som` are **native Python inside `tan`**.
- `generate` renders **in-process from `tan.planner`**. Spawning the SDK's `scripts/alp_project.py` instead is an opt-in escape hatch, behind `TAN_GENERATE_EXECUTOR=subprocess` — useful for A/B-ing the renderer against the SDK script, not a path any customer needs.
- The build surface (`build` / `flash` / `size` / `image` / `clean` / `run`) is `tan`'s own executor, and the only subprocesses it spawns are the real build tools: `west`, `bitbake`, `cmake`, and the per-artefact flash backends.

`alp_cli` remains an SDK-side Python package and was never a user-installed command: the bootstrap scripts (`scripts/bootstrap.sh` on Linux/macOS/WSL2, `scripts/bootstrap.ps1` on native Windows) install it as an editable package into the workspace venv, and `pyproject.toml` registers only `alp-mcp`. It is simply no longer on `tan`'s call path.

The invariant that survived the rewrite is the **contract**, not the implementation language: alp-sdk still plans and `tan` still executes, per ADR-0020.

Four west extension commands survive under `scripts/west_commands/`, registered via `scripts/west-commands.yml`:

| Command            | Purpose                                                                            |
|--------------------|------------------------------------------------------------------------------------|
| `west alp-emit`    | Print one generated artefact from `board.yaml` — read-only, no build. Covers the orchestrator subset (`system-manifest`, `ipc-contract-h`, `dts-reservations`, `dts-partitions`, `storage-mounts-c`, `tfm-sysbuild-conf`, `build-plan`, `kconfig`). |
| `west alp-lock`    | Write `alp.lock`, the workspace dependency lock. Since v0.17.0 `--check` no longer diffs against a tracked copy: it regenerates the lock in memory and schema-validates it, failing on a broken generator or a leaked local path. |
| `west alp-migrate` | Version and migrate a project's `board.yaml`.                                       |
| `west alp-quality` | Run the quality-task registry for a profile (JSON / JUnit / SARIF).                 |

West surfaces these through the **manifest's** `self.west-commands` — not through `zephyr/module.yml` — so they only register when alp-sdk is the workspace's manifest repo. That is the whole substance of the v0.10.1 bootstrap fix (#769); see [Installation](https://docs.alplab.ai/sdk/installation).

`tan flash` dispatches per slice on the manifest's `flash_method`: `zephyr_west_flash` (the board's default `west flash` runner) for a Zephyr slice, `alif_mram_jlink` (J-Link MRAM write) when an AEN slice's SoC publishes a J-Link flash device, `yocto_wic_to_sd_or_emmc` (`bmaptool` / `dd`) for a Yocto slice, plus `baremetal_cmake_flash` and `xspi_flashwriter`. No developer-side tool selection is needed.

**Helper MCUs are not flashed by `tan`.** The GD32G553 supervisor on V2N / V2M and the CC3501E on AEN are both `flash_policy: recovery_only`. Alp Lab programs them in production, `tan flash` skips them, and field updates go over their `update_channel` (`alp_ota_spi_bridge` for the GD32, `alp_ota_spi_otp` for the CC3501E). tan 0.7.0 removed the old `swd_probe` flash backend; a manifest that still names it is refused with `flash.entry-failed`.

See the [`board.yaml` reference](https://docs.alplab.ai/sdk/board-yaml) and the [heterogeneous builds walkthrough](https://docs.alplab.ai/sdk/heterogeneous-builds).

## Hardware identification

The SoM identifies itself at boot from **one authoritative surface**: the 128-byte manifest on the on-module 24C128 EEPROM, carrying family / SKU / hw_rev / serial / mfg date. It is read and integrity-checked (magic + `schema_version` + CRC32) via `alp_hw_info_read()` from [`<alp/hw_info.h>`](https://docs.alplab.ai/sdk/api/hw-info). A blank EEPROM returns `ALP_ERR_NOT_PROVISIONED` so apps can distinguish "unprovisioned unit" from "broken hardware".

Carrier boards may additionally encode their own revision on a board-side BOARD_ID resistor divider — an independent path that never gates the SoM identity.

The build-time companion header (`<alp_hw_info_build.h>`, emitted by the loader) bakes the customer's `board.yaml` identifiers into `ALP_HW_BUILD_*` macros so `alp_hw_info_assert_matches_build()` can fail fast if the wrong firmware is flashed onto a unit.

Production-test programs the manifest with `scripts/program_eeprom.py`.

## SoM power domains {#som-power-domains}

alp-sdk v0.17.0 adds a model of the **on-module** loads a SoM can quiesce around a low-power sleep. `<alp/power.h>` names seven domains in `alp_power_domain_t`: Wi-Fi/BLE coprocessor, Ethernet PHY, external flash, external RAM, temperature sensor, RTC (clock-out only) and backlight. The chain from metadata to runtime is:

1. **Metadata.** The AEN family's `on-module-links.yaml` (schema `on-module-links-v2`) carries a `power_domains:` block that records, for each domain, its control, polarity, default action and restore path.
2. **Devicetree.** `gen_zephyr_board.py` emits an `alp,som-power` node with one `alp,som-power-domain` child per domain the SKU actually carries. Presence comes from that SKU's `on_module:` block, so a part the BOM may leave unfitted gets `alp,bom-optional`.
3. **Runtime.** With `CONFIG_ALP_SDK_SOM_POWER` (on by default when those nodes exist and `CONFIG_ALP_SDK_POWER`, `CONFIG_GPIO` and `CONFIG_PINCTRL` are on), the SDK builds the domain registry and quiesces the domains around STOP / STANDBY, then restores them in reverse order. The quiesce rolls back if any step fails.

Applications steer it with three `[ABI-EXPERIMENTAL]` calls:

- `alp_power_domain_policy_set()` sets a domain to `ALP_POWER_DOMAIN_POLICY_AUTO` (the SoM's safe default action), `ALP_POWER_DOMAIN_POLICY_KEEP_ALIVE` (never touched) or `ALP_POWER_DOMAIN_POLICY_RAIL_OFF`.
- `alp_power_domain_info()` reports a domain's supported and default actions and the loads that depend on it.
- `alp_power_boot_wake_info()` reports the wake cause and which domains were quiesced. A STOP wake on the Alif Ensemble is a cold boot.

Today this is implemented only for the E1M-AEN801 / E1M-AEN803 builds. Every other backend, and an AEN build without the option, answers `ALP_ERR_NOSUPPORT`. `RAIL_OFF` is refused unless the domain is the Wi-Fi/BLE coprocessor and `CONFIG_ALP_SDK_SOM_PD_WIFI_RAIL_OFF=y`.

:::warning[Leave CC3501E RAIL_OFF off on activated modules]
On a unit with `vendor_sbl_container_enable=1`, gating the CC3501E supply may leave its firmware never relaunching. The default Wi-Fi/BLE action holds the coprocessor in reset and releases it on wake, never touching the supply, and has no such risk. After any Wi-Fi/BLE restore, the association, sockets and BLE state are lost and must be re-established.
:::

The STOP / STANDBY backend that calls the quiesce is `CONFIG_ALP_SDK_POWER_ALIF_SE` (Alif Ensemble E8 M55-HE / M55-HP, experimental, default off). Its bench status is recorded in that Kconfig help. See [`<alp/power.h>`](https://docs.alplab.ai/sdk/api/power).

## Repository split

The SDK is intentionally distributed across several repositories so each can evolve on its own cadence:

| Repo                     | Contains                                                                     |
|--------------------------|------------------------------------------------------------------------------|
| [`alp-sdk`](https://github.com/alplabai/alp-sdk)                       | Portable `<alp/...>` API, chip drivers, OS backends, metadata, examples.     |
| [`e1m-spec`](https://github.com/alplabai/e1m-spec)                     | The E1M open-standard pinout and mechanical spec (CC BY-SA 4.0).             |
| [`alp-zephyr-modules`](https://github.com/alplabai/alp-zephyr-modules) | Zephyr **board files** for the official Alp Lab EVKs.                        |
| [`alp-sdk-vscode`](https://github.com/alplabai/alp-sdk-vscode)         | VS Code extension — schema-aware editing, GUI configurator, CLI wrappers.    |
| [`tan-cli`](https://github.com/alplabai/tan-cli)                       | The standalone `tan` CLI — the sole user-facing command surface and the build executor. |
| [Alp Studio](https://studio.alplab.ai)                 | The Studio codegen tool — emits `<alp/...>` calls from block manifests.      |

The split lets a customer pin `alp-sdk` and bump `alp-zephyr-modules` independently when the EVK schematic respins — and vice versa.

## Architecture Decision Records

ADRs that explain why the SDK looks the way it does:

| ADR                                                                                                                     | Topic                                                |
|-------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------|
| [0001](https://github.com/alplabai/alp-sdk/blob/main/docs/adr/0001-wrapper-on-top-of-zephyr.md)                         | Wrapper over Zephyr / Yocto, not reimplementation    |
| [0002](https://github.com/alplabai/alp-sdk/blob/main/docs/adr/0002-error-mechanism.md)                                  | `alp_last_error()` thread-local diagnostic           |
| [0003](https://github.com/alplabai/alp-sdk/blob/main/docs/adr/0003-peripheral-coverage.md)                              | Twelve wrapped peripheral classes                    |
| [0004](https://github.com/alplabai/alp-sdk/blob/main/docs/adr/0004-e1m-portability-bound.md)                            | `E1M_<CLASS>_COUNT` portability bound            |
| [0005](https://github.com/alplabai/alp-sdk/blob/main/docs/adr/0005-alp-sdk-vs-alp-studio-boundary.md)                   | SDK ↔ Studio boundary                                |
| [0006](https://github.com/alplabai/alp-sdk/blob/main/docs/adr/0006-secure-boot-secure-ota.md)                           | Secure boot + secure OTA chain                       |
| [0007](https://github.com/alplabai/alp-sdk/blob/main/docs/adr/0007-wave2-dsp-pipeline-design.md)                        | Wave-2 DSP — pipeline stages, not standalone primitives |
| [0008](https://github.com/alplabai/alp-sdk/blob/main/docs/adr/0008-gpu2d-portable-shim.md)                              | `<alp/gpu2d.h>` portable shim even for single-silicon |
| [0009](https://github.com/alplabai/alp-sdk/blob/main/docs/adr/0009-mender-zephyr-client-deferred.md)                    | Mender Zephyr client deferred to v1.1; secure OTA on Zephyr cut from v0.4 |
| [0010](https://github.com/alplabai/alp-sdk/blob/main/docs/adr/0010-heterogeneous-os-orchestration.md)                   | Heterogeneous OS orchestration — Zephyr/Yocto/baremetal coexist per-core  |
| [0014](https://github.com/alplabai/alp-sdk/blob/main/docs/adr/0014-build-plan-emit-cli-contract.md)                     | The `--emit build-plan` consumer contract                                 |
| [0020](https://github.com/alplabai/alp-sdk/blob/main/docs/adr/0020-sdk-owns-build-execution.md)                         | The SDK plans; the standalone `tan` CLI is the whole command surface      |
