some remaining bugfixes
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
Robin Müller 2022-11-21 18:32:23 +01:00
parent 9953a49b09
commit cc79ffc57b
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
6 changed files with 30 additions and 32 deletions

View File

@ -1681,7 +1681,7 @@ class UpdateStatusReport {
if (not tmReader.crcIsOk()) { if (not tmReader.crcIsOk()) {
return result::CRC_FAILURE; return result::CRC_FAILURE;
} }
if (tmReader.getApid() != Apid::MEM_MAN) { if (tmReader.getModuleApid() != Apid::MEM_MAN) {
return result::INVALID_APID; return result::INVALID_APID;
} }
if (tmReader.getBufSize() < MIN_TMTC_LEN + PAYLOAD_LEN or if (tmReader.getBufSize() < MIN_TMTC_LEN + PAYLOAD_LEN or
@ -1690,10 +1690,7 @@ class UpdateStatusReport {
<< std::endl; << std::endl;
return result::BUF_TOO_SMALL; return result::BUF_TOO_SMALL;
} }
size_t remLen = PAYLOAD_LEN; size_t remLen = tmReader.getPayloadLen();
if (remLen < PAYLOAD_LEN) {
return result::INVALID_REPLY_LENGTH;
}
const uint8_t* dataFieldPtr = tmReader.getPayloadStart(); const uint8_t* dataFieldPtr = tmReader.getPayloadStart();
SerializeAdapter::deSerialize(&memoryId, &dataFieldPtr, &remLen, SerializeIF::Endianness::BIG); SerializeAdapter::deSerialize(&memoryId, &dataFieldPtr, &remLen, SerializeIF::Endianness::BIG);
SerializeAdapter::deSerialize(&n, &dataFieldPtr, &remLen, SerializeIF::Endianness::BIG); SerializeAdapter::deSerialize(&n, &dataFieldPtr, &remLen, SerializeIF::Endianness::BIG);

View File

@ -2,6 +2,7 @@
#include <fsfw/filesystem/HasFileSystemIF.h> #include <fsfw/filesystem/HasFileSystemIF.h>
#include <fsfw/globalfunctions/arrayprinter.h> #include <fsfw/globalfunctions/arrayprinter.h>
#include <fsfw/tasks/TaskFactory.h>
#include <filesystem> #include <filesystem>
#include <fstream> #include <fstream>
@ -84,7 +85,7 @@ ReturnValue_t PlocSupervisorHandler::executeAction(ActionId_t actionId,
break; break;
} }
if (plocSupvHelperExecuting) { if (uartManager.longerRequestActive()) {
return result::SUPV_HELPER_EXECUTING; return result::SUPV_HELPER_EXECUTING;
} }
@ -98,6 +99,7 @@ ReturnValue_t PlocSupervisorHandler::executeAction(ActionId_t actionId,
if (size > config::MAX_PATH_SIZE + config::MAX_FILENAME_SIZE) { if (size > config::MAX_PATH_SIZE + config::MAX_FILENAME_SIZE) {
return result::FILENAME_TOO_LONG; return result::FILENAME_TOO_LONG;
} }
shutdownCmdSent = false;
UpdateParams params; UpdateParams params;
result = extractUpdateCommand(data, size, params); result = extractUpdateCommand(data, size, params);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
@ -107,15 +109,15 @@ ReturnValue_t PlocSupervisorHandler::executeAction(ActionId_t actionId,
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
plocSupvHelperExecuting = true;
return EXECUTION_FINISHED; return EXECUTION_FINISHED;
} }
case CONTINUE_UPDATE: { case CONTINUE_UPDATE: {
shutdownCmdSent = false;
uartManager.initiateUpdateContinuation(); uartManager.initiateUpdateContinuation();
plocSupvHelperExecuting = true;
return EXECUTION_FINISHED; return EXECUTION_FINISHED;
} }
case MEMORY_CHECK_WITH_FILE: { case MEMORY_CHECK_WITH_FILE: {
shutdownCmdSent = false;
UpdateParams params; UpdateParams params;
ReturnValue_t result = extractBaseParams(&data, size, params); ReturnValue_t result = extractBaseParams(&data, size, params);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
@ -125,7 +127,6 @@ ReturnValue_t PlocSupervisorHandler::executeAction(ActionId_t actionId,
return HasFileSystemIF::FILE_DOES_NOT_EXIST; return HasFileSystemIF::FILE_DOES_NOT_EXIST;
} }
uartManager.performMemCheck(params.file, params.memId, params.startAddr); uartManager.performMemCheck(params.file, params.memId, params.startAddr);
plocSupvHelperExecuting = true;
return EXECUTION_FINISHED; return EXECUTION_FINISHED;
} }
default: default:
@ -777,7 +778,6 @@ void PlocSupervisorHandler::handleEvent(EventMessage* eventMessage) {
Event event = eventMessage->getEvent(); Event event = eventMessage->getEvent();
switch (objectId) { switch (objectId) {
case objects::PLOC_SUPERVISOR_HELPER: { case objects::PLOC_SUPERVISOR_HELPER: {
plocSupvHelperExecuting = false;
// After execution of update procedure, PLOC is in a state where it draws approx. 700 mA of // After execution of update procedure, PLOC is in a state where it draws approx. 700 mA of
// current. To leave this state the shutdown MPSoC command must be sent here. // current. To leave this state the shutdown MPSoC command must be sent here.
if (event == PlocSupvUartManager::SUPV_UPDATE_FAILED || if (event == PlocSupvUartManager::SUPV_UPDATE_FAILED ||
@ -786,15 +786,20 @@ void PlocSupervisorHandler::handleEvent(EventMessage* eventMessage) {
event == PlocSupvUartManager::SUPV_CONTINUE_UPDATE_SUCCESSFUL || event == PlocSupvUartManager::SUPV_CONTINUE_UPDATE_SUCCESSFUL ||
event == PlocSupvUartManager::SUPV_MEM_CHECK_FAIL || event == PlocSupvUartManager::SUPV_MEM_CHECK_FAIL ||
event == PlocSupvUartManager::SUPV_MEM_CHECK_OK) { event == PlocSupvUartManager::SUPV_MEM_CHECK_OK) {
// Wait for a short period for the uart state machine to adjust
// TaskFactory::delayTask(5);
if (not shutdownCmdSent) {
shutdownCmdSent = true;
result = this->executeAction(supv::SHUTDOWN_MPSOC, NO_COMMANDER, nullptr, 0); result = this->executeAction(supv::SHUTDOWN_MPSOC, NO_COMMANDER, nullptr, 0);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
triggerEvent(SUPV_MPSOC_SHUWDOWN_BUILD_FAILED); triggerEvent(SUPV_MPSOC_SHUTDOWN_BUILD_FAILED);
sif::warning << "PlocSupervisorHandler::handleEvent: Failed to build MPSoC shutdown " sif::warning << "PlocSupervisorHandler::handleEvent: Failed to build MPSoC shutdown "
"command" "command"
<< std::endl; << std::endl;
return; return;
} }
} }
}
break; break;
} }
default: default:
@ -1217,14 +1222,6 @@ size_t PlocSupervisorHandler::getNextReplyLength(DeviceCommandId_t commandId) {
return replyLen; return replyLen;
} }
ReturnValue_t PlocSupervisorHandler::doSendReadHook() {
// Prevent DHB from polling UART during commands executed by the supervisor helper task
if (plocSupvHelperExecuting) {
return returnvalue::FAILED;
}
return returnvalue::OK;
}
void PlocSupervisorHandler::doOffActivity() {} void PlocSupervisorHandler::doOffActivity() {}
void PlocSupervisorHandler::handleDeviceTm(const uint8_t* data, size_t dataSize, void PlocSupervisorHandler::handleDeviceTm(const uint8_t* data, size_t dataSize,

View File

@ -59,7 +59,7 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
uint8_t expectedReplies = 1, bool useAlternateId = false, uint8_t expectedReplies = 1, bool useAlternateId = false,
DeviceCommandId_t alternateReplyID = 0) override; DeviceCommandId_t alternateReplyID = 0) override;
size_t getNextReplyLength(DeviceCommandId_t deviceCommand) override; size_t getNextReplyLength(DeviceCommandId_t deviceCommand) override;
ReturnValue_t doSendReadHook() override; // ReturnValue_t doSendReadHook() override;
void doOffActivity() override; void doOffActivity() override;
private: private:
@ -81,7 +81,7 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
//! [EXPORT] : [COMMENT] Supervisor helper currently executing a command //! [EXPORT] : [COMMENT] Supervisor helper currently executing a command
static const Event SUPV_HELPER_EXECUTING = MAKE_EVENT(7, severity::LOW); static const Event SUPV_HELPER_EXECUTING = MAKE_EVENT(7, severity::LOW);
//! [EXPORT] : [COMMENT] Failed to build the command to shutdown the MPSoC //! [EXPORT] : [COMMENT] Failed to build the command to shutdown the MPSoC
static const Event SUPV_MPSOC_SHUWDOWN_BUILD_FAILED = MAKE_EVENT(8, severity::LOW); static const Event SUPV_MPSOC_SHUTDOWN_BUILD_FAILED = MAKE_EVENT(8, 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; static const uint16_t PACKET_SEQUENCE_COUNT_MASK = 0x3FFF;
@ -119,6 +119,7 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
SerialComIF* uartComIf = nullptr; SerialComIF* uartComIf = nullptr;
LinuxLibgpioIF* gpioComIF = nullptr; LinuxLibgpioIF* gpioComIF = nullptr;
Gpio uartIsolatorSwitch; Gpio uartIsolatorSwitch;
bool shutdownCmdSent = false;
supv::HkSet hkset; supv::HkSet hkset;
supv::BootStatusReport bootStatusReport; supv::BootStatusReport bootStatusReport;
@ -151,9 +152,6 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
std::string supervisorFilePath = "ploc/supervisor"; std::string supervisorFilePath = "ploc/supervisor";
std::string activeMramFile; std::string activeMramFile;
// Supervisor helper class currently executing a command
bool plocSupvHelperExecuting = false;
Countdown executionReportTimeout = Countdown(EXECUTION_DEFAULT_TIMEOUT, false); Countdown executionReportTimeout = Countdown(EXECUTION_DEFAULT_TIMEOUT, false);
Countdown acknowledgementReportTimeout = Countdown(ACKNOWLEDGE_DEFAULT_TIMEOUT, false); Countdown acknowledgementReportTimeout = Countdown(ACKNOWLEDGE_DEFAULT_TIMEOUT, false);
// Vorago nees some time to boot properly // Vorago nees some time to boot properly

View File

@ -1148,3 +1148,8 @@ int PlocSupvUartManager::removeHdlcFramingWithCrcCheck(const uint8_t* src, size_
*dlen = tlen - 2; *dlen = tlen - 2;
return 0; return 0;
} }
bool PlocSupvUartManager::longerRequestActive() const {
MutexGuard mg(lock);
return state == InternalState::DEDICATED_REQUEST;
}

View File

@ -159,6 +159,7 @@ class PlocSupvUartManager : public DeviceCommunicationIF,
* @brief Can be used to start the UART reception * @brief Can be used to start the UART reception
*/ */
void start(); void start();
bool longerRequestActive() const;
static uint32_t buildProgParams1(uint8_t percent, uint16_t seqCount); static uint32_t buildProgParams1(uint8_t percent, uint16_t seqCount);
static uint32_t buildApidServiceParam1(uint8_t apid, uint8_t serviceId); static uint32_t buildApidServiceParam1(uint8_t apid, uint8_t serviceId);
@ -252,7 +253,7 @@ class PlocSupvUartManager : public DeviceCommunicationIF,
std::array<uint8_t, supv::MAX_COMMAND_SIZE> tmBuf{}; std::array<uint8_t, supv::MAX_COMMAND_SIZE> tmBuf{};
bool debugMode = true; bool debugMode = false;
bool timestamping = true; bool timestamping = true;
// Remembers APID to know at which command a procedure failed // Remembers APID to know at which command a procedure failed

2
tmtc

@ -1 +1 @@
Subproject commit ac2b9cb712405ee07b9de1950fd6c923a6f184b5 Subproject commit 70a1d49246b5bd5297c22d336e9dd8f58f019f90