Refactored AVR8 TDF loading
Refactored EDBG AVR8 target parameter uploading Implemented UPDI parameter extraction (from TDF) and uploading to debug tool Introduced supported physical interfaces in AVR8 TDFs
This commit is contained in:
@@ -51,7 +51,7 @@ TargetDescriptionFile::TargetDescriptionFile(
|
||||
+ matchingDescriptionFiles.front().toObject().find("targetDescriptionFilePath")->toString();
|
||||
|
||||
Logger::debug("Loading AVR8 target description file: " + descriptionFilePath.toStdString());
|
||||
this->init(descriptionFilePath);
|
||||
Targets::TargetDescription::TargetDescriptionFile::init(descriptionFilePath);
|
||||
|
||||
} else if (matchingDescriptionFiles.size() > 1) {
|
||||
/*
|
||||
@@ -86,6 +86,27 @@ TargetDescriptionFile::TargetDescriptionFile(
|
||||
}
|
||||
}
|
||||
|
||||
void TargetDescriptionFile::init(const QDomDocument& xml) {
|
||||
Targets::TargetDescription::TargetDescriptionFile::init(xml);
|
||||
|
||||
this->loadDebugPhysicalInterfaces();
|
||||
}
|
||||
|
||||
void TargetDescriptionFile::loadDebugPhysicalInterfaces() {
|
||||
auto interfaceNamesToInterfaces = std::map<std::string, PhysicalInterface>({
|
||||
{"updi", PhysicalInterface::UPDI},
|
||||
{"debugwire", PhysicalInterface::DEBUG_WIRE},
|
||||
{"jtag", PhysicalInterface::DEBUG_WIRE},
|
||||
{"pdi", PhysicalInterface::PDI},
|
||||
});
|
||||
|
||||
for (const auto& [interfaceName, interface]: this->interfacesByName) {
|
||||
if (interfaceNamesToInterfaces.contains(interfaceName)) {
|
||||
this->supportedDebugPhysicalInterfaces.insert(interfaceNamesToInterfaces.at(interfaceName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QJsonObject TargetDescriptionFile::getTargetDescriptionMapping() {
|
||||
auto mappingFile = QFile(
|
||||
QString::fromStdString(Paths::resourcesDirPath() + "/TargetDescriptionFiles/AVR/Mapping.json")
|
||||
@@ -276,6 +297,63 @@ std::optional<MemorySegment> TargetDescriptionFile::getFirstBootSectionMemorySeg
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::optional<MemorySegment> TargetDescriptionFile::getSignatureMemorySegment() const {
|
||||
if (this->addressSpacesMappedById.contains("signatures")) {
|
||||
auto& signaturesAddressSpace = this->addressSpacesMappedById.at("signatures");
|
||||
auto& signaturesAddressSpaceSegments = signaturesAddressSpace.memorySegmentsByTypeAndName;
|
||||
|
||||
if (signaturesAddressSpaceSegments.contains(MemorySegmentType::SIGNATURES)) {
|
||||
return signaturesAddressSpaceSegments.at(MemorySegmentType::SIGNATURES).begin()->second;
|
||||
}
|
||||
|
||||
} else {
|
||||
// The signatures memory segment may be part of the data address space
|
||||
if (this->addressSpacesMappedById.contains("data")) {
|
||||
auto dataAddressSpace = this->addressSpacesMappedById.at("data");
|
||||
|
||||
if (dataAddressSpace.memorySegmentsByTypeAndName.contains(MemorySegmentType::SIGNATURES)) {
|
||||
auto& signatureSegmentsByName = dataAddressSpace.memorySegmentsByTypeAndName.at(
|
||||
MemorySegmentType::SIGNATURES
|
||||
);
|
||||
|
||||
if (signatureSegmentsByName.contains("signatures")) {
|
||||
return signatureSegmentsByName.at("signatures");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::optional<MemorySegment> TargetDescriptionFile::getFuseMemorySegment() const {
|
||||
if (this->addressSpacesMappedById.contains("data")) {
|
||||
auto dataAddressSpace = this->addressSpacesMappedById.at("data");
|
||||
|
||||
if (dataAddressSpace.memorySegmentsByTypeAndName.contains(MemorySegmentType::FUSES)) {
|
||||
return dataAddressSpace.memorySegmentsByTypeAndName.at(
|
||||
MemorySegmentType::SIGNATURES
|
||||
).begin()->second;
|
||||
}
|
||||
}
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::optional<MemorySegment> TargetDescriptionFile::getLockbitsMemorySegment() const {
|
||||
if (this->addressSpacesMappedById.contains("data")) {
|
||||
auto dataAddressSpace = this->addressSpacesMappedById.at("data");
|
||||
|
||||
if (dataAddressSpace.memorySegmentsByTypeAndName.contains(MemorySegmentType::LOCKBITS)) {
|
||||
return dataAddressSpace.memorySegmentsByTypeAndName.at(
|
||||
MemorySegmentType::LOCKBITS
|
||||
).begin()->second;
|
||||
}
|
||||
}
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::optional<RegisterGroup> TargetDescriptionFile::getCpuRegisterGroup() const {
|
||||
auto& modulesByName = this->modulesMappedByName;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user