aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcgsfv <cgsfv@users.noreply.github.com>2024-04-26 17:05:16 -0700
committercgsfv <cgsfv@users.noreply.github.com>2024-04-26 17:05:16 -0700
commit55ae2534b35f0c5f2dc4bbe9738b17511f31d6cf (patch)
treeb050fe83bb51b937d0336f8661a40b06db3e486d
parent84ed43ec3a52de94277bfea77f3f6a12381ef305 (diff)
downloadriscv-openocd-examine_unavailable_harts_backup.zip
riscv-openocd-examine_unavailable_harts_backup.tar.gz
riscv-openocd-examine_unavailable_harts_backup.tar.bz2
Handle unavailability when deasserting resetexamine_unavailable_harts_backup
-rw-r--r--src/target/riscv/riscv-013.c4
-rw-r--r--src/target/startup.tcl10
2 files changed, 9 insertions, 5 deletions
diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c
index 7a94bc7..44826ef 100644
--- a/src/target/riscv/riscv-013.c
+++ b/src/target/riscv/riscv-013.c
@@ -2979,7 +2979,9 @@ static int deassert_reset(struct target *target)
info->dmi_busy_delay = orig_dmi_busy_delay;
- if (target->reset_halt) {
+ if (get_field(dmstatus, DM_DMSTATUS_ALLUNAVAIL)) {
+ target->state = TARGET_UNAVAILABLE;
+ } else if (target->reset_halt) {
target->state = TARGET_HALTED;
target->debug_reason = DBG_REASON_DBGRQ;
} else {
diff --git a/src/target/startup.tcl b/src/target/startup.tcl
index 7a1e245..8ddac0c 100644
--- a/src/target/startup.tcl
+++ b/src/target/startup.tcl
@@ -129,9 +129,11 @@ proc ocd_process_reset_inner { MODE } {
} else {
$t invoke-event examine-end
}
- if { [$t curstate] == "unavailable" } {
- continue
- }
+ }
+
+ # no need to wait for a target that is unavailable anyway
+ if { [$t curstate] == "unavailable" } {
+ continue
}
# Wait up to 1 second for target to halt. Why 1sec? Cause
@@ -149,7 +151,7 @@ proc ocd_process_reset_inner { MODE } {
continue
}
if { $s != "halted" } {
- return -code error [format "TARGET: %s - Not halted - Maybe unavailable %s" $t $s]
+ return -code error [format "TARGET: %s - Not halted (%s)" $t $s]
}
}
}