Added RiscVProgramInterface for RISC-V debug tools that are unable to program RISC-V targets via the debug interface
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include "src/Targets/Microchip/AVR/AVR8/TargetParameters.hpp"
|
||||
|
||||
#include "TargetInterfaces/RiscV/RiscVDebugInterface.hpp"
|
||||
#include "TargetInterfaces/RiscV/RiscVProgramInterface.hpp"
|
||||
|
||||
#include "src/Targets/TargetRegister.hpp"
|
||||
|
||||
@@ -113,6 +114,23 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Some debug tools are unable to program RISC-V targets via the RISC-V debug interface. Such tools must provide
|
||||
* an implementation of the RiscVProgramInterface, which will allow them to implement flash memory writing as a
|
||||
* separate function, independent of the debug interface.
|
||||
*
|
||||
* The RISC-V target driver will forward all flash memory writes to the RiscVProgramInterface returned by this
|
||||
* member function. If nullptr is returned, the driver will fall back to the RiscVDebugInterface for flash memory
|
||||
* writes.
|
||||
*
|
||||
* Note: the caller of this function will not manage the lifetime of the returned instance.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
virtual DebugToolDrivers::TargetInterfaces::RiscV::RiscVProgramInterface* getRiscVProgramInterface() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
[[nodiscard]] bool isInitialised() const {
|
||||
return this->initialised;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "src/Targets/TargetMemory.hpp"
|
||||
|
||||
namespace DebugToolDrivers::TargetInterfaces::RiscV
|
||||
{
|
||||
class RiscVProgramInterface
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Should write to the target's FLASH memory.
|
||||
*
|
||||
* @param startAddress
|
||||
* @param buffer
|
||||
*/
|
||||
virtual void writeFlashMemory(
|
||||
Targets::TargetMemoryAddress startAddress,
|
||||
const Targets::TargetMemoryBuffer& buffer
|
||||
) = 0;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user