Files
uv-k5-v3-emulator/tools/pc.sh
T
mckero 542515d5ad Finish the portability sweep: one firmware resolver, no author paths
The probe scripts, run.sh, trace_run.sh, webui.py and two emulator tests each named the same hardcoded firmware from a source tree that is not in this repository. They now resolve QEMU and the firmware the way tools/uvk5_testenv.py does -- environment, then PATH, then whatever the checkout has -- and skip with a reason when there is nothing.

webui.py's --qemu and --elf lost their author defaults too: a bare qemu-system-arm through PATH, and no firmware until one is uploaded, which the page already reports.
2026-10-01 15:15:31 +08:00

32 lines
975 B
Bash
Executable File

#!/usr/bin/env bash
# Print the program counter and the two delay-loop registers, once per line.
#
# Comparing successive lines distinguishes three cases: a stuck delay (same PC,
# same r1), a converging delay (same PC, rising r1) and forward progress
# (different PC, or r1 reset for a new call).
set -uo pipefail
# shellcheck source=tools/uvk5_elf.sh
. "$(dirname "$0")/uvk5_elf.sh"
ELF=$(uvk5_find_elf) || { echo "SKIP no firmware found; set ELF or put one in assets/firmware" >&2; exit 0; }
SAMPLES="${1:-6}"
GAP="${2:-2}"
SCRIPT=$(mktemp --suffix=.gdb)
trap 'rm -f "$SCRIPT"' EXIT
cat >"$SCRIPT" <<'EOF'
set confirm off
set pagination off
target remote :1234
info registers pc r0 r1 lr
detach
quit
EOF
for _ in $(seq "$SAMPLES"); do
gdb-multiarch -batch -x "$SCRIPT" "$ELF" 2>/dev/null \
| awk '/^pc /{pc=$2} /^r0 /{r0=$2} /^r1 /{r1=$2} /^lr /{lr=$2}
END{printf "pc=%s lr=%s target=%s elapsed=%s\n", pc, lr, r0, r1}'
sleep "$GAP"
done