---
title: "Firmware Quickstart"
description: "This guide takes a firmware engineer from \"I have an E1M-X module on the bench\" to a working application built against the SDK. It sits alongside the Quick Start walk-through; this page focuses on the choices and patterns that matter when you're targeting a specific SoM and writing real firmware."
source: https://docs.alplab.ai/sdk/firmware-quickstart
---

# Firmware Engineer Quickstart

This guide takes a firmware engineer from "I have an E1M-X module on the bench" to a working application built against the SDK. It sits **alongside** the [Quick Start](https://docs.alplab.ai/sdk/quick-start) walk-through; this page focuses on the choices and patterns that matter when you're targeting a specific SoM and writing real firmware.

## Pick a target

| If your hardware is...                       | `som.sku`              | Board preset        |
|----------------------------------------------|------------------------|---------------------|
| E1M-AEN family on the E1M EVK                | `E1M-AEN801` (etc.)    | `e1m-evk`           |
| E1M-X V2N101 / V2N102 / V2N103 on E1M-X-EVK  | `E1M-V2N101` (etc.)    | `e1m-x-evk`         |
| E1M-X V2N-M1 (V2M101 / V2M102 / V2M103)      | `E1M-V2M101` (etc.)    | `e1m-x-evk`         |

The per-SoM page covers what's populated, which examples target it, and the bring-up flow. alp-sdk v0.17.0 dropped the E1M-NX9101 (NXP i.MX 93) module; it is no longer a valid `som.sku`.

## Workspace setup

If you haven't already, follow the [Quick Start](https://docs.alplab.ai/sdk/quick-start) §1–2. That gets you a `alp-workspace/` with `alp-sdk/`, `zephyr/`, and the standard modules, plus the `tan` CLI (**0.7.0**, which needs alp-sdk **v0.17.0** or newer) — the SDK's sole user-facing command, installed separately from [`alplabai/tan-cli`](https://github.com/alplabai/tan-cli). It is a **Python** program shipped as a self-contained PyInstaller freeze, so there is no Rust toolchain, no rustup and no host Python interpreter to set up:

```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
```

Install `tan` **before** bootstrapping the SDK — `tan bootstrap --sdk-root "$PWD"` is how you bootstrap, and as of `tan` 0.7.0 it also installs and verifies the `arm-zephyr-eabi` cross toolchain real-silicon builds need (`--no-toolchain` skips it).

## Your first `board.yaml`

Example for a V2N101 application that exercises the on-module GD32 bridge:

```yaml
som:
  sku: E1M-V2N101

preset: e1m-x-evk

cores:
  m33_sm:
    # os: omitted → topology default (m33_sm → zephyr).
    app: ./src
    peripherals: [spi, i2c]

chips:
  - gd32g553

diagnostics:
  log_level: info
```

`tan build` validates this (via alp-sdk's `alp_orchestrate`), generates the build-time config from it, and drives `west` / `bitbake` / `cmake` per slice. See the [`board.yaml` reference](https://docs.alplab.ai/sdk/board-yaml).

## Pick a starting example

The `examples/` tree carries reference apps that double as tutorials. Comment density is ~50 % so the source teaches by itself.

### Cross-family examples (work on any SoM)

| Example                          | What it shows                                              |
|----------------------------------|------------------------------------------------------------|
| `gpio-button-led`                | Open a GPIO, set up input + output, basic patterns.        |
| `i2c-scanner`                    | Walk the I²C bus, report devices that ACK.                 |
| `pwm-led-fade`                   | PWM channel open + duty sweep.                             |
| `adc-voltmeter`                  | Sample an ADC channel; convert to millivolts.              |
| `uart-echo` / `uart-rx-ringbuf`  | UART TX / RX, with optional byte-granular ring buffer.     |
| `rtc-clock`                      | Set + read the SoC RTC.                                    |
| `wdt-feed`                       | Watchdog open + feed cadence.                              |

### V2N / V2N-M1-specific examples

| Example                          | What it shows                                              |
|----------------------------------|------------------------------------------------------------|
| `v2n-gd32-bridge-ping`           | PING + GET_VERSION round-trip on both SPI + I²C transports |
| `v2n-board-id-readout`           | Read the SoM EEPROM manifest + assert SKU                  |
| `v2n-pwm-fan-control`            | Ramp a GD32-side PWM channel along a five-stop fan curve   |

Build any of them:

```bash
cd alp-workspace/alp-sdk/examples/<category>/<name>   # e.g. peripheral-io/gpio-button-led
tan run                        # native_sim: build the single image, then run it
# or, for real silicon:
tan build                      # fans out per-core, target from board.yaml
tan flash --confirm            # boot_order-aware programming
```

There is no `-b` / `--board` selector any more — the target comes from the project's `board.yaml`.

## Idiomatic patterns

### Open an I²C bus + talk to a chip

```c
#include <alp/peripheral.h>
#include <alp/chips/tmp112.h>

alp_i2c_t *bus = alp_i2c_open(&(alp_i2c_config_t){
    .bus_id     = 0u,
    .bitrate_hz = 400000u,
});
if (bus == NULL) {
    printk("[i2c] open failed: err=%d\n", (int)alp_last_error());
    return;
}

tmp112_t temp;
if (tmp112_init(&temp, bus, 0x40) != ALP_OK) {
    printk("[tmp112] init failed\n");
}
```

Every on-module chip driver follows the same shape: `<chip>_init(&ctx, bus, addr_or_handle)` then per-feature getters / setters. Drivers under `chips/<part>/<part>.c`; public headers under `<alp/chips/<part>.h>`.

### Use the GD32 bridge from V2N firmware

The V2N's GD32G553 supervisor MCU owns every E1M-standard analog + counter peripheral plus side-channel GPIOs: eight PWM channels, eight-channel ADC bank, both DAC outputs, four quadrature encoders, the Wi-Fi/BT REG_ON pins, the OPTIGA reset, and the cached PMIC status forwarder. Reach it over SPI (fast path) or I²C (management path). On the Cortex-M33 use the SPI path only: `BRD_I2C` is A55 / Linux-exclusive as of alp-sdk v0.17.0, so the M33 passes `NULL` for the I²C handle:

```c
alp_spi_t *spi = alp_spi_open(&(alp_spi_config_t){
    .bus_id        = 1u,
    .freq_hz       = 10000000u,
    .mode          = ALP_SPI_MODE_0,
    .bits_per_word = 8u,
    .cs_pin_id     = 0u,
});

gd32g553_t bridge;
gd32g553_init(&bridge, spi, NULL, GD32G553_BRIDGE_DEFAULT_I2C_ADDR);   /* SPI only */

uint32_t period_ns = 1000000u;  // 1 kHz
uint32_t duty_ns   = 500000u;   // 50 %
gd32g553_pwm_set(&bridge, /* channel */ 0u, period_ns, duty_ns);
```

Full wire spec: [`docs/gd32-bridge-protocol.md`](https://github.com/alplabai/alp-sdk/blob/main/docs/gd32-bridge-protocol.md).

### Monitor the PMIC fleet

On V2N + V2N-M1 the secondary PMIC's status reflects rail health. `BRD_I2C` is A55 / Linux-exclusive, so this runs on the A55 (Linux `/dev/i2c-8`, `bus_id = 8`), never on the M33:

```c
alp_i2c_t *brd_i2c = alp_i2c_open(&(alp_i2c_config_t){
    .bus_id     = 8u,           /* BRD_I2C: Linux /dev/i2c-8 on the A55 */
    .bitrate_hz = 400000u,
});

da9292_t pmic;
da9292_init(&pmic, brd_i2c, DA9292_I2C_ADDR_V2N);

while (1) {
    da9292_status_t s;
    if (da9292_get_status(&pmic, &s) == ALP_OK) {
        if (s.temp_warn || s.vin_uvlo || !s.ch1_pg) {
            log_warning(&s);
        }
    }
    alp_delay_ms(1000);
}
```

### Dual Ethernet on V2N

```c
static int my_mdio_read(uint8_t phy_addr, uint8_t reg, uint16_t *val, void *user) {
    return zephyr_mdio_read(user, phy_addr, reg, val);
}
static int my_mdio_write(uint8_t phy_addr, uint8_t reg, uint16_t val, void *user) {
    return zephyr_mdio_write(user, phy_addr, reg, val);
}

rtl8211fdi_t phy0;
rtl8211fdi_init(&phy0, /* phy_addr */ 0,
                my_mdio_read, my_mdio_write, mdio_dev);
rtl8211fdi_soft_reset(&phy0, 500000);
rtl8211fdi_restart_autoneg(&phy0);
```

### V2N-M1: the DEEPX power-up is done by U-Boot

On V2N-M1 the whole DEEPX power and reset sequence is owned by **U-Boot** (`board_late_init()` on the A55), before Linux or the Cortex-M33 image starts: it brings up the 0.75 V DEEPX rail on the DA9292 CH2, routes the PCIe muxes to the DX-M1 and releases `M1_RESET`. Application firmware — CM33 or Linux — does not run or repeat it. `da9292_v2n_m1_enable_deepx_rail()` was removed from the SDK, and `deepx_dxm1_bring_up()` does not apply on V2N-M1. The three DEEPX TPS628640 bucks at `0x44` / `0x48` / `0x4F` answer on `BRD_I2C` only after U-Boot has enabled the DEEPX rail. See [E1M-X V2N-M1: DEEPX bring-up](https://docs.alplab.ai/e1m/e1m-x-v2n-m1#deepx-bring-up).

### V2N: share one `BRD_I2C` handle across the on-module fleet

The V2N's board-management I²C bus (`BRD_I2C`) hosts both PMICs, the RTC, OPTIGA Trust M, TMP112, the clock generator, and the EEPROM. Open the bus **once** at boot and pass the same `alp_i2c_t *` handle into every chip driver — every `chips/<part>/` API accepts a borrowed bus pointer; none take ownership. `BRD_I2C` is A55 / Linux-exclusive, so this code runs on the A55. In practice the RTC is already bound by the Linux `rtc-rv3028` driver (`/dev/rtc0`), so leave it to the kernel.

```c
alp_i2c_t *brd_i2c = alp_i2c_open(&(alp_i2c_config_t){
    .bus_id     = 8u,           /* BRD_I2C: Linux /dev/i2c-8 on the A55 */
    .bitrate_hz = 400000u,
});

act8760_t        pmic_primary;
da9292_t         pmic_secondary;
optiga_trust_m_t secure_element;

act8760_init(&pmic_primary,            brd_i2c);   /* ACT88760 at 0x25 / 0x26 */
da9292_init(&pmic_secondary,           brd_i2c, DA9292_I2C_ADDR_V2N);
optiga_trust_m_init(&secure_element,   brd_i2c, OPTIGA_TRUST_M_I2C_ADDR);
```

## Chip driver opt-in

Every chip driver is gated on `CONFIG_ALP_SDK_CHIP_<NAME>=y` so unused chips don't cost code size. Two ways to flip the flag:

- **Declarative** (recommended) — list the chip under `chips:` in `board.yaml`. The loader sets the Kconfig automatically.
- **Manual** — add `CONFIG_ALP_SDK_CHIP_GD32G553=y` etc. to your `prj.conf`.

The full chip catalogue is at [`metadata/chips/`](https://github.com/alplabai/alp-sdk/tree/main/metadata/chips). See the [chip page](https://docs.alplab.ai/sdk/chips) for the in-tree summary.

## Build for real silicon

`tan build` figures out the cross-compile target from the SoM's `silicon:` field. Common targets:

```bash
# AEN (Alif Ensemble) — board.yaml: som.sku E1M-AEN801
cd alp-workspace/alp-sdk/examples/peripheral-io/gpio-button-led
tan build
tan flash --confirm            # a Flow D (MRAM) slice also needs --atoc-unqueryable

# V2N-M1 (RZ/V2N + DEEPX) — board.yaml: som.sku E1M-V2M101
cd alp-workspace/alp-sdk/examples/v2n/v2n-gd32-bridge-ping
tan build
tan flash --confirm
```

You never pass a Zephyr board string: `tan build` resolves the `som.sku` in `board.yaml` to the qualified board for you. `tan flash --dry-run` previews every backend first. On AEN, a Flow D (`alif_mram_jlink`) write replaces the module's whole ATOC, so `tan` 0.7.0 refuses it until `--atoc-unqueryable` acknowledges that — see [`tan flash`](https://docs.alplab.ai/sdk/tools/cli#tan-flash--program-the-built-project). The on-module GD32 bridge and CC3501E are programmed by Alp Lab in production; `tan flash` skips them.

## Per-SoM bring-up references

The SDK ships detailed bring-up walk-throughs for each SoM family:

| Family       | Bring-up doc                                                                                                  |
|--------------|---------------------------------------------------------------------------------------------------------------|
| E1M-AEN      | [`docs/bring-up-aen.md`](https://github.com/alplabai/alp-sdk/blob/main/docs/bring-up-aen.md)                  |
| E1M-X V2N    | [`docs/bring-up-v2n.md`](https://github.com/alplabai/alp-sdk/blob/main/docs/bring-up-v2n.md)                  |
| E1M-X V2N-M1 | [`docs/bring-up-v2n-m1.md`](https://github.com/alplabai/alp-sdk/blob/main/docs/bring-up-v2n-m1.md)             |

## Deep tutorials

For longer end-to-end walk-throughs (the examples teach a single peripheral; tutorials teach a flow), see [`docs/tutorials/`](https://github.com/alplabai/alp-sdk/tree/main/docs/tutorials) in the SDK repo:

| # | Tutorial | Scope |
|---|----------|-------|
| 01 | [first-build](https://github.com/alplabai/alp-sdk/blob/main/docs/tutorials/01-first-build.md) | Hello-world on `native_sim` |
| 02 | [i2c-scan](https://github.com/alplabai/alp-sdk/blob/main/docs/tutorials/02-i2c-scan.md) | I²C scanner + populated-chip reasoning |
| 03 | [pwm-fade](https://github.com/alplabai/alp-sdk/blob/main/docs/tutorials/03-pwm-fade.md) | PWM channel basics |
| 04 | [cross-family-portability](https://github.com/alplabai/alp-sdk/blob/main/docs/tutorials/04-cross-family-portability.md) | Intra-family portability: an AEN601 → AEN801 retarget, and the E1M / E1M-X split |
| 05 | [supervisor-mcu-bridge](https://github.com/alplabai/alp-sdk/blob/main/docs/tutorials/05-supervisor-mcu-bridge.md) | V2N's GD32 bridge — protocol + transports |
| 06 | [secure-element-sign](https://github.com/alplabai/alp-sdk/blob/main/docs/tutorials/06-secure-element-sign.md) | OPTIGA Trust M ECDSA |
| 07 | [recovering-a-bricked-bridge](https://github.com/alplabai/alp-sdk/blob/main/docs/tutorials/07-recovering-a-bricked-bridge.md) | Host-driven SWD bit-bang reflash |
| 08 | [runtime-board-detection](https://github.com/alplabai/alp-sdk/blob/main/docs/tutorials/08-runtime-board-detection.md) | EEPROM manifest + BOARD_ID ADC |
| 09 | [board-yaml-deep-dive](https://github.com/alplabai/alp-sdk/blob/main/docs/tutorials/09-board-yaml-deep-dive.md) | Every block, every override |
| 10 | [secure-boot-signing](https://github.com/alplabai/alp-sdk/blob/main/docs/tutorials/10-secure-boot-signing.md) | MCUboot signing on AEN |
| 11 | [mqtt-tls-publish](https://github.com/alplabai/alp-sdk/blob/main/docs/tutorials/11-mqtt-tls-publish.md) | `<alp/iot.h>` + `<alp/security.h>` |
| 12 | [mender-ota](https://github.com/alplabai/alp-sdk/blob/main/docs/tutorials/12-mender-ota.md) | Yocto OTA (V2N + V2N-M1) |
| 13 | [eeprom-provisioning](https://github.com/alplabai/alp-sdk/blob/main/docs/tutorials/13-eeprom-provisioning.md) | Production-line manifest programming |
| 14 | [audio-loopback](https://github.com/alplabai/alp-sdk/blob/main/docs/tutorials/14-audio-loopback.md) | PDM in → I²S out with DSP chain |
| 15 | [mproc-mailbox](https://github.com/alplabai/alp-sdk/blob/main/docs/tutorials/15-mproc-mailbox.md) | Multi-proc IPC end-to-end |
| 16 | [inference-mobilenet](https://github.com/alplabai/alp-sdk/blob/main/docs/tutorials/16-inference-mobilenet.md) | TFLite-Micro on Ethos-U / DRP-AI / DEEPX |

## Getting help

- File issues at [github.com/alplabai/alp-sdk/issues](https://github.com/alplabai/alp-sdk/issues). Include the output of `tan --version` and `tan doctor`, your `board.yaml`, and the full `tan build` log.
- For chip-driver bugs: include the chip's `metadata/chips/<part>.yaml` driver status (`stub` chips return `ALP_ERR_NOSUPPORT` by design).
- Questions: [contact@alplab.ai](mailto:contact@alplab.ai).

## Where next

- [`board.yaml` reference](https://docs.alplab.ai/sdk/board-yaml)
- [Architecture](https://docs.alplab.ai/sdk/architecture)
- [API reference](https://docs.alplab.ai/sdk/api/overview)
- [Chip catalogue](https://docs.alplab.ai/sdk/chips)
- [Examples catalogue](https://docs.alplab.ai/sdk/examples/overview)
- [Glossary](https://docs.alplab.ai/sdk/glossary)
