v1.10.0 #220

Merged
meierj merged 592 commits from develop into main 2022-04-22 07:42:20 +02:00
3 changed files with 55 additions and 13 deletions
Showing only changes of commit fa93ca4dc0 - Show all commits

View File

@ -11,7 +11,6 @@ target_link_libraries(${SIMPLE_OBSW_NAME} PUBLIC
target_compile_definitions(${SIMPLE_OBSW_NAME} PRIVATE "Q7S_SIMPLE_MODE") target_compile_definitions(${SIMPLE_OBSW_NAME} PRIVATE "Q7S_SIMPLE_MODE")
add_subdirectory(simple) add_subdirectory(simple)
target_sources(${OBSW_NAME} PUBLIC target_sources(${OBSW_NAME} PUBLIC
main.cpp main.cpp
) )

View File

@ -16,6 +16,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
#include <libxiphos.h>
#include <filesystem> #include <filesystem>
@ -691,7 +692,7 @@ ReturnValue_t CoreController::actionListDirectoryIntoFile(ActionId_t actionId,
ReturnValue_t CoreController::initBootCopy() { ReturnValue_t CoreController::initBootCopy() {
if (not std::filesystem::exists(CURR_COPY_FILE)) { 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 // not happen normally
std::string cmd = "xsc_boot_copy > " + std::string(CURR_COPY_FILE); std::string cmd = "xsc_boot_copy > " + std::string(CURR_COPY_FILE);
int result = std::system(cmd.c_str()); 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; return HasActionsIF::EXECUTION_FINISHED;
} }
if (size < 3) { if (size < 3 or (data[1] > 1 or data[2] > 1)) {
return HasActionsIF::INVALID_PARAMETERS; return HasActionsIF::INVALID_PARAMETERS;
} }
#if OBSW_VERBOSE_LEVEL >= 1 #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 // 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 tgtCopy = static_cast<Copy>(data[2]);
ReturnValue_t retval = setBootCopyProtection( ReturnValue_t retval = setBootCopyProtection(
static_cast<Chip>(data[1]), static_cast<Copy>(data[2]), true, protOpPerformed, false); static_cast<Chip>(data[1]), static_cast<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;
} }
// The second byte in data is the target chip, the third byte is the target copy switch(tgtChip) {
std::string cmdString = case(Chip::CHIP_0): {
"xsc_boot_copy " + std::to_string(data[1]) + " " + std::to_string(data[2]); switch(tgtCopy) {
int result = std::system(cmdString.c_str()); case(Copy::COPY_0): {
if (result != 0) { xsc_boot_copy(XSC_LIBNOR_CHIP_0, XSC_LIBNOR_COPY_NOMINAL);
utility::handleSystemError(result, "CoreController::executeAction"); break;
return HasReturnvaluesIF::RETURN_FAILED; }
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() {} CoreController::~CoreController() {}

View File

@ -81,12 +81,23 @@ set(CMAKE_PREFIX_PATH
# "${SYSROOT_PATH}/usr/lib/${CROSS_COMPILE}" # "${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 set(CMAKE_C_FLAGS
"-mcpu=cortex-a9 -mfpu=neon-vfpv3 -mfloat-abi=hard ${COMMON_FLAGS} -lgpiod" ${C_FLAGS}
CACHE STRING "C flags for Q7S" CACHE STRING "C flags for Q7S"
) )
set(CMAKE_CXX_FLAGS set(CMAKE_CXX_FLAGS
"${CMAKE_C_FLAGS}" "${CMAKE_C_FLAGS}"
CACHE STRING "CPP flags for Q7S" CACHE STRING "CPP flags for Q7S"
) )