Register a board

This is the command-level companion to Integrate hardware. Start there for the overall workflow and the choices to make before editing configuration. Use this page when you are ready to add the board’s resources, board slot, and environment file.

The hardware host should already be prepared. If it is not, start with Set up a hardware host.

The flow is:

  1. identify stable hardware IDs on the hardware host,

  2. add resources to exporter.yaml,

  3. restart and check the exporter,

  4. create a board slot,

  5. add an envs/<place>.yaml file,

  6. verify the board from the CLI,

  7. run the matching pytest test.

Identify connected hardware

Run these commands on the hardware host while the board is connected:

ls -l /dev/serial/by-id
lsusb
udevadm info --query=property --name=/dev/ttyUSB0
labgrid-suggest

Prefer stable matches:

  • use ID_SERIAL when the adapter has a unique serial number,

  • use ID_PATH when the physical USB port is the stable part of the setup,

  • use ID_VENDOR_ID and ID_MODEL_ID for USB probes.

Publish hardware resources

Edit the exporter config:

/home/labgrid/.config/labgrid/exporter.yaml

Example:

MUN-01-SC598_EZKIT-02:
  console:
    cls: USBSerialPort
    match:
      "@ID_SERIAL": "Example_UART_1234"
  debugger:
    cls: USBDebugger
    match:
      ID_PATH: "pci-0000:00:14.0-usb-0:12.2.1"
  power:
    cls: NetworkPowerPort
    model: example
    host: "http://power-controller.example"
    index: 1

shared-ftdi:
  pin-d3:
    cls: NetworkSysfsGPIO
    host: "lab-exporter-01"
    index: 123

Restart and check the exporter:

sudo systemctl --user --machine=labgrid@.host restart labgrid-exporter.service
sudo systemctl --user --machine=labgrid@.host status labgrid-exporter.service

If the service fails, fix that first. A client cannot see resources from an exporter that did not start.

Create a board slot

Run these commands from a client with LG_COORDINATOR set:

export LG_COORDINATOR=<coordinator-hostname>
labgrid-client -p MUN-01-SC598_EZKIT-02 create
labgrid-client -p MUN-01-SC598_EZKIT-02 add-match '*/MUN-01-SC598_EZKIT-02/*'
labgrid-client -p MUN-01-SC598_EZKIT-02 add-match '*/shared-ftdi/*'
labgrid-client -p MUN-01-SC598_EZKIT-02 set-tags family=adsp board=sc598 kind=ezkit
labgrid-client -p MUN-01-SC598_EZKIT-02 show

The tags must match the needs list of the tests that should run on this board.

Add the environment file

Create an env file in this repository:

envs/MUN-01-SC598_EZKIT-02.yaml

The filename must match the place name. A simple environment looks like this:

targets:
  MUN-01-SC598_EZKIT-02:
    resources:
      RemotePlace:
        name: "MUN-01-SC598_EZKIT-02"
      NetworkService:
        username: "labgrid-client"
        address: "10.44.3.61"

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

      - NetworkPowerDriver:
          name: power
          bindings:
            port: power

      - SSHDriver:
          name: ssh

      - FTDIGPIODriver:
          name: spi_boot
          bindings:
            gpio: pin-d3

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

      - UBootDriver:
          name: uboot
          prompt: "=> "
          bindings:
            console: serial

Verify the board from the CLI

Acquire the place:

labgrid-client -c envs/MUN-01-SC598_EZKIT-02.yaml -p MUN-01-SC598_EZKIT-02 acquire

Then test one operation at a time:

labgrid-client -c envs/MUN-01-SC598_EZKIT-02.yaml -p MUN-01-SC598_EZKIT-02 io low pin-d3
labgrid-client -c envs/MUN-01-SC598_EZKIT-02.yaml -p MUN-01-SC598_EZKIT-02 power cycle
labgrid-client -c envs/MUN-01-SC598_EZKIT-02.yaml -p MUN-01-SC598_EZKIT-02 scp images/u-boot-spl :u-boot-spl
labgrid-client -c envs/MUN-01-SC598_EZKIT-02.yaml -p MUN-01-SC598_EZKIT-02 scp images/u-boot :u-boot
labgrid-client -c envs/MUN-01-SC598_EZKIT-02.yaml -p MUN-01-SC598_EZKIT-02 bootstrap dummy
labgrid-client -c envs/MUN-01-SC598_EZKIT-02.yaml -p MUN-01-SC598_EZKIT-02 console

Release when done:

labgrid-client -c envs/MUN-01-SC598_EZKIT-02.yaml -p MUN-01-SC598_EZKIT-02 release

Run a test

After the CLI flow works, run one pytest test:

set='{"name": "adsp/u-boot"}' pytest -vvs

Start with one test and one place. Do not begin with pytest tests while bringing up a new setup.