Strategies API

Strategies are high-level state machines managing complex workflows.

BootFPGASoC

class adi_lg_plugins.strategies.bootfpgasoc.BootFPGASoC(target, name, status=Status.unknown, reached_linux_marker='analog', update_image=False, wait_for_linux_prompt_timeout=60, debug_write_boot_log=False)[source]

Bases: Strategy

BootFPGASoC strategy for FPGA SoC devices using Kuiper releases.

This strategy works by using an SD card mux to flash a Kuiper release image onto the device’s SD card, and move the necessary boot files into the appropriate locations before booting the device. Flashing a full image is set through the update_image attribute. The following bindings must be present on the target: - PowerProtocol (any power control protocol) - SDMuxDriver (to switch SD card between host and DUT) - MassStorageDriver (to copy boot files to the SD card) - ADIShellDriver (to interact with the device shell after boot) - KuiperDLDriver (to download and manage Kuiper release files)

Optionally, an ImageWriter driver can be used to flash the full image. This is controlled by the update_image attribute.

Therefore, physical connections must be set up to allow: - Power control of the device - SD card access from the host (via SD mux) - Shell access to the device (e.g., via serial console)

Parameters:
  • reached_linux_marker (str) – String to expect in the shell to confirm Linux has booted.

  • update_image (bool) – Whether to flash the full Kuiper image to the SD card.

  • wait_for_linux_prompt_timeout (int) – Timeout in seconds to wait for Linux prompt after boot.

bindings: Dict[str, Any] = {'image_writer': {'USBStorageDriver', None}, 'kuiper': 'KuiperDLDriver', 'mass_storage': 'MassStorageDriver', 'power': 'PowerProtocol', 'sdmux': 'USBSDMuxDriver', 'shell': 'ADIShellDriver'}
transition(status, *, step)[source]

Transition the strategy to a new state.

This method manages state transitions for the boot process. It handles power control, SD mux switching, boot file updates, and device activation in the correct sequence.

Parameters:
  • status (Status or str) – Target state to transition to. Can be a Status enum value or its string representation (e.g., “shell”, “booted”).

  • step – Labgrid step decorator context (injected automatically).

Raises:

StrategyError – If the transition is invalid or fails.

Example

>>> strategy.transition("shell")  # Transition to shell state
>>> strategy.transition(Status.soft_off)  # Power off the device

Note

State transitions are sequential. Requesting a state that requires intermediate states will automatically transition through them.

__init__(target, name, status=Status.unknown, reached_linux_marker='analog', update_image=False, wait_for_linux_prompt_timeout=60, debug_write_boot_log=False)

Method generated by attrs for class BootFPGASoC.

Return type:

None

class adi_lg_plugins.strategies.bootfpgasoc.Status(value)[source]

Boot strategy state machine states.

unknown

Initial state before any operations.

powered_off

Device is powered off.

sd_mux_to_host

SD card muxed to host for file operations.

update_boot_files

Copying boot files to SD card.

sd_mux_to_dut

SD card muxed to device for booting.

booting

Device powered on, boot in progress.

booted

Linux kernel has booted, waiting for user space.

shell

Interactive shell session available.

soft_off

Device being shut down gracefully.

unknown = 0
powered_off = 1
sd_mux_to_host = 2
update_boot_files = 3
sd_mux_to_dut = 4
booting = 5
booted = 6
shell = 7
soft_off = 8

BootFPGASoCSSH

class adi_lg_plugins.strategies.bootfpgasocssh.BootFPGASoCSSH(target, name, status=Status.unknown, reached_linux_marker='analog', wait_for_linux_prompt_timeout=60, debug_write_boot_log=False)[source]

Bases: Strategy

Strategy to boot an FPGA SoC device using ShellDriver and SSHDriver.

This strategy manages the boot process of an FPGA SoC device by utilizing both the ShellDriver for initial boot interactions and the SSHDriver for file transfers and updates. It handles transitions through various states including powering off, booting, updating boot files, and entering a shell.

Power control is optional and can be managed via a power driver if provided.

