Gigastar(2): Fix bootloaders steps
parent
ebf9409c18
commit
1b00c6a05b
|
|
@ -28,7 +28,8 @@ struct BootloaderPhase {
|
||||||
Finalize,
|
Finalize,
|
||||||
Reconnect,
|
Reconnect,
|
||||||
EnterBootloader,
|
EnterBootloader,
|
||||||
Wait
|
Wait,
|
||||||
|
EnterApplication
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual Type getType() const = 0;
|
virtual Type getType() const = 0;
|
||||||
|
|
@ -70,6 +71,16 @@ struct EnterBootloaderPhase : public BootloaderPhase {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct EnterApplicationPhase : public BootloaderPhase {
|
||||||
|
Type getType() const override {
|
||||||
|
return Type::EnterApplication;
|
||||||
|
}
|
||||||
|
|
||||||
|
ChipID chip;
|
||||||
|
|
||||||
|
EnterApplicationPhase(ChipID chip) : chip(chip) {}
|
||||||
|
};
|
||||||
|
|
||||||
struct FlashPhase : public BootloaderPhase {
|
struct FlashPhase : public BootloaderPhase {
|
||||||
Type getType() const override {
|
Type getType() const override {
|
||||||
return Type::Flash;
|
return Type::Flash;
|
||||||
|
|
|
||||||
|
|
@ -67,10 +67,23 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(useNewBootloader) {
|
if(useNewBootloader) {
|
||||||
|
auto mainChip = std::find_if(chipVersions.begin(), chipVersions.end(), [](const auto& chip) { return chip.name == "ZCHIP"; });
|
||||||
|
auto usbChip = std::find_if(chipVersions.begin(), chipVersions.end(), [](const auto& chip) { return chip.name == "USB ZCHIP"; });
|
||||||
|
|
||||||
|
ChipID mainChipID;
|
||||||
|
if(mainChip != chipVersions.end()) {
|
||||||
|
mainChipID = mainChip->id;
|
||||||
|
} else if(usbChip != chipVersions.end()) {
|
||||||
|
mainChipID = usbChip->id;
|
||||||
|
} else {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
BootloaderPipeline pipeline;
|
BootloaderPipeline pipeline;
|
||||||
for(const auto& version : chipVersions) {
|
for(const auto& version : chipVersions) {
|
||||||
pipeline.add<FlashPhase>(version.id, BootloaderCommunication::RADMultiChip);
|
pipeline.add<FlashPhase>(version.id, BootloaderCommunication::RADMultiChip);
|
||||||
}
|
}
|
||||||
|
pipeline.add<EnterApplicationPhase>(mainChipID);
|
||||||
pipeline.add<ReconnectPhase>();
|
pipeline.add<ReconnectPhase>();
|
||||||
pipeline.add<WaitPhase>(std::chrono::milliseconds(3000));
|
pipeline.add<WaitPhase>(std::chrono::milliseconds(3000));
|
||||||
return pipeline;
|
return pipeline;
|
||||||
|
|
|
||||||
|
|
@ -146,10 +146,23 @@ public:
|
||||||
|
|
||||||
BootloaderPipeline getBootloader() override {
|
BootloaderPipeline getBootloader() override {
|
||||||
auto chipVersions = getChipVersions();
|
auto chipVersions = getChipVersions();
|
||||||
|
auto mainChip = std::find_if(chipVersions.begin(), chipVersions.end(), [](const auto& chip) { return chip.name == "ZCHIP"; });
|
||||||
|
auto usbChip = std::find_if(chipVersions.begin(), chipVersions.end(), [](const auto& chip) { return chip.name == "USB ZCHIP"; });
|
||||||
|
|
||||||
|
ChipID mainChipID;
|
||||||
|
if(mainChip != chipVersions.end()) {
|
||||||
|
mainChipID = mainChip->id;
|
||||||
|
} else if(usbChip != chipVersions.end()) {
|
||||||
|
mainChipID = usbChip->id;
|
||||||
|
} else {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
BootloaderPipeline pipeline;
|
BootloaderPipeline pipeline;
|
||||||
for(const auto& version : chipVersions) {
|
for(const auto& version : chipVersions) {
|
||||||
pipeline.add<FlashPhase>(version.id, BootloaderCommunication::RADMultiChip);
|
pipeline.add<FlashPhase>(version.id, BootloaderCommunication::RADMultiChip);
|
||||||
}
|
}
|
||||||
|
pipeline.add<EnterApplicationPhase>(mainChipID);
|
||||||
pipeline.add<ReconnectPhase>();
|
pipeline.add<ReconnectPhase>();
|
||||||
pipeline.add<WaitPhase>(std::chrono::milliseconds(3000));
|
pipeline.add<WaitPhase>(std::chrono::milliseconds(3000));
|
||||||
return pipeline;
|
return pipeline;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue