Extract debug tool firmware version at startup

This commit is contained in:
Nav
2023-11-18 23:15:11 +00:00
parent 221d931add
commit 1600888624
6 changed files with 21 additions and 0 deletions

View File

@@ -45,6 +45,8 @@ public:
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
* TargetPowerManagementInterface class, via this function.

View File

@@ -121,6 +121,11 @@ namespace DebugToolDrivers
return std::string(data.begin(), data.end());
}
std::string EdbgDevice::getFirmwareVersionString() {
// TODO: Implement this
return "UNKNOWN";
}
void EdbgDevice::startSession() {
using namespace CommandFrames::HouseKeeping;
using ResponseFrames::HouseKeeping::ResponseId;

View File

@@ -74,6 +74,13 @@ namespace DebugToolDrivers
*/
std::string getSerialNumber() override;
/**
* Retrieves the EDBG firmware version.
*
* @return
*/
std::string getFirmwareVersionString() override;
/**
* Starts a session with the EDBG device using the "Housekeeping" EDBG sub-protocol.
*/

View File

@@ -59,6 +59,10 @@ namespace DebugToolDrivers::Wch
return UsbDevice::getSerialNumber();
}
std::string WchLinkBase::getFirmwareVersionString() {
return "v" + this->getDeviceInfo().firmwareVersion.toString();
}
const DeviceInfo& WchLinkBase::getDeviceInfo() const {
if (!this->cachedDeviceInfo.has_value()) {
this->cachedDeviceInfo = this->wchLinkInterface->getDeviceInfo();

View File

@@ -30,6 +30,8 @@ namespace DebugToolDrivers::Wch
std::string getSerialNumber() override;
std::string getFirmwareVersionString() override;
protected:
WchLinkVariant variant;

View File

@@ -493,6 +493,7 @@ namespace TargetController
Logger::info("Debug tool connected");
Logger::info("Debug tool name: " + this->debugTool->getName());
Logger::info("Debug tool serial: " + this->debugTool->getSerialNumber());
Logger::info("Debug tool firmware version: " + this->debugTool->getFirmwareVersionString());
this->target = targetIt->second(this->environmentConfig.targetConfig);
const auto& targetDescriptor = this->getTargetDescriptor();