Added abstract data register count check when identifying supported memory access strategies
This commit is contained in:
@@ -8,7 +8,7 @@ namespace DebugToolDrivers::Protocols::RiscVDebugSpec::DebugModule::Registers
|
||||
{
|
||||
struct AbstractControlStatusRegister
|
||||
{
|
||||
std::uint8_t dataCount = 0;
|
||||
std::uint8_t dataRegisterCount = 0;
|
||||
AbstractCommandError commandError = AbstractCommandError::NONE;
|
||||
bool relaxedPrivilege = false;
|
||||
bool busy = false;
|
||||
@@ -16,7 +16,7 @@ namespace DebugToolDrivers::Protocols::RiscVDebugSpec::DebugModule::Registers
|
||||
|
||||
static constexpr AbstractControlStatusRegister fromValue(RegisterValue value) {
|
||||
return {
|
||||
.dataCount = static_cast<std::uint8_t>(value & 0x0F),
|
||||
.dataRegisterCount = static_cast<std::uint8_t>(value & 0x0F),
|
||||
.commandError = static_cast<AbstractCommandError>((value >> 8) & 0x07),
|
||||
.relaxedPrivilege = static_cast<bool>(value & (0x01 << 11)),
|
||||
.busy = static_cast<bool>(value & (0x01 << 12)),
|
||||
@@ -26,7 +26,7 @@ namespace DebugToolDrivers::Protocols::RiscVDebugSpec::DebugModule::Registers
|
||||
|
||||
[[nodiscard]] constexpr RegisterValue value() const {
|
||||
return RegisterValue{0}
|
||||
| static_cast<RegisterValue>(this->dataCount & 0x0F)
|
||||
| static_cast<RegisterValue>(this->dataRegisterCount & 0x0F)
|
||||
| static_cast<RegisterValue>(this->commandError) << 8
|
||||
| static_cast<RegisterValue>(this->relaxedPrivilege) << 11
|
||||
| static_cast<RegisterValue>(this->busy) << 12
|
||||
|
||||
@@ -19,6 +19,7 @@ namespace DebugToolDrivers::Protocols::RiscVDebugSpec
|
||||
std::vector<DebugModule::HartIndex> hartIndices;
|
||||
|
||||
std::unordered_set<DebugModule::MemoryAccessStrategy> memoryAccessStrategies;
|
||||
std::uint8_t abstractDataRegisterCount = 0;
|
||||
std::uint8_t programBufferSize = 0;
|
||||
|
||||
std::unordered_map<TriggerModule::TriggerIndex, TriggerModule::TriggerDescriptor> triggerDescriptorsByIndex;
|
||||
|
||||
@@ -128,10 +128,13 @@ namespace DebugToolDrivers::Protocols::RiscVDebugSpec
|
||||
this->initDebugControlStatusRegister();
|
||||
|
||||
const auto abstractControlStatusRegister = this->readDebugModuleAbstractControlStatusRegister();
|
||||
this->debugModuleDescriptor.abstractDataRegisterCount = abstractControlStatusRegister.dataRegisterCount;
|
||||
this->debugModuleDescriptor.programBufferSize = abstractControlStatusRegister.programBufferSize;
|
||||
|
||||
Logger::debug("Data register count: " + std::to_string(this->debugModuleDescriptor.abstractDataRegisterCount));
|
||||
Logger::debug("Program buffer size: " + std::to_string(this->debugModuleDescriptor.programBufferSize));
|
||||
|
||||
if (this->debugModuleDescriptor.abstractDataRegisterCount > 0) {
|
||||
if (this->debugModuleDescriptor.programBufferSize >= 3) {
|
||||
this->debugModuleDescriptor.memoryAccessStrategies.insert(MemoryAccessStrategy::PROGRAM_BUFFER);
|
||||
}
|
||||
@@ -156,6 +159,7 @@ namespace DebugToolDrivers::Protocols::RiscVDebugSpec
|
||||
if (this->tryExecuteAbstractCommand(probingMemoryAccessCommand) == AbstractCommandError::NONE) {
|
||||
this->debugModuleDescriptor.memoryAccessStrategies.insert(MemoryAccessStrategy::ABSTRACT_COMMAND);
|
||||
}
|
||||
}
|
||||
|
||||
if (this->debugModuleDescriptor.memoryAccessStrategies.empty()) {
|
||||
throw Exceptions::TargetOperationFailure{"Target doesn't support any known memory access strategies"};
|
||||
|
||||
Reference in New Issue
Block a user