From de02bf318c04670e4a1a24e5f95e19b1e0413639 Mon Sep 17 00:00:00 2001 From: Nav Date: Wed, 6 Nov 2024 20:06:55 +0000 Subject: [PATCH] Corrected HW breakpoint count bug in WchRiscV target --- src/Targets/RiscV/Wch/WchRiscV.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Targets/RiscV/Wch/WchRiscV.cpp b/src/Targets/RiscV/Wch/WchRiscV.cpp index 102120d5..ffa0dfb1 100644 --- a/src/Targets/RiscV/Wch/WchRiscV.cpp +++ b/src/Targets/RiscV/Wch/WchRiscV.cpp @@ -47,6 +47,8 @@ namespace Targets::RiscV::Wch } TargetDescriptor WchRiscV::targetDescriptor() { + const auto hardwareBreakpointCount = this->riscVDebugInterface->getHardwareBreakpointCount(); + auto descriptor = TargetDescriptor{ this->targetDescriptionFile.getName(), this->targetDescriptionFile.getFamily(), @@ -58,9 +60,11 @@ namespace Targets::RiscV::Wch this->targetDescriptionFile.targetPinoutDescriptorsByKey(), this->targetDescriptionFile.targetVariantDescriptorsByKey(), BreakpointResources{ - this->riscVDebugInterface->getHardwareBreakpointCount(), + hardwareBreakpointCount, std::nullopt, - static_cast(this->targetConfig.reserveSteppingBreakpoint ? 1 : 0) + static_cast( + this->targetConfig.reserveSteppingBreakpoint && hardwareBreakpointCount > 0 ? 1 : 0 + ) } };