v1.10.0 #220

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

View File

@ -129,13 +129,23 @@ void initmission::initTasks() {
#if OBSW_ADD_STAR_TRACKER == 1 #if OBSW_ADD_STAR_TRACKER == 1
PeriodicTaskIF* strImgLoaderTask = factory->createPeriodicTask( 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); result = strImgLoaderTask->addComponent(objects::STR_HELPER);
if(result != HasReturnvaluesIF::RETURN_OK) { 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 */ #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 */ #endif /* BOARD_TE0720 */
#if OBSW_TEST_CCSDS_BRIDGE == 1 #if OBSW_TEST_CCSDS_BRIDGE == 1
@ -336,7 +346,7 @@ void initmission::createPusTasks(TaskFactory &factory,
void initmission::createTestTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc, void initmission::createTestTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
std::vector<PeriodicTaskIF*>& taskVec) { std::vector<PeriodicTaskIF*>& 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; ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
#endif #endif
PeriodicTaskIF* testTask = factory.createPeriodicTask( PeriodicTaskIF* testTask = factory.createPeriodicTask(
@ -360,5 +370,15 @@ void initmission::createTestTasks(TaskFactory& factory, TaskDeadlineMissedFuncti
initmission::printAddObjectError("GPIOD_TEST", objects::LIBGPIOD_TEST); initmission::printAddObjectError("GPIOD_TEST", objects::LIBGPIOD_TEST);
} }
#endif /* BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1 */ #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); taskVec.push_back(testTask);
} }

View File

@ -1076,9 +1076,10 @@ void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) {
#if BOARD_TE0720 == 1 && OBSW_ADD_PLOC_MPSOC == 1 #if BOARD_TE0720 == 1 && OBSW_ADD_PLOC_MPSOC == 1
UartCookie* plocUartCookie = new UartCookie(objects::PLOC_MPSOC_HANDLER, "/dev/ttyUL1", UartCookie* plocUartCookie = new UartCookie(objects::PLOC_MPSOC_HANDLER, "/dev/ttyUL1",
UartModes::NON_CANONICAL, uart::PLOC_MPSOC_BAUD, mpsoc::MAX_REPLY_SIZE); 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 */ /* Testing PlocMPSoCHandler on TE0720-03-1CFA */
PlocMPSoCHandler* mpsocPlocHandler = new PlocMPSoCHandler(objects::PLOC_MPSOC_HANDLER, PlocMPSoCHandler* mpsocPlocHandler = new PlocMPSoCHandler(objects::PLOC_MPSOC_HANDLER,
objects::UART_COM_IF, plocUartCookie); objects::UART_COM_IF, plocUartCookie, plocMPSoCHelper);
mpsocPlocHandler->setStartUpImmediately(); mpsocPlocHandler->setStartUpImmediately();
#endif #endif

View File

@ -4,7 +4,6 @@
#include <fsfw/tmtcpacket/SpacePacket.h> #include <fsfw/tmtcpacket/SpacePacket.h>
#include <fsfw/globalfunctions/CRC.h> #include <fsfw/globalfunctions/CRC.h>
#include <fsfw/serialize/SerializeAdapter.h> #include <fsfw/serialize/SerializeAdapter.h>
#include <bsp_q7s/devices/ploc/PlocMPSoCHandler.h>
namespace mpsoc { namespace mpsoc {
@ -150,10 +149,10 @@ public:
} }
ReturnValue_t checkCrc() { 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 receivedCrc = *(crcPtr) << 8 | *(crcPtr + 1);
uint16_t recalculatedCrc = CRC::crc16ccitt(this->localData.byteStream, this->getFullSize()); uint16_t recalculatedCrc = CRC::crc16ccitt(this->localData.byteStream, this->getFullSize());
if (recalculatedCrc != this->ge) { if (recalculatedCrc != receivedCrc) {
return CRC_FAILURE; return CRC_FAILURE;
} }
return RETURN_OK; return RETURN_OK;

View File

@ -4,4 +4,5 @@ target_sources(${TARGET_NAME} PRIVATE
PlocMemoryDumper.cpp PlocMemoryDumper.cpp
PlocMPSoCHandler.cpp PlocMPSoCHandler.cpp
PlocMPSoCHelper.cpp PlocMPSoCHelper.cpp
MPSoCSequenceCount.cpp
) )

View File

@ -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() {
}

View File

@ -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_ */

View File

@ -9,6 +9,7 @@ PlocMPSoCHandler::PlocMPSoCHandler(object_id_t objectId, object_id_t uartComIFid
if (comCookie == NULL) { if (comCookie == NULL) {
sif::error << "PlocMPSoCHandler: Invalid com cookie" << std::endl; sif::error << "PlocMPSoCHandler: Invalid com cookie" << std::endl;
} }
eventQueue = QueueFactory::instance()->createMessageQueue(EventMessage::EVENT_MESSAGE_SIZE * 5);
} }
PlocMPSoCHandler::~PlocMPSoCHandler() { PlocMPSoCHandler::~PlocMPSoCHandler() {
@ -84,7 +85,7 @@ ReturnValue_t PlocMPSoCHandler::executeAction(ActionId_t actionId, MessageQueueI
switch(actionId) { switch(actionId) {
case mpsoc::TC_FLASHWRITE: { 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; return FILENAME_TOO_LONG;
} }
result = plocMPSoCHelper->startFlashWrite( result = plocMPSoCHelper->startFlashWrite(
@ -205,7 +206,12 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t *start,
return INVALID_APID; 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; return result;
} }
@ -267,8 +273,8 @@ void PlocMPSoCHandler::handleEvent(EventMessage* eventMessage) {
ReturnValue_t PlocMPSoCHandler::prepareTcMemWriteCommand(const uint8_t * commandData, ReturnValue_t PlocMPSoCHandler::prepareTcMemWriteCommand(const uint8_t * commandData,
size_t commandDataLen) { size_t commandDataLen) {
ReturnValue_t result = RETURN_OK; ReturnValue_t result = RETURN_OK;
sequenceCount.increment(); sequenceCount++;
mpsoc::TcMemWrite tcMemWrite(sequenceCount.get()); mpsoc::TcMemWrite tcMemWrite(sequenceCount);
result = tcMemWrite.createPacket(commandData, commandDataLen); result = tcMemWrite.createPacket(commandData, commandDataLen);
if (result != RETURN_OK) { if (result != RETURN_OK) {
return result; return result;
@ -280,8 +286,8 @@ ReturnValue_t PlocMPSoCHandler::prepareTcMemWriteCommand(const uint8_t * command
ReturnValue_t PlocMPSoCHandler::prepareTcMemReadCommand(const uint8_t * commandData, ReturnValue_t PlocMPSoCHandler::prepareTcMemReadCommand(const uint8_t * commandData,
size_t commandDataLen) { size_t commandDataLen) {
ReturnValue_t result = RETURN_OK; ReturnValue_t result = RETURN_OK;
sequenceCount.increment(); sequenceCount++;
mpsoc::TcMemRead tcMemRead(sequenceCount.get()); mpsoc::TcMemRead tcMemRead(sequenceCount);
result = tcMemRead.createPacket(commandData, commandDataLen); result = tcMemRead.createPacket(commandData, commandDataLen);
if (result != RETURN_OK) { if (result != RETURN_OK) {
return result; return result;
@ -293,8 +299,8 @@ ReturnValue_t PlocMPSoCHandler::prepareTcMemReadCommand(const uint8_t * commandD
ReturnValue_t PlocMPSoCHandler::prepareFlashFopenCmd(const uint8_t * commandData, ReturnValue_t PlocMPSoCHandler::prepareFlashFopenCmd(const uint8_t * commandData,
size_t commandDataLen) { size_t commandDataLen) {
ReturnValue_t result = RETURN_OK; ReturnValue_t result = RETURN_OK;
sequenceCount.increment(); sequenceCount++;
mpsoc::FlashFopen flashFopen(sequenceCount.get()); mpsoc::FlashFopen flashFopen(sequenceCount);
result = flashFopen.createPacket(commandData, commandDataLen); result = flashFopen.createPacket(commandData, commandDataLen);
if (result != RETURN_OK) { if (result != RETURN_OK) {
return result; return result;
@ -306,8 +312,8 @@ ReturnValue_t PlocMPSoCHandler::prepareFlashFopenCmd(const uint8_t * commandData
ReturnValue_t PlocMPSoCHandler::prepareFlashFcloseCmd(const uint8_t * commandData, ReturnValue_t PlocMPSoCHandler::prepareFlashFcloseCmd(const uint8_t * commandData,
size_t commandDataLen) { size_t commandDataLen) {
ReturnValue_t result = RETURN_OK; ReturnValue_t result = RETURN_OK;
sequenceCount.increment(); sequenceCount++;
mpsoc::FlashFclose flashFclose(sequenceCount.get()); mpsoc::FlashFclose flashFclose(sequenceCount);
result = flashFclose.createPacket(commandData, commandDataLen); result = flashFclose.createPacket(commandData, commandDataLen);
if (result != RETURN_OK) { if (result != RETURN_OK) {
return result; return result;
@ -607,16 +613,3 @@ void PlocMPSoCHandler::disableExeReportReply() {
/* Expected replies is set to one here. The value will set to 0 in replyToReply() */ /* Expected replies is set to one here. The value will set to 0 in replyToReply() */
info->command->second.expectedReplies = 0; 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;
}

View File

@ -1,12 +1,13 @@
#ifndef BSP_Q7S_DEVICES_PLOC_PLOCMPSOCHANDLER_H_ #ifndef BSP_Q7S_DEVICES_PLOC_PLOCMPSOCHANDLER_H_
#define BSP_Q7S_DEVICES_PLOC_PLOCMPSOCHANDLER_H_ #define BSP_Q7S_DEVICES_PLOC_PLOCMPSOCHANDLER_H_
#include <string>
#include "fsfw/devicehandlers/DeviceHandlerBase.h" #include "fsfw/devicehandlers/DeviceHandlerBase.h"
#include "bsp_q7s/devices/devicedefinitions/PlocMPSoCDefinitions.h"
#include "fsfw_hal/linux/uart/UartComIF.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 "PlocMPSoCHelper.h"
#include <cstring>
/** /**
* @brief This is the device handler for the MPSoC of the payload computer. * @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 Event SEQ_CNT_MISMATCH = MAKE_EVENT(5, severity::LOW);
static const uint16_t APID_MASK = 0x7FF; 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]; uint8_t commandBuffer[mpsoc::MAX_COMMAND_SIZE];
@ -198,21 +202,6 @@ private:
* the variable expectedReplies of an active command will be set to 0. * the variable expectedReplies of an active command will be set to 0.
*/ */
void disableExeReportReply(); 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_ */ #endif /* BSP_Q7S_DEVICES_PLOC_PLOCMPSOCHANDLER_H_ */

View File

@ -60,7 +60,7 @@ void PlocMPSoCHelper::setComCookie(CookieIF* comCookie_) {
comCookie = comCookie_; comCookie = comCookie_;
} }
void PlocMPSoCHelper::setSequenceCount(SourceSequenceCounter* sequenceCount_) { void PlocMPSoCHelper::setSequenceCount(MPSoCSequenceCount* sequenceCount_) {
sequenceCount = sequenceCount_; sequenceCount = sequenceCount_;
} }
@ -86,13 +86,27 @@ void PlocMPSoCHelper::stopProcess() {
ReturnValue_t PlocMPSoCHelper::performFlashWrite() { ReturnValue_t PlocMPSoCHelper::performFlashWrite() {
ReturnValue_t result = RETURN_OK; ReturnValue_t result = RETURN_OK;
uint8_t tempData[mpsoc::MAX_DATA_SIZE];
std::ifstream file(flashWrite.file, std::ifstream::binary); std::ifstream file(flashWrite.file, std::ifstream::binary);
// Set position of next character to end of file input stream // Set position of next character to end of file input stream
file.seekg(0, file.end); file.seekg(0, file.end);
// tellg returns position of character in input stream // tellg returns position of character in input stream
size_t imageSize = file.tellg(); size_t remainingSize = file.tellg();
sequenceCount->increment(); size_t dataLength = 0;
mpsoc::FlashWrite tc(sequenceCount->get()); 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<char*>(tempData), dataLength);
sequenceCount++;
mpsoc::FlashWrite tc(*sequenceCount);
tc.createPacket(tempData, dataLength);
result = sendCommand(&tc); result = sendCommand(&tc);
if (result != RETURN_OK) { if (result != RETURN_OK) {
return result; return result;
@ -105,6 +119,7 @@ ReturnValue_t PlocMPSoCHelper::performFlashWrite() {
if (result != RETURN_OK) { if (result != RETURN_OK) {
return result; return result;
} }
}
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; sif::warning << "PlocMPSoCHelper::handleTmReception: CRC check failed" << std::endl;
return result; 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; return result;
} }

View File

@ -10,7 +10,7 @@
#include "fsfw_hal/linux/uart/UartComIF.h" #include "fsfw_hal/linux/uart/UartComIF.h"
#include "fsfw/devicehandlers/CookieIF.h" #include "fsfw/devicehandlers/CookieIF.h"
#include "bsp_q7s/devices/devicedefinitions/PlocMPSoCDefinitions.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 * @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 //!P1: Apid of received space packet
//!P2: Internal state of MPSoC //!P2: Internal state of MPSoC
static const Event EXE_INVALID_APID = MAKE_EVENT(10, severity::LOW); 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); PlocMPSoCHelper(object_id_t objectId);
virtual ~PlocMPSoCHelper(); virtual ~PlocMPSoCHelper();
@ -87,7 +91,7 @@ public:
/** /**
* @brief Sets the sequence count object responsible for the sequence count handling * @brief Sets the sequence count object responsible for the sequence count handling
*/ */
void setSequenceCount(SourceSequenceCounter* sequenceCount_); void setSequenceCount(MPSoCSequenceCount* sequenceCount_);
private: private:
@ -99,7 +103,7 @@ private:
class FlashWrite { class FlashWrite {
public: public:
static const std::string file; std::string file;
}; };
FlashWrite flashWrite; FlashWrite flashWrite;
@ -128,7 +132,7 @@ private:
// Communication cookie. Must be set by the MPSoC Handler // Communication cookie. Must be set by the MPSoC Handler
CookieIF* comCookie = nullptr; CookieIF* comCookie = nullptr;
// Sequence count, must be set by Ploc MPSoC Handler // Sequence count, must be set by Ploc MPSoC Handler
SourceSequenceCounter* sequenceCount; MPSoCSequenceCount* sequenceCount;
ReturnValue_t performFlashWrite(); ReturnValue_t performFlashWrite();
ReturnValue_t sendCommand(mpsoc::TcBase* tc); ReturnValue_t sendCommand(mpsoc::TcBase* tc);

View File

@ -1,5 +1,8 @@
#include <fstream>
#include <filesystem>
#include "FilesystemHelper.h" #include "FilesystemHelper.h"
#include "bsp_q7s/memory/SdCardManager.h" #include "bsp_q7s/memory/SdCardManager.h"
#include "fsfw/serviceinterface/serviceInterfaceStream.h"
FilesystemHelper::FilesystemHelper() { FilesystemHelper::FilesystemHelper() {
} }
@ -8,7 +11,7 @@ FilesystemHelper::~FilesystemHelper() {
} }
ReturnValue_t FilesystemHelper::checkPath(std::string path) { ReturnValue_t FilesystemHelper::checkPath(std::string path) {
SdCardManager sdcMan = SdCardManager::instance(); SdCardManager* sdcMan = SdCardManager::instance();
if (sdcMan == nullptr) { if (sdcMan == nullptr) {
sif::warning << "FilesystemHelper::checkPath: Invalid SD card manager" << std::endl; sif::warning << "FilesystemHelper::checkPath: Invalid SD card manager" << std::endl;
return RETURN_FAILED; return RETURN_FAILED;
@ -30,5 +33,8 @@ ReturnValue_t FilesystemHelper::checkPath(std::string path) {
} }
ReturnValue_t FilesystemHelper::fileExists(std::string file) { ReturnValue_t FilesystemHelper::fileExists(std::string file) {
if (not std::filesystem::exists(file)) {
return FILE_NOT_EXISTS;
}
return RETURN_OK;
} }

View File

@ -1,6 +1,7 @@
#ifndef BSP_Q7S_MEMORY_FILESYSTEMHELPER_H_ #ifndef BSP_Q7S_MEMORY_FILESYSTEMHELPER_H_
#define BSP_Q7S_MEMORY_FILESYSTEMHELPER_H_ #define BSP_Q7S_MEMORY_FILESYSTEMHELPER_H_
#include <string>
#include "fsfw/returnvalues/HasReturnvaluesIF.h" #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 * Return error code if path points to SD card and the corresponding SD card is not
* mounted. * 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. * @brief Checks if the file exists on the filesystem.
@ -41,7 +42,7 @@ public:
* *
* @return RETURN_OK if fiel exists, otherwise return error code. * @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_ */ #endif /* BSP_Q7S_MEMORY_FILESYSTEMHELPER_H_ */

View File

@ -1,5 +1,5 @@
#!/bin/sh #!/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 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"