Skip to main content

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 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.skuBoard preset
E1M-AEN family on the E1M EVKE1M-AEN801 (etc.)e1m-evk
E1M-X V2N101 / V2N102 / V2N103 on E1M-X-EVKE1M-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 §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. 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:

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:

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.

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)​

ExampleWhat it shows
gpio-button-ledOpen a GPIO, set up input + output, basic patterns.
i2c-scannerWalk the I²C bus, report devices that ACK.
pwm-led-fadePWM channel open + duty sweep.
adc-voltmeterSample an ADC channel; convert to millivolts.
uart-echo / uart-rx-ringbufUART TX / RX, with optional byte-granular ring buffer.
rtc-clockSet + read the SoC RTC.
wdt-feedWatchdog open + feed cadence.

V2N / V2N-M1-specific examples​

ExampleWhat it shows
v2n-gd32-bridge-pingPING + GET_VERSION round-trip on both SPI + I²C transports
v2n-board-id-readoutRead the SoM EEPROM manifest + assert SKU
v2n-pwm-fan-controlRamp a GD32-side PWM channel along a five-stop fan curve

Build any of them:

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​

#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:

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.

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:

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​

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.

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.

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/. See the chip page 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:

# 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. 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:

FamilyBring-up doc
E1M-AENdocs/bring-up-aen.md
E1M-X V2Ndocs/bring-up-v2n.md
E1M-X V2N-M1docs/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/ in the SDK repo:

#TutorialScope
01first-buildHello-world on native_sim
02i2c-scanI²C scanner + populated-chip reasoning
03pwm-fadePWM channel basics
04cross-family-portabilityIntra-family portability: an AEN601 → AEN801 retarget, and the E1M / E1M-X split
05supervisor-mcu-bridgeV2N's GD32 bridge — protocol + transports
06secure-element-signOPTIGA Trust M ECDSA
07recovering-a-bricked-bridgeHost-driven SWD bit-bang reflash
08runtime-board-detectionEEPROM manifest + BOARD_ID ADC
09board-yaml-deep-diveEvery block, every override
10secure-boot-signingMCUboot signing on AEN
11mqtt-tls-publish<alp/iot.h> + <alp/security.h>
12mender-otaYocto OTA (V2N + V2N-M1)
13eeprom-provisioningProduction-line manifest programming
14audio-loopbackPDM in → I²S out with DSP chain
15mproc-mailboxMulti-proc IPC end-to-end
16inference-mobilenetTFLite-Micro on Ethos-U / DRP-AI / DEEPX

Getting help​

  • File issues at 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.

Where next​

Questions about this page? Email contact@alplab.ai