summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2026-08-11 17:08:05 +0700
committerhathach <[email protected]>2026-09-04 04:21:57 +0700
commit7474173b075ae656ed16dea5dcb3f830349f3450 (patch)
tree9ae828a50313a270d480797f59254c5f03e017b0
parent463ff1f3d2d97b53659364d7c4cde99693688100 (diff)
target-debug: route scheduling and timing questions to the sysview skill
RTOS/ISR scheduling, CPU load and latency-profile questions go to sysview first; target-debug keeps the failure-hunting techniques. CLAUDE.md points at the new skill.
-rw-r--r--.claude/agents/target-debugger.md1
-rw-r--r--.claude/skills/target-debug/SKILL.md6
-rw-r--r--CLAUDE.md1
3 files changed, 7 insertions, 1 deletions
diff --git a/.claude/agents/target-debugger.md b/.claude/agents/target-debugger.md
index c7acca91c..896a71c0d 100644
--- a/.claude/agents/target-debugger.md
+++ b/.claude/agents/target-debugger.md
@@ -24,6 +24,7 @@ one BEFORE acting:
| usbmon | Linux-host URB capture; only when a Linux PC is the link's host (default posture: dual-side, both ends simultaneously) |
| usb-sniffer | wire-level capture (hardware tap): host can't see the bus, usbmon vs target logs disagree, or TinyUSB is the host (no usbmon anywhere) |
| etm-trace | instruction-level ETM trace via SEGGER J-Trace (exact execution history, profile, coverage) when sampled PCs and logs cannot resolve the mechanism. Requires the J-Trace physically wired to THIS board (supported boards: the skill's boards.md) — use only when your prompt states the board is trace-wired or the user asked for it; otherwise name it in `notes` as the next technique |
+| sysview | RTOS/scheduler-level timing via SEGGER SystemView over J-Link/J-Trace (or any OpenOCD-supported probe, e.g. ST-Link-only boards, via a raw-RTT capture) — per-task and per-ISR CPU load, task-switch and ISR enter/exit timeline, ready→run latency. Reach for it when the bug is *scheduling*-shaped (throughput jitter, a task starved/preempted, ISR too long) rather than a logic/state bug; build with `-DSYSVIEW=<level>`, no source edits needed. Post-mortem mode (`-DSYSVIEW_POST_MORTEM=1`) answers "what ran right before this crash/hang" from a halted target when a live recording session isn't possible |
| usb-kernel-debug | why the Linux kernel acted (dmesg/dynamic debug); PC host or a Linux gadget peer's device side |
| usb-kernel-recover | only when the DUT or fixture wedges the rig PC's Linux host stack |
diff --git a/.claude/skills/target-debug/SKILL.md b/.claude/skills/target-debug/SKILL.md
index 7ee96f48e..c447fe619 100644
--- a/.claude/skills/target-debug/SKILL.md
+++ b/.claude/skills/target-debug/SKILL.md
@@ -17,6 +17,7 @@ Raspberry Pi). Pick capture channels by which end runs Linux, not by habit:
| **`target-debug`** | **what the target did** (logs, driver state, PC) | always — either role, needs a debug probe |
| `usb-sniffer` | what crossed the wire (PIDs, handshakes, resets) | hardware tap cabled in — role-agnostic |
| `etm-trace` | exactly which instructions executed (profile, coverage, history) | SEGGER J-Trace wired to this board's trace header — confirm with the user first |
+| `sysview` | where CPU time goes: task/ISR schedule, per-context load, switch + ready→run timing, or (post-mortem mode) what ran right before a crash/hang | SEGGER J-Link/J-Trace on this board for live capture, or any OpenOCD-supported probe for raw RTT capture; RTOS/scheduler-level timing question |
For enumeration/transfer bugs the default posture is **dual-side capture** —
both ends simultaneously: usbmon + a target
@@ -240,7 +241,10 @@ holds the first KB after boot, not the wedge tail. The buffer flags have no
overwrite mode (only SKIP/TRIM/BLOCK); keeping the tail instead requires the
firmware-side overwrite write call (rtt skill §post-mortem). So post-mortem
RTT from a default-mode build is evidence only if a live drain was running —
-otherwise instrument with the RAM ring above.
+otherwise instrument with the RAM ring above. (The one exemption is a
+`-DSYSVIEW_POST_MORTEM=1` build: SystemView's post-mortem mode switches its
+channel to an overwrite ring that always holds the most recent events with no
+drain — the `sysview` skill's route for "what ran right before this hang".)
Stand up the drain per the **rtt** skill: JLinkExe's `-RTTTelnetPort` (what
`rtt.py` wraps) is the headless-proven route; JLinkGDBServer's needs
a GDB client attached on some parts (LPC4088), and JLinkRTTLogger fails to
diff --git a/CLAUDE.md b/CLAUDE.md
index d3ab995bf..7ba6fd1b7 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -22,6 +22,7 @@ Bias toward caution over speed. For trivial tasks, use judgment.
- **Commits/PRs:** imperative mood, scoped changes, link issues, include test/build evidence. After opening a PR, drive it to green: address automated review comments (Copilot/Codex/Claude) and fix failing CI, pushing follow-ups until checks pass and threads resolve. Useful: `gh pr checks <num> --watch`, `gh pr view <num> --comments`.
- **Deferred work:** work that is worth doing but is a *separate scope* from the current PR — it deserves its own PR, written by a different session. Write it as a **handoff** with the `superpowers:writing-plans` skill, one doc per follow-up, in `docs/superpowers/followup/pr<NNN>-<topic>.md` (the PR it was split out of, so the origin stays traceable). Say what is already established (with citations/measurements), what remains, and why it was split out. Delete the doc when its PR lands. Never bundle unrelated follow-ups into one file.
- **Formatting/lint:** `clang-format` (`.clang-format`), `codespell` (`.codespellrc`); run `pre-commit run --all-files` before submitting.
+- **Skills/docs:** action first — runnable commands and ordered steps up top, one complete recipe rather than fragments the reader must assemble. Keep explanation to what changes a decision; cut background, derivations and evidence tables down to the rule they support. Per-board/per-target detail goes in a sibling `boards.md`, not the `SKILL.md` (`.claude/skills/etm-trace`, `.claude/skills/sysview`). Verify a doc's commands actually run before committing them, and when restructuring, check findability with a fresh agent given a real retrieval task.
## Bootstrap