Ignoring AVR8 registers that are not in the data address space

This commit is contained in:
Nav
2021-08-30 22:31:44 +01:00
parent 9d9f429fba
commit df1f3958c0
3 changed files with 11 additions and 1 deletions

View File

@@ -66,7 +66,7 @@ TargetDescriptionFile::TargetDescriptionFile(
matchingDescriptionFiles.begin(), matchingDescriptionFiles.begin(),
matchingDescriptionFiles.end(), matchingDescriptionFiles.end(),
std::back_inserter(targetNames), std::back_inserter(targetNames),
[](const QJsonValue& descriptionFile) { [] (const QJsonValue& descriptionFile) {
return QString("\"" + descriptionFile.toObject().find("targetName")->toString().toLower() + "\""); return QString("\"" + descriptionFile.toObject().find("targetName")->toString().toLower() + "\"");
} }
); );
@@ -473,6 +473,11 @@ void TargetDescriptionFile::loadTargetRegisterDescriptors() {
auto& peripheralRegisterGroups = this->peripheralRegisterGroupsMappedByModuleRegisterGroupName auto& peripheralRegisterGroups = this->peripheralRegisterGroupsMappedByModuleRegisterGroupName
.at(registerGroupName); .at(registerGroupName);
for (const auto& peripheralRegisterGroup : peripheralRegisterGroups) { for (const auto& peripheralRegisterGroup : peripheralRegisterGroups) {
if (peripheralRegisterGroup.addressSpaceId.value_or("") != "data") {
// Currently, we only deal with registers in the data address space.
continue;
}
for (const auto& [moduleRegisterName, moduleRegister] : registerGroup.registersMappedByName) { for (const auto& [moduleRegisterName, moduleRegister] : registerGroup.registersMappedByName) {
if (moduleRegister.size < 1) { if (moduleRegister.size < 1) {
continue; continue;

View File

@@ -20,6 +20,7 @@ namespace Bloom::Targets::TargetDescription
std::string name; std::string name;
std::optional<std::string> moduleName; std::optional<std::string> moduleName;
std::optional<std::uint16_t> offset; std::optional<std::uint16_t> offset;
std::optional<std::string> addressSpaceId;
std::map<std::string, Register> registersMappedByName; std::map<std::string, Register> registersMappedByName;
}; };
} }

View File

@@ -173,6 +173,10 @@ RegisterGroup TargetDescriptionFile::generateRegisterGroupFromXml(const QDomElem
registerGroup.moduleName = xmlElement.attribute("name-in-module").toLower().toStdString(); registerGroup.moduleName = xmlElement.attribute("name-in-module").toLower().toStdString();
} }
if (xmlElement.hasAttribute("address-space")) {
registerGroup.addressSpaceId = xmlElement.attribute("address-space").toLower().toStdString();
}
if (xmlElement.hasAttribute("offset")) { if (xmlElement.hasAttribute("offset")) {
registerGroup.offset = xmlElement.attribute("offset").toInt(nullptr, 16); registerGroup.offset = xmlElement.attribute("offset").toInt(nullptr, 16);
} }