Added RiscVProgramInterface for RISC-V debug tools that are unable to program RISC-V targets via the debug interface

This commit is contained in:
Nav
2023-12-08 23:04:04 +00:00
parent 084eef1a30
commit f4b30dbdf6
4 changed files with 48 additions and 0 deletions

View File

@@ -51,6 +51,7 @@ namespace Targets::RiscV
void RiscV::setDebugTool(DebugTool* debugTool) {
this->riscVDebugInterface = debugTool->getRiscVDebugInterface();
this->riscVProgramInterface = debugTool->getRiscVProgramInterface();
}
void RiscV::activate() {
@@ -395,6 +396,10 @@ namespace Targets::RiscV
return this->writeMemory(memoryType, alignedStartAddress, alignedBuffer);
}
if (memoryType == TargetMemoryType::FLASH && this->riscVProgramInterface != nullptr) {
return this->riscVProgramInterface->writeFlashMemory(startAddress, buffer);
}
this->riscVDebugInterface->writeDebugModuleRegister(RegisterAddress::ABSTRACT_DATA_1, startAddress);
auto command = AbstractCommandRegister();

View File

@@ -8,6 +8,7 @@
#include "src/DebugToolDrivers/DebugTool.hpp"
#include "src/DebugToolDrivers/TargetInterfaces/RiscV/RiscVDebugInterface.hpp"
#include "src/DebugToolDrivers/TargetInterfaces/RiscV/RiscVProgramInterface.hpp"
#include "src/Targets/RiscV/RiscVGeneric.hpp"
#include "src/Targets/RiscV/Registers/RegisterNumbers.hpp"
@@ -104,6 +105,7 @@ namespace Targets::RiscV
RiscVRegisterDescriptor stackPointerRegisterDescriptor;
DebugToolDrivers::TargetInterfaces::RiscV::RiscVDebugInterface* riscVDebugInterface = nullptr;
DebugToolDrivers::TargetInterfaces::RiscV::RiscVProgramInterface* riscVProgramInterface = nullptr;
std::set<DebugModule::HartIndex> hartIndices;
DebugModule::HartIndex selectedHartIndex = 0;