Merge remote-tracking branch 'origin/develop' into mueller/rtds-update
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
2022-05-16 15:17:29 +02:00
9 changed files with 345 additions and 310 deletions

View File

@ -309,6 +309,10 @@ class ApidOnlyPacket : public SpacePacket {
*/
class MPSoCBootSelect : public SpacePacket {
public:
static const uint8_t NVM0 = 0;
static const uint8_t NVM1 = 1;
/**
* @brief Constructor
*
@ -317,7 +321,7 @@ class MPSoCBootSelect : public SpacePacket {
* @param bp1 Partition pin 1
* @param bp2 Partition pin 2
*/
MPSoCBootSelect(uint8_t mem, uint8_t bp0, uint8_t bp1, uint8_t bp2)
MPSoCBootSelect(uint8_t mem = 0, uint8_t bp0 = 0, uint8_t bp1 = 0, uint8_t bp2 = 0)
: SpacePacket(DATA_FIELD_LENGTH - 1, true, APID_SEL_MPSOC_BOOT_IMAGE, DEFAULT_SEQUENCE_COUNT),
mem(mem),
bp0(bp0),
@ -1460,7 +1464,9 @@ class ExecutionReport : public VerificationReport {
OUT_OF_RANGE = 0x103,
OUT_OF_HEAP_MEMORY = 0x104,
INVALID_STATE_TRANSITION = 0x105,
MPSOC_BOOT_FAILED = 0x106,
MPSOC_ALREADY_BOOTING = 0x106,
MPSOC_ALREADY_OPERATIONAL = 0x107,
MPSOC_BOOT_FAILED = 0x108,
SP_NOT_AVAILABLE = 0x200,
SP_DATA_INSUFFICIENT = 0x201,
SP_MEMORY_ID_INVALID = 0x202,
@ -1594,6 +1600,14 @@ class ExecutionReport : public VerificationReport {
sif::warning << STATUS_PRINTOUT_PREFIX << "Invalid state transition" << std::endl;
break;
}
case StatusCode::MPSOC_ALREADY_BOOTING: {
sif::warning << STATUS_PRINTOUT_PREFIX << "MPSoC already booting" << std::endl;
break;
}
case StatusCode::MPSOC_ALREADY_OPERATIONAL: {
sif::warning << STATUS_PRINTOUT_PREFIX << "MPSoC already operational" << std::endl;
break;
}
case StatusCode::MPSOC_BOOT_FAILED: {
sif::warning << STATUS_PRINTOUT_PREFIX << "MPSoC boot failed" << std::endl;
break;

View File

@ -108,7 +108,11 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
MessageQueueIF* eventQueue = nullptr;
MessageQueueIF* commandActionHelperQueue = nullptr;
SourceSequenceCounter sequenceCount;
// Initiate the sequence count with the maximum value. It is incremented before
// a packet is sent, so the first value will be 0 accordingly using
// the wrap around of the counter.
SourceSequenceCounter sequenceCount =
SourceSequenceCounter(SpacePacketBase::LIMIT_SEQUENCE_COUNT - 1);
uint8_t commandBuffer[mpsoc::MAX_COMMAND_SIZE];

View File

@ -1062,8 +1062,8 @@ ReturnValue_t PlocSupervisorHandler::handleBootStatusReport(const uint8_t* data)
nextReplyId = supv::EXE_REPORT;
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_PLOC_SUPERVISOR == 1
sif::info << "PlocSupervisorHandler::handleBootStatusReport: SoC State (0 - off, 1 - booting, 3 "
"- operating, 4 - Shutdown): "
sif::info << "PlocSupervisorHandler::handleBootStatusReport: SoC State (0 - off, 1 - booting, 2 - Update, 3 "
"- operating, 4 - Shutdown, 5 - Reset): "
<< static_cast<unsigned int>(bootStatusReport.socState.value) << std::endl;
sif::info << "PlocSupervisorHandler::handleBootStatusReport: Power Cycles: "
<< static_cast<unsigned int>(bootStatusReport.powerCycles.value) << std::endl;

View File

@ -10,6 +10,7 @@
#endif
#include "fsfw/globalfunctions/CRC.h"
#include "fsfw/tasks/TaskFactory.h"
#include "fsfw/timemanager/Countdown.h"
#include "mission/utility/Filenaming.h"
#include "mission/utility/ProgressPrinter.h"
@ -158,10 +159,12 @@ ReturnValue_t PlocSupvHelper::performUpdate() {
uint16_t dataLength = 0;
size_t bytesWritten = 0;
uint16_t sequenceCount = 1;
uint32_t packetNum = 1;
supv::SequenceFlags seqFlags = supv::SequenceFlags::FIRST_PKT;
while (remainingSize > 0) {
if (terminate) {
terminate = false;
triggerEvent(TERMINATED_UPDATE_PROCEDURE);
return PROCESS_TERMINATED;
}
if (remainingSize > supv::WriteMemory::CHUNK_MAX) {
@ -193,8 +196,10 @@ ReturnValue_t PlocSupvHelper::performUpdate() {
update.startAddress + bytesWritten, dataLength, tempData);
result = handlePacketTransmission(packet);
if (result != RETURN_OK) {
triggerEvent(WRITE_MEMORY_FAILED, packetNum);
return result;
}
packetNum += 1;
bytesWritten += dataLength;
#if OBSW_DEBUG_PLOC_SUPERVISOR == 1
progressPrinter.print(bytesWritten);
@ -233,7 +238,7 @@ ReturnValue_t PlocSupvHelper::performEventBufferRequest() {
ReturnValue_t PlocSupvHelper::prepareUpdate() {
ReturnValue_t result = RETURN_OK;
supv::ApidOnlyPacket packet(supv::APID_PREPARE_UPDATE);
result = handlePacketTransmission(packet);
result = handlePacketTransmission(packet, PREPARE_UPDATE_EXECUTION_REPORT);
if (result != RETURN_OK) {
return result;
}
@ -342,8 +347,8 @@ ReturnValue_t PlocSupvHelper::handleTmReception(supv::TmPacket* tmPacket, size_t
}
}
if (remainingBytes != 0) {
sif::warning << "PlocSupvHelper::handleTmReception: Failed to read " << remainingBytes
<< " bytes" << std::endl;
sif::warning << "PlocSupvHelper::handleTmReception: Failed to read " << std::dec
<< remainingBytes << " bytes" << std::endl;
return RETURN_FAILED;
}
result = tmPacket->checkCrc();
@ -372,6 +377,8 @@ ReturnValue_t PlocSupvHelper::receive(uint8_t* data, size_t* readBytes, size_t r
}
if (*readBytes > 0) {
std::memcpy(data, buffer, *readBytes);
} else {
TaskFactory::delayTask(40);
}
return result;
}

View File

@ -78,6 +78,9 @@ class PlocSupvHelper : public SystemObject, public ExecutableObjectIF, public Ha
//! P1: Return value
//! P2: Apid of command for which the reception of the execution report failed
static const Event EXE_RECEPTION_FAILURE = MAKE_EVENT(16, severity::LOW);
//! [EXPORT] : [COMMENT] Update procedure failed when sending packet with number P1
//! P1: Packet number for which the memory write command fails
static const Event WRITE_MEMORY_FAILED = MAKE_EVENT(17, severity::LOW);
PlocSupvHelper(object_id_t objectId);
virtual ~PlocSupvHelper();
@ -128,6 +131,7 @@ class PlocSupvHelper : public SystemObject, public ExecutableObjectIF, public Ha
static const size_t SIZE_EVENT_BUFFER_FULL_PACKET = 1024;
static const size_t SIZE_EVENT_BUFFER_LAST_PACKET = 200;
static const uint32_t CRC_EXECUTION_TIMEOUT = 60000;
static const uint32_t PREPARE_UPDATE_EXECUTION_REPORT = 2000;
struct Update {
uint8_t memoryId;
@ -177,7 +181,7 @@ class PlocSupvHelper : public SystemObject, public ExecutableObjectIF, public Ha
ReturnValue_t performUpdate();
ReturnValue_t performEventBufferRequest();
ReturnValue_t handlePacketTransmission(SpacePacket& packet,
uint32_t timeoutExecutionReport = 1000);
uint32_t timeoutExecutionReport = 2000);
ReturnValue_t sendCommand(SpacePacket& packet);
/**
* @brief Function which reads form the communication interface