bindings: Dict[str, Any] = {'kuiper': {'KuiperDLDriver', None}, 'power': {'PowerProtocol', None}, 'shell': 'ADIShellDriver', 'ssh': 'SSHDriver'}
transition(status, *, step)[source]

Transition the strategy to a new state.

This method manages state transitions for SSH-based boot. It handles power control, shell driver activation, SSH file transfer, and device reboot sequences.

Parameters:
  • status (Status or str) – Target state to transition to. Can be a Status enum value or its string representation (e.g., “shell”, “booted”).

  • step – Labgrid step decorator context (injected automatically).

Raises:

StrategyError – If the transition is invalid or fails.

Example

>>> strategy.transition("shell")  # Transition to shell state
>>> strategy.transition("update_boot_files")  # Update boot files via SSH

Note

This strategy uses SSH for file transfers, unlike BootFPGASoC which uses SD card mux. Power control is optional in this strategy.

__init__(target, name, status=Status.unknown, reached_linux_marker='analog', wait_for_linux_prompt_timeout=60, debug_write_boot_log=False)

Method generated by attrs for class BootFPGASoCSSH.

Return type:

None

class adi_lg_plugins.strategies.bootfpgasocssh.Status(value)[source]

Boot strategy state machine states for SSH-based boot.

unknown

Initial state before any operations.

powered_off

Device is powered off.

booting

Device powered on, initial boot in progress.

booted

Linux kernel has booted, waiting for shell access.

update_boot_files

Copying boot files to device via SSH.

reboot

Device is rebooting with new boot files.

booting_new

Device booting after file update.

shell

Interactive shell session available.

soft_off

Device being shut down gracefully.

unknown = 0
powered_off = 1
booting = 2
booted = 3
update_boot_files = 4
reboot = 5
booting_new = 6
shell = 7
soft_off = 8

BootFPGASoCTFTP

class adi_lg_plugins.strategies.bootfpgasoctftp.BootFPGASoCTFTP(target, name, status=Status.unknown, reached_linux_marker='analog', wait_for_linux_prompt_timeout=60, tftp_root_folder='/var/lib/tftpboot', kernel_addr='0x30000000', dtb_addr='0x2A000000', bootargs='console=ttyPS0,115200 root=/dev/mmcblk0p2 rw earlycon earlyprintk rootfstype=ext4 rootwait')[source]

Bases: Strategy

Strategy to boot an FPGA SoC device using ShellDriver and TFTP.

This strategy manages the boot process of an FPGA SoC device by utilizing both the ShellDriver for initial boot interactions and TFTP for kernel loading. It depends on a TFTPServerResource to provide the server IP address. It handles transitions through various states including powering off, booting, updating boot files, and entering a shell.

bindings: Dict[str, Any] = {'kuiper': {'KuiperDLDriver', None}, 'power': 'PowerProtocol', 'shell': 'ADIShellDriver', 'ssh': {'SSHDriver', None}, 'tftp_driver': 'TFTPServerDriver', 'tftp_server': 'TFTPServerResource'}
transition(status, *, step)[source]
__init__(target, name, status=Status.unknown, reached_linux_marker='analog', wait_for_linux_prompt_timeout=60, tftp_root_folder='/var/lib/tftpboot', kernel_addr='0x30000000', dtb_addr='0x2A000000', bootargs='console=ttyPS0,115200 root=/dev/mmcblk0p2 rw earlycon earlyprintk rootfstype=ext4 rootwait')

Method generated by attrs for class BootFPGASoCTFTP.

Return type:

None

class adi_lg_plugins.strategies.bootfpgasoctftp.Status(value)[source]

Boot strategy state machine states for TFTP-based boot.

unknown = 0
powered_off = 1
update_boot_files = 2
booting = 3
booted = 4
shell = 5
soft_off = 6

BootSelMap

class adi_lg_plugins.strategies.bootselmap.BootSelMap(target, name, status=Status.unknown, reached_linux_marker='analog', ethernet_interface=None, iio_jesd_driver_name='axi-ad9081-rx-hpc', iio_jesd_data_mode='DATA', iio_jesd_link_mode_attr='jesd204_link_mode', pre_boot_boot_files=None, post_boot_boot_files=None)[source]

Bases: Strategy

BootSelMap - Strategy to boot SelMap based dual FPGA design.

This strategy does not replace the kernel. It focuses on booting the secondary FPGA via the SelMap interface after the primary FPGA has booted Linux.

bindings: Dict[str, Any] = {'power': 'PowerProtocol', 'shell': 'ADIShellDriver', 'ssh': 'SSHDriver'}
transition(status, *, step)[source]

Transition the strategy to a new state.

This method manages state transitions for dual FPGA SelMap boot. It handles booting the primary Zynq FPGA, updating boot files for both FPGAs, and triggering the SelMap boot of the secondary Virtex FPGA.

Parameters:
  • status (Status or str) – Target state to transition to. Can be a Status enum value or its string representation (e.g., “shell”, “booted_virtex”).

  • step – Labgrid step decorator context (injected automatically).

Raises:

StrategyError – If the transition is invalid or fails.

Example

>>> strategy.transition("booted_zynq")  # Boot primary Zynq FPGA
>>> strategy.transition("trigger_selmap_boot")  # Boot secondary Virtex FPGA
>>> strategy.transition("shell")  # Get shell access

Note

This strategy manages a complex dual-FPGA system where the primary Zynq FPGA boots Linux and then triggers the secondary Virtex FPGA boot via the SelMap interface.

Check JESD link modes and return True when all linked modes are DATA.

Returns False when no modes are found or if any mode is not DATA.

Parameters:

timeout (int)

Return type:

bool

__init__(target, name, status=Status.unknown, reached_linux_marker='analog', ethernet_interface=None, iio_jesd_driver_name='axi-ad9081-rx-hpc', iio_jesd_data_mode='DATA', iio_jesd_link_mode_attr='jesd204_link_mode', pre_boot_boot_files=None, post_boot_boot_files=None)

Method generated by attrs for class BootSelMap.

Return type:

None

class adi_lg_plugins.strategies.bootselmap.Status(value)[source]

Boot strategy state machine states for dual FPGA SelMap boot.

unknown

Initial state before any operations.

powered_off

Both FPGAs are powered off.

booting_zynq

Primary Zynq FPGA is booting.

booted_zynq

Zynq FPGA has booted Linux successfully.

update_zynq_boot_files

Updating Zynq boot files before booting.

update_virtex_boot_files

Updating Virtex bitstream files.

trigger_selmap_boot

Triggering SelMap boot of secondary Virtex FPGA.

wait_for_virtex_boot

Waiting for Virtex FPGA boot to complete.

booted_virtex

Secondary Virtex FPGA has booted successfully.

shell

Interactive shell session available on Zynq.

soft_off

Device being shut down gracefully.

unknown = 0
powered_off = 1
booting_zynq = 2
booted_zynq = 3
update_zynq_boot_files = 4
update_virtex_boot_files = 5
trigger_selmap_boot = 6
wait_for_virtex_boot = 7
booted_virtex = 8
shell = 9
soft_off = 10

BootFabric

class adi_lg_plugins.strategies.bootfabric.BootFabric(target, name, status=Status.unknown, reached_boot_marker='login:', wait_for_boot_timeout=120, verify_iio_device=None, trigger_dhcp_reset=False, power_off_delay=2, debug_write_boot_log=False)[source]

Bases: Strategy

BootFabric - Strategy to boot logic-only Xilinx FPGAs with Microblaze.

This strategy manages the boot process of logic-only FPGA devices (Virtex, Artix, Kintex) using JTAG. It handles powering on the device, flashing the bitstream via JTAG, downloading the Linux kernel, and providing shell access via serial console.

Boot Sequence:
  1. Power on FPGA

  2. Flash bitstream via JTAG (configures FPGA fabric and Microblaze processor)

  3. Download Linux kernel image via JTAG

  4. Start kernel execution

  5. Wait for boot completion and verify shell access

  6. Fixup networking

  7. Provide interactive shell access

Bindings:

power: PowerProtocol (optional) - Power control (on/off) jtag: XilinxJTAGDriver - JTAG programming driver shell: ADIShellDriver (optional) - Serial console access ssh: SSHDriver (optional) - SSH access

Resources:

XilinxDeviceJTAG: JTAG target IDs and file paths XilinxVivadoTool: Vivado installation path for xsdb

reached_boot_marker

String to expect in console when boot complete. Default: “login:” (standard Linux login prompt).

Type:

str

wait_for_boot_timeout

Timeout in seconds to wait for boot marker. Default: 120 seconds.

Type:

int

verify_iio_device

IIO device name to verify after boot. If specified, driver checks if device is available after booting. Example: “axi-ad9081-rx-hpc” for AD9081 transceiver.

Type:

str, optional

bindings: Dict[str, Any] = {'jtag': 'XilinxJTAGDriver', 'power': {'PowerProtocol', None}, 'shell': {'ADIShellDriver', None}, 'ssh': {'SSHDriver', None}}
__attrs_post_init__()[source]

Initialize strategy.

transition(status, *, step)[source]

Transition the strategy to a new state.

This method manages state transitions for Virtex/Artix FPGA boot via JTAG. It handles power control, bitstream flashing, kernel downloading, and boot verification.

Parameters:
  • status (Status or str) – Target state to transition to. Can be a Status enum value or its string representation (e.g., “shell”, “booted”).

  • step – Labgrid step decorator context (injected automatically).

Raises:

StrategyError – If the transition is invalid or fails.

Example

>>> strategy.transition("shell")  # Boot FPGA and get shell
>>> strategy.transition("soft_off")  # Power off FPGA

Note

State transitions are sequential. Requesting a state that requires intermediate states will automatically transition through them.

__init__(target, name, status=Status.unknown, reached_boot_marker='login:', wait_for_boot_timeout=120, verify_iio_device=None, trigger_dhcp_reset=False, power_off_delay=2, debug_write_boot_log=False)

Method generated by attrs for class BootFabric.

Return type:

None

class adi_lg_plugins.strategies.bootfabric.Status(value)[source]

Boot strategy state machine states for Virtex/Artix FPGA boot.

unknown

Initial state before any operations.

powered_off

FPGA is powered off.

powered_on

FPGA is powered on but not configured.

bitstream_flashed

FPGA bitstream has been flashed via JTAG.

kernel_downloaded

Linux kernel has been downloaded to Microblaze.

booting

Kernel execution has started.

booted

Kernel has booted and is ready for interaction.

shell

Interactive shell session available on Microblaze.

soft_off

Device being shut down gracefully.

unknown = 0
powered_off = 1
powered_on = 2
flash_fpga = 3
booted = 4
fixup_networking = 5
shell = 6
soft_off = 7

SoftwareProvisioningStrategy

class adi_lg_plugins.strategies.software_provisioning.SoftwareProvisioningStrategy(target, name, status=Status.unknown, packages=NOTHING, repos=NOTHING, build_steps=NOTHING, test_steps=NOTHING)[source]

Bases: Strategy

Strategy to provision software on a target using SoftwareInstallerDriver.

This strategy automates the process of installing packages, cloning repositories, building software, and running tests.

packages

List of package names to install.

Type:

list

repos

List of repositories to clone. Each item can be a dictionary {‘url’: …, ‘dest’: …, ‘branch’: …} or a tuple (url, dest, [branch]).

Type:

list

build_steps

List of build steps. Each item can be a dictionary {‘cmd’: …, ‘dir’: …} or a tuple (cmd, dir).

Type:

list

test_steps

List of test steps. Each item can be a dictionary {‘cmd’: …, ‘dir’: …} or a tuple (cmd, dir).

Type:

list

bindings: Dict[str, Any] = {'installer': 'SoftwareInstallerDriver'}
transition(status, *, step)[source]
__init__(target, name, status=Status.unknown, packages=NOTHING, repos=NOTHING, build_steps=NOTHING, test_steps=NOTHING)

Method generated by attrs for class SoftwareProvisioningStrategy.

Return type:

None

class adi_lg_plugins.strategies.software_provisioning.Status(value)[source]

States for SoftwareProvisioningStrategy

unknown = 0
connected = 1
software_installed = 2
repos_cloned = 3
built = 4
tested = 5