USB & Target Boards¶
Alloy supports passing USB devices (debuggers, development boards, programmers) from your host machine into the VM. You can flash firmware and run a debug session without leaving your development environment.
Prerequisites¶
USB passthrough is built into VirtualBox. No additional setup needed.
Make sure you're in the vboxusers group on Linux:
WSL2 requires usbipd-win to share USB devices with WSL:
After installing, reboot your machine.
List connected USB devices¶
Connect your board or debugger, then:
ID DEVICE STATUS
1 J-Link Ultra+ (SEGGER) available
2 STM32 STLink available
3 CP2102 USB to UART Bridge available
Attach a device to the VM¶
The device is now accessible inside the VM. Verify from inside the VM:
Flash firmware¶
Once the device is attached, use your normal flash tool from inside the VM:
alloy-host ssh arm-dev
# inside the VM:
JLinkExe -device nRF9160 -if SWD -speed 4000 -commandfile flash.jlink
# or with OpenOCD:
openocd -f interface/jlink.cfg -f target/nrf9160.cfg -c "program firmware.hex verify reset exit"
# or with pyocd:
pyocd flash --target nrf9160 firmware.bin
The device behaves exactly as it would if you were running these tools directly on your host machine.
Detach a device¶
The device is released back to the host and is available to other applications.
Check attachment status¶
Troubleshooting¶
Device shows as "available" but lsusb doesn't show it inside the VM
Try detaching and re-attaching:
On Linux: permission denied accessing the device
Your blueprint should include udev rules for your debugger. Add a task to install the appropriate rules file:
- name: Install J-Link udev rules
get_file:
url: "https://raw.githubusercontent.com/your-org/configs/main/99-jlink.rules"
sha256: "..."
dest: /etc/udev/rules.d/99-jlink.rules
run_command:
command: udevadm control --reload-rules && udevadm trigger
On Windows (WSL2): device not showing up
Run this in PowerShell (as administrator):
Then run alloy-host usb attach from WSL.