Corrected HW breakpoint count bug in WchRiscV target

This commit is contained in:
Nav
2024-11-06 20:06:55 +00:00
parent 7662dec100
commit de02bf318c

View File

@@ -47,6 +47,8 @@ namespace Targets::RiscV::Wch
} }
TargetDescriptor WchRiscV::targetDescriptor() { TargetDescriptor WchRiscV::targetDescriptor() {
const auto hardwareBreakpointCount = this->riscVDebugInterface->getHardwareBreakpointCount();
auto descriptor = TargetDescriptor{ auto descriptor = TargetDescriptor{
this->targetDescriptionFile.getName(), this->targetDescriptionFile.getName(),
this->targetDescriptionFile.getFamily(), this->targetDescriptionFile.getFamily(),
@@ -58,9 +60,11 @@ namespace Targets::RiscV::Wch
this->targetDescriptionFile.targetPinoutDescriptorsByKey(), this->targetDescriptionFile.targetPinoutDescriptorsByKey(),
this->targetDescriptionFile.targetVariantDescriptorsByKey(), this->targetDescriptionFile.targetVariantDescriptorsByKey(),
BreakpointResources{ BreakpointResources{
this->riscVDebugInterface->getHardwareBreakpointCount(), hardwareBreakpointCount,
std::nullopt, std::nullopt,
static_cast<std::uint16_t>(this->targetConfig.reserveSteppingBreakpoint ? 1 : 0) static_cast<std::uint16_t>(
this->targetConfig.reserveSteppingBreakpoint && hardwareBreakpointCount > 0 ? 1 : 0
)
} }
}; };