usbdfu)This test verifies the USB Device Firmware Upgrade (DFU) functionality on the OpenTitan Earlgrey target. It ensures that the device can enumerate as a DFU device, that the host can perform download (programming) and upload (readback) operations, and that device certificates can be read via alternate interface settings.
The test consists of three main components:
Firmware (test_usb.rs): Runs on the Ibex core of the OpenTitan.
lc_ctrl).Serial Number: <hex>).DNLOAD blocks (2048 bytes). Block 0 triggers an erase of 64KB starting at 0xA0000 (Bank 1).0xA0000 using the flash_server service.UPLOAD to read back the programmed data.UPLOAD to read UDS, CDI_0, and CDI_1 certificates. If a certificate is blank (expected for UDS on FPGA), it stalls the control pipe, which is handled gracefully by the host.Flash Server (flash_server.rs): A separate userspace process running on the target.
Host Harness (host_usb_dfu_check.rs): Runs on the host machine.
Idle state.To run the test on a connected CW310 board:
bazelisk test --test_output=all --cache_test_results=no //target/earlgrey/tests/usbdfu:usb_hyper310_test
To see verbose log output from the host harness and target console during the test:
bazelisk test --test_output=all --cache_test_results=no //target/earlgrey/tests/usbdfu:usb_hyper310_test --test_arg=--logging=info