continued reboot handler
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
This commit is contained in:
parent
a3f63e970f
commit
00eb5a2f1e
@ -170,15 +170,15 @@ void Q7STestTask::testProtHandler() {
|
|||||||
bool opPerformed = false;
|
bool opPerformed = false;
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
// If any chips are unlocked, lock them here
|
// If any chips are unlocked, lock them here
|
||||||
result = coreController->setBootCopyProtection(
|
result = coreController->setBootCopyProtection(xsc::Chip::ALL_CHIP, xsc::Copy::ALL_COPY, true,
|
||||||
CoreController::Chip::ALL_CHIP, CoreController::Copy::ALL_COPY, true, opPerformed, true);
|
opPerformed, true);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// unlock own copy
|
// unlock own copy
|
||||||
result = coreController->setBootCopyProtection(
|
result = coreController->setBootCopyProtection(xsc::Chip::SELF_CHIP, xsc::Copy::SELF_COPY, false,
|
||||||
CoreController::Chip::SELF_CHIP, CoreController::Copy::SELF_COPY, false, opPerformed, true);
|
opPerformed, true);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||||
}
|
}
|
||||||
@ -191,8 +191,8 @@ void Q7STestTask::testProtHandler() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// lock own copy
|
// lock own copy
|
||||||
result = coreController->setBootCopyProtection(
|
result = coreController->setBootCopyProtection(xsc::Chip::SELF_CHIP, xsc::Copy::SELF_COPY, true,
|
||||||
CoreController::Chip::SELF_CHIP, CoreController::Copy::SELF_COPY, true, opPerformed, true);
|
opPerformed, true);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||||
}
|
}
|
||||||
@ -205,8 +205,8 @@ void Q7STestTask::testProtHandler() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// unlock specific copy
|
// unlock specific copy
|
||||||
result = coreController->setBootCopyProtection(
|
result = coreController->setBootCopyProtection(xsc::Chip::CHIP_1, xsc::Copy::COPY_1, false,
|
||||||
CoreController::Chip::CHIP_1, CoreController::Copy::COPY_1, false, opPerformed, true);
|
opPerformed, true);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||||
}
|
}
|
||||||
@ -219,8 +219,8 @@ void Q7STestTask::testProtHandler() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// lock specific copy
|
// lock specific copy
|
||||||
result = coreController->setBootCopyProtection(
|
result = coreController->setBootCopyProtection(xsc::Chip::CHIP_1, xsc::Copy::COPY_1, true,
|
||||||
CoreController::Chip::CHIP_1, CoreController::Copy::COPY_1, true, opPerformed, true);
|
opPerformed, true);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||||
}
|
}
|
||||||
|
@ -22,8 +22,8 @@
|
|||||||
#include "bsp_q7s/memory/SdCardManager.h"
|
#include "bsp_q7s/memory/SdCardManager.h"
|
||||||
#include "bsp_q7s/memory/scratchApi.h"
|
#include "bsp_q7s/memory/scratchApi.h"
|
||||||
|
|
||||||
CoreController::Chip CoreController::CURRENT_CHIP = Chip::NO_CHIP;
|
xsc::Chip CoreController::CURRENT_CHIP = xsc::Chip::NO_CHIP;
|
||||||
CoreController::Copy CoreController::CURRENT_COPY = Copy::NO_COPY;
|
xsc::Copy CoreController::CURRENT_COPY = xsc::Copy::NO_COPY;
|
||||||
|
|
||||||
CoreController::CoreController(object_id_t objectId)
|
CoreController::CoreController(object_id_t objectId)
|
||||||
: ExtendedControllerBase(objectId, objects::NO_OBJECT, 5), opDivider(5) {
|
: ExtendedControllerBase(objectId, objects::NO_OBJECT, 5), opDivider(5) {
|
||||||
@ -700,22 +700,18 @@ ReturnValue_t CoreController::initBootCopy() {
|
|||||||
utility::handleSystemError(result, "CoreController::initBootCopy");
|
utility::handleSystemError(result, "CoreController::initBootCopy");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::ifstream file(CURR_COPY_FILE);
|
|
||||||
std::string line;
|
getCurrentBootCopy(CURRENT_CHIP, CURRENT_COPY);
|
||||||
std::getline(file, line);
|
|
||||||
std::istringstream iss(line);
|
|
||||||
int value = 0;
|
|
||||||
iss >> value;
|
|
||||||
CURRENT_CHIP = static_cast<Chip>(value);
|
|
||||||
iss >> value;
|
|
||||||
CURRENT_COPY = static_cast<Copy>(value);
|
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoreController::getCurrentBootCopy(Chip &chip, Copy ©) {
|
void CoreController::getCurrentBootCopy(xsc::Chip &chip, xsc::Copy ©) {
|
||||||
|
xsc_libnor_chip_t xscChip;
|
||||||
|
xsc_libnor_copy_t xscCopy;
|
||||||
|
xsc_boot_get_chip_copy(&xscChip, &xscCopy);
|
||||||
// Not really thread-safe but it does not need to be
|
// Not really thread-safe but it does not need to be
|
||||||
chip = CURRENT_CHIP;
|
chip = static_cast<xsc::Chip>(xscChip);
|
||||||
copy = CURRENT_COPY;
|
copy = static_cast<xsc::Copy>(xscCopy);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t CoreController::initWatchdogFifo() {
|
ReturnValue_t CoreController::initWatchdogFifo() {
|
||||||
@ -762,8 +758,8 @@ ReturnValue_t CoreController::actionPerformReboot(const uint8_t *data, size_t si
|
|||||||
SdCardManager::instance()->switchOffSdCard(sd::SdCard::SLOT_0);
|
SdCardManager::instance()->switchOffSdCard(sd::SdCard::SLOT_0);
|
||||||
SdCardManager::instance()->switchOffSdCard(sd::SdCard::SLOT_1);
|
SdCardManager::instance()->switchOffSdCard(sd::SdCard::SLOT_1);
|
||||||
// If any boot copies are unprotected
|
// If any boot copies are unprotected
|
||||||
ReturnValue_t retval =
|
ReturnValue_t retval = setBootCopyProtection(xsc::Chip::SELF_CHIP, xsc::Copy::SELF_COPY, true,
|
||||||
setBootCopyProtection(Chip::SELF_CHIP, Copy::SELF_COPY, true, protOpPerformed, false);
|
protOpPerformed, false);
|
||||||
if (retval == HasReturnvaluesIF::RETURN_OK and protOpPerformed) {
|
if (retval == HasReturnvaluesIF::RETURN_OK and protOpPerformed) {
|
||||||
sif::info << "Running slot was writeprotected before reboot" << std::endl;
|
sif::info << "Running slot was writeprotected before reboot" << std::endl;
|
||||||
}
|
}
|
||||||
@ -785,23 +781,24 @@ ReturnValue_t CoreController::actionPerformReboot(const uint8_t *data, size_t si
|
|||||||
// Check that the target chip and copy is writeprotected first
|
// Check that the target chip and copy is writeprotected first
|
||||||
generateChipStateFile();
|
generateChipStateFile();
|
||||||
// If any boot copies are unprotected, protect them here
|
// If any boot copies are unprotected, protect them here
|
||||||
auto tgtChip = static_cast<Chip>(data[1]);
|
auto tgtChip = static_cast<xsc::Chip>(data[1]);
|
||||||
auto tgtCopy = static_cast<Copy>(data[2]);
|
auto tgtCopy = static_cast<xsc::Copy>(data[2]);
|
||||||
|
|
||||||
ReturnValue_t retval = setBootCopyProtection(
|
ReturnValue_t retval =
|
||||||
static_cast<Chip>(data[1]), static_cast<Copy>(data[2]), true, protOpPerformed, false);
|
setBootCopyProtection(static_cast<xsc::Chip>(data[1]), static_cast<xsc::Copy>(data[2]), true,
|
||||||
|
protOpPerformed, false);
|
||||||
if (retval == HasReturnvaluesIF::RETURN_OK and protOpPerformed) {
|
if (retval == HasReturnvaluesIF::RETURN_OK and protOpPerformed) {
|
||||||
sif::info << "Target slot was writeprotected before reboot" << std::endl;
|
sif::info << "Target slot was writeprotected before reboot" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (tgtChip) {
|
switch (tgtChip) {
|
||||||
case (Chip::CHIP_0): {
|
case (xsc::Chip::CHIP_0): {
|
||||||
switch (tgtCopy) {
|
switch (tgtCopy) {
|
||||||
case (Copy::COPY_0): {
|
case (xsc::Copy::COPY_0): {
|
||||||
xsc_boot_copy(XSC_LIBNOR_CHIP_0, XSC_LIBNOR_COPY_NOMINAL);
|
xsc_boot_copy(XSC_LIBNOR_CHIP_0, XSC_LIBNOR_COPY_NOMINAL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (Copy::COPY_1): {
|
case (xsc::Copy::COPY_1): {
|
||||||
xsc_boot_copy(XSC_LIBNOR_CHIP_0, XSC_LIBNOR_COPY_GOLD);
|
xsc_boot_copy(XSC_LIBNOR_CHIP_0, XSC_LIBNOR_COPY_GOLD);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -811,13 +808,13 @@ ReturnValue_t CoreController::actionPerformReboot(const uint8_t *data, size_t si
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (Chip::CHIP_1): {
|
case (xsc::Chip::CHIP_1): {
|
||||||
switch (tgtCopy) {
|
switch (tgtCopy) {
|
||||||
case (Copy::COPY_0): {
|
case (xsc::Copy::COPY_0): {
|
||||||
xsc_boot_copy(XSC_LIBNOR_CHIP_1, XSC_LIBNOR_COPY_NOMINAL);
|
xsc_boot_copy(XSC_LIBNOR_CHIP_1, XSC_LIBNOR_COPY_NOMINAL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (Copy::COPY_1): {
|
case (xsc::Copy::COPY_1): {
|
||||||
xsc_boot_copy(XSC_LIBNOR_CHIP_1, XSC_LIBNOR_COPY_GOLD);
|
xsc_boot_copy(XSC_LIBNOR_CHIP_1, XSC_LIBNOR_COPY_GOLD);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -884,8 +881,8 @@ ReturnValue_t CoreController::generateChipStateFile() {
|
|||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t CoreController::setBootCopyProtection(Chip targetChip, Copy targetCopy, bool protect,
|
ReturnValue_t CoreController::setBootCopyProtection(xsc::Chip targetChip, xsc::Copy targetCopy,
|
||||||
bool &protOperationPerformed,
|
bool protect, bool &protOperationPerformed,
|
||||||
bool updateProtFile) {
|
bool updateProtFile) {
|
||||||
bool allChips = false;
|
bool allChips = false;
|
||||||
bool allCopies = false;
|
bool allCopies = false;
|
||||||
@ -894,14 +891,14 @@ ReturnValue_t CoreController::setBootCopyProtection(Chip targetChip, Copy target
|
|||||||
protOperationPerformed = false;
|
protOperationPerformed = false;
|
||||||
|
|
||||||
switch (targetChip) {
|
switch (targetChip) {
|
||||||
case (Chip::ALL_CHIP): {
|
case (xsc::Chip::ALL_CHIP): {
|
||||||
allChips = true;
|
allChips = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (Chip::NO_CHIP): {
|
case (xsc::Chip::NO_CHIP): {
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
case (Chip::SELF_CHIP): {
|
case (xsc::Chip::SELF_CHIP): {
|
||||||
selfChip = true;
|
selfChip = true;
|
||||||
targetChip = CURRENT_CHIP;
|
targetChip = CURRENT_CHIP;
|
||||||
break;
|
break;
|
||||||
@ -911,14 +908,14 @@ ReturnValue_t CoreController::setBootCopyProtection(Chip targetChip, Copy target
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch (targetCopy) {
|
switch (targetCopy) {
|
||||||
case (Copy::ALL_COPY): {
|
case (xsc::Copy::ALL_COPY): {
|
||||||
allCopies = true;
|
allCopies = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (Copy::NO_COPY): {
|
case (xsc::Copy::NO_COPY): {
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
case (Copy::SELF_COPY): {
|
case (xsc::Copy::SELF_COPY): {
|
||||||
selfCopy = true;
|
selfCopy = true;
|
||||||
targetCopy = CURRENT_COPY;
|
targetCopy = CURRENT_COPY;
|
||||||
break;
|
break;
|
||||||
@ -941,10 +938,10 @@ ReturnValue_t CoreController::setBootCopyProtection(Chip targetChip, Copy target
|
|||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CoreController::handleBootCopyProtAtIndex(Chip targetChip, Copy targetCopy, bool protect,
|
int CoreController::handleBootCopyProtAtIndex(xsc::Chip targetChip, xsc::Copy targetCopy,
|
||||||
bool &protOperationPerformed, bool selfChip,
|
bool protect, bool &protOperationPerformed,
|
||||||
bool selfCopy, bool allChips, bool allCopies,
|
bool selfChip, bool selfCopy, bool allChips,
|
||||||
uint8_t arrIdx) {
|
bool allCopies, uint8_t arrIdx) {
|
||||||
bool currentProt = protArray[arrIdx];
|
bool currentProt = protArray[arrIdx];
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
bool performOp = false;
|
bool performOp = false;
|
||||||
@ -957,22 +954,22 @@ int CoreController::handleBootCopyProtAtIndex(Chip targetChip, Copy targetCopy,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Chip currentChip;
|
xsc::Chip currentChip;
|
||||||
Copy currentCopy;
|
xsc::Copy currentCopy;
|
||||||
oss << "writeprotect ";
|
oss << "writeprotect ";
|
||||||
if (arrIdx == 0 or arrIdx == 1) {
|
if (arrIdx == 0 or arrIdx == 1) {
|
||||||
oss << "0 ";
|
oss << "0 ";
|
||||||
currentChip = Chip::CHIP_0;
|
currentChip = xsc::Chip::CHIP_0;
|
||||||
} else {
|
} else {
|
||||||
oss << "1 ";
|
oss << "1 ";
|
||||||
currentChip = Chip::CHIP_1;
|
currentChip = xsc::Chip::CHIP_1;
|
||||||
}
|
}
|
||||||
if (arrIdx == 0 or arrIdx == 2) {
|
if (arrIdx == 0 or arrIdx == 2) {
|
||||||
oss << "0 ";
|
oss << "0 ";
|
||||||
currentCopy = Copy::COPY_0;
|
currentCopy = xsc::Copy::COPY_0;
|
||||||
} else {
|
} else {
|
||||||
oss << "1 ";
|
oss << "1 ";
|
||||||
currentCopy = Copy::COPY_1;
|
currentCopy = xsc::Copy::COPY_1;
|
||||||
}
|
}
|
||||||
if (protect) {
|
if (protect) {
|
||||||
oss << "1";
|
oss << "1";
|
||||||
@ -1067,29 +1064,29 @@ ReturnValue_t CoreController::handleProtInfoUpdateLine(std::string nextLine) {
|
|||||||
uint8_t wordIdx = 0;
|
uint8_t wordIdx = 0;
|
||||||
uint8_t arrayIdx = 0;
|
uint8_t arrayIdx = 0;
|
||||||
istringstream iss(nextLine);
|
istringstream iss(nextLine);
|
||||||
Chip currentChip = Chip::CHIP_0;
|
xsc::Chip currentChip = xsc::Chip::CHIP_0;
|
||||||
Copy currentCopy = Copy::COPY_0;
|
xsc::Copy currentCopy = xsc::Copy::COPY_0;
|
||||||
while (iss >> word) {
|
while (iss >> word) {
|
||||||
if (wordIdx == 1) {
|
if (wordIdx == 1) {
|
||||||
currentChip = static_cast<Chip>(stoi(word));
|
currentChip = static_cast<xsc::Chip>(stoi(word));
|
||||||
}
|
}
|
||||||
if (wordIdx == 3) {
|
if (wordIdx == 3) {
|
||||||
currentCopy = static_cast<Copy>(stoi(word));
|
currentCopy = static_cast<xsc::Copy>(stoi(word));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wordIdx == 3) {
|
if (wordIdx == 3) {
|
||||||
if (currentChip == Chip::CHIP_0) {
|
if (currentChip == xsc::Chip::CHIP_0) {
|
||||||
if (currentCopy == Copy::COPY_0) {
|
if (currentCopy == xsc::Copy::COPY_0) {
|
||||||
arrayIdx = 0;
|
arrayIdx = 0;
|
||||||
} else if (currentCopy == Copy::COPY_1) {
|
} else if (currentCopy == xsc::Copy::COPY_1) {
|
||||||
arrayIdx = 1;
|
arrayIdx = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (currentChip == Chip::CHIP_1) {
|
else if (currentChip == xsc::Chip::CHIP_1) {
|
||||||
if (currentCopy == Copy::COPY_0) {
|
if (currentCopy == xsc::Copy::COPY_0) {
|
||||||
arrayIdx = 2;
|
arrayIdx = 2;
|
||||||
} else if (currentCopy == Copy::COPY_1) {
|
} else if (currentCopy == xsc::Copy::COPY_1) {
|
||||||
arrayIdx = 3;
|
arrayIdx = 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1150,132 +1147,115 @@ void CoreController::performRebootFileHandling(bool recreateFile) {
|
|||||||
}
|
}
|
||||||
std::string path = sdcMan->getCurrentMountPrefix(sdInfo.pref) + REBOOT_FILE;
|
std::string path = sdcMan->getCurrentMountPrefix(sdInfo.pref) + REBOOT_FILE;
|
||||||
if (not std::filesystem::exists(path) or recreateFile) {
|
if (not std::filesystem::exists(path) or recreateFile) {
|
||||||
std::ofstream rebootFile(path);
|
rebootFile.enabled = true;
|
||||||
if (rebootFile.is_open()) {
|
rebootFile.img00Cnt = 0;
|
||||||
// Initiate reboot file first. Reboot handling will be on on initialization
|
rebootFile.img01Cnt = 0;
|
||||||
rebootFile << "on: 1\nmaxcnt: " << static_cast<int>(DEFAULT_MAX_BOOT_CNT)
|
rebootFile.img10Cnt = 0;
|
||||||
<< "\nimg00: 0\nimg01: 0\nimg10: 0\nimg11: 0\n";
|
rebootFile.img11Cnt = 0;
|
||||||
}
|
rebootFile.lastChip = xsc::Chip::CHIP_0;
|
||||||
}
|
rebootFile.lastCopy = xsc::Copy::COPY_0;
|
||||||
xsc_libnor_chip_t chip;
|
rebootFile.bootFlag = false;
|
||||||
xsc_libnor_copy_t copy;
|
rewriteRebootFile(rebootFile);
|
||||||
xsc_boot_get_chip_copy(&chip, ©);
|
|
||||||
std::string selfMatch;
|
|
||||||
if (chip == XSC_LIBNOR_CHIP_0) {
|
|
||||||
if (copy == XSC_LIBNOR_COPY_NOMINAL) {
|
|
||||||
selfMatch = "00";
|
|
||||||
} else {
|
|
||||||
selfMatch = "01";
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (copy == XSC_LIBNOR_COPY_NOMINAL) {
|
if (not parseRebootFile(path, rebootFile)) {
|
||||||
selfMatch = "10";
|
performRebootFileHandling(true);
|
||||||
} else {
|
|
||||||
selfMatch = "11";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
uint8_t relevantBootCnt = 0;
|
|
||||||
bool on = true;
|
|
||||||
size_t maxCnt = DEFAULT_MAX_BOOT_CNT;
|
|
||||||
uint8_t bootCnt00 = 0;
|
|
||||||
uint8_t bootCnt01 = 0;
|
|
||||||
uint8_t bootCnt10 = 0;
|
|
||||||
uint8_t bootCnt11 = 0;
|
|
||||||
ifstream file(path);
|
|
||||||
string word;
|
|
||||||
|
|
||||||
string line;
|
if (rebootFile.bootFlag) {
|
||||||
uint8_t lineIdx = 0;
|
// Trigger event to inform ground that a reboot was triggered
|
||||||
while (std::getline(file, line)) {
|
|
||||||
istringstream iss(line);
|
|
||||||
switch (lineIdx) {
|
|
||||||
case 0: {
|
|
||||||
iss >> word;
|
|
||||||
if (word.find("on:") == string::npos) {
|
|
||||||
// invalid file
|
|
||||||
performRebootFileHandling(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
iss >> on;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 1: {
|
|
||||||
iss >> word;
|
|
||||||
if (word.find("maxcnt:") == string::npos) {
|
|
||||||
performRebootFileHandling(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
iss >> maxCnt;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 2: {
|
|
||||||
iss >> word;
|
|
||||||
if (word.find("img00:") == string::npos) {
|
|
||||||
performRebootFileHandling(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
iss >> bootCnt00;
|
|
||||||
if (word.find(selfMatch) != string::npos) {
|
|
||||||
relevantBootCnt = bootCnt00;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 3: {
|
|
||||||
iss >> word;
|
|
||||||
if (word.find("img01:") == string::npos) {
|
|
||||||
performRebootFileHandling(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
iss >> bootCnt01;
|
|
||||||
if (word.find(selfMatch) != string::npos) {
|
|
||||||
relevantBootCnt = bootCnt01;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 4: {
|
|
||||||
iss >> word;
|
|
||||||
if (word.find("img10:") == string::npos) {
|
|
||||||
performRebootFileHandling(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
iss >> bootCnt10;
|
|
||||||
if (word.find(selfMatch) != string::npos) {
|
|
||||||
relevantBootCnt = bootCnt10;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 5: {
|
|
||||||
iss >> word;
|
|
||||||
if (word.find("img11:") == string::npos) {
|
|
||||||
performRebootFileHandling(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
iss >> bootCnt11;
|
|
||||||
if (word.find(selfMatch) != string::npos) {
|
|
||||||
relevantBootCnt = bootCnt11;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
lineIdx++;
|
|
||||||
}
|
}
|
||||||
if (relevantBootCnt > maxCnt) {
|
|
||||||
|
if (rebootFile.relevantBootCnt > rebootFile.maxCount) {
|
||||||
// Reboot to other image
|
// Reboot to other image
|
||||||
determineAndExecuteReboot(copy, chip, bootCnt00, bootCnt01, bootCnt10, bootCnt11, maxCnt);
|
bool doReboot = false;
|
||||||
|
xsc_libnor_chip_t tgtChip;
|
||||||
|
xsc_libnor_copy_t tgtCopy;
|
||||||
|
determineAndExecuteReboot(rebootFile, doReboot, tgtChip, tgtCopy);
|
||||||
|
if (doReboot) {
|
||||||
|
#if OBSW_VERBOSE_LEVEL >= 1
|
||||||
|
sif::info << "Boot counter for image " << CURRENT_CHIP << " " << CURRENT_COPY
|
||||||
|
<< "too high. Rebooting to " << tgtChip << " " << tgtCopy << std::endl;
|
||||||
|
#endif
|
||||||
|
xsc_boot_copy(tgtChip, tgtCopy);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
doPerformRebootFileHandling = false;
|
doPerformRebootFileHandling = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoreController::determineAndExecuteReboot(xsc_libnor_copy_t copy, xsc_libnor_chip_t chip,
|
void CoreController::determineAndExecuteReboot(RebootFile &rf, bool &needsReboot,
|
||||||
uint8_t cnt00, uint8_t cnt01, uint8_t cnt10,
|
xsc_libnor_chip_t &tgtChip,
|
||||||
uint8_t cnt11, uint8_t maxCnt) {
|
xsc_libnor_copy_t &tgtCopy) {
|
||||||
xsc_libnor_chip_t tgtChip = XSC_LIBNOR_CHIP_0;
|
tgtChip = XSC_LIBNOR_CHIP_0;
|
||||||
xsc_libnor_copy_t tgtCopy = XSC_LIBNOR_COPY_NOMINAL;
|
tgtCopy = XSC_LIBNOR_COPY_NOMINAL;
|
||||||
if((copy == XSC_LIBNOR_COPY_GOLD) and (chip == XSC_LIBNOR_CHIP_1) and (cnt11 >= maxCnt)) {
|
needsReboot = false;
|
||||||
if(cnt10 >= maxCnt) {
|
if ((CURRENT_COPY == xsc::COPY_0) and (CURRENT_CHIP == xsc::CHIP_0) and
|
||||||
if(cnt00 >= maxCnt) {
|
(rf.img00Cnt >= rf.maxCount)) {
|
||||||
if(cnt01 >= maxCnt) {
|
needsReboot = true;
|
||||||
|
if (rf.img01Cnt >= rf.maxCount) {
|
||||||
|
if (rf.img10Cnt >= rf.maxCount) {
|
||||||
|
if (rf.img11Cnt >= rf.maxCount) {
|
||||||
|
// Can't really do much here. Stay on image
|
||||||
|
sif::warning << "All reboot counts too high, but already on fallback image" << std::endl;
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
tgtCopy = XSC_LIBNOR_COPY_GOLD;
|
||||||
|
tgtChip = XSC_LIBNOR_CHIP_1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tgtCopy = XSC_LIBNOR_COPY_GOLD;
|
||||||
|
tgtChip = XSC_LIBNOR_CHIP_0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tgtCopy = XSC_LIBNOR_COPY_GOLD;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((CURRENT_COPY == xsc::COPY_0) and (CURRENT_CHIP == xsc::CHIP_1) and
|
||||||
|
(rf.img01Cnt >= rf.maxCount)) {
|
||||||
|
needsReboot = true;
|
||||||
|
if (rf.img00Cnt >= rf.maxCount) {
|
||||||
|
if (rf.img10Cnt >= rf.maxCount) {
|
||||||
|
if (rf.img11Cnt >= rf.maxCount) {
|
||||||
|
// Reboot to fallback image
|
||||||
|
} else {
|
||||||
|
tgtChip = XSC_LIBNOR_CHIP_1;
|
||||||
|
tgtCopy = XSC_LIBNOR_COPY_GOLD;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tgtChip = XSC_LIBNOR_CHIP_1;
|
||||||
|
tgtCopy = XSC_LIBNOR_COPY_NOMINAL;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Reboot on fallback image
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((CURRENT_COPY == xsc::COPY_1) and (CURRENT_CHIP == xsc::CHIP_0) and
|
||||||
|
(rf.img10Cnt >= rf.maxCount)) {
|
||||||
|
needsReboot = true;
|
||||||
|
if (rf.img11Cnt >= rf.maxCount) {
|
||||||
|
if (rf.img00Cnt >= rf.maxCount) {
|
||||||
|
if (rf.img01Cnt >= rf.maxCount) {
|
||||||
|
// Reboot to fallback image
|
||||||
|
} else {
|
||||||
|
tgtChip = XSC_LIBNOR_CHIP_0;
|
||||||
|
tgtCopy = XSC_LIBNOR_COPY_GOLD;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tgtChip = XSC_LIBNOR_CHIP_0;
|
||||||
|
tgtCopy = XSC_LIBNOR_COPY_NOMINAL;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tgtCopy = XSC_LIBNOR_COPY_GOLD;
|
||||||
|
tgtChip = XSC_LIBNOR_CHIP_1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((CURRENT_COPY == xsc::COPY_1) and (CURRENT_CHIP == xsc::CHIP_1) and
|
||||||
|
(rf.img11Cnt >= rf.maxCount)) {
|
||||||
|
needsReboot = true;
|
||||||
|
if (rf.img10Cnt >= rf.maxCount) {
|
||||||
|
if (rf.img00Cnt >= rf.maxCount) {
|
||||||
|
if (rf.img01Cnt >= rf.maxCount) {
|
||||||
// Reboot to fallback image
|
// Reboot to fallback image
|
||||||
} else {
|
} else {
|
||||||
tgtChip = XSC_LIBNOR_CHIP_0;
|
tgtChip = XSC_LIBNOR_CHIP_0;
|
||||||
@ -1290,24 +1270,150 @@ void CoreController::determineAndExecuteReboot(xsc_libnor_copy_t copy, xsc_libno
|
|||||||
tgtCopy = XSC_LIBNOR_COPY_NOMINAL;
|
tgtCopy = XSC_LIBNOR_COPY_NOMINAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if((copy == XSC_LIBNOR_COPY_NOMINAL) and (chip == XSC_LIBNOR_CHIP_0) and (cnt00 >= maxCnt)) {
|
}
|
||||||
if(cnt01 >= maxCnt) {
|
|
||||||
if(cnt10 >= maxCnt) {
|
bool CoreController::parseRebootFile(std::string path, RebootFile &rf) {
|
||||||
if(cnt11 >= maxCnt) {
|
using namespace std;
|
||||||
// Can't really do much here. Stay on image
|
std::string selfMatch;
|
||||||
sif::warning << "All reboot counts too high, but already on fallback image" << std::endl;
|
if (CURRENT_CHIP == xsc::CHIP_0) {
|
||||||
return;
|
if (CURRENT_COPY == xsc::COPY_0) {
|
||||||
} else {
|
selfMatch = "00";
|
||||||
tgtChip = XSC_LIBNOR_CHIP_1;
|
|
||||||
tgtCopy = XSC_LIBNOR_COPY_NOMINAL;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
tgtChip = XSC_LIBNOR_CHIP_1;
|
|
||||||
tgtCopy = XSC_LIBNOR_COPY_GOLD;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
tgtCopy = XSC_LIBNOR_COPY_GOLD;
|
selfMatch = "01";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (CURRENT_COPY == xsc::COPY_0) {
|
||||||
|
selfMatch = "10";
|
||||||
|
} else {
|
||||||
|
selfMatch = "11";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
xsc_boot_copy(tgtChip, tgtCopy);
|
ifstream file(path);
|
||||||
|
string word;
|
||||||
|
string line;
|
||||||
|
uint8_t lineIdx = 0;
|
||||||
|
while (std::getline(file, line)) {
|
||||||
|
istringstream iss(line);
|
||||||
|
switch (lineIdx) {
|
||||||
|
case 0: {
|
||||||
|
iss >> word;
|
||||||
|
if (word.find("on:") == string::npos) {
|
||||||
|
// invalid file
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
iss >> rf.enabled;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 1: {
|
||||||
|
iss >> word;
|
||||||
|
if (word.find("maxcnt:") == string::npos) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
iss >> rf.maxCount;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 2: {
|
||||||
|
iss >> word;
|
||||||
|
if (word.find("img00:") == string::npos) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
iss >> rf.img00Cnt;
|
||||||
|
if (word.find(selfMatch) != string::npos) {
|
||||||
|
rf.relevantBootCnt = rf.img00Cnt;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 3: {
|
||||||
|
iss >> word;
|
||||||
|
if (word.find("img01:") == string::npos) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
iss >> rf.img01Cnt;
|
||||||
|
if (word.find(selfMatch) != string::npos) {
|
||||||
|
rf.relevantBootCnt = rf.img01Cnt;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 4: {
|
||||||
|
iss >> word;
|
||||||
|
if (word.find("img10:") == string::npos) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
iss >> rf.img10Cnt;
|
||||||
|
if (word.find(selfMatch) != string::npos) {
|
||||||
|
rf.relevantBootCnt = rf.img10Cnt;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 5: {
|
||||||
|
iss >> word;
|
||||||
|
if (word.find("img11:") == string::npos) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
iss >> rf.img11Cnt;
|
||||||
|
if (word.find(selfMatch) != string::npos) {
|
||||||
|
rf.relevantBootCnt = rf.img11Cnt;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 6: {
|
||||||
|
iss >> word;
|
||||||
|
if (word.find("bootflag:") == string::npos) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
iss >> rf.bootFlag;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 7: {
|
||||||
|
iss >> word;
|
||||||
|
if (word.find("bootflag:") == string::npos) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 8: {
|
||||||
|
iss >> word;
|
||||||
|
uint8_t copyRaw = 0;
|
||||||
|
uint8_t chipRaw = 0;
|
||||||
|
if (word.find("last:") == string::npos) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
iss >> chipRaw;
|
||||||
|
if (iss.fail()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
iss >> copyRaw;
|
||||||
|
if (iss.fail()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (chipRaw > 1 or copyRaw > 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
rf.lastChip = static_cast<xsc::Chip>(chipRaw);
|
||||||
|
rf.lastCopy = static_cast<xsc::Copy>(copyRaw);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (iss.fail()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
lineIdx++;
|
||||||
|
}
|
||||||
|
if (lineIdx < 8) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CoreController::rewriteRebootFile(RebootFile file) {
|
||||||
|
std::string path = sdcMan->getCurrentMountPrefix(sdInfo.pref) + REBOOT_FILE;
|
||||||
|
std::ofstream rebootFile(path);
|
||||||
|
if (rebootFile.is_open()) {
|
||||||
|
// Initiate reboot file first. Reboot handling will be on on initialization
|
||||||
|
rebootFile << "on: " << file.enabled << "\nmaxcnt: " << file.maxCount
|
||||||
|
<< "\nimg00: " << file.img00Cnt << "\nimg01: " << file.img01Cnt
|
||||||
|
<< "\nimg10: " << file.img10Cnt << "\nimg11: " << file.img11Cnt
|
||||||
|
<< "\nbootflag: " << file.bootFlag << "\nlast: " << file.lastChip << " "
|
||||||
|
<< file.lastCopy << "\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,23 +1,44 @@
|
|||||||
#ifndef BSP_Q7S_CORE_CORECONTROLLER_H_
|
#ifndef BSP_Q7S_CORE_CORECONTROLLER_H_
|
||||||
#define BSP_Q7S_CORE_CORECONTROLLER_H_
|
#define BSP_Q7S_CORE_CORECONTROLLER_H_
|
||||||
|
|
||||||
#include "bsp_q7s/memory/SdCardManager.h"
|
|
||||||
#include "events/subsystemIdRanges.h"
|
|
||||||
|
|
||||||
#include <fsfw/globalfunctions/PeriodicOperationDivider.h>
|
#include <fsfw/globalfunctions/PeriodicOperationDivider.h>
|
||||||
#include "fsfw/controller/ExtendedControllerBase.h"
|
#include <libxiphos.h>
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <libxiphos.h>
|
|
||||||
|
#include "bsp_q7s/memory/SdCardManager.h"
|
||||||
|
#include "events/subsystemIdRanges.h"
|
||||||
|
#include "fsfw/controller/ExtendedControllerBase.h"
|
||||||
|
|
||||||
class Timer;
|
class Timer;
|
||||||
class SdCardManager;
|
class SdCardManager;
|
||||||
|
|
||||||
|
namespace xsc {
|
||||||
|
|
||||||
|
enum Chip : uint8_t { CHIP_0, CHIP_1, NO_CHIP, SELF_CHIP, ALL_CHIP };
|
||||||
|
enum Copy : uint8_t { COPY_0, COPY_1, NO_COPY, SELF_COPY, ALL_COPY };
|
||||||
|
|
||||||
|
} // namespace xsc
|
||||||
|
|
||||||
|
struct RebootFile {
|
||||||
|
static constexpr uint8_t DEFAULT_MAX_BOOT_CNT = 10;
|
||||||
|
|
||||||
|
bool enabled = false;
|
||||||
|
size_t maxCount = DEFAULT_MAX_BOOT_CNT;
|
||||||
|
uint8_t img00Cnt = 0;
|
||||||
|
uint8_t img01Cnt = 0;
|
||||||
|
uint8_t img10Cnt = 0;
|
||||||
|
uint8_t img11Cnt = 0;
|
||||||
|
uint8_t relevantBootCnt = 0;
|
||||||
|
bool bootFlag = false;
|
||||||
|
xsc::Chip lastChip = xsc::Chip::CHIP_0;
|
||||||
|
xsc::Copy lastCopy = xsc::Copy::COPY_0;
|
||||||
|
};
|
||||||
|
|
||||||
class CoreController : public ExtendedControllerBase {
|
class CoreController : public ExtendedControllerBase {
|
||||||
public:
|
public:
|
||||||
enum Chip : uint8_t { CHIP_0, CHIP_1, NO_CHIP, SELF_CHIP, ALL_CHIP };
|
static xsc::Chip CURRENT_CHIP;
|
||||||
|
static xsc::Copy CURRENT_COPY;
|
||||||
enum Copy : uint8_t { COPY_0, COPY_1, NO_COPY, SELF_COPY, ALL_COPY };
|
|
||||||
|
|
||||||
static constexpr char CHIP_PROT_SCRIPT[] = "/home/root/scripts/get-chip-prot-status.sh";
|
static constexpr char CHIP_PROT_SCRIPT[] = "/home/root/scripts/get-chip-prot-status.sh";
|
||||||
static constexpr char CHIP_STATE_FILE[] = "/tmp/chip_prot_status.txt";
|
static constexpr char CHIP_STATE_FILE[] = "/tmp/chip_prot_status.txt";
|
||||||
@ -25,8 +46,6 @@ class CoreController : public ExtendedControllerBase {
|
|||||||
static constexpr char VERSION_FILE[] = "/conf/version.txt";
|
static constexpr char VERSION_FILE[] = "/conf/version.txt";
|
||||||
static constexpr char REBOOT_FILE[] = "/conf/reboot.txt";
|
static constexpr char REBOOT_FILE[] = "/conf/reboot.txt";
|
||||||
|
|
||||||
static constexpr uint8_t DEFAULT_MAX_BOOT_CNT = 10;
|
|
||||||
|
|
||||||
static constexpr ActionId_t LIST_DIRECTORY_INTO_FILE = 0;
|
static constexpr ActionId_t LIST_DIRECTORY_INTO_FILE = 0;
|
||||||
static constexpr ActionId_t REBOOT_OBC = 32;
|
static constexpr ActionId_t REBOOT_OBC = 32;
|
||||||
static constexpr ActionId_t MOUNT_OTHER_COPY = 33;
|
static constexpr ActionId_t MOUNT_OTHER_COPY = 33;
|
||||||
@ -54,7 +73,7 @@ class CoreController : public ExtendedControllerBase {
|
|||||||
*/
|
*/
|
||||||
static ReturnValue_t generateChipStateFile();
|
static ReturnValue_t generateChipStateFile();
|
||||||
static ReturnValue_t incrementAllocationFailureCount();
|
static ReturnValue_t incrementAllocationFailureCount();
|
||||||
static void getCurrentBootCopy(Chip& chip, Copy& copy);
|
static void getCurrentBootCopy(xsc::Chip& chip, xsc::Copy& copy);
|
||||||
|
|
||||||
ReturnValue_t updateProtInfo(bool regenerateChipStateFile = true);
|
ReturnValue_t updateProtInfo(bool regenerateChipStateFile = true);
|
||||||
|
|
||||||
@ -69,15 +88,12 @@ class CoreController : public ExtendedControllerBase {
|
|||||||
* @param updateProtFile Specify whether the protection info file is updated
|
* @param updateProtFile Specify whether the protection info file is updated
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ReturnValue_t setBootCopyProtection(Chip targetChip, Copy targetCopy, bool protect,
|
ReturnValue_t setBootCopyProtection(xsc::Chip targetChip, xsc::Copy targetCopy, bool protect,
|
||||||
bool& protOperationPerformed, bool updateProtFile = true);
|
bool& protOperationPerformed, bool updateProtFile = true);
|
||||||
|
|
||||||
bool sdInitFinished() const;
|
bool sdInitFinished() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static Chip CURRENT_CHIP;
|
|
||||||
static Copy CURRENT_COPY;
|
|
||||||
|
|
||||||
// Designated value for rechecking FIFO open
|
// Designated value for rechecking FIFO open
|
||||||
static constexpr int RETRY_FIFO_OPEN = -2;
|
static constexpr int RETRY_FIFO_OPEN = -2;
|
||||||
int watchdogFifoFd = 0;
|
int watchdogFifoFd = 0;
|
||||||
@ -128,6 +144,7 @@ class CoreController : public ExtendedControllerBase {
|
|||||||
sd::SdState commandedState = sd::SdState::OFF;
|
sd::SdState commandedState = sd::SdState::OFF;
|
||||||
};
|
};
|
||||||
SdInfo sdInfo;
|
SdInfo sdInfo;
|
||||||
|
RebootFile rebootFile = {};
|
||||||
bool doPerformRebootFileHandling = true;
|
bool doPerformRebootFileHandling = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -168,11 +185,13 @@ class CoreController : public ExtendedControllerBase {
|
|||||||
void performWatchdogControlOperation();
|
void performWatchdogControlOperation();
|
||||||
|
|
||||||
ReturnValue_t handleProtInfoUpdateLine(std::string nextLine);
|
ReturnValue_t handleProtInfoUpdateLine(std::string nextLine);
|
||||||
int handleBootCopyProtAtIndex(Chip targetChip, Copy targetCopy, bool protect,
|
int handleBootCopyProtAtIndex(xsc::Chip targetChip, xsc::Copy targetCopy, bool protect,
|
||||||
bool& protOperationPerformed, bool selfChip, bool selfCopy,
|
bool& protOperationPerformed, bool selfChip, bool selfCopy,
|
||||||
bool allChips, bool allCopies, uint8_t arrIdx);
|
bool allChips, bool allCopies, uint8_t arrIdx);
|
||||||
void determineAndExecuteReboot(xsc_libnor_copy_t copy, xsc_libnor_chip_t chip, uint8_t cnt00,
|
void determineAndExecuteReboot(RebootFile& rf, bool& needsReboot, xsc_libnor_chip_t& tgtChip,
|
||||||
uint8_t cnt01, uint8_t cnt10, uint8_t cnt11, uint8_t maxCnt);
|
xsc_libnor_copy_t& tgtCopy);
|
||||||
|
bool parseRebootFile(std::string path, RebootFile& file);
|
||||||
|
void rewriteRebootFile(RebootFile file);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* BSP_Q7S_CORE_CORECONTROLLER_H_ */
|
#endif /* BSP_Q7S_CORE_CORECONTROLLER_H_ */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user