From 0f0f5e2fcb957e72faa4efeadd841e4d7da963e5 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Mon, 10 Jan 2022 16:18:18 +0100 Subject: [PATCH] mpsoc sequence count restructured --- bsp_q7s/core/InitMission.cpp | 26 ++++++++-- bsp_q7s/core/ObjectFactory.cpp | 3 +- .../devicedefinitions/PlocMPSoCDefinitions.h | 5 +- bsp_q7s/devices/ploc/CMakeLists.txt | 1 + bsp_q7s/devices/ploc/MPSoCSequenceCount.cpp | 18 +++++++ bsp_q7s/devices/ploc/MPSoCSequenceCount.h | 21 ++++++++ bsp_q7s/devices/ploc/PlocMPSoCHandler.cpp | 43 +++++++-------- bsp_q7s/devices/ploc/PlocMPSoCHandler.h | 27 +++------- bsp_q7s/devices/ploc/PlocMPSoCHelper.cpp | 52 +++++++++++++------ bsp_q7s/devices/ploc/PlocMPSoCHelper.h | 12 +++-- bsp_q7s/memory/FilesystemHelper.cpp | 10 +++- bsp_q7s/memory/FilesystemHelper.h | 5 +- .../Q7S/win_path_helper_xilinx_tools.sh | 4 +- 13 files changed, 151 insertions(+), 76 deletions(-) create mode 100644 bsp_q7s/devices/ploc/MPSoCSequenceCount.cpp create mode 100644 bsp_q7s/devices/ploc/MPSoCSequenceCount.h diff --git a/bsp_q7s/core/InitMission.cpp b/bsp_q7s/core/InitMission.cpp index 7977deed..39441975 100644 --- a/bsp_q7s/core/InitMission.cpp +++ b/bsp_q7s/core/InitMission.cpp @@ -129,13 +129,23 @@ void initmission::initTasks() { #if OBSW_ADD_STAR_TRACKER == 1 PeriodicTaskIF* strImgLoaderTask = factory->createPeriodicTask( - "FILE_SYSTEM_TASK", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc); + "STR_HELPER_TASK", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc); result = strImgLoaderTask->addComponent(objects::STR_HELPER); if(result != HasReturnvaluesIF::RETURN_OK) { - initmission::printAddObjectError("FILE_SYSTEM_TASK", objects::STR_HELPER); + initmission::printAddObjectError("STR_HELPER_TASK", objects::STR_HELPER); } #endif /* OBSW_ADD_STAR_TRACKER == 1 */ +#if OBSW_ADD_PLOC_MPSOC == 1 + PeriodicTaskIF* plocMPSoCHelperTask = factory->createPeriodicTask( + "PLOC_MPSOC_HELPER_TASK", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc); + result = plocMPSoCHelperTask->addComponent(objects::PLOC_MPSOC_HELPER); + if(result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("PLOC_MPSOC_HELPER_TASK", objects::PLOC_MPSOC_HELPER); + } +#endif /* OBSW_ADD_PLOC_MPSOC == 1 */ + + #endif /* BOARD_TE0720 */ #if OBSW_TEST_CCSDS_BRIDGE == 1 @@ -336,7 +346,7 @@ void initmission::createPusTasks(TaskFactory &factory, void initmission::createTestTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc, std::vector& taskVec) { -#if OBSW_ADD_TEST_TASK == 1 || OBSW_ADD_SPI_TEST_CODE == 1 || (BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1) +#if OBSW_ADD_TEST_TASK == 1 || OBSW_ADD_SPI_TEST_CODE == 1 || (BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1) || OBSW_ADD_PLOC_MPSOC == 1 ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; #endif PeriodicTaskIF* testTask = factory.createPeriodicTask( @@ -360,5 +370,15 @@ void initmission::createTestTasks(TaskFactory& factory, TaskDeadlineMissedFuncti initmission::printAddObjectError("GPIOD_TEST", objects::LIBGPIOD_TEST); } #endif /* BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1 */ + +#if OBSW_ADD_PLOC_MPSOC == 1 + PeriodicTaskIF* plocMPSoCHelperTask = factory.createPeriodicTask( + "PLOC_MPSOC_HELPER_TASK", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc); + result = plocMPSoCHelperTask->addComponent(objects::PLOC_MPSOC_HELPER); + if(result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("PLOC_MPSOC_HELPER_TASK", objects::PLOC_MPSOC_HELPER); + } +#endif /* OBSW_ADD_PLOC_MPSOC == 1 */ + taskVec.push_back(testTask); } diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 3db0d607..845eaf03 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -1076,9 +1076,10 @@ void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) { #if BOARD_TE0720 == 1 && OBSW_ADD_PLOC_MPSOC == 1 UartCookie* plocUartCookie = new UartCookie(objects::PLOC_MPSOC_HANDLER, "/dev/ttyUL1", UartModes::NON_CANONICAL, uart::PLOC_MPSOC_BAUD, mpsoc::MAX_REPLY_SIZE); + PlocMPSoCHelper* plocMPSoCHelper = new PlocMPSoCHelper(objects::PLOC_MPSOC_HELPER); /* Testing PlocMPSoCHandler on TE0720-03-1CFA */ PlocMPSoCHandler* mpsocPlocHandler = new PlocMPSoCHandler(objects::PLOC_MPSOC_HANDLER, - objects::UART_COM_IF, plocUartCookie); + objects::UART_COM_IF, plocUartCookie, plocMPSoCHelper); mpsocPlocHandler->setStartUpImmediately(); #endif diff --git a/bsp_q7s/devices/devicedefinitions/PlocMPSoCDefinitions.h b/bsp_q7s/devices/devicedefinitions/PlocMPSoCDefinitions.h index 4b169d5f..a57b3c26 100644 --- a/bsp_q7s/devices/devicedefinitions/PlocMPSoCDefinitions.h +++ b/bsp_q7s/devices/devicedefinitions/PlocMPSoCDefinitions.h @@ -4,7 +4,6 @@ #include #include #include -#include namespace mpsoc { @@ -150,10 +149,10 @@ public: } ReturnValue_t checkCrc() { - uint8_t crcPtr = this->getPacketData() + this->getPacketDataLength() - 1; + uint8_t* crcPtr = this->getPacketData() + this->getPacketDataLength() - 1; uint16_t receivedCrc = *(crcPtr) << 8 | *(crcPtr + 1); uint16_t recalculatedCrc = CRC::crc16ccitt(this->localData.byteStream, this->getFullSize()); - if (recalculatedCrc != this->ge) { + if (recalculatedCrc != receivedCrc) { return CRC_FAILURE; } return RETURN_OK; diff --git a/bsp_q7s/devices/ploc/CMakeLists.txt b/bsp_q7s/devices/ploc/CMakeLists.txt index 0babd089..2a80d64c 100644 --- a/bsp_q7s/devices/ploc/CMakeLists.txt +++ b/bsp_q7s/devices/ploc/CMakeLists.txt @@ -4,4 +4,5 @@ target_sources(${TARGET_NAME} PRIVATE PlocMemoryDumper.cpp PlocMPSoCHandler.cpp PlocMPSoCHelper.cpp + MPSoCSequenceCount.cpp ) diff --git a/bsp_q7s/devices/ploc/MPSoCSequenceCount.cpp b/bsp_q7s/devices/ploc/MPSoCSequenceCount.cpp new file mode 100644 index 00000000..450900d4 --- /dev/null +++ b/bsp_q7s/devices/ploc/MPSoCSequenceCount.cpp @@ -0,0 +1,18 @@ +#include "fsfw/serviceInterface/ServiceInterfaceStream.h" +#include "MPSoCSequenceCount.h" + +MPSoCSequenceCount::MPSoCSequenceCount() : SourceSequenceCounter() { +} + +ReturnValue_t MPSoCSequenceCount::compare(uint16_t recvSeqCount) { + if (recvSeqCount != *this) { + sif::warning << "MPSoCSequenceCount::compare: Packet sequence count mismatch. Received: " + << recvSeqCount << ", Expected: " << *this << std::endl; + return HasReturnvaluesIF::RETURN_FAILED; + } + return HasReturnvaluesIF::RETURN_OK; +} + +MPSoCSequenceCount::~MPSoCSequenceCount() { +} + diff --git a/bsp_q7s/devices/ploc/MPSoCSequenceCount.h b/bsp_q7s/devices/ploc/MPSoCSequenceCount.h new file mode 100644 index 00000000..9495f6a2 --- /dev/null +++ b/bsp_q7s/devices/ploc/MPSoCSequenceCount.h @@ -0,0 +1,21 @@ +#ifndef BSP_Q7S_DEVICES_PLOC_MPSOCSEQUENCECOUNT_H_ +#define BSP_Q7S_DEVICES_PLOC_MPSOCSEQUENCECOUNT_H_ + +#include "fsfw/tmtcservices/SourceSequenceCounter.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" + +/** + * @brief Class to manage the sequence count of the space packets exchanged with the MPSoC of the + * PLOC. + * + * @author J. Meier + */ +class MPSoCSequenceCount : public SourceSequenceCounter { +public: + MPSoCSequenceCount(); + virtual ~MPSoCSequenceCount(); + + ReturnValue_t compare(uint16_t recvSeqCount); +}; + +#endif /* BSP_Q7S_DEVICES_PLOC_MPSOCSEQUENCECOUNT_H_ */ diff --git a/bsp_q7s/devices/ploc/PlocMPSoCHandler.cpp b/bsp_q7s/devices/ploc/PlocMPSoCHandler.cpp index 6842d9b1..b9d17a8a 100644 --- a/bsp_q7s/devices/ploc/PlocMPSoCHandler.cpp +++ b/bsp_q7s/devices/ploc/PlocMPSoCHandler.cpp @@ -9,6 +9,7 @@ PlocMPSoCHandler::PlocMPSoCHandler(object_id_t objectId, object_id_t uartComIFid if (comCookie == NULL) { sif::error << "PlocMPSoCHandler: Invalid com cookie" << std::endl; } + eventQueue = QueueFactory::instance()->createMessageQueue(EventMessage::EVENT_MESSAGE_SIZE * 5); } PlocMPSoCHandler::~PlocMPSoCHandler() { @@ -26,8 +27,8 @@ ReturnValue_t PlocMPSoCHandler::initialize() { return ObjectManagerIF::CHILD_INIT_FAILED; } -EventManagerIF* manager = ObjectManager::instance()->get( - objects::EVENT_MANAGER); + EventManagerIF* manager = ObjectManager::instance()->get( + objects::EVENT_MANAGER); if (manager == nullptr) { #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::error << "PlocMPSoCHandler::initialize: Invalid event manager" << std::endl; @@ -84,7 +85,7 @@ ReturnValue_t PlocMPSoCHandler::executeAction(ActionId_t actionId, MessageQueueI switch(actionId) { case mpsoc::TC_FLASHWRITE: { - if (size > config::MAX_PATH_SIZE + config::MAX_FILE_NAME) { + if (size > config::MAX_PATH_SIZE + config::MAX_FILENAME_SIZE) { return FILENAME_TOO_LONG; } result = plocMPSoCHelper->startFlashWrite( @@ -205,7 +206,12 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t *start, return INVALID_APID; } } - result = checkPacketSequenceCount(start); + uint16_t recvSeqCnt = (*(start + 2) << 8 | *(start + 3)) & PACKET_SEQUENCE_COUNT_MASK; + result = sequenceCount.compare(recvSeqCnt); + if (result != RETURN_OK) { + triggerEvent(SEQ_CNT_MISMATCH, sequenceCount, recvSeqCnt); + sequenceCount = recvSeqCnt; + } return result; } @@ -267,8 +273,8 @@ void PlocMPSoCHandler::handleEvent(EventMessage* eventMessage) { ReturnValue_t PlocMPSoCHandler::prepareTcMemWriteCommand(const uint8_t * commandData, size_t commandDataLen) { ReturnValue_t result = RETURN_OK; - sequenceCount.increment(); - mpsoc::TcMemWrite tcMemWrite(sequenceCount.get()); + sequenceCount++; + mpsoc::TcMemWrite tcMemWrite(sequenceCount); result = tcMemWrite.createPacket(commandData, commandDataLen); if (result != RETURN_OK) { return result; @@ -280,8 +286,8 @@ ReturnValue_t PlocMPSoCHandler::prepareTcMemWriteCommand(const uint8_t * command ReturnValue_t PlocMPSoCHandler::prepareTcMemReadCommand(const uint8_t * commandData, size_t commandDataLen) { ReturnValue_t result = RETURN_OK; - sequenceCount.increment(); - mpsoc::TcMemRead tcMemRead(sequenceCount.get()); + sequenceCount++; + mpsoc::TcMemRead tcMemRead(sequenceCount); result = tcMemRead.createPacket(commandData, commandDataLen); if (result != RETURN_OK) { return result; @@ -293,8 +299,8 @@ ReturnValue_t PlocMPSoCHandler::prepareTcMemReadCommand(const uint8_t * commandD ReturnValue_t PlocMPSoCHandler::prepareFlashFopenCmd(const uint8_t * commandData, size_t commandDataLen) { ReturnValue_t result = RETURN_OK; - sequenceCount.increment(); - mpsoc::FlashFopen flashFopen(sequenceCount.get()); + sequenceCount++; + mpsoc::FlashFopen flashFopen(sequenceCount); result = flashFopen.createPacket(commandData, commandDataLen); if (result != RETURN_OK) { return result; @@ -306,8 +312,8 @@ ReturnValue_t PlocMPSoCHandler::prepareFlashFopenCmd(const uint8_t * commandData ReturnValue_t PlocMPSoCHandler::prepareFlashFcloseCmd(const uint8_t * commandData, size_t commandDataLen) { ReturnValue_t result = RETURN_OK; - sequenceCount.increment(); - mpsoc::FlashFclose flashFclose(sequenceCount.get()); + sequenceCount++; + mpsoc::FlashFclose flashFclose(sequenceCount); result = flashFclose.createPacket(commandData, commandDataLen); if (result != RETURN_OK) { return result; @@ -607,16 +613,3 @@ void PlocMPSoCHandler::disableExeReportReply() { /* Expected replies is set to one here. The value will set to 0 in replyToReply() */ info->command->second.expectedReplies = 0; } - -ReturnValue_t PlocMPSoCHandler::checkPacketSequenceCount(const uint8_t* data) { - uint16_t receivedSeqCnt = (*(data + 2) << 8 | *(data + 3)) & PACKET_SEQUENCE_COUNT_MASK; - uint16_t expectedSeqCnt = sequenceCount.get(); - if (receivedSeqCnt != expectedSeqCnt) { - sif::warning << "PlocMPSoCHandler::checkPacketSequenceCount: Packet sequence count " - "mismatch. Received: " << receivedSeqCnt << ", Expected: " - << expectedSeqCnt << std::endl; - triggerEvent(SEQ_CNT_MISMATCH, expectedSeqCnt, receivedSeqCnt); - } - sequenceCount.reset(receivedSeqCnt); - return RETURN_OK; -} diff --git a/bsp_q7s/devices/ploc/PlocMPSoCHandler.h b/bsp_q7s/devices/ploc/PlocMPSoCHandler.h index 3fef3a58..a85bf432 100644 --- a/bsp_q7s/devices/ploc/PlocMPSoCHandler.h +++ b/bsp_q7s/devices/ploc/PlocMPSoCHandler.h @@ -1,12 +1,13 @@ #ifndef BSP_Q7S_DEVICES_PLOC_PLOCMPSOCHANDLER_H_ #define BSP_Q7S_DEVICES_PLOC_PLOCMPSOCHANDLER_H_ +#include #include "fsfw/devicehandlers/DeviceHandlerBase.h" -#include "bsp_q7s/devices/devicedefinitions/PlocMPSoCDefinitions.h" #include "fsfw_hal/linux/uart/UartComIF.h" -#include "fsfw/tmtcservices/SourceSequenceCounter.h" +#include "fsfw/ipc/QueueFactory.h" +#include "bsp_q7s/devices/devicedefinitions/PlocMPSoCDefinitions.h" +#include "MPSoCSequenceCount.h" #include "PlocMPSoCHelper.h" -#include /** * @brief This is the device handler for the MPSoC of the payload computer. @@ -88,8 +89,11 @@ private: static const Event SEQ_CNT_MISMATCH = MAKE_EVENT(5, severity::LOW); static const uint16_t APID_MASK = 0x7FF; + static const uint16_t PACKET_SEQUENCE_COUNT_MASK = 0x3FFF; - SourceSequenceCounter sequenceCount; + MessageQueueIF* eventQueue = nullptr; + + MPSoCSequenceCount sequenceCount; uint8_t commandBuffer[mpsoc::MAX_COMMAND_SIZE]; @@ -198,21 +202,6 @@ private: * the variable expectedReplies of an active command will be set to 0. */ void disableExeReportReply(); - - /** - * @brief This function checks and increments the packet sequence count of a received space - * packet. - * - * @param data Pointer to a space packet. - * - * @return RETURN_OK if successful - * - * @details There should be never a case in which a wrong packet sequence count is received - * because the communication scheme between PLOC and OBC always follows a strict - * procedure. Thus this function mainly serves for debugging purposes to detected an - * invalid handling of the packet sequence count. - */ - ReturnValue_t checkPacketSequenceCount(const uint8_t* data); }; #endif /* BSP_Q7S_DEVICES_PLOC_PLOCMPSOCHANDLER_H_ */ diff --git a/bsp_q7s/devices/ploc/PlocMPSoCHelper.cpp b/bsp_q7s/devices/ploc/PlocMPSoCHelper.cpp index 4511c881..b922a44d 100644 --- a/bsp_q7s/devices/ploc/PlocMPSoCHelper.cpp +++ b/bsp_q7s/devices/ploc/PlocMPSoCHelper.cpp @@ -60,7 +60,7 @@ void PlocMPSoCHelper::setComCookie(CookieIF* comCookie_) { comCookie = comCookie_; } -void PlocMPSoCHelper::setSequenceCount(SourceSequenceCounter* sequenceCount_) { +void PlocMPSoCHelper::setSequenceCount(MPSoCSequenceCount* sequenceCount_) { sequenceCount = sequenceCount_; } @@ -86,24 +86,39 @@ void PlocMPSoCHelper::stopProcess() { ReturnValue_t PlocMPSoCHelper::performFlashWrite() { ReturnValue_t result = RETURN_OK; + uint8_t tempData[mpsoc::MAX_DATA_SIZE]; std::ifstream file(flashWrite.file, std::ifstream::binary); // Set position of next character to end of file input stream file.seekg(0, file.end); // tellg returns position of character in input stream - size_t imageSize = file.tellg(); - sequenceCount->increment(); - mpsoc::FlashWrite tc(sequenceCount->get()); - result = sendCommand(&tc); - if (result != RETURN_OK) { - return result; - } - result = handleAck(); - if (result != RETURN_OK) { - return result; - } - result = handleExe(); - if (result != RETURN_OK) { - return result; + size_t remainingSize = file.tellg(); + size_t dataLength = 0; + while (remainingSize > 0) { + if (terminate) { + return RETURN_OK; + } + if (remainingSize > mpsoc::MAX_DATA_SIZE) { + dataLength = mpsoc::MAX_DATA_SIZE; + } + else { + dataLength = remainingSize; + } + file.read(reinterpret_cast(tempData), dataLength); + sequenceCount++; + mpsoc::FlashWrite tc(*sequenceCount); + tc.createPacket(tempData, dataLength); + result = sendCommand(&tc); + if (result != RETURN_OK) { + return result; + } + result = handleAck(); + if (result != RETURN_OK) { + return result; + } + result = handleExe(); + if (result != RETURN_OK) { + return result; + } } return result; } @@ -198,6 +213,13 @@ ReturnValue_t PlocMPSoCHelper::handleTmReception(mpsoc::TmPacket* tmPacket, size sif::warning << "PlocMPSoCHelper::handleTmReception: CRC check failed" << std::endl; return result; } + uint16_t recvSeqCnt = tmPacket->getPacketSequenceCount(); + result = sequenceCount->compare(recvSeqCnt); + if (result != RETURN_OK) { + triggerEvent(SEQ_CNT_MISMATCH, *sequenceCount, recvSeqCnt); + *sequenceCount = recvSeqCnt; + return result; + } return result; } diff --git a/bsp_q7s/devices/ploc/PlocMPSoCHelper.h b/bsp_q7s/devices/ploc/PlocMPSoCHelper.h index 0655e2cc..8cd77e74 100644 --- a/bsp_q7s/devices/ploc/PlocMPSoCHelper.h +++ b/bsp_q7s/devices/ploc/PlocMPSoCHelper.h @@ -10,7 +10,7 @@ #include "fsfw_hal/linux/uart/UartComIF.h" #include "fsfw/devicehandlers/CookieIF.h" #include "bsp_q7s/devices/devicedefinitions/PlocMPSoCDefinitions.h" -#include "fsfw/tmtcservices/SourceSequenceCounter.h" +#include "MPSoCSequenceCount.h" /** * @brief Helper class for MPSoC of PLOC intended to accelerate large data transfers between @@ -60,6 +60,10 @@ public: //!P1: Apid of received space packet //!P2: Internal state of MPSoC static const Event EXE_INVALID_APID = MAKE_EVENT(10, severity::LOW); + //! [EXPORT] : [COMMENT] Received sequence count does not match expected sequence count + //!P1: Expected sequence count + //!P2: Received sequence count + static const Event SEQ_CNT_MISMATCH = MAKE_EVENT(11, severity::LOW); PlocMPSoCHelper(object_id_t objectId); virtual ~PlocMPSoCHelper(); @@ -87,7 +91,7 @@ public: /** * @brief Sets the sequence count object responsible for the sequence count handling */ - void setSequenceCount(SourceSequenceCounter* sequenceCount_); + void setSequenceCount(MPSoCSequenceCount* sequenceCount_); private: @@ -99,7 +103,7 @@ private: class FlashWrite { public: - static const std::string file; + std::string file; }; FlashWrite flashWrite; @@ -128,7 +132,7 @@ private: // Communication cookie. Must be set by the MPSoC Handler CookieIF* comCookie = nullptr; // Sequence count, must be set by Ploc MPSoC Handler - SourceSequenceCounter* sequenceCount; + MPSoCSequenceCount* sequenceCount; ReturnValue_t performFlashWrite(); ReturnValue_t sendCommand(mpsoc::TcBase* tc); diff --git a/bsp_q7s/memory/FilesystemHelper.cpp b/bsp_q7s/memory/FilesystemHelper.cpp index 7413541f..1c990426 100644 --- a/bsp_q7s/memory/FilesystemHelper.cpp +++ b/bsp_q7s/memory/FilesystemHelper.cpp @@ -1,5 +1,8 @@ +#include +#include #include "FilesystemHelper.h" #include "bsp_q7s/memory/SdCardManager.h" +#include "fsfw/serviceinterface/serviceInterfaceStream.h" FilesystemHelper::FilesystemHelper() { } @@ -8,7 +11,7 @@ FilesystemHelper::~FilesystemHelper() { } ReturnValue_t FilesystemHelper::checkPath(std::string path) { - SdCardManager sdcMan = SdCardManager::instance(); + SdCardManager* sdcMan = SdCardManager::instance(); if (sdcMan == nullptr) { sif::warning << "FilesystemHelper::checkPath: Invalid SD card manager" << std::endl; return RETURN_FAILED; @@ -30,5 +33,8 @@ ReturnValue_t FilesystemHelper::checkPath(std::string path) { } ReturnValue_t FilesystemHelper::fileExists(std::string file) { - + if (not std::filesystem::exists(file)) { + return FILE_NOT_EXISTS; + } + return RETURN_OK; } diff --git a/bsp_q7s/memory/FilesystemHelper.h b/bsp_q7s/memory/FilesystemHelper.h index 4efe74c0..a3e59dea 100644 --- a/bsp_q7s/memory/FilesystemHelper.h +++ b/bsp_q7s/memory/FilesystemHelper.h @@ -1,6 +1,7 @@ #ifndef BSP_Q7S_MEMORY_FILESYSTEMHELPER_H_ #define BSP_Q7S_MEMORY_FILESYSTEMHELPER_H_ +#include #include "fsfw/returnvalues/HasReturnvaluesIF.h" /** @@ -32,7 +33,7 @@ public: * Return error code if path points to SD card and the corresponding SD card is not * mounted. */ - static const ReturnValue_t checkPath(std::string path); + static ReturnValue_t checkPath(std::string path); /** * @brief Checks if the file exists on the filesystem. @@ -41,7 +42,7 @@ public: * * @return RETURN_OK if fiel exists, otherwise return error code. */ - static const ReturnValue_t fileExists(std::string file); + static ReturnValue_t fileExists(std::string file); }; #endif /* BSP_Q7S_MEMORY_FILESYSTEMHELPER_H_ */ diff --git a/cmake/scripts/Q7S/win_path_helper_xilinx_tools.sh b/cmake/scripts/Q7S/win_path_helper_xilinx_tools.sh index a8352331..780a4a95 100644 --- a/cmake/scripts/Q7S/win_path_helper_xilinx_tools.sh +++ b/cmake/scripts/Q7S/win_path_helper_xilinx_tools.sh @@ -1,5 +1,5 @@ #!/bin/sh -export PATH=$PATH:"/c/Xilinx/SDK/2018.2/gnu/aarch32/nt/gcc-arm-linux-gnueabi/bin" +export PATH=$PATH:"/c/Users/Xilinx/SDK/2018.2/gnu/aarch32/nt/gcc-arm-linux-gnueabi/bin" export CROSS_COMPILE="arm-linux-gnueabihf" -export Q7S_SYSROOT="/c/Users/${USER}/Documents/EIVE/cortexa9hf-neon-xiphos-linux-gnueabi" +#export Q7S_SYSROOT="/c/Users/${USER}/Documents/EIVE/cortexa9hf-neon-xiphos-linux-gnueabi"