Skip to content

remote/client: support OpenOCD bootstrap without environment#1864

Open
ozan956 wants to merge 2 commits into
labgrid-project:masterfrom
ozan956:fix/remote-client-openocd-bootstrap
Open

remote/client: support OpenOCD bootstrap without environment#1864
ozan956 wants to merge 2 commits into
labgrid-project:masterfrom
ozan956:fix/remote-client-openocd-bootstrap

Conversation

@ozan956
Copy link
Copy Markdown

@ozan956 ozan956 commented May 7, 2026

The bootstrap fallback path was too narrow for OpenOCD-based setups without a
local environment.

Previously, labgrid-client bootstrap only auto-created OpenOCDDriver for
NetworkAlteraUSBBlaster. If a place exposed only NetworkUSBDebugger, the
client still failed with target has no compatible resource available even
though OpenOCDDriver can bind to that resource type.

The existing bootstrap_args path was also too limited. It only handled raw
key=value strings, which was not sufficient for OpenOCDDriver arguments
such as load_commands, search, or config, where structured values like
lists are often required.

This change:

  • extends the bootstrap fallback to NetworkUSBDebugger
  • parses bootstrap driver arguments as YAML values
  • allows structured OpenOCD driver arguments to be passed directly from the CLI

This makes CLI-only OpenOCD bootstrap flows usable in more cases without
requiring a local environment file.

I verified the change with focused regression tests:

pytest -q tests/test_client.py -k 'bootstrap_network_usb_debugger or bootstrap_openocd_args'

Checklist

  • Tests for the feature
  • PR has been tested

@ozan956 ozan956 force-pushed the fix/remote-client-openocd-bootstrap branch from 4800392 to 91725b3 Compare May 7, 2026 11:14
@codecov
Copy link
Copy Markdown

codecov Bot commented May 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 46.2%. Comparing base (06fd06c) to head (8026458).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff            @@
##           master   #1864     +/-   ##
========================================
+ Coverage    46.0%   46.2%   +0.2%     
========================================
  Files         180     180             
  Lines       14462   14475     +13     
========================================
+ Hits         6654    6695     +41     
+ Misses       7808    7780     -28     
Flag Coverage Δ
3.10 46.2% <100.0%> (+0.2%) ⬆️
3.11 46.2% <100.0%> (+0.2%) ⬆️
3.12 46.2% <100.0%> (+0.2%) ⬆️
3.13 46.2% <100.0%> (+0.2%) ⬆️
3.14 46.2% <100.0%> (+0.2%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Emantor
Copy link
Copy Markdown
Member

Emantor commented May 30, 2026

Do we need a complete yaml definition and loader for the bootstrap arguments? Can't we instead supply an openocd native target configuration instead or limit this to a list of key-value items?

The bootstrap fallback path was too narrow for OpenOCD-based setups
without a local environment.

So far, `labgrid-client bootstrap` only auto-created `OpenOCDDriver`
for `NetworkAlteraUSBBlaster`. If a place exposed only
`NetworkUSBDebugger`, the client failed with "target has no compatible
resource available" even though `OpenOCDDriver` can bind to that
resource type.

In addition, the existing `bootstrap_args` path only handled raw
`key=value` strings. This was not sufficient for `OpenOCDDriver`
arguments such as `load_commands`, `search`, or `config`, which often
need structured values like lists.

Extend the bootstrap fallback to `NetworkUSBDebugger` and parse
bootstrap driver arguments as YAML values. This allows CLI-only OpenOCD
bootstrap flows to pass structured driver arguments without requiring a
local environment file.

Signed-off-by: Ozan Durgut <ozan.durgut@analog.com>
@ozan956 ozan956 force-pushed the fix/remote-client-openocd-bootstrap branch from 91725b3 to 83839d1 Compare June 1, 2026 13:27
Add unit tests for OpenOCD bootstrap argument parsing and the
NetworkUSBDebugger fallback path in the client.

Keep these tests separate from the OpenOCD integration tests so they do
not depend on the openocd binary being installed.

Signed-off-by: Ozan Durgut <ozan.durgut@analog.com>
@ozan956 ozan956 force-pushed the fix/remote-client-openocd-bootstrap branch from 83839d1 to 8026458 Compare June 1, 2026 13:35
@ozan956
Copy link
Copy Markdown
Author

ozan956 commented Jun 1, 2026

Do we need a complete yaml definition and loader for the bootstrap arguments? Can't we instead supply an openocd native target configuration instead or limit this to a list of key-value items?

Thanks @Emantor,

As you see I am trying to solve two problems. First, extending the bootstrap fallback path so labgrid-client bootstrap can also instantiate OpenOCDDriver for NetworkUSBDebugger when no local environment is available. Second, making it possible to pass the structured OpenOCD driver arguments needed by that CLI-only path.

Regarding your suggestion, I can say that this can work for some cases, but I do not think its the best option to have a config wrapper like that. The main reason is that the arguments here are not only static target configuration. They also describe the bootstrap workflow itself, for example custom source ..., init, autoboot_elf, and shutdown sequences. Those are valid OpenOCD commands, so they can certainly be moved into a script file, but requiring a separate OpenOCD file for every target or case-specific variation would add maintenance overhead ( since there can be multiple config/command combinations for multiple boards) and keep the CLI-only path less practical.

I do agree that the generic YAML parsing may be overkill. The important part for me is the ability to pass the OpenOCD-specific structured arguments needed by this bootstrap flow, not to introduce a fully generic typed argument mechanism for bootstrap in general. So, I think we can maybe restrict this path to a small whitelist of OpenOCD-specific keys such as config, search, load_commands, interface_config, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants