Made AVR8 Physical Interfaces more generic (to include non-debug interfaces such as ISP)

This commit is contained in:
Nav
2022-08-04 21:06:13 +01:00
parent 40218e5c21
commit 96f0c14b53
5 changed files with 15 additions and 11 deletions

View File

@@ -579,6 +579,7 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
this->name = this->targetDescriptionFile->getTargetName();
this->family = this->targetDescriptionFile->getFamily();
this->supportedPhysicalInterfaces = this->targetDescriptionFile->getSupportedPhysicalInterfaces();
this->targetParameters = this->targetDescriptionFile->getTargetParameters();
this->padDescriptorsByName = this->targetDescriptionFile->getPadDescriptorsMappedByName();
@@ -736,8 +737,7 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
);
}
const auto& supportedPhysicalInterfaces = this->targetDescriptionFile->getSupportedDebugPhysicalInterfaces();
if (!supportedPhysicalInterfaces.contains(PhysicalInterface::DEBUG_WIRE)) {
if (!this->supportedPhysicalInterfaces.contains(PhysicalInterface::DEBUG_WIRE)) {
throw Exception(
"Target does not support debugWire physical interface - check target configuration or "
"report this issue via " + Paths::homeDomainName() + "/report-issue"

View File

@@ -140,6 +140,8 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
std::optional<Family> family;
std::optional<TargetDescription::TargetDescriptionFile> targetDescriptionFile;
std::set<PhysicalInterface> supportedPhysicalInterfaces;
std::optional<TargetParameters> targetParameters;
std::map<std::string, PadDescriptor> padDescriptorsByName;
std::map<int, TargetVariant> targetVariantsById;

View File

@@ -6,6 +6,7 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
{
enum class PhysicalInterface: std::uint8_t
{
ISP,
JTAG,
DEBUG_WIRE,
PDI,

View File

@@ -96,7 +96,7 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit::TargetDescription
void TargetDescriptionFile::init(const QDomDocument& xml) {
Targets::TargetDescription::TargetDescriptionFile::init(xml);
this->loadDebugPhysicalInterfaces();
this->loadSupportedPhysicalInterfaces();
this->loadPadDescriptors();
this->loadTargetVariants();
this->loadTargetRegisterDescriptors();
@@ -270,7 +270,7 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit::TargetDescription
}
}
const auto& supportedPhysicalInterfaces = this->getSupportedDebugPhysicalInterfaces();
const auto& supportedPhysicalInterfaces = this->getSupportedPhysicalInterfaces();
if (supportedPhysicalInterfaces.contains(PhysicalInterface::DEBUG_WIRE)
|| supportedPhysicalInterfaces.contains(PhysicalInterface::JTAG)
@@ -396,17 +396,18 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit::TargetDescription
return this->getFuseBitsDescriptorByName("spien");
}
void TargetDescriptionFile::loadDebugPhysicalInterfaces() {
void TargetDescriptionFile::loadSupportedPhysicalInterfaces() {
auto interfaceNamesToInterfaces = std::map<std::string, PhysicalInterface>({
{"updi", PhysicalInterface::UPDI},
{"debugwire", PhysicalInterface::DEBUG_WIRE},
{"jtag", PhysicalInterface::DEBUG_WIRE},
{"pdi", PhysicalInterface::PDI},
{"isp", PhysicalInterface::ISP},
});
for (const auto& [interfaceName, interface]: this->interfacesByName) {
if (interfaceNamesToInterfaces.contains(interfaceName)) {
this->supportedDebugPhysicalInterfaces.insert(interfaceNamesToInterfaces.at(interfaceName));
this->supportedPhysicalInterfaces.insert(interfaceNamesToInterfaces.at(interfaceName));
}
}
}

View File

@@ -106,8 +106,8 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit::TargetDescription
*
* @return
*/
[[nodiscard]] const auto& getSupportedDebugPhysicalInterfaces() const {
return this->supportedDebugPhysicalInterfaces;
[[nodiscard]] const auto& getSupportedPhysicalInterfaces() const {
return this->supportedPhysicalInterfaces;
}
/**
@@ -161,7 +161,7 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit::TargetDescription
};
};
std::set<PhysicalInterface> supportedDebugPhysicalInterfaces;
std::set<PhysicalInterface> supportedPhysicalInterfaces;
std::map<std::string, PadDescriptor> padDescriptorsByName;
std::map<int, TargetVariant> targetVariantsById;
@@ -169,9 +169,9 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit::TargetDescription
std::map<TargetRegisterType, TargetRegisterDescriptors> targetRegisterDescriptorsByType;
/**
* Populates this->supportedDebugPhysicalInterfaces with physical interfaces defined in the TDF.
* Populates this->supportedPhysicalInterfaces with physical interfaces defined in the TDF.
*/
void loadDebugPhysicalInterfaces();
void loadSupportedPhysicalInterfaces();
/**
* Generates a collection of PadDescriptor objects from data in the TDF and populates this->padDescriptorsByName.