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) {