diff --git a/src/DebugToolDrivers/DebugTool.hpp b/src/DebugToolDrivers/DebugTool.hpp index cc3c0dd9..221f7c39 100644 --- a/src/DebugToolDrivers/DebugTool.hpp +++ b/src/DebugToolDrivers/DebugTool.hpp @@ -3,12 +3,14 @@ #include "TargetInterfaces/TargetPowerManagementInterface.hpp" #include "TargetInterfaces/Microchip/AVR/AVR8/Avr8DebugInterface.hpp" +#include "TargetInterfaces/Microchip/AVR/AvrIspInterface.hpp" #include "src/Targets/Microchip/AVR/AVR8/Avr8TargetConfig.hpp" #include "src/Targets/Microchip/AVR/AVR8/Family.hpp" #include "src/Targets/Microchip/AVR/AVR8/TargetParameters.hpp" -#include "src/Targets/TargetRegister.hpp" -#include "TargetInterfaces/Microchip/AVR/AvrIspInterface.hpp" +#include "TargetInterfaces/RiscV/RiscVDebugInterface.hpp" + +#include "src/Targets/TargetRegister.hpp" /** * A debug tool can be any device that provides access to the connected target. Debug tools are usually connected @@ -97,6 +99,20 @@ public: return nullptr; } + /** + * All debug tools that support interfacing with RISC-V targets must provide an implementation of the + * RiscVDebugInterface class, via this function. + * + * For debug tools that do not support this interface, a nullptr should be returned. + * + * Note: the caller of this function will not manage the lifetime of the returned instance. + * + * @return + */ + virtual DebugToolDrivers::TargetInterfaces::RiscV::RiscVDebugInterface* getRiscVDebugInterface() { + return nullptr; + } + [[nodiscard]] bool isInitialised() const { return this->initialised; } diff --git a/src/DebugToolDrivers/WCH/WchLinkBase.hpp b/src/DebugToolDrivers/WCH/WchLinkBase.hpp index 472c7621..c0d280b8 100644 --- a/src/DebugToolDrivers/WCH/WchLinkBase.hpp +++ b/src/DebugToolDrivers/WCH/WchLinkBase.hpp @@ -32,6 +32,10 @@ namespace DebugToolDrivers::Wch std::string getFirmwareVersionString() override; + DebugToolDrivers::TargetInterfaces::RiscV::RiscVDebugInterface* getRiscVDebugInterface() override { + return this->wchLinkInterface.get(); + } + protected: WchLinkVariant variant;