Skip to content

Pico 2 (RP2350) CYCCNT measurement firmware (hardware testing Setup 2)#21

Merged
tap merged 1 commit into
mainfrom
claude/pico2-firmware
Jun 12, 2026
Merged

Pico 2 (RP2350) CYCCNT measurement firmware (hardware testing Setup 2)#21
tap merged 1 commit into
mainfrom
claude/pico2-firmware

Conversation

@tap

@tap tap commented Jun 12, 2026

Copy link
Copy Markdown
Owner

The Setup 2 deliverable from docs/HARDWARE_TESTING.md: standalone Raspberry Pi Pico 2 (RP2350) firmware that measures the converter's real-silicon cost with DWT.CYCCNT — closing the loop between our deterministic QEMU instruction counts and actual M33 cycles.

What's in here (examples/pico2_cyccnt/, not wired into the root build)

  • Standalone CMake project: Pico SDK 2.1.1 pinned via FetchContent (GIT_SUBMODULES "lib/tinyusb" keeps the clone minimal; source tarballs can't work — they exclude the tinyusb submodule USB stdio needs), PICO_BOARD=pico2.
  • main.cpp: enables CYCCNT, runs exactly the icount pipeline workload (997 Hz sine, push/pull 32-frame blocks, 1000 warmup + 2000 measured) across Q15 × {fast, balanced} × {1, 2, 12}ch plus float 1ch (option-gated), and prints mean/p99/max cycles per block, cycles/frame, and the % of a 150 MHz core per 48 kHz stream. The source documents the QEMU M33 baselines it calibrates against (pipeline_q15 5,043 insns/frame; pipeline12_q15 10,027) — flash it and the printed table answers "cycles per QEMU instruction" for all future M33 budget math.
  • 12-channel case is heap-constructed under try/catch (prints SKIP on bad_alloc rather than faulting); input buffer sized so it fits SRAM.
  • README with build/flash instructions and how to read the output.

Verified

Full cross-build to a flashable pico2_cyccnt.uf2 (74.6 KB binary, 12.2 KB static RAM; heap analysis says 12ch fits). Disassembly confirms the SMLALD dual-MAC Q15 path (C4) is in the binary — the measurement covers the intended kernel. Not run: needs your physical Pico 2; that's the point.

https://claude.ai/code/session_01HuAFfoeD5a5Xe5aGNA16M9


Generated by Claude Code

Standalone Pico SDK project (examples/pico2_cyccnt/, not wired into the
root build) implementing the cycle-measurement deliverable of
docs/HARDWARE_TESTING.md Setup 2: the icount runPipeline workload
(push/pull 32-frame blocks, 997 Hz sine, 1000 warmup + 2000 measured
iterations) timed per block with the Cortex-M33 cycle counter, over
Q15 x {fast, balanced} x {1, 2, 12} channels plus float 1ch (guarded by
PICO2_MEASURE_FLOAT, default ON). Prints mean/p99/max cycles per block,
cycles/frame and the 150 MHz core share of one 48 kHz stream, ending
with SRT_PICO2_DONE; correlating against the committed M33 QEMU
instruction baselines calibrates the cycles-per-instruction ratio.

Pico SDK 2.1.1 pinned via FetchContent (git tag; release tarballs lack
the tinyusb submodule USB stdio needs). Verified: full cross-build with
arm-none-eabi-gcc 13.2.1 produces pico2_cyccnt.uf2 (text 74,588 B,
bss 12,224 B; SMLALD present in the Q15 dot product). Not run -- no
RP2350 hardware in this environment.

https://claude.ai/code/session_01HuAFfoeD5a5Xe5aGNA16M9
@tap tap merged commit 37916ba into main Jun 12, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants