From 1a4f907925af1c414cad1b89d05fb0ebd3021587 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 28 Jul 2021 17:48:08 +0200 Subject: [PATCH] moved sd card init, more functions static now --- README.md | 2 +- bsp_q7s/core/CoreController.cpp | 23 +++++++++++++---------- bsp_q7s/core/CoreController.h | 2 +- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index a174fbf1..d71db451 100644 --- a/README.md +++ b/README.md @@ -318,7 +318,7 @@ wget https://eive-cloud.irs.uni-stuttgart.de/index.php/s/rfoaistRd67yBbH/downloa or the following command for Linux (could be useful for CI/CD) ```sh -wget https://eive-cloud.irs.uni-stuttgart.de/index.php/s/2Fp2ag6NGnbtAsK/download/gcc-arm-linux-gnueabi.tar.gz +wget https://eive-cloud.irs.uni-stuttgart.de/index.php/s/MRaeA2XnMXpZ5Pp/download/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf.tar.xz ``` ## Installing CMake and MSYS2 on Windows diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index d6555f95..5d99d3ec 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -20,6 +20,18 @@ CoreController::Copy CoreController::currentCopy = Copy::NO_COPY; CoreController::CoreController(object_id_t objectId): ExtendedControllerBase(objectId, objects::NO_OBJECT, 5) { + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; + try { + result = sdCardInit(); + if(result != HasReturnvaluesIF::RETURN_OK) { + sif::warning << "CoreController::CoreController: SD card init failed" << std::endl; + } + } + catch(const std::filesystem::filesystem_error& e) { + sif::error << "CoreController::CoreController: sdCardInit failed with exception " << + e.what() << std::endl; + } + initBootCopy(); } @@ -41,16 +53,6 @@ LocalPoolDataSetBase* CoreController::getDataSetHandle(sid_t sid) { ReturnValue_t CoreController::initialize() { ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; - try { - result = sdCardInit(); - if(result != HasReturnvaluesIF::RETURN_OK) { - sif::warning << "CoreController::initialize: SD card init failed" << std::endl; - } - } - catch(const std::filesystem::filesystem_error& e) { - sif::error << "CoreController::initialize: sdCardInit failed with exception " << e.what() - << std::endl; - } result = scratch::writeNumber(scratch::ALLOC_FAILURE_COUNT, 0); if(result != HasReturnvaluesIF::RETURN_OK) { @@ -374,6 +376,7 @@ ReturnValue_t CoreController::actionListDirectoryIntoFile(ActionId_t actionId, } ReturnValue_t CoreController::initBootCopy() { + // We could create this file even before the OBSW is started.. std::string fileName = "/tmp/curr_copy.txt"; std::string cmd = "xsc_boot_copy > " + fileName; int result = std::system(cmd.c_str()); diff --git a/bsp_q7s/core/CoreController.h b/bsp_q7s/core/CoreController.h index 5576f7ca..add107e7 100644 --- a/bsp_q7s/core/CoreController.h +++ b/bsp_q7s/core/CoreController.h @@ -62,7 +62,7 @@ private: SdCardManager::SdStatusPair& statusPair); ReturnValue_t initVersionFile(); - ReturnValue_t initBootCopy(); + static ReturnValue_t initBootCopy(); ReturnValue_t actionListDirectoryIntoFile(ActionId_t actionId, MessageQueueId_t commandedBy, const uint8_t *data, size_t size);