From 00d6f5fb71c4a56fd1e071c6b1b11bdc006c7d1a Mon Sep 17 00:00:00 2001 From: Nav Date: Sat, 19 Oct 2024 14:22:12 +0100 Subject: [PATCH] Corrected bug in RISC-V debug translator where a reset wasn't always keeping the target halted --- .../Protocols/RiscVDebugSpec/DebugTranslator.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/DebugToolDrivers/Protocols/RiscVDebugSpec/DebugTranslator.cpp b/src/DebugToolDrivers/Protocols/RiscVDebugSpec/DebugTranslator.cpp index 7766364a..ff21140f 100644 --- a/src/DebugToolDrivers/Protocols/RiscVDebugSpec/DebugTranslator.cpp +++ b/src/DebugToolDrivers/Protocols/RiscVDebugSpec/DebugTranslator.cpp @@ -204,20 +204,20 @@ namespace DebugToolDrivers::Protocols::RiscVDebugSpec } void DebugTranslator::reset() { - auto controlRegister = ControlRegister{ + this->writeDebugModuleControlRegister(ControlRegister{ .debugModuleActive = true, .ndmReset = true, .setResetHaltRequest = true, .selectedHartIndex = this->selectedHartIndex, .haltRequest = true, - }; + }); + this->writeDebugModuleControlRegister(ControlRegister{ + .debugModuleActive = true, + .selectedHartIndex = this->selectedHartIndex, + .haltRequest = true, + }); - this->writeDebugModuleControlRegister(controlRegister); - - controlRegister.ndmReset = false; - this->writeDebugModuleControlRegister(controlRegister); auto statusRegister = this->readDebugModuleStatusRegister(); - for ( auto attempts = 0; !statusRegister.allHaveReset @@ -233,6 +233,7 @@ namespace DebugToolDrivers::Protocols::RiscVDebugSpec .clearResetHaltRequest = true, .selectedHartIndex = this->selectedHartIndex, .acknowledgeHaveReset = true, + .haltRequest = true, }); if (!statusRegister.allHaveReset) {