Fixed issue with automatic config variant selection, where we were not properly handling XMEGA targets with the JTAG physical interface.

Also introduced new AVR8 families, for D series targets.
Also moved AVR family param outside of TargetParameters struct
This commit is contained in:
Nav
2021-06-06 17:44:13 +01:00
parent 5ba95e6967
commit 3f1247ce74
11 changed files with 178 additions and 28 deletions

View File

@@ -33,6 +33,10 @@ using namespace Exceptions;
void Avr8::preActivationConfigure(const TargetConfig& targetConfig) {
Target::preActivationConfigure(targetConfig);
if (this->family.has_value()) {
this->avr8Interface->setFamily(this->family.value());
}
this->avr8Interface->configure(targetConfig);
}
@@ -53,7 +57,7 @@ void Avr8::postActivationConfigure() {
if (targetSignature != tdSignature) {
throw Exception("Failed to validate connected target - target signature mismatch.\nThe target signature"
"(\"" + targetSignature.toHex() + "\") does not match the AVR8 target description signature (\""
" (\"" + targetSignature.toHex() + "\") does not match the AVR8 target description signature (\""
+ tdSignature.toHex() + "\"). This will likely be due to an incorrect target name in the configuration file"
+ " (bloom.json)."
);
@@ -61,6 +65,11 @@ void Avr8::postActivationConfigure() {
}
void Avr8::postPromotionConfigure() {
if (!this->family.has_value()) {
throw Exception("Failed to resolve AVR8 family");
}
this->avr8Interface->setFamily(this->family.value());
this->avr8Interface->setTargetParameters(this->getTargetParameters());
}
@@ -276,7 +285,6 @@ TargetParameters& Avr8::getTargetParameters() {
if (!this->targetParameters.has_value()) {
assert(this->targetDescriptionFile.has_value());
this->targetParameters = TargetParameters();
this->targetParameters->family = this->family;
auto& propertyGroups = this->targetDescriptionFile->getPropertyGroupsMappedByName();
auto flashMemorySegment = this->targetDescriptionFile->getFlashMemorySegment();

View File

@@ -62,6 +62,7 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
explicit Avr8() = default;
Avr8(const std::string& name, const TargetSignature& signature): name(name) {
this->id = signature;
this->loadTargetDescriptionFile();
};
/*

View File

@@ -7,5 +7,8 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
MEGA,
XMEGA,
TINY,
DB,
DA,
DD,
};
}

View File

@@ -141,9 +141,9 @@ Family TargetDescriptionFile::getFamily() const {
throw Exception("Could not find target family name in target description file.");
}
if (familyNameToEnums.find(familyName) == familyNameToEnums.end()) {
if (!familyNameToEnums.contains(familyName)) {
throw Exception("Unknown family name in target description file.");
}
return familyNameToEnums.find(familyName)->second;
return familyNameToEnums.at(familyName);
}

View File

@@ -36,6 +36,9 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit::TargetDescription
{"avr tiny", Family::TINY},
{"tinyavr", Family::TINY},
{"tinyavr 2", Family::TINY},
{"avr da", Family::DA},
{"avr db", Family::DB},
{"avr dd", Family::DD},
};
};

View File

@@ -10,8 +10,6 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
{
struct TargetParameters
{
std::optional<Family> family;
std::optional<std::uint32_t> bootSectionStartAddress;
std::optional<std::uint32_t> gpRegisterStartAddress;
std::optional<std::uint32_t> gpRegisterSize;