From b3bb029c47e13f0e6bb500e7e3590f880e735524 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 22 Aug 2022 12:41:08 +0200 Subject: [PATCH] something wrong with mem check --- generators/bsp_q7s_events.csv | 5 +- generators/events/translateEvents.cpp | 7 ++- generators/objects/translateObjects.cpp | 2 +- .../PlocSupervisorDefinitions.h | 4 +- linux/devices/ploc/PlocSupvHelper.cpp | 47 +++++++++++++------ linux/devices/ploc/PlocSupvHelper.h | 1 + linux/fsfwconfig/events/translateEvents.cpp | 7 ++- linux/fsfwconfig/objects/translateObjects.cpp | 2 +- tmtc | 2 +- 9 files changed, 51 insertions(+), 26 deletions(-) diff --git a/generators/bsp_q7s_events.csv b/generators/bsp_q7s_events.csv index 0aa188c2..7d822e1d 100644 --- a/generators/bsp_q7s_events.csv +++ b/generators/bsp_q7s_events.csv @@ -205,10 +205,11 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path 13616;0x3530;SUPV_EXE_INVALID_APID;LOW;Supervisor helper expected execution report but received space packet with other apid P1: Apid of received space packet P2: Internal state of supervisor helper;linux/devices/ploc/PlocSupvHelper.h 13617;0x3531;ACK_RECEPTION_FAILURE;LOW;Failed to receive acknowledgment report P1: Return value P2: Apid of command for which the reception of the acknowledgment report failed;linux/devices/ploc/PlocSupvHelper.h 13618;0x3532;EXE_RECEPTION_FAILURE;LOW;Failed to receive execution report P1: Return value P2: Apid of command for which the reception of the execution report failed;linux/devices/ploc/PlocSupvHelper.h -13619;0x3533;WRITE_MEMORY_FAILED;LOW;Update procedure failed when sending packet. P1: Bytes written, P2: Sequence Count;linux/devices/ploc/PlocSupvHelper.h +13619;0x3533;WRITE_MEMORY_FAILED;LOW;Update procedure failed when sending packet. P1: First byte percent, Third and Fourht bytes Sequence Count, P2: Bytes written;linux/devices/ploc/PlocSupvHelper.h 13620;0x3534;SUPV_REPLY_SIZE_MISSMATCH;LOW;;linux/devices/ploc/PlocSupvHelper.h 13621;0x3535;SUPV_REPLY_CRC_MISSMATCH;LOW;;linux/devices/ploc/PlocSupvHelper.h -13622;0x3536;SUPV_UPDATE_PROGRESS;INFO;Will be triggered every 5 percent of the update progress. P1: Bytes written, P2: Sequence Count;linux/devices/ploc/PlocSupvHelper.h +13622;0x3536;SUPV_UPDATE_PROGRESS;INFO;Will be triggered every 5 percent of the update progress. P1: First byte percent, Third and Fourht bytes Sequence Count, P2: Bytes written;linux/devices/ploc/PlocSupvHelper.h +13623;0x3537;SUPV_MEM_CHECK_STATUS;INFO;;linux/devices/ploc/PlocSupvHelper.h 13700;0x3584;ALLOC_FAILURE;MEDIUM;;bsp_q7s/core/CoreController.h 13701;0x3585;REBOOT_SW;MEDIUM; Software reboot occurred. Can also be a systemd reboot. P1: Current Chip, P2: Current Copy;bsp_q7s/core/CoreController.h 13702;0x3586;REBOOT_MECHANISM_TRIGGERED;MEDIUM;The reboot mechanism was triggered. P1: First 16 bits: Last Chip, Last 16 bits: Last Copy, P2: Each byte is the respective reboot count for the slots;bsp_q7s/core/CoreController.h diff --git a/generators/events/translateEvents.cpp b/generators/events/translateEvents.cpp index debb17d5..f9511036 100644 --- a/generators/events/translateEvents.cpp +++ b/generators/events/translateEvents.cpp @@ -1,7 +1,7 @@ /** - * @brief Auto-generated event translation file. Contains 214 translations. + * @brief Auto-generated event translation file. Contains 215 translations. * @details - * Generated on: 2022-08-21 08:37:22 + * Generated on: 2022-08-22 12:35:41 */ #include "translateEvents.h" @@ -211,6 +211,7 @@ const char *WRITE_MEMORY_FAILED_STRING = "WRITE_MEMORY_FAILED"; const char *SUPV_REPLY_SIZE_MISSMATCH_STRING = "SUPV_REPLY_SIZE_MISSMATCH"; const char *SUPV_REPLY_CRC_MISSMATCH_STRING = "SUPV_REPLY_CRC_MISSMATCH"; const char *SUPV_UPDATE_PROGRESS_STRING = "SUPV_UPDATE_PROGRESS"; +const char *SUPV_MEM_CHECK_STATUS_STRING = "SUPV_MEM_CHECK_STATUS"; const char *ALLOC_FAILURE_STRING = "ALLOC_FAILURE"; const char *REBOOT_SW_STRING = "REBOOT_SW"; const char *REBOOT_MECHANISM_TRIGGERED_STRING = "REBOOT_MECHANISM_TRIGGERED"; @@ -630,6 +631,8 @@ const char *translateEvents(Event event) { return SUPV_REPLY_CRC_MISSMATCH_STRING; case (13622): return SUPV_UPDATE_PROGRESS_STRING; + case (13623): + return SUPV_MEM_CHECK_STATUS_STRING; case (13700): return ALLOC_FAILURE_STRING; case (13701): diff --git a/generators/objects/translateObjects.cpp b/generators/objects/translateObjects.cpp index 2f561520..de55983c 100644 --- a/generators/objects/translateObjects.cpp +++ b/generators/objects/translateObjects.cpp @@ -2,7 +2,7 @@ * @brief Auto-generated object translation file. * @details * Contains 133 translations. - * Generated on: 2022-08-21 08:37:22 + * Generated on: 2022-08-22 12:35:41 */ #include "translateObjects.h" diff --git a/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h b/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h index 348fed54..9c371305 100644 --- a/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h +++ b/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h @@ -268,8 +268,8 @@ static const uint32_t ADC_REPORT_SET_ID = ADC_REPORT; namespace recv_timeout { // Erase memory can require up to 60 seconds for execution -static const uint32_t ERASE_MEMORY_TIMEOUT = 60000; -static const uint32_t UPDATE_STATUS_REPORT_TIMEOUT = 70000; +static const uint32_t ERASE_MEMORY = 60000; +static const uint32_t UPDATE_STATUS_REPORT = 70000; } // namespace recv_timeout /** diff --git a/linux/devices/ploc/PlocSupvHelper.cpp b/linux/devices/ploc/PlocSupvHelper.cpp index f07acaef..b324b15b 100644 --- a/linux/devices/ploc/PlocSupvHelper.cpp +++ b/linux/devices/ploc/PlocSupvHelper.cpp @@ -377,7 +377,7 @@ ReturnValue_t PlocSupvHelper::eraseMemory() { if (result != RETURN_OK) { return result; } - result = handlePacketTransmission(eraseMemory, supv::recv_timeout::ERASE_MEMORY_TIMEOUT); + result = handlePacketTransmission(eraseMemory, supv::recv_timeout::ERASE_MEMORY); if (result != RETURN_OK) { return result; } @@ -451,8 +451,14 @@ ReturnValue_t PlocSupvHelper::handleExe(uint32_t timeout) { << std::endl; return result; } + + return exeReportHandling(); +} + +ReturnValue_t PlocSupvHelper::exeReportHandling() { supv::ExecutionReport exeReport(tmBuf.data(), tmBuf.size()); - result = checkReceivedTm(exeReport); + + ReturnValue_t result = checkReceivedTm(exeReport); if (result != RETURN_OK) { return result; } @@ -465,7 +471,7 @@ ReturnValue_t PlocSupvHelper::handleExe(uint32_t timeout) { } return result; } - return RETURN_OK; + return exeReportHandling(); } ReturnValue_t PlocSupvHelper::handleTmReception(size_t remainingBytes, uint8_t* readBuf, @@ -597,18 +603,29 @@ ReturnValue_t PlocSupvHelper::handleCheckMemoryCommand() { } result = - handleTmReception(static_cast(updateStatusReport.getNominalSize()), - statusReportBuf.data(), supv::recv_timeout::UPDATE_STATUS_REPORT_TIMEOUT); - if (result != RETURN_OK) { - sif::warning - << "PlocSupvHelper::handleCheckMemoryCommand: Failed to receive update status report" - << std::endl; - return result; - } - result = updateStatusReport.checkCrc(); - if (result != RETURN_OK) { - sif::warning << "PlocSupvHelper::handleTmReception: CRC check failed" << std::endl; - return result; + handleTmReception(ccsds::HEADER_LEN, tmBuf.data(), supv::recv_timeout::UPDATE_STATUS_REPORT); + SpacePacketReader spReader(tmBuf.data(), tmBuf.size()); + if (spReader.getApid() == supv::APID_EXE_FAILURE) { + size_t remBytes = spReader.getPacketDataLen() + 1; + result = handleTmReception(remBytes, tmBuf.data() + ccsds::HEADER_LEN); + if (result != HasReturnvaluesIF::RETURN_OK) { + sif::warning << "Reading exe failure report failed" << std::endl; + } + return exeReportHandling(); + } else if (spReader.getApid() == supv::APID_UPDATE_STATUS_REPORT) { + size_t remBytes = spReader.getPacketDataLen() + 1; + result = handleTmReception(remBytes, tmBuf.data() + ccsds::HEADER_LEN); + if (result != RETURN_OK) { + sif::warning + << "PlocSupvHelper::handleCheckMemoryCommand: Failed to receive update status report" + << std::endl; + return result; + } + result = updateStatusReport.checkCrc(); + if (result != RETURN_OK) { + sif::warning << "PlocSupvHelper::handleTmReception: CRC check failed" << std::endl; + return result; + } } result = handleExe(CRC_EXECUTION_TIMEOUT); diff --git a/linux/devices/ploc/PlocSupvHelper.h b/linux/devices/ploc/PlocSupvHelper.h index ee745b54..81cbfd1d 100644 --- a/linux/devices/ploc/PlocSupvHelper.h +++ b/linux/devices/ploc/PlocSupvHelper.h @@ -250,6 +250,7 @@ class PlocSupvHelper : public SystemObject, public ExecutableObjectIF, public Ha // finished. ReturnValue_t calcImageCrc(); ReturnValue_t handleCheckMemoryCommand(); + ReturnValue_t exeReportHandling(); /** * @brief Return size of file with name filename * diff --git a/linux/fsfwconfig/events/translateEvents.cpp b/linux/fsfwconfig/events/translateEvents.cpp index debb17d5..f9511036 100644 --- a/linux/fsfwconfig/events/translateEvents.cpp +++ b/linux/fsfwconfig/events/translateEvents.cpp @@ -1,7 +1,7 @@ /** - * @brief Auto-generated event translation file. Contains 214 translations. + * @brief Auto-generated event translation file. Contains 215 translations. * @details - * Generated on: 2022-08-21 08:37:22 + * Generated on: 2022-08-22 12:35:41 */ #include "translateEvents.h" @@ -211,6 +211,7 @@ const char *WRITE_MEMORY_FAILED_STRING = "WRITE_MEMORY_FAILED"; const char *SUPV_REPLY_SIZE_MISSMATCH_STRING = "SUPV_REPLY_SIZE_MISSMATCH"; const char *SUPV_REPLY_CRC_MISSMATCH_STRING = "SUPV_REPLY_CRC_MISSMATCH"; const char *SUPV_UPDATE_PROGRESS_STRING = "SUPV_UPDATE_PROGRESS"; +const char *SUPV_MEM_CHECK_STATUS_STRING = "SUPV_MEM_CHECK_STATUS"; const char *ALLOC_FAILURE_STRING = "ALLOC_FAILURE"; const char *REBOOT_SW_STRING = "REBOOT_SW"; const char *REBOOT_MECHANISM_TRIGGERED_STRING = "REBOOT_MECHANISM_TRIGGERED"; @@ -630,6 +631,8 @@ const char *translateEvents(Event event) { return SUPV_REPLY_CRC_MISSMATCH_STRING; case (13622): return SUPV_UPDATE_PROGRESS_STRING; + case (13623): + return SUPV_MEM_CHECK_STATUS_STRING; case (13700): return ALLOC_FAILURE_STRING; case (13701): diff --git a/linux/fsfwconfig/objects/translateObjects.cpp b/linux/fsfwconfig/objects/translateObjects.cpp index 2f561520..de55983c 100644 --- a/linux/fsfwconfig/objects/translateObjects.cpp +++ b/linux/fsfwconfig/objects/translateObjects.cpp @@ -2,7 +2,7 @@ * @brief Auto-generated object translation file. * @details * Contains 133 translations. - * Generated on: 2022-08-21 08:37:22 + * Generated on: 2022-08-22 12:35:41 */ #include "translateObjects.h" diff --git a/tmtc b/tmtc index b3f0c08b..425870d1 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit b3f0c08bd757c8b6616398eb6dbd64c9107d59bc +Subproject commit 425870d16150f5b99e8e450ac892104e557aff20