Compare commits

...

3 Commits

Author SHA1 Message Date
d60f4dd3e3
bump tmtc
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
2024-04-11 10:52:26 +02:00
6a0b18ffd0
that should do the job
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
2024-04-11 10:49:29 +02:00
398e7a3a05
MPSoC file split
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
2024-04-11 10:36:38 +02:00
5 changed files with 51 additions and 8 deletions

View File

@ -48,6 +48,7 @@
#define OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP 1 #define OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP 1
#define OBSW_PRINT_MISSED_DEADLINES 1 #define OBSW_PRINT_MISSED_DEADLINES 1
#define OBSW_MPSOC_JTAG_BOOT 0
#define OBSW_SYRLINKS_SIMULATED 1 #define OBSW_SYRLINKS_SIMULATED 1
#define OBSW_ADD_TEST_CODE 0 #define OBSW_ADD_TEST_CODE 0
#define OBSW_ADD_TEST_TASK 0 #define OBSW_ADD_TEST_TASK 0

View File

@ -6,10 +6,10 @@
#include <linux/payload/mpsocRetvals.h> #include <linux/payload/mpsocRetvals.h>
#include <mission/payload/plocSpBase.h> #include <mission/payload/plocSpBase.h>
#include "OBSWConfig.h"
#include "eive/definitions.h" #include "eive/definitions.h"
#include "fsfw/globalfunctions/CRC.h" #include "fsfw/returnvalues/returnvalue.h"
#include "fsfw/serialize/SerializeAdapter.h" #include "fsfw/serialize/SerializeAdapter.h"
#include "fsfw/serialize/SerializeIF.h"
namespace mpsoc { namespace mpsoc {
@ -838,20 +838,47 @@ class TcSimplexSendFile : public TcBase {
: TcBase(params, apid::TC_SIMPLEX_SEND_FILE, sequenceCount) {} : TcBase(params, apid::TC_SIMPLEX_SEND_FILE, sequenceCount) {}
ReturnValue_t setPayload(const uint8_t* commandData, size_t commandDataLen) { ReturnValue_t setPayload(const uint8_t* commandData, size_t commandDataLen) {
if (commandDataLen < MIN_DATA_LENGTH) {
return INVALID_LENGTH;
}
if (commandDataLen > MAX_DATA_LENGTH) { if (commandDataLen > MAX_DATA_LENGTH) {
return INVALID_LENGTH; return INVALID_LENGTH;
} }
std::string fileName(reinterpret_cast<const char*>(commandData)); const uint8_t** dataPtr = &commandData;
ReturnValue_t result = SerializeAdapter::deSerialize(&chunkParameter, dataPtr, &commandDataLen,
SerializeIF::Endianness::NETWORK);
if (result != returnvalue::OK) {
return result;
}
/// No chunks makes no sense, and DIV str can not be longer than whats representable with 3
/// decimal digits.
if (chunkParameter == 0 or chunkParameter > 999) {
return INVALID_PARAMETER;
}
std::string fileName(reinterpret_cast<const char*>(*dataPtr));
if (fileName.size() + sizeof(NULL_TERMINATOR) > MAX_FILENAME_SIZE) { if (fileName.size() + sizeof(NULL_TERMINATOR) > MAX_FILENAME_SIZE) {
return FILENAME_TOO_LONG; return FILENAME_TOO_LONG;
} }
spParams.setFullPayloadLen(commandDataLen + CRC_SIZE); size_t currentCopyIdx = 0;
std::memcpy(payloadStart, commandData, commandDataLen); size_t payloadLen = fileName.length() + sizeof(NULL_TERMINATOR) + CRC_SIZE;
if (chunkParameter > 1) {
char divStr[16]{};
sprintf(divStr, "DIV%03u", chunkParameter);
std::memcpy(payloadStart, divStr, DIV_STR_LEN);
payloadLen += DIV_STR_LEN;
currentCopyIdx += DIV_STR_LEN;
}
std::memcpy(payloadStart + currentCopyIdx, *dataPtr, fileName.length());
spParams.setFullPayloadLen(payloadLen);
return returnvalue::OK; return returnvalue::OK;
} }
private: private:
static const size_t MAX_DATA_LENGTH = 256; uint32_t chunkParameter = 0;
static constexpr size_t MAX_DATA_LENGTH = 256;
static constexpr size_t MIN_DATA_LENGTH = 4;
static constexpr size_t DIV_STR_LEN = 6;
}; };
/** /**

2
tmtc

@ -1 +1 @@
Subproject commit a8d0143b1ed9a14f7e071ee3344dc4e8f1937c55 Subproject commit 37eafb722b36ebabb50252121c80ef7712216486

View File

@ -6,5 +6,6 @@ target_sources(${UNITTEST_NAME} PRIVATE
testEnvironment.cpp testEnvironment.cpp
testGenericFilesystem.cpp testGenericFilesystem.cpp
hdlcEncodingRw.cpp hdlcEncodingRw.cpp
mpsocTests.cpp
printChar.cpp printChar.cpp
) )

14
unittest/mpsocTests.cpp Normal file
View File

@ -0,0 +1,14 @@
#include <catch2/catch_test_macros.hpp>
TEST_CASE("MPSoC helper tests", "[payload]") {
char divStr[16]{};
uint32_t divParam = 0;
SECTION("Simple Test") {
divParam = 3;
CHECK(divParam < 999);
sprintf(divStr, "DIV%03u", divParam);
REQUIRE(strcmp(divStr, "DIV003") == 0);
}
}