Added postInit() function to debug tool interface, for outputting any debug-tool-specific info after initialisation.
Removed `getFirmwareVersionString()` function
This commit is contained in:
@@ -46,14 +46,17 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual void close() = 0;
|
virtual void close() = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function is called immediately after successful initialisation of the debug tool.
|
||||||
|
*/
|
||||||
|
virtual void postInit() = 0;
|
||||||
|
|
||||||
virtual bool isInitialised() const = 0;
|
virtual bool isInitialised() const = 0;
|
||||||
|
|
||||||
virtual std::string getName() = 0;
|
virtual std::string getName() = 0;
|
||||||
|
|
||||||
virtual std::string getSerialNumber() = 0;
|
virtual std::string getSerialNumber() = 0;
|
||||||
|
|
||||||
virtual std::string getFirmwareVersionString() = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All debug tools that support target power management functions must provide an implementation of the
|
* All debug tools that support target power management functions must provide an implementation of the
|
||||||
* TargetPowerManagementInterface class, via this function.
|
* TargetPowerManagementInterface class, via this function.
|
||||||
|
|||||||
@@ -83,6 +83,10 @@ namespace DebugToolDrivers::Microchip
|
|||||||
this->initialised = false;
|
this->initialised = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EdbgDevice::postInit() {
|
||||||
|
// TODO: Log firmware version of EDBG device
|
||||||
|
}
|
||||||
|
|
||||||
bool EdbgDevice::isInitialised() const {
|
bool EdbgDevice::isInitialised() const {
|
||||||
return this->initialised;
|
return this->initialised;
|
||||||
}
|
}
|
||||||
@@ -105,11 +109,6 @@ namespace DebugToolDrivers::Microchip
|
|||||||
return std::string{data.begin(), data.end()};
|
return std::string{data.begin(), data.end()};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string EdbgDevice::getFirmwareVersionString() {
|
|
||||||
// TODO: Implement this
|
|
||||||
return "UNKNOWN";
|
|
||||||
}
|
|
||||||
|
|
||||||
DebugToolDrivers::TargetInterfaces::TargetPowerManagementInterface* EdbgDevice::getTargetPowerManagementInterface()
|
DebugToolDrivers::TargetInterfaces::TargetPowerManagementInterface* EdbgDevice::getTargetPowerManagementInterface()
|
||||||
{
|
{
|
||||||
return this->targetPowerManagementInterface.get();
|
return this->targetPowerManagementInterface.get();
|
||||||
|
|||||||
@@ -50,6 +50,8 @@ namespace DebugToolDrivers::Microchip
|
|||||||
*/
|
*/
|
||||||
void close() override;
|
void close() override;
|
||||||
|
|
||||||
|
void postInit() override;
|
||||||
|
|
||||||
[[nodiscard]] bool isInitialised() const override;
|
[[nodiscard]] bool isInitialised() const override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -59,13 +61,6 @@ namespace DebugToolDrivers::Microchip
|
|||||||
*/
|
*/
|
||||||
std::string getSerialNumber() override;
|
std::string getSerialNumber() override;
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves the EDBG firmware version.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
std::string getFirmwareVersionString() override;
|
|
||||||
|
|
||||||
DebugToolDrivers::TargetInterfaces::TargetPowerManagementInterface* getTargetPowerManagementInterface() override;
|
DebugToolDrivers::TargetInterfaces::TargetPowerManagementInterface* getTargetPowerManagementInterface() override;
|
||||||
|
|
||||||
TargetInterfaces::Microchip::Avr8::Avr8DebugInterface* getAvr8DebugInterface(
|
TargetInterfaces::Microchip::Avr8::Avr8DebugInterface* getAvr8DebugInterface(
|
||||||
@@ -73,6 +68,7 @@ namespace DebugToolDrivers::Microchip
|
|||||||
const Targets::Microchip::Avr8::Avr8TargetConfig& targetConfig
|
const Targets::Microchip::Avr8::Avr8TargetConfig& targetConfig
|
||||||
) override;
|
) override;
|
||||||
|
|
||||||
|
|
||||||
TargetInterfaces::Microchip::Avr8::AvrIspInterface* getAvrIspInterface(
|
TargetInterfaces::Microchip::Avr8::AvrIspInterface* getAvrIspInterface(
|
||||||
const Targets::Microchip::Avr8::TargetDescriptionFile& targetDescriptionFile,
|
const Targets::Microchip::Avr8::TargetDescriptionFile& targetDescriptionFile,
|
||||||
const Targets::Microchip::Avr8::Avr8TargetConfig& targetConfig
|
const Targets::Microchip::Avr8::Avr8TargetConfig& targetConfig
|
||||||
|
|||||||
@@ -56,6 +56,10 @@ namespace DebugToolDrivers::Wch
|
|||||||
this->initialised = false;
|
this->initialised = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WchLinkBase::postInit() {
|
||||||
|
Logger::info("WCH-Link firmware version: " + this->getDeviceInfo().firmwareVersion.toString());
|
||||||
|
}
|
||||||
|
|
||||||
bool WchLinkBase::isInitialised() const {
|
bool WchLinkBase::isInitialised() const {
|
||||||
return this->initialised;
|
return this->initialised;
|
||||||
}
|
}
|
||||||
@@ -64,10 +68,6 @@ namespace DebugToolDrivers::Wch
|
|||||||
return UsbDevice::getSerialNumber();
|
return UsbDevice::getSerialNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string WchLinkBase::getFirmwareVersionString() {
|
|
||||||
return "v" + this->getDeviceInfo().firmwareVersion.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
::DebugToolDrivers::Protocols::RiscVDebugSpec::DebugTranslator* WchLinkBase::getRiscVDebugInterface(
|
::DebugToolDrivers::Protocols::RiscVDebugSpec::DebugTranslator* WchLinkBase::getRiscVDebugInterface(
|
||||||
const Targets::RiscV::TargetDescriptionFile& targetDescriptionFile,
|
const Targets::RiscV::TargetDescriptionFile& targetDescriptionFile,
|
||||||
const Targets::RiscV::RiscVTargetConfig& targetConfig
|
const Targets::RiscV::RiscVTargetConfig& targetConfig
|
||||||
|
|||||||
@@ -30,12 +30,12 @@ namespace DebugToolDrivers::Wch
|
|||||||
|
|
||||||
void close() override;
|
void close() override;
|
||||||
|
|
||||||
|
void postInit() override;
|
||||||
|
|
||||||
[[nodiscard]] bool isInitialised() const override;
|
[[nodiscard]] bool isInitialised() const override;
|
||||||
|
|
||||||
std::string getSerialNumber() override;
|
std::string getSerialNumber() override;
|
||||||
|
|
||||||
std::string getFirmwareVersionString() override;
|
|
||||||
|
|
||||||
::DebugToolDrivers::Protocols::RiscVDebugSpec::DebugTranslator* getRiscVDebugInterface(
|
::DebugToolDrivers::Protocols::RiscVDebugSpec::DebugTranslator* getRiscVDebugInterface(
|
||||||
const Targets::RiscV::TargetDescriptionFile& targetDescriptionFile,
|
const Targets::RiscV::TargetDescriptionFile& targetDescriptionFile,
|
||||||
const Targets::RiscV::RiscVTargetConfig& targetConfig
|
const Targets::RiscV::RiscVTargetConfig& targetConfig
|
||||||
|
|||||||
@@ -496,11 +496,12 @@ namespace TargetController
|
|||||||
|
|
||||||
Logger::info("Connecting to debug tool");
|
Logger::info("Connecting to debug tool");
|
||||||
this->debugTool->init();
|
this->debugTool->init();
|
||||||
|
|
||||||
Logger::info("Debug tool connected");
|
Logger::info("Debug tool connected");
|
||||||
|
|
||||||
|
this->debugTool->postInit();
|
||||||
|
|
||||||
Logger::info("Debug tool name: " + this->debugTool->getName());
|
Logger::info("Debug tool name: " + this->debugTool->getName());
|
||||||
Logger::info("Debug tool serial: " + this->debugTool->getSerialNumber());
|
Logger::info("Debug tool serial: " + this->debugTool->getSerialNumber());
|
||||||
Logger::info("Debug tool firmware version: " + this->debugTool->getFirmwareVersionString());
|
|
||||||
|
|
||||||
this->target = this->constructTarget(*briefTargetDescriptor);
|
this->target = this->constructTarget(*briefTargetDescriptor);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user