summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2026-06-12midi: document that midi2_ump_word_count() must never return 0claude/adoring-pasteur-kbaFaClaude
The midi2_device/midi2_host tx packing loops advance by this count and no longer carry an explicit == 0 guard (removed in a749fe0).
2026-06-12midi2: drop unreachable pkt_bytes==0 guard in tx packing loopsClaude
midi2_ump_word_count() is total over the 4-bit message type (every case returns 1..4 words) and callers mask mt with 0x0F, so pkt_bytes can never be 0. Remove the dead break (flagged by PVS V547) instead of suppressing. Verified: pico examples rebuild, ceedling test:all 60/60 (incl. test_midi2_device/test_midi2_host), PVS re-run on both TUs is clean.
2026-06-12bare_api: cast config-descriptor buffer via uintptr_t instead of suppressing ↵Claude
V641 temp_buf is a uint16_t[128] reused to hold the GET_DESCRIPTOR(Configuration) wire-format blob; casting it to tusb_desc_configuration_t* to read the 9-byte header tripped PVS V641 (buffer size not a multiple of the element size). Route the cast through uintptr_t so the (correct) header read no longer trips the size-ratio heuristic, dropping the inline //-V641 suppression. Verified: pico examples rebuild; single-TU PVS re-run on bare_api/main.c is clean (no V641, no MISRA pointer/integer-cast finding).
2026-06-12usbd: use _usbd_rhport directly instead of rewriting the rhport parameterClaude
Replace the `rhport = _usbd_rhport;` parameter-rewrite pattern in the 9 usbd_edpt_*/usbd_sof_enable functions with `(void) rhport;` and pass _usbd_rhport directly to the dcd_* calls, matching the existing style of usbd_edpt_claim/release/busy/stalled. This resolves PVS-Studio V763 (parameter always rewritten before use) properly, so drop the global //-V::763 suppression from .pvsconfig. Verified: pico examples rebuild, ceedling test:all 60/60, CI-exact PVS re-run reports zero TinyUSB-owned findings with the suppression removed.
2026-06-11clean up PVS-Studio static-analysis findings for raspberry_pi_picoClaude
Resolves all TinyUSB-owned alerts reported by the CI PVS-Studio job (static_analysis.yml, run with --security-related-issues) on the raspberry_pi_pico board: 0 remaining in src/ and examples/. Genuine fixes: - ncm_device: validate wNdpIndex against sizeof(nth16_t), not the pointer size sizeof(nth16) (4 bytes) — the latter under-checks the NTB header (V568). - tusb: drop the redundant `ff_buf != NULL && ff_bufsize > 0` guard in tu_edpt_stream_init(); the early return already guarantees it (V560). - midi_host: bounds-check idx in tuh_midi_itf_get_info() instead of the always-true `&_midi_host[idx]` pointer (V560). - examples: fully initialize resolutions_per_format / frame_num / interval_ms arrays instead of leaving trailing elements implicitly zero (V1009). False positives suppressed at the cause: - usbd/usbh: hide the weak dcd_deinit()/hcd_deinit() stubs from the analyzer with #ifndef PVS_STUDIO. PVS analyzes one TU at a time and binds the call to the always-false weak stub (it cannot model the linker selecting the port's strong definition), then reports the cleanup loop after TU_ASSERT(...deinit()) as unreachable (V779). False positives suppressed locally (inline //-V or .pvsconfig): - .pvsconfig: V501 (HID descriptor macros), V763 (rhport override), V785 (audio function-index switch), V1044 (hardware poll loops). - inline //-V for config-dependent or intentional constructs: V512, V514-style contiguous clears, V547, V557, V560, V614, V619, V641, V1008, V1037, V1048, V1086. Verified: all examples build for raspberry_pi_pico; ceedling test:all passes (60/60); re-run of the CI-exact PVS invocation reports zero TinyUSB-owned findings.
2026-06-11Merge pull request #3695 from hathach/claude/adoring-pasteur-kbaFaHa Thach
Add pvs skill to run PVS-Studio analysis for a board
2026-06-11pvs skill: harden credentials parsing; note compile DB is exported by defaultClaude
- Parse PVS_STUDIO_CREDENTIALS into two quoted fields (no glob/word-split). - AGENTS.md: examples build sets CMAKE_EXPORT_COMPILE_COMMANDS ON already. Addresses Copilot review on #3695.
2026-06-11pvs skill: mirror CI --security-related-issues flag and ignore SARIF outputClaude
- Add --security-related-issues to run_pvs.sh and AGENTS.md analyze commands so local runs reproduce the CI SAST classification (static_analysis.yml). - Ignore *.sarif so a successful run leaves the worktree clean. Addresses Codex review on #3695.
2026-06-11Merge pull request #3693 from hathach/claude/review-model-opusHa Thach
ci(claude-review): run auto review on Opus (claude-opus-4-8)
2026-06-11ci(claude-review): run auto review on Opus (claude-opus-4-8)hathach
The review action currently runs on the default Sonnet 4.6. On PR #3643 (musb EP0 race) it posted "No issues found" while an Opus pass on the same diff surfaced substantive questions (ISR-boundary RXRDY lifetime, regression scope of the DATA-state split). Pin the reviewer to claude-opus-4-8 for higher-signal reviews; subagents keep their cheaper default models. Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-06-11Merge pull request #3692 from hathach/claude/bump-claude-review-max-turnsHa Thach
ci(claude-review): raise --max-turns 20 -> 50
2026-06-11Merge pull request #3636 from hathach/stm32c5Ha Thach
2026-06-11ci(claude-review): raise --max-turns 20 -> 50hathach
The Claude Code Review action runs /code-review:code-review with a hard --max-turns cap. On large PRs (e.g. #3636 "add stm32c5 support", 29 files / +1689), the agent exhausts 20 turns exploring the diff before it can produce and post its review, so the SDK returns an error and the claude-review check fails red with: Reached maximum number of turns (20) Raise the cap to 50 so port-sized PRs complete and post their review. Cost scales with tokens, not the cap: a finished review pays the same whether the ceiling is 25 or 50 — the cap only bites when the agent would otherwise be force-stopped mid-run. Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-06-11Merge remote-tracking branch 'origin/master' into stm32c5hathach
# Conflicts: # README.rst
2026-06-11README: use emoji for Supported CPUs status marks (#3691)Ha Thach
Replace the ✔/⚠/✖ status symbols in the Supported CPUs table and its legend with ✅ (Supported), 🟡 (Partial support) and ❌ (Not supported by hardware) for clearer at-a-glance scanning.
2026-06-11Fix stm32f723disco host/cdc_msc_hid HIL: UART RX starvation + DWC2 DMA ↵Ha Thach
split-IN NAK storm (#3677) Fix stm32f723disco host HIL: UART RX starvation + DWC2 split bulk NAK/XactErr handling (#3677) stm32f7 BSP — UART RX starvation - The host console USART shared interrupt priority with the USB OTG ISR, so a long OTG interrupt could starve RXNE and drop received bytes. Raise the USART RX IRQ above OTG_FS/OTG_HS in both the bare-metal and FreeRTOS init paths, guarded by #ifdef UART_ID so boards without a UART console keep the default OTG priority. dwc2 host — split NAK/XactErr handling - Slave mode: a persistently-NAKing split bulk/control IN poll re-armed the start-split immediately, storming the ISR and starving task context. Throttle by disabling the channel and re-arming on the resulting halt (no frame deferral). - Buffer-DMA mode: a pure split bulk-OUT NAK was unhandled, leaving the channel halted and stalling the transfer — the dominant cause of CDC echo truncation. Handle it by rewinding the buffer pointers and retrying the start-split (Programming Guide v4.20a 5.1.4.2). - Buffer-DMA mode: a split bulk-OUT XactErr was retried immediately, exhausting HCD_XFER_ERROR_MAX before the transient cleared. Throttle via channel_disable + re-arm to give the hub TT a recovery gap, mirroring slave mode. - All three are scoped to split transfers (hcsplt.split_en); non-split NAK/XactErr keep the core-handled / immediate-retry behavior. The OUT XactErr throttle also excludes periodic split, where channel_disable() is a no-op and would wedge the channel. The nak_disabled flag is generalized to retry_disabled and honors xfer->closing so an endpoint close during a throttled retry tears down cleanly. Verified on stm32f723disco HIL (slave + CFG_TUH_DWC2_DMA_ENABLE): host/cdc_msc_hid, msc_file_explorer, and device_info all pass on both variants; DMA CDC echo went from ~15-25% raw failure to 10/10 clean.
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-09Merge pull request #3686 from hathach/update-hil-poolHa Thach
HIL: add stm32u083nucleo and post test report as PR comment
2026-06-09Merge pull request #3681 from hathach/cdc_ctrl_bufHa Thach
host/cdc: use local control buffer
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-08ci: demote Average Code Size Metrics title to h2hathach
metrics.md (write_combine_markdown) is also used as the PR size comment when there is no base-metrics baseline; use h2 for its title too so the sticky comment heading is consistent (and not oversized) in that fallback case. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-08ci: demote sticky-comment report headings to h2; rename HIL reporthathach
The Size Difference Report and HIL comments rendered their titles at h1, which is oversized inside a PR comment. Use h2 for both titles (with subsections demoted to h3 to keep the hierarchy), and rename the HIL comment from "HIL test results" to "Hardware-in-the-loop (HIL) Test Report" for consistency. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-08ci: include hil-hfp-iar (IAR) results in the HIL PR commenthathach
hil-hfp-iar runs hil_test.py on hfp.json built with IAR on its own rig. Upload its report as the hil-report-hfp-iar artifact and add the job to the hil-report combine job's needs, so the sticky comment shows a third table for the IAR rig alongside tinyusb.json and hfp.json (gcc). The combine gate now runs if either HIL job produced results. 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-08gitattributes: keep shell scripts LF under core.autocrlfhathach
With core.autocrlf=true, *.sh files were checked out / restored with CRLF line endings, which breaks bash ($'\r': command not found; set: pipefail: invalid option). Pin *.sh to eol=lf so shell scripts stay LF in the working tree regardless of autocrlf. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-08Fix formatting in README.rst table (#3685)Ha Thach
2026-06-08Fix formatting in README.rst tableHa Thach
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-08tools/gen_presets: build into cmake-build-<board> with single-config Ninjahathach
Change the default configure preset binaryDir from build/<board> to cmake-build-<board> (the dir name HIL expects) and switch the generator from Ninja Multi-Config to single-config Ninja. Multi-Config nests binaries under a RelWithDebInfo/ subdir, which hil_test.py does not look in; single-config emits device/<ex>/<ex>.elf so preset-built firmware is directly consumable by `hil_test.py -B examples`. Regenerated BoardPresets.json (also picks up the tracked ch32v103c_bluepill board that was missing from presets). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-08stm32u0: implement board_get_unique_id from UID_BASEhathach
Previously stm32u0 had no board_get_unique_id(), so it fell back to the weak default in hw/bsp/board.c and every board reported the placeholder USB serial 0123456789ABCDEF. HIL identifies boards by USB serial, so a non-unique serial collides on a multi-board rig. Read the 96-bit unique ID from UID_BASE, mirroring stm32u5. Verified on stm32u083nucleo: now enumerates as 300044000D5036394E373620. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-08ci: post auto-review findings to the PR (#3684)Ha Thach
Add --comment so the auto-review is actually posted on the PR.
2026-06-06host/cdc: use local control bufferHiFiPhile
2026-06-05add tm4c123x evk to hill pool (#3676)Ha Thach
* add ek_tm4c123gxl to the hil pool, flashing with lm4flash
2026-06-05ci: carry metrics baseline forward on no-code-change pushes (#3678)Ha Thach
* ci: carry metrics baseline forward on no-code-change pushes The code-metrics job is gated on code_changed and only uploads the metrics-tinyusb artifact on push, so a workflow/docs-only push to master (e.g. removing an unrelated workflow) leaves the latest master Build run without a baseline. PRs download the baseline from the latest master run, so the size comparison then finds nothing and silently falls back to absolute sizes. Add a small metrics-carry-forward job that, on a non-code-change push, downloads the previous metrics-tinyusb artifact and re-publishes it, so the latest run always carries a usable baseline. Carry-forward runs re-upload too, so the baseline chains across consecutive no-code pushes (bounded by artifact retention).
2026-06-05Compact pvs skill; fix PVS-Studio -S/--dump-files docs in AGENTS.mdClaude
The AGENTS.md '-S src/foo.c' example was inaccurate: -S takes a plaintext file listing source paths, not paths directly. Drop --dump-files from the documented commands (it scatters .PVS-Studio.i/.cfg dumps across the tree; FP-debugging only) and reference the new pvs skill. https://claude.ai/code/session_015inWmFhRYSq17CxMukdoqX
2026-06-05Add pvs skill to run PVS-Studio analysis for a boardClaude
Bundle a run_pvs.sh helper (takes BOARD as its first argument) that follows the PVS-Studio static-analysis flow from AGENTS.md: build all examples with an exported compile_commands.json, run pvs-studio-analyzer against .PVS-Studio/.pvsconfig, then emit errorfile + SARIF reports. https://claude.ai/code/session_015inWmFhRYSq17CxMukdoqX
2026-06-04Remove Sponsor Triage workflow (migrated to hathach/hathach) (#3675)Ha Thach
This personal automation now lives in the hathach/hathach repo alongside the other personal project-sync workflows; it has no place in the tinyusb library. Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-04Merge pull request #3666 from hathach/dwc2_postfixHa Thach
dwc2 postfixes
2026-06-04Merge pull request #3653 from hathach/ch32_warningHa Thach
add device specific issues
2026-06-04dwc2: cleanup setup_packet pointer cast (review feedback)hathach
Cast DOEPDMA0 through uintptr_t and use sizeof(tusb_control_request_t) instead of the magic constant 8, matching project convention. Add a reference to Programming Guide v4.20a 9.1.2.1 for the DOEPDMAn-8 rule. Addresses Copilot review comment; no functional change. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-04Update setup buffer size definition based on DMA configurationhathach
2026-06-04Merge branch 'master' into dwc2_postfixhathach
2026-06-04ci(labeler): auto-apply Port labels from changed driver files (#3673)Ha Thach
* ci(labeler): auto-apply Port labels from changed driver files Add path-based labeling so a PR touching a dcd/hcd driver under src/portable/ gets the matching "Port <ip>" label automatically.
2026-06-04ci(labeler): match emoji-renamed labels (#3672)Ha Thach
Labels were renamed to add emojis (Adafruit 🌸, Sponsor 💖, Prio 🚩, Prio Top 🚨); update the hardcoded label names in the labeler script to match so they attach to the existing labels instead of recreating plain ones. Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>