Device: RAD-Gigastar and RAD-Gigastar 2: Fix bootloader pipeline

This commit is contained in:
Max Brombach
2026-10-02 14:28:40 -04:00
committed by Kyle Schwarz
parent f4836f279f
commit 3932b54947
3 changed files with 51 additions and 4 deletions
+3 -2
View File
@@ -91,9 +91,10 @@ struct FlashPhase : public BootloaderPhase {
bool authenticate = true; bool authenticate = true;
bool encrypt = true; bool encrypt = true;
bool checkOutOfDate = true; bool checkOutOfDate = true;
uint8_t slot = UINT8_MAX;
FlashPhase(ChipID chip, BootloaderCommunication comm, bool authenticate = true, bool encrypt = true, bool checkOutOfDate = true) FlashPhase(ChipID chip, BootloaderCommunication comm, bool authenticate = true, bool encrypt = true, bool checkOutOfDate = true, uint8_t slot = UINT8_MAX)
: chip(chip), comm(comm), authenticate(authenticate), encrypt(encrypt), checkOutOfDate(checkOutOfDate) {} : chip(chip), comm(comm), authenticate(authenticate), encrypt(encrypt), checkOutOfDate(checkOutOfDate), slot(slot) {}
}; };
enum class BootloaderSetting { enum class BootloaderSetting {
@@ -87,9 +87,32 @@ public:
} }
BootloaderPipeline pipeline; BootloaderPipeline pipeline;
auto compVersions = getComponentVersions();
for(size_t i = 0; i < chipVersions.size(); i++) { for(size_t i = 0; i < chipVersions.size(); i++) {
const auto& version = chipVersions[i]; const auto& version = chipVersions[i];
pipeline.add<FlashPhase>(version.id, BootloaderCommunication::RADMultiChip, i == 0); auto it = compVersions.begin();
std::vector<ComponentVersion> sameIdComponents;
while(it != compVersions.end()) {
it = std::find_if(it, compVersions.end(), [&version](const auto& component) {
return (ChipID)component.identifier == version.id;
});
if (it != compVersions.end()) {
sameIdComponents.push_back(*it);
it++;
}
}
if (sameIdComponents.size() > 1) {
std::vector<ComponentVersion> tempCompVersions;
for (const auto& component : compVersions) {
if ((ChipID)component.identifier != version.id || component.expansionSlot != sameIdComponents[0].expansionSlot) {
tempCompVersions.push_back(component);
}
}
compVersions = std::move(tempCompVersions);
}
if (!sameIdComponents.empty()) {
pipeline.add<FlashPhase>(version.id, BootloaderCommunication::RADMultiChip, i == 0, true, true, sameIdComponents[0].expansionSlot);
}
} }
pipeline.add<EnterApplicationPhase>(mainChipID); pipeline.add<EnterApplicationPhase>(mainChipID);
pipeline.add<WaitPhase>(std::chrono::milliseconds(3000)); pipeline.add<WaitPhase>(std::chrono::milliseconds(3000));
@@ -171,9 +171,32 @@ public:
} }
BootloaderPipeline pipeline; BootloaderPipeline pipeline;
auto compVersions = getComponentVersions();
for(size_t i = 0; i < chipVersions.size(); i++) { for(size_t i = 0; i < chipVersions.size(); i++) {
const auto& version = chipVersions[i]; const auto& version = chipVersions[i];
pipeline.add<FlashPhase>(version.id, BootloaderCommunication::RADMultiChip, i == 0); auto it = compVersions.begin();
std::vector<ComponentVersion> sameIdComponents;
while(it != compVersions.end()) {
it = std::find_if(it, compVersions.end(), [&version](const auto& component) {
return (ChipID)component.identifier == version.id;
});
if (it != compVersions.end()) {
sameIdComponents.push_back(*it);
it++;
}
}
if (sameIdComponents.size() > 1) {
std::vector<ComponentVersion> tempCompVersions;
for (const auto& component : compVersions) {
if ((ChipID)component.identifier != version.id || component.expansionSlot != sameIdComponents[0].expansionSlot) {
tempCompVersions.push_back(component);
}
}
compVersions = std::move(tempCompVersions);
}
if (!sameIdComponents.empty()) {
pipeline.add<FlashPhase>(version.id, BootloaderCommunication::RADMultiChip, i == 0, true, true, sameIdComponents[0].expansionSlot);
}
} }
pipeline.add<EnterApplicationPhase>(mainChipID); pipeline.add<EnterApplicationPhase>(mainChipID);
pipeline.add<WaitPhase>(std::chrono::milliseconds(3000)); pipeline.add<WaitPhase>(std::chrono::milliseconds(3000));