riscv-011: Don't trigger semihosting before the target is examined
In riscv-011 target, the handle_halt() function, and thus also riscv_semihosting(), can get called from within examine() before the examination is actually complete! The chain of the function calls is: - examine() -> riscv011_poll() -> poll_target() -> handle_halt() -> riscv_semihosting() If the target is already halted due to a breakpoint (dcsr.cause = SWBP) at the time OpenOCD connects to it, semihosting will be attempted before completing the examination, and the examination will fail. This issue was observed on HiFive1 Rev A01. The fix is to handle semihosting only after the target got successfully examined. Change-Id: Iccfa0da35d47a430d8674131ebd2eb8e5e2922c0 Signed-off-by: Jan Matyas <jan.matyas@codasip.com>
This commit is contained in:
parent
8f59570468
commit
a28e713067
|
@ -1884,8 +1884,11 @@ static int handle_halt(struct target *target, bool announce)
|
|||
|
||||
if (target->debug_reason == DBG_REASON_BREAKPOINT) {
|
||||
int retval;
|
||||
if (riscv_semihosting(target, &retval) != 0)
|
||||
return retval;
|
||||
/* Don't try to handle semihosting before the target
|
||||
* gets successfully examined. */
|
||||
if (target_was_examined(target))
|
||||
if (riscv_semihosting(target, &retval) != SEMIHOSTING_NONE)
|
||||
return retval;
|
||||
}
|
||||
|
||||
if (announce)
|
||||
|
|
Loading…
Reference in New Issue