Added target family attribute to AVR8 TDFs and renamed AVR family attribute to avr-family
This commit is contained in:
@@ -23,7 +23,7 @@ namespace Targets::Microchip::Avr::Avr8Bit
|
||||
, targetDescriptionFile(TargetDescription::TargetDescriptionFile(this->targetConfig.name))
|
||||
, signature(this->targetDescriptionFile.getTargetSignature())
|
||||
, name(this->targetDescriptionFile.getTargetName())
|
||||
, family(this->targetDescriptionFile.getFamily())
|
||||
, family(this->targetDescriptionFile.getAvrFamily())
|
||||
, targetParameters(this->targetDescriptionFile.getTargetParameters())
|
||||
, supportedPhysicalInterfaces(this->targetDescriptionFile.getSupportedPhysicalInterfaces())
|
||||
, padDescriptorsByName(this->targetDescriptionFile.getPadDescriptorsMappedByName())
|
||||
|
||||
@@ -41,8 +41,15 @@ namespace Targets::Microchip::Avr::Avr8Bit::TargetDescription
|
||||
Targets::TargetDescription::TargetDescriptionFile::init(descriptionFilePath);
|
||||
}
|
||||
|
||||
void TargetDescriptionFile::init(const QDomDocument& xml) {
|
||||
Targets::TargetDescription::TargetDescriptionFile::init(xml);
|
||||
void TargetDescriptionFile::init(const QDomDocument& document) {
|
||||
Targets::TargetDescription::TargetDescriptionFile::init(document);
|
||||
|
||||
const auto device = document.elementsByTagName("device").item(0).toElement();
|
||||
if (!device.isElement()) {
|
||||
throw TargetDescriptionParsingFailureException("Device element not found.");
|
||||
}
|
||||
|
||||
this->avrFamilyName = device.attributes().namedItem("avr-family").nodeValue().toLower().toStdString();
|
||||
|
||||
this->loadSupportedPhysicalInterfaces();
|
||||
this->loadPadDescriptors();
|
||||
@@ -100,16 +107,14 @@ namespace Targets::Microchip::Avr::Avr8Bit::TargetDescription
|
||||
);
|
||||
}
|
||||
|
||||
Family TargetDescriptionFile::getFamily() const {
|
||||
Family TargetDescriptionFile::getAvrFamily() const {
|
||||
static const auto targetFamiliesByName = TargetDescriptionFile::getFamilyNameToEnumMapping();
|
||||
|
||||
const auto& familyName = this->getFamilyName();
|
||||
|
||||
if (familyName.empty()) {
|
||||
if (this->avrFamilyName.empty()) {
|
||||
throw Exception("Could not find target family name in target description file.");
|
||||
}
|
||||
|
||||
const auto familyIt = targetFamiliesByName.find(familyName);
|
||||
const auto familyIt = targetFamiliesByName.find(this->avrFamilyName);
|
||||
|
||||
if (familyIt == targetFamiliesByName.end()) {
|
||||
throw Exception("Unknown family name in target description file.");
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace Targets::Microchip::Avr::Avr8Bit::TargetDescription
|
||||
*
|
||||
* @param xml
|
||||
*/
|
||||
void init(const QDomDocument& xml) override;
|
||||
void init(const QDomDocument& document) override;
|
||||
|
||||
/**
|
||||
* Loads the AVR8 target description JSON mapping file.
|
||||
@@ -67,7 +67,7 @@ namespace Targets::Microchip::Avr::Avr8Bit::TargetDescription
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
[[nodiscard]] Family getFamily() const;
|
||||
[[nodiscard]] Family getAvrFamily() const;
|
||||
|
||||
/**
|
||||
* Constructs an instance of TargetParameters, for the AVR8 target, with data from the TDF.
|
||||
@@ -197,6 +197,7 @@ namespace Targets::Microchip::Avr::Avr8Bit::TargetDescription
|
||||
};
|
||||
};
|
||||
|
||||
std::string avrFamilyName;
|
||||
std::set<PhysicalInterface> supportedPhysicalInterfaces;
|
||||
|
||||
std::map<std::string, PadDescriptor> padDescriptorsByName;
|
||||
|
||||
Reference in New Issue
Block a user