Commit Graph

342 Commits

Author SHA1 Message Date
d9dc891ee2 test/hil: fix esp32 audio_test_freertos (FreeRTOS tick), skip metro_m4
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) <noreply@anthropic.com>
2026-06-18 19:36:00 +07:00
8d6e3c2dcd test/hil: fail audio test on missing alsa-utils instead of skipping
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) <noreply@anthropic.com>
2026-06-18 17:15:50 +07:00
133de45950 test/hil: add ch32v103r_r1_1v0 to CI HIL pool
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) <noreply@anthropic.com>
2026-06-18 11:10:29 +07:00
52035e2fa3 Merge pull request #3643 from hathach/musb_ep0_race
dcd/musb: defer EP0 SETUP during DATA_IN/STATUS race
2026-06-17 09:20:24 +07:00
d9f736dcf9 hil: enable nanoch32v203 in CI with fsdev + usbfs variants (#3707)
* 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-16 17:42:31 +07:00
7b791916a7 device: clamp EP0 OUT data copy to the control transfer buffer (#3705)
* 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-16 17:36:17 +07:00
ff57edb3e5 hil: make serial write timeout fatal
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 <noreply@anthropic.com>
2026-06-13 23:35:35 +07:00
4f5be18911 Merge remote-tracking branch 'origin/master' into musb_ep0_race
# Conflicts:
#	test/hil/hil_test.py
2026-06-11 20:14:31 +07:00
6f35e76667 HIL: replace build.flags_on with named build variants (#3687)
* 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-11 08:16:43 +07:00
575a8fbcd0 Merge pull request #3690 from hathach/claude/board-test-idle-park
hil: park boards with idle board_test instead of erasing flash
2026-06-10 18:04:54 +07:00
8219efdc6c test/hil: erase MCU after tests; show throughput speeds in report
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) <noreply@anthropic.com>
2026-06-09 11:44:06 +07:00
1b3627d2b6 test/hil: use for skipped in HIL report
Neutral white circle for skipped, giving a // pass/fail/skip set.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-08 17:49:07 +07:00
3875e9cde8 test/hil: use / emoji for HIL report pass/fail
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) <noreply@anthropic.com>
2026-06-08 17:17:26 +07:00
7b60e3951e test/hil: clear HIL report up front on a fresh run
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) <noreply@anthropic.com>
2026-06-08 16:18:04 +07:00
fba8d25784 test/hil: accumulate HIL report across re-runs; post as sticky PR comment
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) <noreply@anthropic.com>
2026-06-08 16:11:13 +07:00
46aded44af presets,hil: keep Ninja Multi-Config; make HIL find its output
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) <noreply@anthropic.com>
2026-06-08 15:42:00 +07:00
d38ba79ad4 test/hil: report board x test results as a markdown matrix
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) <noreply@anthropic.com>
2026-06-08 15:17:20 +07:00
d2e7bbb085 test/hil: add stm32u083nucleo to pool and expose ~/bin on remote PATH
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) <noreply@anthropic.com>
2026-06-08 14:35:07 +07:00
1009b14b02 add tm4c123x evk to hill pool (#3676)
* add ek_tm4c123gxl to the hil pool, flashing with lm4flash
2026-06-05 21:23:40 +07:00
1f6236ae07 dwc2: address Copilot review (comment grammar/typo, tinyusb.json f407 dedup)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-03 23:41:19 +07:00
e45d5ad528 Add STM32F407 and STM32L476 disco board configurations to tinyusb.json 2026-06-03 23:13:17 +07:00
4a131e1562 hil: replace pyfatfs with mtools, update host setup instructions
- 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-27 17:43:22 +07:00
264472e380 Merge remote-tracking branch 'tinyusb/master' into musb_ep0_race 2026-05-25 21:09:53 +02:00
f4d0d09c8e hil added hub + msc + cdc for host capable board 2026-05-21 19:06:31 +07:00
4c87db341e Merge pull request #3571 from sauloverissimo/feat/midi2-device-host-driver
feat: Add USB-MIDI 2.0 Device and Host class drivers
2026-05-19 22:12:28 +02:00
ae61e6c7e6 fix test hung
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2026-05-15 00:45:49 +02:00
460ce56f40 hil: add audio test, optimize log print
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2026-05-12 22:18:05 +02:00
97852816e8 midi2: align descriptors with USB-MIDI 2.0 spec
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-12 11:07:45 -03:00
77cef83304 test: add MIDI 2.0 Device and Host unit tests
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-12 11:07:44 -03:00
4e64f3e91c Merge pull request #3632 from hathach/msc_os
hcd/dwc2: fix txfifo full check
2026-05-11 16:02:50 +02:00
3188ed4fd6 modernize script
Co-authored-by: Copilot <copilot@github.com>
Signed-off-by: Zixun LI <admin@hifiphile.com>
2026-05-06 10:03:32 +02:00
c13481a4c3 try to fix CI stuck
Co-authored-by: Copilot <copilot@github.com>
Signed-off-by: Zixun LI <admin@hifiphile.com>
2026-05-05 15:03:25 +02:00
fc0747c2a7 hil remove hub from pico native host test for now 2026-05-04 19:39:46 +07:00
2a8e659bb9 hil_test: use non-blocking writes with timeout for printer tests 2026-05-04 12:12:45 +07:00
9d3ad336bf deprecated usbd_control.c and merge its functionality into usbd.c 2026-04-29 17:27:59 +07:00
f53a9ec9af Merge branch 'master' into hil_hfp 2026-04-29 15:01:16 +07:00
f5d6c6ba91 Improve remote execution in hil_ci.sh 2026-04-29 12:32:25 +07:00
47f2228ced address review feedback for AGENTS.md and hil skill
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) <noreply@anthropic.com>
2026-04-29 11:09:48 +07:00
f2654a675b only re-run tests that failed per board
hil remove hub from pico2 since it is not stable
2026-04-28 19:17:56 +07:00
3792a9a387 fix warning, change hil jlink for feather nrf52840 2026-04-28 16:38:36 +07:00
9a2bd7b46c run hil_hfp on gcc build
Co-authored-by: Copilot <copilot@github.com>
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2026-04-26 12:47:59 +02:00
cf50ea245b hil: comment out net_lwip_webserver test for PR #3605
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) <noreply@anthropic.com>
2026-04-26 14:54:00 +07:00
053cac96ab hil: bump net iface enum timeout to 30s for net_lwip_webserver
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) <noreply@anthropic.com>
2026-04-26 14:41:00 +07:00
1b55dde72a add throughput test for hil 2026-04-24 22:18:05 +07:00
d808111cfd musb double packet for epout 2026-04-23 18:10:17 +07:00
d0c550cadc enable double buffer for tm4c 2026-04-21 19:44:10 +07:00
85b967c9b0 refactor interrupt handling and add pipe_write to fix IN ZLP issue 2026-04-21 11:28:29 +07:00
da2368bc14 fix usbnet hardcode speed. disable hil test for now 2026-04-20 22:11:17 +07:00
9d0af750a5 add test for net_lwip_webserver with iperf throughput validation 2026-04-20 17:46:15 +07:00
ce81b01eda improving transfer tracking and adding support for un-armed Rx data handling 2026-04-20 16:44:25 +07:00