summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2026-06-22Merge remote-tracking branch 'origin/master' into add-ch58x-usbfshathach
2026-06-20hw/bsp/ch58x: address review feedback and read the real chip unique idhathach
Fold in the CH58x BSP review fixes: - family.mk: drop stray trailing backslashes on the last LDFLAGS/SRC_C entries (harmless -- GNU Make ends the list at the blank line -- but misleading). - debug_uart.c: uart_write() spun on a full ring buffer with nothing to drain it (only uart_sync() advances tx_consume), so a burst larger than the buffer deadlocked. Drain the FIFO while waiting, like uart_sync() does. - wch-riscv.cfg: move the OpenOCD work area from 0x80000000 (unmapped) to the 0x20000000 SRAM, sized to 32 KB, matching ch32v20x/wch-riscv.cfg. - family.c: implement board_get_unique_id() from the factory MAC. CH58x is a BLE part, so a unique 6-byte MAC lives in FlashROM at ROM_CFG_MAC_ADDR; GetMACAddress() reads it via FLASH_EEPROM_CMD (in libISP583.a), so no extra source file is needed. The read buffer is TU_ATTR_ALIGNED(4) and 8 bytes, per the SDK's documented 4-byte-aligned, word-granular buffer contract (CH58x_flash.c). - test/hil/tinyusb.json: key ch582m_evt off this board's actual MAC (D443627B5450) instead of the fixed placeholder, like every other board. Verified on ci.lan HIL: ch582m_evt enumerates with serial D443627B5450 and all device examples pass. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-19test/hil: add ch582m_evt to CI HIL poolhathach
Add the device-only CH582M-EVT (WCH USBFS via the shared dcd_ch32_usbfs.c), riscv-gcc, flashed by openocd_wch probe 7FD88F0604B5, to tinyusb.json. Also reorder device_tests to keep examples sharing a VID:PID non-adjacent: cdc_msc and cdc_msc_throughput both use cafe:4003, and on boards whose CPU-reset does not drop D+ (e.g. WCH CH58x via openocd) back-to-back same-PID firmware leaves the host on the previous example's cached descriptors, so the new example's CDC never enumerates and the test fails. Moving dfu (cafe:4000) between them changes the PID and forces the host to re-enumerate. Remote HIL on ci.lan: all device examples pass, including cdc_msc_throughput (no skip needed). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-18test/hil: fix esp32 audio_test_freertos (FreeRTOS tick), skip metro_m4hathach
Enabling the audio test fleet-wide surfaced failures on esp32-p4/s3 and metro_m4_express: the UAC mic enumerates but arecord fails the iso IN read with EIO, while 18 other boards pass strict=1.000. esp32: root cause is the FreeRTOS tick rate. ESP-IDF defaults CONFIG_FREERTOS_HZ to 100, so the audio task wakes only every 10 ms and can't service the 1 ms UAC iso frames -> underrun -> arecord EIO. (The same dwc2 driver passes on STM32, whose FreeRTOSConfig is 1000 Hz.) Set CONFIG_FREERTOS_HZ=1000 in the example sdkconfig.defaults; the example defaults are honored in the generated sdkconfig alongside the BSP's, so this takes effect. metro_m4_express (samd51): not tick-rate -- its FreeRTOSConfig is already 1000 Hz like the passing boards -- so it's a separate iso-IN issue, skipped for now. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-18test/hil: fail audio test on missing alsa-utils instead of skippinghathach
arecord (alsa-utils) is a documented HIL host requirement, like mtools/libmtp9/iperf — none of which have a skip-if-missing guard. The audio test was the exception: it silently returned 'skipped' when arecord was absent, masking host misconfiguration. The ci.lan rig had been silently skipping device/audio_test_freertos on every board because alsa-utils was never installed. Remove the shutil.which('arecord') guard so a missing package surfaces as a failure, consistent with the other tool-dependent tests, and drop the now-unused shutil import. Note in the host-setup comment that these packages are required (a missing tool fails its test rather than skipping). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-18test/hil: add ch32v103r_r1_1v0 to CI HIL poolhathach
Now that CH32V103 USB device works, add the board to the active HIL pool. It is a WCH RISC-V USBFS part, so it builds under the riscv-gcc bucket; single config (USBFS only, no fsdev variant). cdc_msc_throughput is skipped for this board: its device->host CDC bulk-IN read hard-fails here (a known, pre-existing dcd_ch32_usbfs throughput limitation, not specific to CH32V103). All other device tests pass on ci.lan (verified green, 0 failures). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-17Merge pull request #3643 from hathach/musb_ep0_raceHa Thach
dcd/musb: defer EP0 SETUP during DATA_IN/STATUS race
2026-06-16hil: enable nanoch32v203 in CI with fsdev + usbfs variants (#3707)Ha Thach
* hil: enable nanoch32v203 in CI with fsdev + usbfs variants nanoch32v203 was parked in boards-skip; move it into the active pool now that the board is wired to the ci.lan rig. Cover both USB device IPs as build variants: - nanoch32v203-fsdev: RHPORT_DEVICE=0 (USBD / stm32 FSDev IP) - nanoch32v203-usbfs: RHPORT_DEVICE=1 (WCH USBFS IP)
2026-06-16device: clamp EP0 OUT data copy to the control transfer buffer (#3705)Ha Thach
* device: clamp EP0 OUT data copy to the control transfer buffer usbd_control_xfer_cb() copied xferred_bytes from the EP0 bounce buffer into the requester's buffer with no bound. A non-compliant host that sends an OUT data packet larger than the control transfer's data_len (= min(len, wLength), the buffer capacity) would overflow that buffer and over-count total_xferred. Clamp xferred_bytes to the remaining buffer space before the memcpy and accounting.
2026-06-13hil: make serial write timeout fatalhathach
pyserial's posix write() raises SerialTimeoutException after partial progress with the byte count lost, so the retry loop re-sent from the same offset and could duplicate bytes on the wire — surfacing as bogus data-mismatch failures that look like device firmware bugs. write_timeout is already a total per-call deadline, so the loop added duplication risk without extending the budget: write once and treat a timeout as fatal. Default bumped 2 -> 10 s to keep the old overall bound; HIL_SERIAL_WRITE_DEADLINE removed. The per-character CLI loops keep their existing pacing (the 2 ms sleep between single-byte writes already spaces them on the wire); no unbounded ser.flush()/tcdrain is added. Review follow-up for #3643 (hil_test.py l.257/264 findings). Co-Authored-By: Claude Fable 5 <[email protected]>
2026-06-11Merge remote-tracking branch 'origin/master' into musb_ep0_racehathach
# Conflicts: # test/hil/hil_test.py
2026-06-11HIL: replace build.flags_on with named build variants (#3687)Ha Thach
* test/hil: replace build.flags_on with named variant schema Boards declare build variants as `variant: [{name, flags}]` instead of `build.flags_on`. The variant `name` is the build dir (cmake-build-<name>) and the HIL report row; `flags` is the raw CFLAGS string (-D...=1) injected via CFLAGS_CLI. No `variant` => a single build named after the board. - build.py: --build-name <name> (dir) + --cflag=<token> (raw CFLAGS, repeatable, =form survives the matrix's shell word-splitting); drop -f1/CFLAGS wrapping. - hil_ci_set_matrix.py: emit one build arg per variant. - hil_test.py: iterate variants; report row + build dir = variant name. - hil_ci.sh: copy all cmake-build-<board>* dirs for -b runs. - get_deps.py: accept (ignore) --build-name/--cflag from matrix args. - tinyusb.json: migrate all 6 flags_on boards to variant. * board_test: park CI build with busy spin instead of wfe
2026-06-10Merge pull request #3690 from hathach/claude/board-test-idle-parkHa Thach
hil: park boards with idle board_test instead of erasing flash
2026-06-09test/hil: erase MCU after tests; show throughput speeds in reporthathach
Teardown: instead of flashing device/board_test (a USB-less blink loop that keeps the MCU busy-looping), erase the first flash sector (vector table) so the board faults to idle after its tests — no USB, lower power, faster. Per-flasher erase_<name>: openocd/openocd_adi `flash erase_sector 0 0 0`; stlink `--erase 0`; jlink erases the sector at the flash origin read from the ELF (pure-Python, new elf_flash_origin); esptool `erase_region 0x0 0x4000`; lm4flash writes a 4 KB all-0xFF blank image (lm4flash erases before programming, so the first sector ends up blank). device/board_test flash remains a fallback for flashers with no erase_ function. The teardown is no longer a report column (it's cleanup). Report: cdc_msc_throughput and msc_file_explorer[_freertos] now return a compact read/write speed shown in their report cell instead of the pass tick (e.g. "C 652k/422k M 1.1M/783k", "rd 1.2MB/s"). test_example returns an optional metric; render_matrix shows it verbatim. Firmware lookup factored into find_firmware (reused by the erase teardown). Verified on the rig (stm32f723disco, jlink): erase disables the board in 0.8 s and it disappears from the bus; the throughput cell shows live speeds. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-08test/hil: use ⚪ for skipped in HIL reporthathach
Neutral white circle for skipped, giving a ✅/❌/⚪ pass/fail/skip set. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-08test/hil: use ✅/❌ emoji for HIL report pass/failhathach
Colored emoji render green/red in the GitHub PR comment, far more visible than the monochrome ✔/✖ dingbats. Skip stays ➖. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-08test/hil: clear HIL report up front on a fresh runhathach
The report sidecar lives in a persistent dir (it survives the CI workspace clean so accumulation works across run attempts). A full run is "fresh" and must not merge prior state, but previously fresh only avoided *loading* the json at merge time — if a fresh run crashed before writing the report, the stale json/md from an earlier run lingered and a retry (fresh=False) could merge it, or the always() upload could post it. Delete hil_report.json/.md at the start of a fresh run so prior results can never leak. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-08test/hil: accumulate HIL report across re-runs; post as sticky PR commenthathach
hil_test.py persists results in a hil_report.json sidecar and regenerates hil_report.md from it. A full run starts fresh; a re-run (--skip-board / -bt, i.e. the .skip file) merges into the existing report so already-passed boards/tests are preserved while only re-run cells update. The report dir is configurable via HIL_REPORT_DIR. build.yml: each HIL rig writes the report to a workspace-sibling dir that survives the per-attempt workspace clean, and uploads it as an artifact. A new hil-report job merges the rigs' reports into one sticky PR comment (marocchino) with one table per rig. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-08presets,hil: keep Ninja Multi-Config; make HIL find its outputhathach
Per review (HiFiPhile): Ninja Multi-Config is needed for IAR, otherwise the optimization level can't be lowered to none for debug. Revert gen_presets.py back to Ninja Multi-Config (keeping only the cmake-build-<board> binaryDir change), and instead teach hil_test.py to locate <ex>.elf whether it sits directly in the example dir (single-config) or under a per-config subdir like RelWithDebInfo/ (multi-config). Verified: stm32u083nucleo passes 13/13 remote HIL with a multi-config preset build (rsync preserves the RelWithDebInfo/ subdir; the resolver finds it). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-08test/hil: report board x test results as a markdown matrixhathach
hil_test.py now writes hil_report.md and prints it to stdout: rows are boards, columns are tests (bare example names), cells are pass/fail/skip. test_example returns a per-test status, test_board collects a board x test grid (one row per flags-on variant), and main() renders an aligned table. A missing binary counts as skipped. hil_ci.sh copies the report back from the remote after a run; hil_report.md is gitignored. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-08test/hil: add stm32u083nucleo to pool and expose ~/bin on remote PATHhathach
Add stm32u083nucleo to the active boards in tinyusb.json, flashed via the stlink flasher (onboard ST-Link + STM32CubeProgrammer); ci's openocd build has no STM32U0 flash driver. STM32_Programmer_CLI lives in ~/bin on ci, which the remote `bash -s` shell in hil_ci.sh did not have on PATH, so add $HOME/bin to its PATH export (matching the GHA runner .path). Verified remote: 13/13 device tests pass on ci.lan. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-05add tm4c123x evk to hill pool (#3676)Ha Thach
* add ek_tm4c123gxl to the hil pool, flashing with lm4flash
2026-06-03dwc2: address Copilot review (comment grammar/typo, tinyusb.json f407 dedup)hathach
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-03Add STM32F407 and STM32L476 disco board configurations to tinyusb.jsonhathach
2026-05-27hil: replace pyfatfs with mtools, update host setup instructionshathach
- Removed `pyfatfs` dependency in favor of `mtools` for reading FAT volumes, simplifying the block device read logic. - Updated `requirements.txt` and added detailed host setup instructions for system packages. - Switched to `cython-hidapi` for HID tests, replacing deprecated APIs with updated usage. - Removed unnecessary warnings suppression and `fs` module.
2026-05-25Merge remote-tracking branch 'tinyusb/master' into musb_ep0_raceHiFiPhile
2026-05-21hil added hub + msc + cdc for host capable boardhathach
2026-05-19Merge pull request #3571 from sauloverissimo/feat/midi2-device-host-driverZixun LI
feat: Add USB-MIDI 2.0 Device and Host class drivers
2026-05-15fix test hungHiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2026-05-12hil: add audio test, optimize log printHiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2026-05-12midi2: align descriptors with USB-MIDI 2.0 specSaulo Veríssimo
Brings the MIDI 2.0 device driver into full conformance with USB Device Class Definition for MIDI Devices v2.0 (USB-IF, May 2020). - Alt 1 MS Interface Header wTotalLength now reports 0x0007 per Table 5-2 ("set to match bLength"), replacing the prior 0x0011 carried over from USB-MIDI 1.0 conventions. - GET_DESCRIPTOR class request now validates bmRequestType direction, type and recipient plus wIndex and wValue high byte per Section 6. - iBlockItem in the default Group Terminal Block is driven by CFG_TUD_MIDI2_BLOCK_STRIDX so applications can attach a UI string descriptor to the block per Table 5-6. - UMP word byte order assumption (little-endian host per Section 3.2.2) is documented inline so future big-endian ports know where to wrap access with tu_htole32 / tu_le32toh. Validated on RP2040 and ESP32-P4 under Linux kernel 6.17: lsusb -v reports wTotalLength = 0x0007 on Alt 1 MS Header (raw bytes 07 24 01 00 02 07 00). amidi -l enumerates Group Terminals exposed via the class-specific GET_DESCRIPTOR response.
2026-05-12test: add MIDI 2.0 Device and Host unit testsSaulo Veríssimo
Add unit tests for MIDI 2.0 drivers: - Device: UMP word count (all 16 message types), descriptor macro validation (length, byte layout, alt settings, endpoints), CS endpoint subtypes, traversal integrity - Host: UMP word count, callback struct validation, CS endpoint subtypes Also add Sphinx documentation for MIDI 2.0 class drivers (Device and Host API reference, lifecycle, configuration, examples). Tests: 60/60 PASS (FIFO 26/26, USBD 5/5, MIDI2 Device 18/18, MIDI2 Host 6/6, USBD internal 5/5)
2026-05-11Merge pull request #3632 from hathach/msc_osZixun LI
hcd/dwc2: fix txfifo full check
2026-05-06modernize scriptZixun LI
Co-authored-by: Copilot <[email protected]> Signed-off-by: Zixun LI <[email protected]>
2026-05-05try to fix CI stuckZixun LI
Co-authored-by: Copilot <[email protected]> Signed-off-by: Zixun LI <[email protected]>
2026-05-04hil remove hub from pico native host test for nowhathach
2026-05-04hil_test: use non-blocking writes with timeout for printer testshathach
2026-04-29deprecated `usbd_control.c` and merge its functionality into `usbd.c`hathach
2026-04-29Merge branch 'master' into hil_hfphathach
2026-04-29Improve remote execution in `hil_ci.sh`hathach
2026-04-29address review feedback for AGENTS.md and hil skillhathach
AGENTS.md: - fix build dir to cmake-build-<board> (matches hil_test.py expectation) - reformat flash section to avoid shell-pipe ambiguity, use <board> - mention board.mk for Make-based builds - complete OpenOCD jlink interface example - update stale "Build Option 2" references to "All examples for a board" - split PVS-Studio command so it is copy-pasteable .claude/skills/hil/SKILL.md: - clarify local.json is user-supplied, not tracked in repo - use python3 consistently - add all-boards variant for remote execution - delegate remote execution to test/hil/hil_ci.sh test/hil/hil_ci.sh: - portable shebang (/usr/bin/env bash) - set -euo pipefail - env overrides for REMOTE, REMOTE_DIR, CONFIG, ROOT_DIR - --prune-empty-dirs on rsync to skip empty subdirs - fail-fast sanity check on repo layout Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
2026-04-28only re-run tests that failed per boardhathach
hil remove hub from pico2 since it is not stable
2026-04-28fix warning, change hil jlink for feather nrf52840hathach
2026-04-26run hil_hfp on gcc buildHiFiPhile
Co-authored-by: Copilot <[email protected]> Signed-off-by: HiFiPhile <[email protected]>
2026-04-26hil: comment out net_lwip_webserver test for PR #3605hathach
The CI HIL host hits an intermittent USB net interface enumeration race that fails this test consistently while the device-side build/code is fine. Disable the entry in device_tests so the rest of the HIL suite can gate the PR; will re-enable once the host-side flake is addressed. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
2026-04-26hil: bump net iface enum timeout to 30s for net_lwip_webserverhathach
The CI HIL host repeatedly fails the test with "USB net iface enx... did not come up with 192.168.7.x within 15s" — USB enumeration + DHCP serve takes longer there than on the local rig. Bump just this test's timeout to 30s; other tests stay on the 15s global ENUM_TIMEOUT. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
2026-04-24add throughput test for hilhathach
2026-04-23musb double packet for epouthathach
2026-04-21enable double buffer for tm4chathach
2026-04-21refactor interrupt handling and add `pipe_write` to fix IN ZLP issuehathach