Catch errors when handling unexpected target resets in RiscV driver
This commit is contained in:
@@ -179,19 +179,24 @@ namespace DebugToolDrivers::Protocols::RiscVDebugSpec
|
|||||||
if (statusRegister.anyHaveReset) {
|
if (statusRegister.anyHaveReset) {
|
||||||
Logger::warning("Reset detected at RISC-V hart " + std::to_string(this->selectedHartIndex));
|
Logger::warning("Reset detected at RISC-V hart " + std::to_string(this->selectedHartIndex));
|
||||||
|
|
||||||
if (statusRegister.anyRunning) {
|
try {
|
||||||
this->stop();
|
if (statusRegister.anyRunning) {
|
||||||
}
|
this->stop();
|
||||||
|
}
|
||||||
|
|
||||||
this->initDebugControlStatusRegister();
|
this->initDebugControlStatusRegister();
|
||||||
this->writeDebugModuleControlRegister(ControlRegister{
|
this->writeDebugModuleControlRegister(ControlRegister{
|
||||||
.debugModuleActive = true,
|
.debugModuleActive = true,
|
||||||
.selectedHartIndex = this->selectedHartIndex,
|
.selectedHartIndex = this->selectedHartIndex,
|
||||||
.acknowledgeHaveReset = true,
|
.acknowledgeHaveReset = true,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (statusRegister.anyRunning) {
|
if (statusRegister.anyRunning) {
|
||||||
this->run();
|
this->run();
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (const Exceptions::TargetOperationFailure& exception) {
|
||||||
|
Logger::error("Failed to handle unexpected RISC-V hart reset - error: " + exception.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user