link libxiphos and use it for reboot
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
61b5836acd
commit
fa93ca4dc0
@ -11,7 +11,6 @@ target_link_libraries(${SIMPLE_OBSW_NAME} PUBLIC
|
||||
target_compile_definitions(${SIMPLE_OBSW_NAME} PRIVATE "Q7S_SIMPLE_MODE")
|
||||
add_subdirectory(simple)
|
||||
|
||||
|
||||
target_sources(${OBSW_NAME} PUBLIC
|
||||
main.cpp
|
||||
)
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <libxiphos.h>
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
@ -691,7 +692,7 @@ ReturnValue_t CoreController::actionListDirectoryIntoFile(ActionId_t actionId,
|
||||
|
||||
ReturnValue_t CoreController::initBootCopy() {
|
||||
if (not std::filesystem::exists(CURR_COPY_FILE)) {
|
||||
// Thils file is created by the systemd service eive-early-config so this should
|
||||
// This file is created by the systemd service eive-early-config so this should
|
||||
// not happen normally
|
||||
std::string cmd = "xsc_boot_copy > " + std::string(CURR_COPY_FILE);
|
||||
int result = std::system(cmd.c_str());
|
||||
@ -773,7 +774,7 @@ ReturnValue_t CoreController::actionPerformReboot(const uint8_t *data, size_t si
|
||||
}
|
||||
return HasActionsIF::EXECUTION_FINISHED;
|
||||
}
|
||||
if (size < 3) {
|
||||
if (size < 3 or (data[1] > 1 or data[2] > 1)) {
|
||||
return HasActionsIF::INVALID_PARAMETERS;
|
||||
}
|
||||
#if OBSW_VERBOSE_LEVEL >= 1
|
||||
@ -784,21 +785,52 @@ ReturnValue_t CoreController::actionPerformReboot(const uint8_t *data, size_t si
|
||||
// Check that the target chip and copy is writeprotected first
|
||||
generateChipStateFile();
|
||||
// If any boot copies are unprotected, protect them here
|
||||
auto tgtChip = static_cast<Chip>(data[1]);
|
||||
auto tgtCopy = static_cast<Copy>(data[2]);
|
||||
|
||||
ReturnValue_t retval = setBootCopyProtection(
|
||||
static_cast<Chip>(data[1]), static_cast<Copy>(data[2]), true, protOpPerformed, false);
|
||||
if (retval == HasReturnvaluesIF::RETURN_OK and protOpPerformed) {
|
||||
sif::info << "Target slot was writeprotected before reboot" << std::endl;
|
||||
}
|
||||
|
||||
// The second byte in data is the target chip, the third byte is the target copy
|
||||
std::string cmdString =
|
||||
"xsc_boot_copy " + std::to_string(data[1]) + " " + std::to_string(data[2]);
|
||||
int result = std::system(cmdString.c_str());
|
||||
if (result != 0) {
|
||||
utility::handleSystemError(result, "CoreController::executeAction");
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
switch(tgtChip) {
|
||||
case(Chip::CHIP_0): {
|
||||
switch(tgtCopy) {
|
||||
case(Copy::COPY_0): {
|
||||
xsc_boot_copy(XSC_LIBNOR_CHIP_0, XSC_LIBNOR_COPY_NOMINAL);
|
||||
break;
|
||||
}
|
||||
case(Copy::COPY_1): {
|
||||
xsc_boot_copy(XSC_LIBNOR_CHIP_0, XSC_LIBNOR_COPY_GOLD);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return HasActionsIF::EXECUTION_FINISHED;
|
||||
case(Chip::CHIP_1): {
|
||||
switch(tgtCopy) {
|
||||
case(Copy::COPY_0): {
|
||||
xsc_boot_copy(XSC_LIBNOR_CHIP_1, XSC_LIBNOR_COPY_NOMINAL);
|
||||
break;
|
||||
}
|
||||
case(Copy::COPY_1): {
|
||||
xsc_boot_copy(XSC_LIBNOR_CHIP_1, XSC_LIBNOR_COPY_GOLD);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
|
||||
CoreController::~CoreController() {}
|
||||
|
@ -81,8 +81,19 @@ set(CMAKE_PREFIX_PATH
|
||||
# "${SYSROOT_PATH}/usr/lib/${CROSS_COMPILE}"
|
||||
)
|
||||
|
||||
set(C_FLAGS
|
||||
-mcpu=cortex-a9
|
||||
-mfpu=neon-vfpv3
|
||||
-mfloat-abi=hard
|
||||
${COMMON_FLAGS}
|
||||
-lgpiod
|
||||
-lxiphos
|
||||
)
|
||||
|
||||
string (REPLACE ";" " " C_FLAGS "${C_FLAGS}")
|
||||
|
||||
set(CMAKE_C_FLAGS
|
||||
"-mcpu=cortex-a9 -mfpu=neon-vfpv3 -mfloat-abi=hard ${COMMON_FLAGS} -lgpiod"
|
||||
${C_FLAGS}
|
||||
CACHE STRING "C flags for Q7S"
|
||||
)
|
||||
set(CMAKE_CXX_FLAGS
|
||||
|
Loading…
Reference in New Issue
Block a user