tools: a hardware harness, so a board can be proven and not just a protocol
check.sh proves the protocol under simavr on every chip; it cannot prove a board. Two things live only on silicon — an RC oscillator that is not on its nominal, and a reset edge that has to come from somewhere — and until now the scripts that reached them were per-session scratch on the machine holding the programmer, which is where the ATtiny13A run's findings nearly stayed. pbrig.py is the primitives, knowing nothing per-board: every deployment fact is a flag or a PUREBOOT_* variable. Two rig facts are encoded in it because neither is guessable and each cost a session to learn: an ISP access *is* the reset edge where the adapter's DTR is unwired, so a session begins with an ISP touch and knocks immediately after; and avrdude splits -U on colons, so a Windows drive letter breaks the spec and every file goes as a bare name with avrdude run in its own directory. Its `rate` subcommand is the one that turns "the loader is silent, so the wiring must be wrong" into a number, by sweeping the host rate against a fixed cycles-per-bit transmitter — PUREBOOT_HEARTBEAT makes the existing fixture into one, software link only, since the hardware-link idle owes the self-update tests its command loop. pbhw.py takes every bound from the info block the loader reports, so one run covers a 1 KiB tiny and a 128 KiB mega alike. Both are exercised on an ATtiny13A: backup verified against a known-good capture, the clock measured at 9.048 MHz against a 9.6 MHz nominal, and the suite 11/11. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -117,8 +117,27 @@ struct link<C, false> {
|
||||
}
|
||||
[[noreturn]] static void idle()
|
||||
{
|
||||
#if defined(PUREBOOT_HEARTBEAT)
|
||||
// Repeat the banner forever, which turns the fixture into a fixed
|
||||
// cycles-per-bit transmitter: `tools/pbrig.py rate` sweeps the host rate
|
||||
// against it to find the part's true bit rate, and from that the clock
|
||||
// its RC oscillator is really running at. Only the *bit* timing carries
|
||||
// the measurement — the delay merely spaces the lines out, so its own
|
||||
// error does not matter. Software link only: the hardware-link idle owes
|
||||
// the self-update tests a command loop, and a crystal deployment has
|
||||
// nothing to measure.
|
||||
while (true) {
|
||||
tx('A');
|
||||
tx('P');
|
||||
tx('P');
|
||||
tx('\r');
|
||||
tx('\n');
|
||||
dev::delay<50_ms>();
|
||||
}
|
||||
#else
|
||||
while (true) {
|
||||
}
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user