Hardware Model

This page is a short reference for how hw-test maps labgrid objects. It does not describe the step-by-step board registration flow. For that, use Register a board.

For full labgrid syntax, use the upstream references:

Labgrid Objects

coordinator

Tracks resources, Labgrid Places, tags, and locks.

exporter

Runs beside the hardware and exposes resources to the coordinator.

place

A lockable slot. In this repository it is usually one board, such as MUN-01-SC598_EZKIT-02.

place config

The Labgrid target configuration stored on the coordinator for a place. It maps matched resources to drivers such as power, serial, SSH, GPIO, OpenOCD, and U-Boot. hw-test loads it automatically after acquiring the place.

tests/<name>/config.toml

Describes the test context. The needs list selects compatible Labgrid Places by tag.

Resource Names

The resource names in the exporter configuration are the names used in place config bindings. For example, if the exporter exposes a serial resource named console, the coordinator-side place config binds it like this:

- SerialDriver:
    name: serial
    bindings:
      port: console

Use stable resource matches on the exporter. Avoid matching serial adapters only by /dev/ttyUSB0. Prefer unique serial IDs or stable physical USB paths.

Place Config Shape

There is no per-place environment file in hw-test. Configure the place from the coordinator with labgrid-client -p <place> edit while the place is idle. The config is the target body itself; do not add a targets wrapper or a nested RemotePlace resource:

resources:
  - NetworkService:
      username: "labgrid-client"
      address: "exporter.example.com"

drivers:
  - SerialDriver:
      name: serial
      bindings:
        port: console

  - NetworkPowerDriver:
      name: power
      bindings:
        port: power

  - SSHDriver:
      name: ssh

  - OpenOCDDriver:
      name: openocd
      load_commands:
        - "source [find interface/adi-dbgagent.cfg]"
        - "source [find target/adspsc59x_a55.cfg]"
        - "source [find /tools/u-boot.tcl]"
        - "init"
        - "autoboot_elf"
        - "shutdown"

The selected place imports the resources matched by its coordinator-side matches. NetworkService is used for SSH operations on the exporter. Driver bindings must match resource names from the place. The config is visible in labgrid-client -p <place> show and can be exported for inspection after acquisition with labgrid-client -p <place> env.

OpenOCD Scripts

OpenOCD scripts installed on the exporter should be loaded from the exporter side:

load_commands:
  - "source [find interface/adi-dbgagent.cfg]"
  - "source [find target/adspsc59x_a55.cfg]"
  - "source [find /tools/u-boot.tcl]"
  - "init"
  - "autoboot_elf"
  - "shutdown"

Do not put exporter-only OpenOCD scripts under the labgrid config: key. That key is for files that live on the client and should be copied to the exporter. Use source [find ...] for scripts already installed under the exporter’s OpenOCD script path.

Always include shutdown in one-shot OpenOCD command flows so the debugger is released for the next run.