Skip to content
Eliott65Sondewiki
Contents

Test benches

Before going onto the probe, each piece runs on the PC, against a model of what it will meet for real. These benches found several faults before they reached the hardware.

The principle

Everything that does not depend on the Pico W is written as portable modules: CMSIS-DAP processor, SWD protocol, log, update, boot loader. They also compile for the PC, where they run against models: an SWD target, a flash, a TCP server. make test runs the whole set.

OpenOCD against the simulated target

The PC server presents the simulated target (RP2040 debug port, two cores, 64 KiB of RAM) as a real probe, on both ports. The real OpenOCD connects to it; so does the e65s.py tool. One scenario makes a counter go up every millisecond then freezes it, like a 6502 program that stops: enough to try the log’s trigger.

The PIO program in a simulator

The SWD PIO program is assembled by the official tool, then run in the Eliott65 project’s PIO simulator, against a bit-level simulated target: it reads SWDIO on the rising edge, drives the line for its responses, and detects the line reset.

  • The CMSIS-DAP processor’s complete scenario passes: reset, selection of both cores, identifier, power-up, writes, posted reads, a 64-word block, wait, wrong parity, unselected target.
  • The bench checks that the probe and the target never drive SWDIO at the same time, and, since the tests on the board, that no SWDIO change falls on a clock edge.
  • A fault found along the way: when the target did not respond, the old code asked the PIO program for more than 32 bits at once, while it only reads 32.

The update and the boot loader

  • The update: 8 tests against the PC server (sending, checking, applying, exact sectors, UF2 file, wrong CRC, invalid vectors, block order and maximum size, restarts, version), plus a test of the watchdog setting before restart.
  • The boot loader: 35 checks, including 236 simulated power cuts, at every possible moment of installation (86), restoration (75) and preparation (75). A cut leaves the current sector erased, the worst case, and nothing more is written afterwards.
  • End to end, with a simulated 2 MiB flash and boot loader: trial then validation, an image never validated and the return to the old one at the 4th start-up, two updates in a row with the second one rejected, merged UF2 files, wrong base address.

Sources in the repository : README.md, docs/journal/01-cmsis-dap-tcp.md, docs/journal/02-firmware-pico-w.md, docs/journal/05-mise-a-jour-par-le-reseau.md, docs/journal/07-amorce.md.