How to access hardware from Workshop¶
The host device used to flash a board depends on the board and runner. Create an in-project SDK with a custom-device plug that matches only the device required by your board.
Prerequisites¶
Before starting, ensure you have these requirements satisfied:
A launched
zephyr-26-04Workshop.A development board connected to the host.
A Zephyr application built for that board in
/project/zephyr/build.The host device node used by the board’s flash runner.
Run the host commands in this guide from the project directory
that contains .workshop/zephyr-26-04.yaml.
Identify the host device¶
Use your board and runner documentation
to identify the device node used for flashing.
For a USB serial adapter, the node can be /dev/ttyUSB0
or /dev/ttyACM0.
Query its subsystem, vendor ID, and product ID:
$ udevadm info --query=property \
--property=SUBSYSTEM \
--property=ID_VENDOR_ID \
--property=ID_MODEL_ID \
/dev/ttyUSB0
The output for a serial adapter is similar to:
SUBSYSTEM=tty
ID_VENDOR_ID=0403
ID_MODEL_ID=6001
Use the values reported for your device. Do not copy the example identifiers unless they match your hardware.
Create a device SDK¶
Create an in-project SDK definition:
$ mkdir -p .workshop/board-device
$ editor .workshop/board-device/sdk.yaml
Add a custom-device plug with the attributes from udevadm:
name: board-device
plugs:
flash-device:
interface: custom-device
subsystem: tty
vendorid: "0403"
productid: "6001"
The tty subsystem applies to the serial-adapter example.
Use the subsystem reported for your device.
Always set vendorid for a tty device,
and set productid when the host reports one.
Quote both identifiers so YAML preserves leading zeroes.
Add the in-project SDK to the sdks list
in .workshop/zephyr-26-04.yaml:
sdks:
# Existing SDK entries...
- name: project-board-device
Apply the updated definition:
$ workshop refresh zephyr-26-04
Connect the device¶
Connect the plug to the system custom-device slot:
$ workshop connect \
zephyr-26-04/board-device:flash-device :custom-device
Verify the connection:
$ workshop connections --all
The connection for board-device:flash-device
must show system:custom-device in the slot column
and manual in the notes column.
Flash the application¶
Flash the application
from the default /project/zephyr/build directory:
$ workshop run zephyr-26-04 -- flash
To use a different build directory,
pass its path with the -d option:
$ workshop run zephyr-26-04 -- flash -d /project/path/to/build
Some boards expose more than one host device, or they require a board-specific runner and additional arguments. Declare and connect one narrowly scoped plug for each required device. Use west flash --context to list the available options.
Remove device access¶
Disconnect the plug:
$ workshop disconnect zephyr-26-04/board-device:flash-device
Run workshop connections --all to check that the plug is disconnected.
See also¶
Tutorial:
Reference: