From f99e96a20a9c42b92219827883a6414c596d0e5a Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Wed, 23 Mar 2022 05:28:24 +0100 Subject: [PATCH] flash write tc, fix in pus data extraction --- linux/devices/devicedefinitions/PlocMPSoCDefinitions.h | 8 +++++--- linux/devices/ploc/PlocMPSoCHandler.cpp | 4 ++++ tmtc | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/linux/devices/devicedefinitions/PlocMPSoCDefinitions.h b/linux/devices/devicedefinitions/PlocMPSoCDefinitions.h index 9557eb11..a73f7f94 100644 --- a/linux/devices/devicedefinitions/PlocMPSoCDefinitions.h +++ b/linux/devices/devicedefinitions/PlocMPSoCDefinitions.h @@ -290,7 +290,7 @@ public: size_t nameSize = filename.size(); std::memcpy(this->getPacketData(), filename.c_str(), nameSize); - std::memcpy(this->getPacketData() + nameSize, &accessMode, + std::memcpy(this->getPacketData() + nameSize + 1, &accessMode, sizeof(accessMode)); this->setPacketDataLength(nameSize + CRC_SIZE - 1); result = addCrc(); @@ -588,11 +588,12 @@ class FlashWritePusCmd : public MPSoCReturnValuesIF { if (obcFile.size() > (config::MAX_PATH_SIZE + config::MAX_FILENAME_SIZE)) { return FILENAME_TOO_LONG; } - mpsocFile = std::string(reinterpret_cast(commandData + obcFile.size())); + mpsocFile = std::string( + reinterpret_cast(commandData + obcFile.size() + SIZE_NULL_TERMINATOR)); if (mpsocFile.size() > MAX_FILENAME_SIZE) { return MPSOC_FILENAME_TOO_LONG; } - return HasReturnvaluesIF::HasReturnvaluesIF::RETURN_OK; + return HasReturnvaluesIF::RETURN_OK; } std::string getObcFile() { @@ -605,6 +606,7 @@ class FlashWritePusCmd : public MPSoCReturnValuesIF { private: + static const size_t SIZE_NULL_TERMINATOR = 1; std::string obcFile = ""; std::string mpsocFile = ""; }; diff --git a/linux/devices/ploc/PlocMPSoCHandler.cpp b/linux/devices/ploc/PlocMPSoCHandler.cpp index b2b2727c..3734575b 100644 --- a/linux/devices/ploc/PlocMPSoCHandler.cpp +++ b/linux/devices/ploc/PlocMPSoCHandler.cpp @@ -90,6 +90,10 @@ ReturnValue_t PlocMPSoCHandler::executeAction(ActionId_t actionId, MessageQueueI return MPSoCReturnValuesIF::FILENAME_TOO_LONG; } mpsoc::FlashWritePusCmd flashWritePusCmd; + result = flashWritePusCmd.extractFields(data, size); + if (result != RETURN_OK) { + return result; + } result = plocMPSoCHelper->startFlashWrite(flashWritePusCmd.getObcFile(), flashWritePusCmd.getMPSoCFile()); if (result != RETURN_OK) { diff --git a/tmtc b/tmtc index b96ecce4..71c16f78 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit b96ecce483fa26bb031dac53fd6eeb8889521093 +Subproject commit 71c16f78aebadbc7b3d52bd5b09838937bbbc7d1