From 9c1eee075c53c9bca1cefe7d5faf7d6267b6f730 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 2 Oct 2023 14:15:50 +0200 Subject: [PATCH 01/16] well that was fast --- bsp_q7s/core/CMakeLists.txt | 3 ++- bsp_q7s/core/XiphosWdtHandler.cpp | 39 +++++++++++++++++++++++++++++++ bsp_q7s/core/XiphosWdtHandler.h | 22 +++++++++++++++++ bsp_q7s/em/emObjectFactory.cpp | 2 ++ bsp_q7s/fmObjectFactory.cpp | 2 ++ bsp_q7s/scheduling.cpp | 9 +++++++ common/config/eive/objects.h | 1 + tmtc | 2 +- 8 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 bsp_q7s/core/XiphosWdtHandler.cpp create mode 100644 bsp_q7s/core/XiphosWdtHandler.h diff --git a/bsp_q7s/core/CMakeLists.txt b/bsp_q7s/core/CMakeLists.txt index 33550144..530b53e9 100644 --- a/bsp_q7s/core/CMakeLists.txt +++ b/bsp_q7s/core/CMakeLists.txt @@ -1 +1,2 @@ -target_sources(${OBSW_NAME} PRIVATE CoreController.cpp WatchdogHandler.cpp) +target_sources(${OBSW_NAME} PRIVATE CoreController.cpp WatchdogHandler.cpp + XiphosWdtHandler.cpp) diff --git a/bsp_q7s/core/XiphosWdtHandler.cpp b/bsp_q7s/core/XiphosWdtHandler.cpp new file mode 100644 index 00000000..38d206db --- /dev/null +++ b/bsp_q7s/core/XiphosWdtHandler.cpp @@ -0,0 +1,39 @@ +#include "XiphosWdtHandler.h" + +XiphosWdtHandler::XiphosWdtHandler(object_id_t objectId) : SystemObject(objectId) {} + +ReturnValue_t XiphosWdtHandler::initialize() { + int result = xsc_watchdog_init(&wdtHandle); + if (result != 0) { + sif::error << "XiphosWdtHandler: Initiating watchdog failed with code " << result << ": " + << strerror(result) << std::endl; + return ObjectManagerIF::CHILD_INIT_FAILED; + } + if (wdtHandle == nullptr) { + sif::error << "XiphosWdtHandler: WDT handle is nullptr!" << std::endl; + return ObjectManagerIF::CHILD_INIT_FAILED; + } + result = xsc_watchdog_set_timeout(wdtHandle, timeoutSeconds); + if (result != 0) { + sif::error << "XiphosWdtHandler: Setting WDT timeout of " << timeoutSeconds + << " seconds failed with code " << result << ": " << strerror(result) << std::endl; + return ObjectManagerIF::CHILD_INIT_FAILED; + } + result = xsc_watchdog_enable(wdtHandle); + if (result != 0) { + sif::error << "XiphosWdtHandler: Enabling WDT failed with code " << result << ": " + << strerror(result) << std::endl; + return ObjectManagerIF::CHILD_INIT_FAILED; + } + return returnvalue::OK; +} + +ReturnValue_t XiphosWdtHandler::performOperation(uint8_t opCode) { + int result = xsc_watchdog_keepalive(wdtHandle); + if (result != 0) { + sif::warning << "XiphosWdtHandler: Feeding WDT failed with code " << result << ": " + << strerror(result) << std::endl; + return returnvalue::FAILED; + } + return returnvalue::OK; +} diff --git a/bsp_q7s/core/XiphosWdtHandler.h b/bsp_q7s/core/XiphosWdtHandler.h new file mode 100644 index 00000000..346c13ef --- /dev/null +++ b/bsp_q7s/core/XiphosWdtHandler.h @@ -0,0 +1,22 @@ +#ifndef BSP_Q7S_CORE_XIPHOSWDTHANDLER_H_ +#define BSP_Q7S_CORE_XIPHOSWDTHANDLER_H_ + +#include +#include +#include +#include + +class XiphosWdtHandler : public SystemObject, public ExecutableObjectIF { + public: + XiphosWdtHandler(object_id_t objectId); + ReturnValue_t performOperation(uint8_t opCode) override; + ReturnValue_t initialize() override; + + private: + // Timeout duration range specified by Xiphos: 0.001 seconds to 171 seconds. The libxiphos API + // expects an int, so I guess this translates to 1 to 171 seconds. + uint32_t timeoutSeconds = 60; + struct watchdog_s* wdtHandle = nullptr; +}; + +#endif /* BSP_Q7S_CORE_XIPHOSWDTHANDLER_H_ */ diff --git a/bsp_q7s/em/emObjectFactory.cpp b/bsp_q7s/em/emObjectFactory.cpp index 976602d4..06867a1c 100644 --- a/bsp_q7s/em/emObjectFactory.cpp +++ b/bsp_q7s/em/emObjectFactory.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -37,6 +38,7 @@ void ObjectFactory::produce(void* args) { PersistentTmStores stores; readFirmwareVersion(); + new XiphosWdtHandler(objects::XIPHOS_WDT); ObjectFactory::produceGenericObjects(&healthTable, &pusFunnel, &cfdpFunnel, *SdCardManager::instance(), &ipcStore, &tmStore, stores, 200, enableHkSets); diff --git a/bsp_q7s/fmObjectFactory.cpp b/bsp_q7s/fmObjectFactory.cpp index a3ab6bba..83e3d90b 100644 --- a/bsp_q7s/fmObjectFactory.cpp +++ b/bsp_q7s/fmObjectFactory.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -34,6 +35,7 @@ void ObjectFactory::produce(void* args) { PersistentTmStores stores; readFirmwareVersion(); + new XiphosWdtHandler(objects::XIPHOS_WDT); ObjectFactory::produceGenericObjects(&healthTable, &pusFunnel, &cfdpFunnel, *SdCardManager::instance(), &ipcStore, &tmStore, stores, 200, true); diff --git a/bsp_q7s/scheduling.cpp b/bsp_q7s/scheduling.cpp index d7c179ad..7a94c118 100644 --- a/bsp_q7s/scheduling.cpp +++ b/bsp_q7s/scheduling.cpp @@ -82,6 +82,14 @@ void scheduling::initTasks() { } #endif + PeriodicTaskIF* xiphosWdtTask = + factory->createPeriodicTask("XIPHOS_WDT", 90, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, + missedDeadlineFunc, &RR_SCHEDULING); + result = xiphosWdtTask->addComponent(objects::XIPHOS_WDT); + if (result != returnvalue::OK) { + scheduling::printAddObjectError("XIPHOS_WDT", objects::XIPHOS_WDT); + } + PeriodicTaskIF* coreCtrlTask = factory->createPeriodicTask( "CORE_CTRL", 55, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc, &RR_SCHEDULING); result = coreCtrlTask->addComponent(objects::CORE_CONTROLLER); @@ -410,6 +418,7 @@ void scheduling::initTasks() { }; sif::info << "Starting tasks.." << std::endl; + xiphosWdtTask->startTask(); tmTcDistributor->startTask(); #if OBSW_ADD_TCPIP_SERVERS == 1 diff --git a/common/config/eive/objects.h b/common/config/eive/objects.h index 0cc4b9d9..2118aa6d 100644 --- a/common/config/eive/objects.h +++ b/common/config/eive/objects.h @@ -26,6 +26,7 @@ enum commonObjects : uint32_t { THERMAL_CONTROLLER = 0x43400001, ACS_CONTROLLER = 0x43000002, CORE_CONTROLLER = 0x43000003, + XIPHOS_WDT = 0x43000004, GLOBAL_JSON_CFG = 0x43000006, /* 0x44 ('D') for device handlers */ diff --git a/tmtc b/tmtc index 22a42108..783bdd29 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 22a42108b431bafa707de2b3a24cad9de95b70d0 +Subproject commit 783bdd297a931a96c8b077ec2c2456a203b23ffc From 404a1009ed46a839da2a9a21c901427447e9a7a4 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 2 Oct 2023 14:47:41 +0200 Subject: [PATCH 02/16] that should get the job done --- CHANGELOG.md | 5 +++++ bsp_q7s/core/XiphosWdtHandler.cpp | 19 ++++++++++++++----- bsp_q7s/scheduling.cpp | 4 +++- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ae7901e..da8e84c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,11 @@ will consitute of a breaking change warranting a new major release: - Missing `nullptr` checks for PLOC Supervisor handler, which could lead to crashes. +## Added + +- Activate Xiphos WDT with a timeout period of 60 seconds using the `libxiphos` API. The WDT + calls are done by the new `XiphosWdtHandler` object. + # [v6.6.0] 2023-09-18 ## Changed diff --git a/bsp_q7s/core/XiphosWdtHandler.cpp b/bsp_q7s/core/XiphosWdtHandler.cpp index 38d206db..dbf1474a 100644 --- a/bsp_q7s/core/XiphosWdtHandler.cpp +++ b/bsp_q7s/core/XiphosWdtHandler.cpp @@ -19,11 +19,20 @@ ReturnValue_t XiphosWdtHandler::initialize() { << " seconds failed with code " << result << ": " << strerror(result) << std::endl; return ObjectManagerIF::CHILD_INIT_FAILED; } - result = xsc_watchdog_enable(wdtHandle); - if (result != 0) { - sif::error << "XiphosWdtHandler: Enabling WDT failed with code " << result << ": " - << strerror(result) << std::endl; - return ObjectManagerIF::CHILD_INIT_FAILED; + int nowayout = 0; + int status = 0; + result = xsc_watchdog_get_status(&nowayout, &status); + if (result == 0) { + if (status == 0) { + result = xsc_watchdog_enable(wdtHandle); + if (result != 0) { + sif::error << "XiphosWdtHandler: Enabling WDT failed with code " << result << ": " + << strerror(result) << std::endl; + return ObjectManagerIF::CHILD_INIT_FAILED; + } + } + } else { + sif::warning << "XiphosWdtHandler: Getting WDT status failed" << std::endl; } return returnvalue::OK; } diff --git a/bsp_q7s/scheduling.cpp b/bsp_q7s/scheduling.cpp index 7a94c118..e8208e65 100644 --- a/bsp_q7s/scheduling.cpp +++ b/bsp_q7s/scheduling.cpp @@ -82,8 +82,10 @@ void scheduling::initTasks() { } #endif + // Medium priority, higher than something like payload, but not the highest priority to also + // detect tasks which choke other tasks. PeriodicTaskIF* xiphosWdtTask = - factory->createPeriodicTask("XIPHOS_WDT", 90, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, + factory->createPeriodicTask("XIPHOS_WDT", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc, &RR_SCHEDULING); result = xiphosWdtTask->addComponent(objects::XIPHOS_WDT); if (result != returnvalue::OK) { From 34100e6c9505c02477d0ebaed1cc911c099cdd15 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 2 Oct 2023 14:49:29 +0200 Subject: [PATCH 03/16] small robustness tweak --- bsp_q7s/core/XiphosWdtHandler.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bsp_q7s/core/XiphosWdtHandler.cpp b/bsp_q7s/core/XiphosWdtHandler.cpp index dbf1474a..5d4da7b6 100644 --- a/bsp_q7s/core/XiphosWdtHandler.cpp +++ b/bsp_q7s/core/XiphosWdtHandler.cpp @@ -15,9 +15,9 @@ ReturnValue_t XiphosWdtHandler::initialize() { } result = xsc_watchdog_set_timeout(wdtHandle, timeoutSeconds); if (result != 0) { - sif::error << "XiphosWdtHandler: Setting WDT timeout of " << timeoutSeconds + // This propably means that the default timeout is used. Still continue with task init. + sif::warning << "XiphosWdtHandler: Setting WDT timeout of " << timeoutSeconds << " seconds failed with code " << result << ": " << strerror(result) << std::endl; - return ObjectManagerIF::CHILD_INIT_FAILED; } int nowayout = 0; int status = 0; From 8fc560f9de72acfd08e480e500dbeb82fd302499 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 10 Oct 2023 11:34:18 +0200 Subject: [PATCH 04/16] what is this? --- bsp_q7s/core/XiphosWdtHandler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bsp_q7s/core/XiphosWdtHandler.h b/bsp_q7s/core/XiphosWdtHandler.h index 346c13ef..271df1a0 100644 --- a/bsp_q7s/core/XiphosWdtHandler.h +++ b/bsp_q7s/core/XiphosWdtHandler.h @@ -15,7 +15,7 @@ class XiphosWdtHandler : public SystemObject, public ExecutableObjectIF { private: // Timeout duration range specified by Xiphos: 0.001 seconds to 171 seconds. The libxiphos API // expects an int, so I guess this translates to 1 to 171 seconds. - uint32_t timeoutSeconds = 60; + int timeoutSeconds = 120; struct watchdog_s* wdtHandle = nullptr; }; From 4b4c78c3faab3fe8db1f34ec5a0edf9461a42da6 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 10 Oct 2023 12:19:42 +0200 Subject: [PATCH 05/16] lets go back to 60 seconds --- bsp_q7s/core/XiphosWdtHandler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bsp_q7s/core/XiphosWdtHandler.h b/bsp_q7s/core/XiphosWdtHandler.h index 271df1a0..1f6f8c0d 100644 --- a/bsp_q7s/core/XiphosWdtHandler.h +++ b/bsp_q7s/core/XiphosWdtHandler.h @@ -15,7 +15,7 @@ class XiphosWdtHandler : public SystemObject, public ExecutableObjectIF { private: // Timeout duration range specified by Xiphos: 0.001 seconds to 171 seconds. The libxiphos API // expects an int, so I guess this translates to 1 to 171 seconds. - int timeoutSeconds = 120; + int timeoutSeconds = 60; struct watchdog_s* wdtHandle = nullptr; }; From 9a283b0f98e6092b55e960944c2dd7e74275ea9f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 10 Oct 2023 19:15:52 +0200 Subject: [PATCH 06/16] add action cmds --- bsp_q7s/core/XiphosWdtHandler.cpp | 124 +++++++++++++++++++++++------- bsp_q7s/core/XiphosWdtHandler.h | 12 ++- tmtc | 2 +- 3 files changed, 108 insertions(+), 30 deletions(-) diff --git a/bsp_q7s/core/XiphosWdtHandler.cpp b/bsp_q7s/core/XiphosWdtHandler.cpp index 5d4da7b6..be087648 100644 --- a/bsp_q7s/core/XiphosWdtHandler.cpp +++ b/bsp_q7s/core/XiphosWdtHandler.cpp @@ -1,48 +1,116 @@ #include "XiphosWdtHandler.h" -XiphosWdtHandler::XiphosWdtHandler(object_id_t objectId) : SystemObject(objectId) {} +#include "fsfw/ipc/QueueFactory.h" + +XiphosWdtHandler::XiphosWdtHandler(object_id_t objectId) + : SystemObject(objectId), + requestQueue(QueueFactory::instance()->createMessageQueue()), + actionHelper(this, requestQueue) {} ReturnValue_t XiphosWdtHandler::initialize() { - int result = xsc_watchdog_init(&wdtHandle); - if (result != 0) { - sif::error << "XiphosWdtHandler: Initiating watchdog failed with code " << result << ": " - << strerror(result) << std::endl; + ReturnValue_t result = actionHelper.initialize(); + if (result != returnvalue::OK) { + return result; + } + int retval = xsc_watchdog_init(&wdtHandle); + if (retval != 0) { + sif::error << "XiphosWdtHandler: Initiating watchdog failed with code " << retval << ": " + << strerror(retval) << std::endl; return ObjectManagerIF::CHILD_INIT_FAILED; } if (wdtHandle == nullptr) { sif::error << "XiphosWdtHandler: WDT handle is nullptr!" << std::endl; return ObjectManagerIF::CHILD_INIT_FAILED; } - result = xsc_watchdog_set_timeout(wdtHandle, timeoutSeconds); - if (result != 0) { + retval = xsc_watchdog_set_timeout(wdtHandle, timeoutSeconds); + if (retval != 0) { // This propably means that the default timeout is used. Still continue with task init. sif::warning << "XiphosWdtHandler: Setting WDT timeout of " << timeoutSeconds - << " seconds failed with code " << result << ": " << strerror(result) << std::endl; + << " seconds failed with code " << result << ": " << strerror(retval) << std::endl; } - int nowayout = 0; - int status = 0; - result = xsc_watchdog_get_status(&nowayout, &status); - if (result == 0) { - if (status == 0) { - result = xsc_watchdog_enable(wdtHandle); - if (result != 0) { - sif::error << "XiphosWdtHandler: Enabling WDT failed with code " << result << ": " - << strerror(result) << std::endl; - return ObjectManagerIF::CHILD_INIT_FAILED; - } - } - } else { - sif::warning << "XiphosWdtHandler: Getting WDT status failed" << std::endl; - } - return returnvalue::OK; + return enableWdt(); } ReturnValue_t XiphosWdtHandler::performOperation(uint8_t opCode) { - int result = xsc_watchdog_keepalive(wdtHandle); - if (result != 0) { - sif::warning << "XiphosWdtHandler: Feeding WDT failed with code " << result << ": " - << strerror(result) << std::endl; + CommandMessage command; + ReturnValue_t result; + for (result = requestQueue->receiveMessage(&command); result == returnvalue::OK; + result = requestQueue->receiveMessage(&command)) { + result = actionHelper.handleActionMessage(&command); + if (result == returnvalue::OK) { + continue; + } + sif::warning << "Can not handle message with message type " << command.getMessageType() + << std::endl; + } + int retval = xsc_watchdog_keepalive(wdtHandle); + if (retval != 0) { + sif::warning << "XiphosWdtHandler: Feeding WDT failed with code " << retval << ": " + << strerror(retval) << std::endl; return returnvalue::FAILED; } return returnvalue::OK; } + +ReturnValue_t XiphosWdtHandler::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy, + const uint8_t *data, size_t size) { + switch (actionId) { + case (ActionId::ENABLE): { + ReturnValue_t result = enableWdt(); + if (result != returnvalue::OK) { + return result; + } + return EXECUTION_FINISHED; + } + case (ActionId::DISABLE): { + ReturnValue_t result = disableWdt(); + if (result != returnvalue::OK) { + return result; + } + return EXECUTION_FINISHED; + } + } + return HasActionsIF::INVALID_ACTION_ID; +} + +ReturnValue_t XiphosWdtHandler::enableWdt() { + int nowayout = 0; + int status = 0; + int retval = xsc_watchdog_get_status(&nowayout, &status); + // If this fails for whatever reason, just try enabling in any case. + if (retval != 0) { + sif::warning << "XiphosWdtHandler: Getting WDT status failed" << std::endl; + } + // Of course the enable API will fail if the device is already on, just perfect, love me some + // good C API... :))) + if (retval != 0 or status == 0) { + int retval = xsc_watchdog_enable(wdtHandle); + if (retval != 0) { + sif::error << "XiphosWdtHandler: Enabling WDT failed with code " << retval << ": " + << strerror(retval) << std::endl; + return returnvalue::FAILED; + } + } + return returnvalue::OK; +} + +ReturnValue_t XiphosWdtHandler::disableWdt() { + int nowayout = 0; + int status = 0; + int retval = xsc_watchdog_get_status(&nowayout, &status); + // If this fails for whatever reason, just try disabling in any case. + if (retval != 0) { + sif::warning << "XiphosWdtHandler: Getting WDT status failed" << std::endl; + } + // Of course the disable API will fail if the device is already off, just perfect, love me some + // good C API... :))) + if (retval != 0 or status == 1) { + int retval = xsc_watchdog_disable(wdtHandle); + if (retval != 0) { + sif::error << "XiphosWdtHandler: Disabling WDT failed with code " << retval << ": " + << strerror(retval) << std::endl; + return returnvalue::FAILED; + } + } + return returnvalue::OK; +} diff --git a/bsp_q7s/core/XiphosWdtHandler.h b/bsp_q7s/core/XiphosWdtHandler.h index 1f6f8c0d..28e48429 100644 --- a/bsp_q7s/core/XiphosWdtHandler.h +++ b/bsp_q7s/core/XiphosWdtHandler.h @@ -6,17 +6,27 @@ #include #include -class XiphosWdtHandler : public SystemObject, public ExecutableObjectIF { +class XiphosWdtHandler : public SystemObject, public ExecutableObjectIF, public HasActionsIF { public: + enum ActionId { ENABLE = 0, DISABLE = 1 }; + XiphosWdtHandler(object_id_t objectId); ReturnValue_t performOperation(uint8_t opCode) override; ReturnValue_t initialize() override; + ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy, + const uint8_t* data, size_t size) override; + private: + // Wrappers to ensure idempotency of trash C API. + ReturnValue_t enableWdt(); + ReturnValue_t disableWdt(); // Timeout duration range specified by Xiphos: 0.001 seconds to 171 seconds. The libxiphos API // expects an int, so I guess this translates to 1 to 171 seconds. int timeoutSeconds = 60; struct watchdog_s* wdtHandle = nullptr; + MessageQueueIF* requestQueue = nullptr; + ActionHelper actionHelper; }; #endif /* BSP_Q7S_CORE_XIPHOSWDTHANDLER_H_ */ diff --git a/tmtc b/tmtc index 783bdd29..d82cecbe 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 783bdd297a931a96c8b077ec2c2456a203b23ffc +Subproject commit d82cecbe6e51e76a5b3b974b1c0d32ea22693853 From c3cdcaf9f445cda72f9930aa71469d9acc4f7023 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 11 Oct 2023 10:58:25 +0200 Subject: [PATCH 07/16] bump tmtc and gens --- bsp_hosted/fsfwconfig/events/translateEvents.cpp | 2 +- bsp_hosted/fsfwconfig/objects/translateObjects.cpp | 7 +++++-- generators/bsp_hosted_objects.csv | 1 + generators/bsp_q7s_objects.csv | 1 + generators/events/translateEvents.cpp | 2 +- generators/objects/translateObjects.cpp | 7 +++++-- linux/fsfwconfig/events/translateEvents.cpp | 2 +- linux/fsfwconfig/objects/translateObjects.cpp | 7 +++++-- mission/controller/CMakeLists.txt | 6 +++--- mission/system/power/CMakeLists.txt | 3 ++- tmtc | 2 +- 11 files changed, 26 insertions(+), 14 deletions(-) diff --git a/bsp_hosted/fsfwconfig/events/translateEvents.cpp b/bsp_hosted/fsfwconfig/events/translateEvents.cpp index 77df8166..9bb03ff0 100644 --- a/bsp_hosted/fsfwconfig/events/translateEvents.cpp +++ b/bsp_hosted/fsfwconfig/events/translateEvents.cpp @@ -1,7 +1,7 @@ /** * @brief Auto-generated event translation file. Contains 313 translations. * @details - * Generated on: 2023-10-10 13:50:27 + * Generated on: 2023-10-11 10:54:39 */ #include "translateEvents.h" diff --git a/bsp_hosted/fsfwconfig/objects/translateObjects.cpp b/bsp_hosted/fsfwconfig/objects/translateObjects.cpp index 8d80ca56..7e795093 100644 --- a/bsp_hosted/fsfwconfig/objects/translateObjects.cpp +++ b/bsp_hosted/fsfwconfig/objects/translateObjects.cpp @@ -1,8 +1,8 @@ /** * @brief Auto-generated object translation file. * @details - * Contains 173 translations. - * Generated on: 2023-10-10 13:50:27 + * Contains 174 translations. + * Generated on: 2023-10-11 10:54:39 */ #include "translateObjects.h" @@ -11,6 +11,7 @@ const char *ACS_CONTROLLER_STRING = "ACS_CONTROLLER"; const char *CORE_CONTROLLER_STRING = "CORE_CONTROLLER"; const char *POWER_CONTROLLER_STRING = "POWER_CONTROLLER"; const char *GLOBAL_JSON_CFG_STRING = "GLOBAL_JSON_CFG"; +const char *XIPHOS_WDT_STRING = "XIPHOS_WDT"; const char *THERMAL_CONTROLLER_STRING = "THERMAL_CONTROLLER"; const char *DUMMY_HANDLER_STRING = "DUMMY_HANDLER"; const char *MGM_0_LIS3_HANDLER_STRING = "MGM_0_LIS3_HANDLER"; @@ -192,6 +193,8 @@ const char *translateObject(object_id_t object) { return POWER_CONTROLLER_STRING; case 0x43000006: return GLOBAL_JSON_CFG_STRING; + case 0x43000007: + return XIPHOS_WDT_STRING; case 0x43400001: return THERMAL_CONTROLLER_STRING; case 0x44000001: diff --git a/generators/bsp_hosted_objects.csv b/generators/bsp_hosted_objects.csv index 4cb21f46..689a58f2 100644 --- a/generators/bsp_hosted_objects.csv +++ b/generators/bsp_hosted_objects.csv @@ -3,6 +3,7 @@ 0x43000003;CORE_CONTROLLER 0x43000004;POWER_CONTROLLER 0x43000006;GLOBAL_JSON_CFG +0x43000007;XIPHOS_WDT 0x43400001;THERMAL_CONTROLLER 0x44000001;DUMMY_HANDLER 0x44120006;MGM_0_LIS3_HANDLER diff --git a/generators/bsp_q7s_objects.csv b/generators/bsp_q7s_objects.csv index 914b7df6..10cfed26 100644 --- a/generators/bsp_q7s_objects.csv +++ b/generators/bsp_q7s_objects.csv @@ -3,6 +3,7 @@ 0x43000003;CORE_CONTROLLER 0x43000004;POWER_CONTROLLER 0x43000006;GLOBAL_JSON_CFG +0x43000007;XIPHOS_WDT 0x43400001;THERMAL_CONTROLLER 0x44120006;MGM_0_LIS3_HANDLER 0x44120010;GYRO_0_ADIS_HANDLER diff --git a/generators/events/translateEvents.cpp b/generators/events/translateEvents.cpp index 77df8166..9bb03ff0 100644 --- a/generators/events/translateEvents.cpp +++ b/generators/events/translateEvents.cpp @@ -1,7 +1,7 @@ /** * @brief Auto-generated event translation file. Contains 313 translations. * @details - * Generated on: 2023-10-10 13:50:27 + * Generated on: 2023-10-11 10:54:39 */ #include "translateEvents.h" diff --git a/generators/objects/translateObjects.cpp b/generators/objects/translateObjects.cpp index aeb2b405..0599cc18 100644 --- a/generators/objects/translateObjects.cpp +++ b/generators/objects/translateObjects.cpp @@ -1,8 +1,8 @@ /** * @brief Auto-generated object translation file. * @details - * Contains 177 translations. - * Generated on: 2023-10-10 13:50:27 + * Contains 178 translations. + * Generated on: 2023-10-11 10:54:39 */ #include "translateObjects.h" @@ -11,6 +11,7 @@ const char *ACS_CONTROLLER_STRING = "ACS_CONTROLLER"; const char *CORE_CONTROLLER_STRING = "CORE_CONTROLLER"; const char *POWER_CONTROLLER_STRING = "POWER_CONTROLLER"; const char *GLOBAL_JSON_CFG_STRING = "GLOBAL_JSON_CFG"; +const char *XIPHOS_WDT_STRING = "XIPHOS_WDT"; const char *THERMAL_CONTROLLER_STRING = "THERMAL_CONTROLLER"; const char *MGM_0_LIS3_HANDLER_STRING = "MGM_0_LIS3_HANDLER"; const char *GYRO_0_ADIS_HANDLER_STRING = "GYRO_0_ADIS_HANDLER"; @@ -196,6 +197,8 @@ const char *translateObject(object_id_t object) { return POWER_CONTROLLER_STRING; case 0x43000006: return GLOBAL_JSON_CFG_STRING; + case 0x43000007: + return XIPHOS_WDT_STRING; case 0x43400001: return THERMAL_CONTROLLER_STRING; case 0x44120006: diff --git a/linux/fsfwconfig/events/translateEvents.cpp b/linux/fsfwconfig/events/translateEvents.cpp index 77df8166..9bb03ff0 100644 --- a/linux/fsfwconfig/events/translateEvents.cpp +++ b/linux/fsfwconfig/events/translateEvents.cpp @@ -1,7 +1,7 @@ /** * @brief Auto-generated event translation file. Contains 313 translations. * @details - * Generated on: 2023-10-10 13:50:27 + * Generated on: 2023-10-11 10:54:39 */ #include "translateEvents.h" diff --git a/linux/fsfwconfig/objects/translateObjects.cpp b/linux/fsfwconfig/objects/translateObjects.cpp index aeb2b405..0599cc18 100644 --- a/linux/fsfwconfig/objects/translateObjects.cpp +++ b/linux/fsfwconfig/objects/translateObjects.cpp @@ -1,8 +1,8 @@ /** * @brief Auto-generated object translation file. * @details - * Contains 177 translations. - * Generated on: 2023-10-10 13:50:27 + * Contains 178 translations. + * Generated on: 2023-10-11 10:54:39 */ #include "translateObjects.h" @@ -11,6 +11,7 @@ const char *ACS_CONTROLLER_STRING = "ACS_CONTROLLER"; const char *CORE_CONTROLLER_STRING = "CORE_CONTROLLER"; const char *POWER_CONTROLLER_STRING = "POWER_CONTROLLER"; const char *GLOBAL_JSON_CFG_STRING = "GLOBAL_JSON_CFG"; +const char *XIPHOS_WDT_STRING = "XIPHOS_WDT"; const char *THERMAL_CONTROLLER_STRING = "THERMAL_CONTROLLER"; const char *MGM_0_LIS3_HANDLER_STRING = "MGM_0_LIS3_HANDLER"; const char *GYRO_0_ADIS_HANDLER_STRING = "GYRO_0_ADIS_HANDLER"; @@ -196,6 +197,8 @@ const char *translateObject(object_id_t object) { return POWER_CONTROLLER_STRING; case 0x43000006: return GLOBAL_JSON_CFG_STRING; + case 0x43000007: + return XIPHOS_WDT_STRING; case 0x43400001: return THERMAL_CONTROLLER_STRING; case 0x44120006: diff --git a/mission/controller/CMakeLists.txt b/mission/controller/CMakeLists.txt index 901decc0..690ede64 100644 --- a/mission/controller/CMakeLists.txt +++ b/mission/controller/CMakeLists.txt @@ -1,7 +1,7 @@ if(TGT_BSP MATCHES "arm/q7s" OR TGT_BSP MATCHES "") - target_sources(${LIB_EIVE_MISSION} PRIVATE ThermalController.cpp - AcsController.cpp - PowerController.cpp) + target_sources( + ${LIB_EIVE_MISSION} PRIVATE ThermalController.cpp AcsController.cpp + PowerController.cpp) endif() add_subdirectory(acs) diff --git a/mission/system/power/CMakeLists.txt b/mission/system/power/CMakeLists.txt index a7e91e05..2c720978 100644 --- a/mission/system/power/CMakeLists.txt +++ b/mission/system/power/CMakeLists.txt @@ -1 +1,2 @@ -target_sources(${LIB_EIVE_MISSION} PRIVATE epsModeTree.cpp EpsSubsystem.cpp GomspacePowerFdir.cpp) +target_sources(${LIB_EIVE_MISSION} PRIVATE epsModeTree.cpp EpsSubsystem.cpp + GomspacePowerFdir.cpp) diff --git a/tmtc b/tmtc index d82cecbe..ec8febf6 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit d82cecbe6e51e76a5b3b974b1c0d32ea22693853 +Subproject commit ec8febf623a651b83c518443c30e9acfa36461fd From fddae1bfc60fea86619058cab6cae01662b9cfc3 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 11 Oct 2023 13:56:05 +0200 Subject: [PATCH 08/16] compile fixes --- bsp_q7s/core/XiphosWdtHandler.cpp | 6 ++++-- bsp_q7s/core/XiphosWdtHandler.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/bsp_q7s/core/XiphosWdtHandler.cpp b/bsp_q7s/core/XiphosWdtHandler.cpp index be087648..6a1dc687 100644 --- a/bsp_q7s/core/XiphosWdtHandler.cpp +++ b/bsp_q7s/core/XiphosWdtHandler.cpp @@ -84,7 +84,7 @@ ReturnValue_t XiphosWdtHandler::enableWdt() { // Of course the enable API will fail if the device is already on, just perfect, love me some // good C API... :))) if (retval != 0 or status == 0) { - int retval = xsc_watchdog_enable(wdtHandle); + retval = xsc_watchdog_enable(wdtHandle); if (retval != 0) { sif::error << "XiphosWdtHandler: Enabling WDT failed with code " << retval << ": " << strerror(retval) << std::endl; @@ -105,7 +105,7 @@ ReturnValue_t XiphosWdtHandler::disableWdt() { // Of course the disable API will fail if the device is already off, just perfect, love me some // good C API... :))) if (retval != 0 or status == 1) { - int retval = xsc_watchdog_disable(wdtHandle); + retval = xsc_watchdog_disable(wdtHandle); if (retval != 0) { sif::error << "XiphosWdtHandler: Disabling WDT failed with code " << retval << ": " << strerror(retval) << std::endl; @@ -114,3 +114,5 @@ ReturnValue_t XiphosWdtHandler::disableWdt() { } return returnvalue::OK; } + +MessageQueueId_t XiphosWdtHandler::getCommandQueue() const { return requestQueue->getId(); } diff --git a/bsp_q7s/core/XiphosWdtHandler.h b/bsp_q7s/core/XiphosWdtHandler.h index 28e48429..5d073e76 100644 --- a/bsp_q7s/core/XiphosWdtHandler.h +++ b/bsp_q7s/core/XiphosWdtHandler.h @@ -16,6 +16,7 @@ class XiphosWdtHandler : public SystemObject, public ExecutableObjectIF, public ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy, const uint8_t* data, size_t size) override; + [[nodiscard]] virtual MessageQueueId_t getCommandQueue() const override; private: // Wrappers to ensure idempotency of trash C API. From 8cb46610062d4f8609debba3903e07033a062310 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 11 Oct 2023 14:51:55 +0200 Subject: [PATCH 09/16] higher timeout (max value) --- bsp_q7s/core/XiphosWdtHandler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bsp_q7s/core/XiphosWdtHandler.h b/bsp_q7s/core/XiphosWdtHandler.h index 5d073e76..69fad067 100644 --- a/bsp_q7s/core/XiphosWdtHandler.h +++ b/bsp_q7s/core/XiphosWdtHandler.h @@ -24,7 +24,7 @@ class XiphosWdtHandler : public SystemObject, public ExecutableObjectIF, public ReturnValue_t disableWdt(); // Timeout duration range specified by Xiphos: 0.001 seconds to 171 seconds. The libxiphos API // expects an int, so I guess this translates to 1 to 171 seconds. - int timeoutSeconds = 60; + int timeoutSeconds = 80; struct watchdog_s* wdtHandle = nullptr; MessageQueueIF* requestQueue = nullptr; ActionHelper actionHelper; From eb1b9c837f1863a7ed602aa1346b29f73557b938 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 11 Oct 2023 14:53:10 +0200 Subject: [PATCH 10/16] comment --- bsp_q7s/core/XiphosWdtHandler.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bsp_q7s/core/XiphosWdtHandler.h b/bsp_q7s/core/XiphosWdtHandler.h index 69fad067..3f46cfd3 100644 --- a/bsp_q7s/core/XiphosWdtHandler.h +++ b/bsp_q7s/core/XiphosWdtHandler.h @@ -24,6 +24,8 @@ class XiphosWdtHandler : public SystemObject, public ExecutableObjectIF, public ReturnValue_t disableWdt(); // Timeout duration range specified by Xiphos: 0.001 seconds to 171 seconds. The libxiphos API // expects an int, so I guess this translates to 1 to 171 seconds. + // WARNING: DO NOT SET THIS HIGHER THAN 80 SECONDS! + // Possible bug in Xiphos/Xilinx kernel driver for watchdog, related to overflow. int timeoutSeconds = 80; struct watchdog_s* wdtHandle = nullptr; MessageQueueIF* requestQueue = nullptr; From 4e3229f0189319127de58436061b3ffc057c4aa3 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 11 Oct 2023 15:00:15 +0200 Subject: [PATCH 11/16] cache wdt state --- bsp_q7s/core/XiphosWdtHandler.cpp | 14 +++++++++----- bsp_q7s/core/XiphosWdtHandler.h | 1 + tmtc | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/bsp_q7s/core/XiphosWdtHandler.cpp b/bsp_q7s/core/XiphosWdtHandler.cpp index 6a1dc687..8444b65f 100644 --- a/bsp_q7s/core/XiphosWdtHandler.cpp +++ b/bsp_q7s/core/XiphosWdtHandler.cpp @@ -43,11 +43,13 @@ ReturnValue_t XiphosWdtHandler::performOperation(uint8_t opCode) { sif::warning << "Can not handle message with message type " << command.getMessageType() << std::endl; } - int retval = xsc_watchdog_keepalive(wdtHandle); - if (retval != 0) { - sif::warning << "XiphosWdtHandler: Feeding WDT failed with code " << retval << ": " - << strerror(retval) << std::endl; - return returnvalue::FAILED; + if (enabled) { + int retval = xsc_watchdog_keepalive(wdtHandle); + if (retval != 0) { + sif::warning << "XiphosWdtHandler: Feeding WDT failed with code " << retval << ": " + << strerror(retval) << std::endl; + return returnvalue::FAILED; + } } return returnvalue::OK; } @@ -91,6 +93,7 @@ ReturnValue_t XiphosWdtHandler::enableWdt() { return returnvalue::FAILED; } } + enabled = true; return returnvalue::OK; } @@ -112,6 +115,7 @@ ReturnValue_t XiphosWdtHandler::disableWdt() { return returnvalue::FAILED; } } + enabled = false; return returnvalue::OK; } diff --git a/bsp_q7s/core/XiphosWdtHandler.h b/bsp_q7s/core/XiphosWdtHandler.h index 3f46cfd3..a8d73f48 100644 --- a/bsp_q7s/core/XiphosWdtHandler.h +++ b/bsp_q7s/core/XiphosWdtHandler.h @@ -27,6 +27,7 @@ class XiphosWdtHandler : public SystemObject, public ExecutableObjectIF, public // WARNING: DO NOT SET THIS HIGHER THAN 80 SECONDS! // Possible bug in Xiphos/Xilinx kernel driver for watchdog, related to overflow. int timeoutSeconds = 80; + bool enabled = false; struct watchdog_s* wdtHandle = nullptr; MessageQueueIF* requestQueue = nullptr; ActionHelper actionHelper; diff --git a/tmtc b/tmtc index aba369f1..dcae9308 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit aba369f11f928aefe570f18651bd72ce98953961 +Subproject commit dcae930895b3debca5a5b615fc20cded7c3d0e89 From 9265f27af91317982f93f9e00aabc8a128def018 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 11 Oct 2023 15:02:59 +0200 Subject: [PATCH 12/16] changelog --- CHANGELOG.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f9038140..f3c69d56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,8 @@ will consitute of a breaking change warranting a new major release: - EPS Subsystem has been added to EIVE System Tree - Power Controller for calculating the State of Charge and FDIR regarding low SoC has been introduced. +- Activate Xiphos WDT with a timeout period of 80 seconds using the `libxiphos` API. The WDT + calls are done by the new `XiphosWdtHandler` object. ## Changed @@ -36,11 +38,6 @@ will consitute of a breaking change warranting a new major release: - Missing `nullptr` checks for PLOC Supervisor handler, which could lead to crashes. - SCEX bugfix for normal and transition commanding. -## Added - -- Activate Xiphos WDT with a timeout period of 60 seconds using the `libxiphos` API. The WDT - calls are done by the new `XiphosWdtHandler` object. - # [v6.6.0] 2023-09-18 ## Changed From a381efc5d949370ab65a6a2b72f5592ffabad463 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 11 Oct 2023 18:16:36 +0200 Subject: [PATCH 13/16] prep next release --- CHANGELOG.md | 4 +++- CMakeLists.txt | 4 ++-- tmtc | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 700a9a49..b7143400 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,9 @@ will consitute of a breaking change warranting a new major release: # [unreleased] -- Bumped `eive-tmtc` to v5.7.0. +# [v7.0.0] 2023-10-11 + +- Bumped `eive-tmtc` to v5.7.1. - Bumped `eive-fsfw` ## Added diff --git a/CMakeLists.txt b/CMakeLists.txt index 65038b76..2b02cfdb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,8 +9,8 @@ # ############################################################################## cmake_minimum_required(VERSION 3.13) -set(OBSW_VERSION_MAJOR 6) -set(OBSW_VERSION_MINOR 6) +set(OBSW_VERSION_MAJOR 7) +set(OBSW_VERSION_MINOR 0) set(OBSW_VERSION_REVISION 0) # set(CMAKE_VERBOSE TRUE) diff --git a/tmtc b/tmtc index 9711dd92..39e6a048 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 9711dd9242340720e28d41eefda90666ec9af4bb +Subproject commit 39e6a0488922590900b862e5e70524be1d6ec5ba From 62305ec39b31ba0533b2358173c3d5fd4233ad7f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 11 Oct 2023 19:38:03 +0200 Subject: [PATCH 14/16] bump tmtc --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index dcae9308..e249f147 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit dcae930895b3debca5a5b615fc20cded7c3d0e89 +Subproject commit e249f147bc1738003d31290df8f2b525d91c3482 From bb4e495199f61d0d8257f3777dc3d83442e89a43 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 11 Oct 2023 19:40:16 +0200 Subject: [PATCH 15/16] changelog correcion --- CHANGELOG.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 14e7e392..a6d88025 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,12 @@ will consitute of a breaking change warranting a new major release: # [unreleased] +# [v7.1.0] 2023-10-11 + +- Bumped `eive-tmtc` to v5.8.0. +- Activate Xiphos WDT with a timeout period of 80 seconds using the `libxiphos` API. The WDT + calls are done by the new `XiphosWdtHandler` object. + # [v7.0.0] 2023-10-11 - Bumped `eive-tmtc` to v5.7.1. @@ -26,8 +32,6 @@ will consitute of a breaking change warranting a new major release: - EPS Subsystem has been added to EIVE System Tree - Power Controller for calculating the State of Charge and FDIR regarding low SoC has been introduced. -- Activate Xiphos WDT with a timeout period of 80 seconds using the `libxiphos` API. The WDT - calls are done by the new `XiphosWdtHandler` object. ## Changed From ebe67a38a96651e8295a7076bd0cb0cb4759b4b7 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 11 Oct 2023 19:49:24 +0200 Subject: [PATCH 16/16] bump minor version --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2b02cfdb..65e85d35 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ cmake_minimum_required(VERSION 3.13) set(OBSW_VERSION_MAJOR 7) -set(OBSW_VERSION_MINOR 0) +set(OBSW_VERSION_MINOR 1) set(OBSW_VERSION_REVISION 0) # set(CMAKE_VERBOSE TRUE)