Compare commits

...

2 Commits

Author SHA1 Message Date
Tim Newsome a74e59f0fc
Improve user messages.
Co-authored-by: Jan Matyas <50193733+JanMatCodasip@users.noreply.github.com>
Signed-off-by: Tim Newsome <tim@sifive.com>
2022-10-05 10:32:47 -07:00
Tim Newsome d4c92a5ac7 target: Try to examine unexamined target in halt()
Some targets fail to examine during `init`, e.g. for timing reasons. The
right solution is a better config script, but that ends up being
complicated to figure out. This is a bit of a hack, but hopefully
silently fixes the problem so users won't have to deal with it at all.

Change-Id: Ib04d0680eb4136f06c383caa6775dd2581a08ce0
Signed-off-by: Tim Newsome <tim@sifive.com>
2022-10-04 13:36:18 -07:00
1 changed files with 8 additions and 2 deletions

View File

@ -589,8 +589,14 @@ int target_halt(struct target *target)
int retval;
/* We can't poll until after examine */
if (!target_was_examined(target)) {
LOG_ERROR("Target not examined yet");
return ERROR_FAIL;
/* Try to examine the target right now, in case the target we're
* talking to didn't examine correctly during `init`. */
LOG_TARGET_INFO(target, "Trying to examine unexamined target before halt attempt.");
target_examine();
if (!target_was_examined(target)) {
LOG_TARGET_ERROR(target, "Re-examination before halt failed. Target not examined yet.");
return ERROR_FAIL;
}
}
retval = target->type->halt(target);