applet.interface.jtag_probe: completely rework error handling.
JTAGProbeInterface historically suffered from underuse of exceptions;
it was originally written to return void values on error paths since
it strictly validates all input at every opportunity, and this does
not survive collision with the real world. (Can you believe there are
production JTAG devices where IDCODE is 32 zeroes?) Scanning, as well
as any future manual overrides, have to relax validation greatly.
Unfortunately, this approach caused proliferation of identical error
handling code in every caller, error propagation boilerplate, and
polymorphic return values. It was awful. This commit changes all
remaining code to use exceptions and, in most cases, accept a check=
argument to opt into returning void values where truly necessary.
The check= argument is not forwarded; callers that need to customize
error handling in a fine-grained way should inline and tweak the code
that needs to behave differently.
by
whitequark
4 years 2 months
Fix tests broken in commit 77425539.
by
whitequark
4 years 2 months
applet.interface.jtag_probe: fix race condition in scan_xr().
by
whitequark
4 years 2 months
applet.interface.jtag_probe: don't track IR offsets. NFCI.
Per-TAP IR offsets are redundant, pointless, and complicate the logic
of specifying IR lengths manually.
by
whitequark
4 years 2 months
applet.interface.jtag_probe: improve TAP selection logic.
* Require --tap-index option if more than one TAP is found.
Before this commit, TAP #0 was implicitly chosen.
* Extract redundant error handling code into select_tap().
* Convert logger errors into exceptions where appropriate.
by
whitequark
4 years 2 months
applet.interface.jtag_probe: remove read_dr(idempotent=) argument.
Before this commit, this unused option had to be threaded through
a lot of unrelated code, which polluted interfaces. Moreover, since
commit 42144aa6, it is also worse than useless, because scan_dr()
does the exact same thing more safely (it does not rely on provided
DR length).
by
whitequark
4 years 2 months
applet.interface.jtag_probe: remove scan_dr(zero_ok=) argument.
Before this commit, this option used only in enumerate-ir had to be
threaded through a lot of unrelated code, which polluted interfaces
and made the logic hard to understand.
Also, tighten the post-conditions on scan_xr_length() such that it
always requires a valid scan result (finite non-zero length).
by
whitequark
4 years 2 months
applet.interface.jtag_probe: move XR scan limits to JTAGProbeInterface.
Before this commit, these rarely useful options had to be threaded
through a lot of unrelated code, which polluted interfaces and was
done quite inconsistently.
Also, do not call add_run_arguments() from add_run_tap_arguments().
This was inconsistent with our conventions and required an `access`
argument in add_run_tap_arguments() that was otherwise unnecessary.
by
whitequark
4 years 2 months
applet.interface.jtag_probe: reliably detect overlong XR scans.
by
whitequark
4 years 2 months
applet.interface.jtag_probe: clarify enumerate-ir documentation.
Also, lower log level for DR[?] to WARN since it is as noncompliant
as DR[0] and neither of these results usually indicates a problem.
by
whitequark
4 years 2 months