Extending handling of unavailable harts
This commit is contained in:
parent
0e74950144
commit
506ebe8fe1
|
@ -1797,7 +1797,7 @@ static int set_dcsr_ebreak(struct target *target, bool step)
|
||||||
static int halt_set_dcsr_ebreak(struct target *target)
|
static int halt_set_dcsr_ebreak(struct target *target)
|
||||||
{
|
{
|
||||||
RISCV013_INFO(info);
|
RISCV013_INFO(info);
|
||||||
LOG_TARGET_DEBUG(target, "Halt to set DCSR.ebreak*");
|
LOG_TARGET_INFO(target, "Halt to set DCSR.ebreak*");
|
||||||
|
|
||||||
/* Remove this hart from the halt group. This won't work on all targets
|
/* Remove this hart from the halt group. This won't work on all targets
|
||||||
* because the debug spec allows halt groups to be hard-coded, but I
|
* because the debug spec allows halt groups to be hard-coded, but I
|
||||||
|
@ -1830,7 +1830,7 @@ static int halt_set_dcsr_ebreak(struct target *target)
|
||||||
foreach_smp_target(entry, targets) {
|
foreach_smp_target(entry, targets) {
|
||||||
struct target *t = entry->target;
|
struct target *t = entry->target;
|
||||||
if (riscv013_halt_prep(t) != ERROR_OK) {
|
if (riscv013_halt_prep(t) != ERROR_OK) {
|
||||||
LOG_TARGET_DEBUG(target, "riscv013_halt_prep failed - t_coreid: %d", t->coreid);
|
LOG_TARGET_INFO(target, "riscv013_halt_prep failed - t_coreid: %d", t->coreid);
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1846,15 +1846,15 @@ static int halt_set_dcsr_ebreak(struct target *target)
|
||||||
}
|
}
|
||||||
halt_result = riscv013_halt_go(target);
|
halt_result = riscv013_halt_go(target);
|
||||||
if (halt_result == ERROR_OK) {
|
if (halt_result == ERROR_OK) {
|
||||||
// if (dm013_select_target(target) != ERROR_OK) {
|
if (dm013_select_target(target) != ERROR_OK) {
|
||||||
// LOG_TARGET_DEBUG(target, "dm013_select_target failed");
|
LOG_TARGET_INFO(target, "dm013_select_target failed");
|
||||||
// return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
// }
|
}
|
||||||
// if (set_dcsr_ebreak(target, false) == ERROR_OK) {
|
if (set_dcsr_ebreak(target, false) == ERROR_OK) {
|
||||||
// if (dm013_select_target(target) != ERROR_OK) {
|
if (dm013_select_target(target) != ERROR_OK) {
|
||||||
// LOG_TARGET_DEBUG(target, "dm013_select_target failed");
|
LOG_TARGET_INFO(target, "dm013_select_target failed");
|
||||||
// return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
// }
|
}
|
||||||
resume_result = riscv013_step_or_resume_current_hart(target, false);
|
resume_result = riscv013_step_or_resume_current_hart(target, false);
|
||||||
if (resume_result == ERROR_OK) {
|
if (resume_result == ERROR_OK) {
|
||||||
target->state = TARGET_RUNNING;
|
target->state = TARGET_RUNNING;
|
||||||
|
@ -1867,10 +1867,10 @@ static int halt_set_dcsr_ebreak(struct target *target)
|
||||||
LOG_TARGET_INFO(target, "riscv013_step_or_resume_current_hart failed");
|
LOG_TARGET_INFO(target, "riscv013_step_or_resume_current_hart failed");
|
||||||
result = ERROR_FAIL;
|
result = ERROR_FAIL;
|
||||||
}
|
}
|
||||||
// } else {
|
} else {
|
||||||
// LOG_TARGET_DEBUG(target, "set_dcsr_ebreak failed");
|
LOG_TARGET_INFO(target, "set_dcsr_ebreak failed");
|
||||||
// result = ERROR_FAIL;
|
result = ERROR_FAIL;
|
||||||
// }
|
}
|
||||||
} else if (halt_result == ERROR_TARGET_RESOURCE_NOT_AVAILABLE) {
|
} else if (halt_result == ERROR_TARGET_RESOURCE_NOT_AVAILABLE) {
|
||||||
LOG_TARGET_INFO(target, "riscv013_halt_go aborted");
|
LOG_TARGET_INFO(target, "riscv013_halt_go aborted");
|
||||||
} else {
|
} else {
|
||||||
|
@ -2073,6 +2073,7 @@ static int examine(struct target *target)
|
||||||
const bool hart_unavailable_at_examine_start = state_at_examine_start == RISCV_STATE_UNAVAILABLE;
|
const bool hart_unavailable_at_examine_start = state_at_examine_start == RISCV_STATE_UNAVAILABLE;
|
||||||
if (hart_unavailable_at_examine_start) {
|
if (hart_unavailable_at_examine_start) {
|
||||||
LOG_TARGET_DEBUG(target, "Did not fully examine hart %d as it was unavailable, deferring examine.", info->index);
|
LOG_TARGET_DEBUG(target, "Did not fully examine hart %d as it was unavailable, deferring examine.", info->index);
|
||||||
|
target->state = TARGET_UNAVAILABLE;
|
||||||
target->defer_examine = true;
|
target->defer_examine = true;
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,6 +129,9 @@ proc ocd_process_reset_inner { MODE } {
|
||||||
} else {
|
} else {
|
||||||
$t invoke-event examine-end
|
$t invoke-event examine-end
|
||||||
}
|
}
|
||||||
|
if { [$t curstate] == "unavailable" } {
|
||||||
|
continue
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Wait up to 1 second for target to halt. Why 1sec? Cause
|
# Wait up to 1 second for target to halt. Why 1sec? Cause
|
||||||
|
@ -143,7 +146,7 @@ proc ocd_process_reset_inner { MODE } {
|
||||||
set s [$t curstate]
|
set s [$t curstate]
|
||||||
|
|
||||||
if { $s != "halted" } {
|
if { $s != "halted" } {
|
||||||
return -code error [format "TARGET: %s - Not halted" $t]
|
return -code error [format "TARGET: %s - Not halted - Maybe unavailable %s" $t $s]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,6 +163,9 @@ proc ocd_process_reset_inner { MODE } {
|
||||||
if { ![$t was_examined] && [$t examine_deferred] } {
|
if { ![$t was_examined] && [$t examine_deferred] } {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if { [$t curstate] == "unavailable" } {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
set err [catch "$t arp_waitstate halted 5000"]
|
set err [catch "$t arp_waitstate halted 5000"]
|
||||||
# Did it halt?
|
# Did it halt?
|
||||||
|
|
Loading…
Reference in New Issue