Revert "target: Update messages connected with `examine`"

This reverts commit a3db93b1ce.

Reason for revert: https://github.com/riscv/riscv-openocd/pull/931#issuecomment-1761550506
This commit is contained in:
Kirill Radkin 2023-10-16 13:59:35 +03:00
parent 6e9514efcd
commit 6c96b9d8c3
2 changed files with 14 additions and 20 deletions

View File

@ -744,22 +744,16 @@ static int default_check_reset(struct target *target)
* Keep in sync */ * Keep in sync */
int target_examine_one(struct target *target) int target_examine_one(struct target *target)
{ {
if (target->examine_attempted)
LOG_TARGET_INFO(target, "Retry examination.");
LOG_TARGET_INFO(target, "Examination started.");
target_call_event_callbacks(target, TARGET_EVENT_EXAMINE_START); target_call_event_callbacks(target, TARGET_EVENT_EXAMINE_START);
int retval = target->type->examine(target); int retval = target->type->examine(target);
if (retval != ERROR_OK) { if (retval != ERROR_OK) {
LOG_TARGET_ERROR(target, "Examination failed. examine() -> %d", retval);
target_reset_examined(target); target_reset_examined(target);
target_call_event_callbacks(target, TARGET_EVENT_EXAMINE_FAIL); target_call_event_callbacks(target, TARGET_EVENT_EXAMINE_FAIL);
return retval; return retval;
} }
LOG_TARGET_INFO(target, "Target successfully examined."); LOG_USER("[%s] Target successfully examined.", target_name(target));
target_set_examined(target); target_set_examined(target);
target_call_event_callbacks(target, TARGET_EVENT_EXAMINE_END); target_call_event_callbacks(target, TARGET_EVENT_EXAMINE_END);
@ -778,6 +772,12 @@ static int jtag_enable_callback(enum jtag_event event, void *priv)
return target_examine_one(target); 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. /* Targets that correctly implement init + examine, i.e.
* no communication with target during init: * no communication with target during init:
* *
@ -788,6 +788,8 @@ int target_examine(void)
int retval = ERROR_OK; int retval = ERROR_OK;
struct target *target; struct target *target;
examine_attempted = true;
for (target = all_targets; target; target = target->next) { for (target = all_targets; target; target = target->next) {
/* defer examination, but don't skip it */ /* defer examination, but don't skip it */
if (!target->tap->enabled) { if (!target->tap->enabled) {
@ -799,11 +801,11 @@ int target_examine(void)
if (target->defer_examine) if (target->defer_examine)
continue; continue;
target->examine_attempted = true;
int retval2 = target_examine_one(target); int retval2 = target_examine_one(target);
if (retval2 != ERROR_OK) if (retval2 != ERROR_OK) {
LOG_WARNING("target %s examination failed", target_name(target));
retval = retval2; retval = retval2;
}
} }
return retval; return retval;
} }
@ -3064,11 +3066,11 @@ static int handle_target(void *priv)
LOG_TARGET_DEBUG(target, "target_poll() -> %d, next attempt in %dms", LOG_TARGET_DEBUG(target, "target_poll() -> %d, next attempt in %dms",
retval, target->backoff.interval); retval, target->backoff.interval);
if (retval != ERROR_OK && target->examine_attempted) { if (retval != ERROR_OK && examine_attempted) {
target_reset_examined(target); target_reset_examined(target);
retval = target_examine_one(target); retval = target_examine_one(target);
if (retval != ERROR_OK) { if (retval != ERROR_OK) {
LOG_TARGET_DEBUG(target, "Polling again in %dms", LOG_TARGET_DEBUG(target, "Examination failed. Polling again in %dms",
target->backoff.interval); target->backoff.interval);
return retval; return retval;
} }
@ -6266,8 +6268,6 @@ static int target_create(struct jim_getopt_info *goi)
target->halt_issued = false; target->halt_issued = false;
target->examine_attempted = false;
/* initialize trace information */ /* initialize trace information */
target->trace_info = calloc(1, sizeof(struct trace)); target->trace_info = calloc(1, sizeof(struct trace));
if (!target->trace_info) { if (!target->trace_info) {

View File

@ -138,12 +138,6 @@ struct target {
*/ */
bool examined; bool examined;
/* 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. */
bool examine_attempted;
/** /**
* true if the target is currently running a downloaded * true if the target is currently running a downloaded
* "algorithm" instead of arbitrary user code. OpenOCD code * "algorithm" instead of arbitrary user code. OpenOCD code