This is an automated email from Gerrit. "Tim Newsome <t...@sifive.com>" just uploaded a new patch set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/6833
-- gerrit commit 930ea439f0e5b2cc452c23d3aaffa699b15940a7 Author: Tim Newsome <t...@sifive.com> Date: Mon Nov 29 17:55:02 2021 -0800 Don't reexamine targets until it's time. Don't reexamine targets until we're past the examine stage of init(). Earlier than that, examine() will likely fail because the scan chain hasn't been examined yet. Change-Id: I76ee9181f35cedcdb1a3e0f8ac33ab361c68d3af Signed-off-by: Tim Newsome <t...@sifive.com> diff --git a/src/target/target.c b/src/target/target.c index 7cdd8d830..a9d2c6c43 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -769,6 +769,12 @@ static int jtag_enable_callback(enum jtag_event event, void *priv) return target_examine_one(target); } +/* When this is true, it's OK to call examine() again in the hopes that this time + * it will work. Earlier than that there is probably other initialization that + * needs to happen (like scanning the JTAG chain) before examine should be + * called. */ +static bool examine_attempted; + /* Targets that correctly implement init + examine, i.e. * no communication with target during init: * @@ -779,6 +785,8 @@ int target_examine(void) int retval = ERROR_OK; struct target *target; + examine_attempted = true; + for (target = all_targets; target; target = target->next) { /* defer examination, but don't skip it */ if (!target->tap->enabled) { @@ -3053,8 +3061,8 @@ static int handle_target(void *priv) */ target_call_event_callbacks(target, TARGET_EVENT_GDB_HALT); } - if (target->backoff.times > 0) { - LOG_USER("Polling target %s failed, trying to reexamine", target_name(target)); + if (target->backoff.times > 0 && examine_attempted) { + LOG_DEBUG("[%s] Polling failed, trying to reexamine", target_name(target)); target_reset_examined(target); retval = target_examine_one(target); /* Target examination could have failed due to unstable connection, --