Implemented RiscVProgramInterface in WchLinkInterface

This commit is contained in:
Nav
2023-12-09 18:22:32 +00:00
parent d6c3f8044a
commit 7630baf51b
4 changed files with 109 additions and 1 deletions

View File

@@ -36,6 +36,24 @@ namespace DebugToolDrivers::Wch
return this->wchLinkInterface.get();
}
/**
* WCH-Link debug tools cannot write to flash memory via the RISC-V debug interface (RiscVDebugInterface).
* Flash memory writes via abstract commands fail silently.
*
* We have to send a vendor-specific command to the debug tool, in order to program the target.
*
* For this reason, we have to provide an implementation of the RiscVProgramInterface, so that the RISC-V
* target driver forwards any flash memory writes to this implementation (instead of relying on the debug
* interface).
*
* The WchLinkInterface implements both the RiscVDebugInterface and the RiscVProgramInterface.
*
* @return
*/
DebugToolDrivers::TargetInterfaces::RiscV::RiscVProgramInterface* getRiscVProgramInterface() override {
return this->wchLinkInterface.get();
}
protected:
WchLinkVariant variant;