diff --git a/UNITTESTS/features/lorawan/loramaccrypto/unittest.cmake b/UNITTESTS/features/lorawan/loramaccrypto/unittest.cmake index a2740df449..2001f8e9d7 100644 --- a/UNITTESTS/features/lorawan/loramaccrypto/unittest.cmake +++ b/UNITTESTS/features/lorawan/loramaccrypto/unittest.cmake @@ -35,6 +35,7 @@ set(unittest-test-sources stubs/cipher_stub.c stubs/aes_stub.c stubs/cmac_stub.c + stubs/mbed_assert_stub.c ../features/nanostack/coap-service/test/coap-service/unittest/stub/mbedtls_stub.c ) diff --git a/UNITTESTS/features/netsocket/cellular/CellularNonIPSocket/unittest.cmake b/UNITTESTS/features/netsocket/cellular/CellularNonIPSocket/unittest.cmake index 3dc6d8d78f..57ace7017d 100644 --- a/UNITTESTS/features/netsocket/cellular/CellularNonIPSocket/unittest.cmake +++ b/UNITTESTS/features/netsocket/cellular/CellularNonIPSocket/unittest.cmake @@ -20,4 +20,5 @@ set(unittest-test-sources stubs/EventFlags_stub.cpp stubs/Mutex_stub.cpp stubs/CellularContext_stub.cpp + stubs/mbed_assert_stub.c ) diff --git a/drivers/Watchdog.h b/drivers/Watchdog.h index 6d7ea6506c..ce3a58c35d 100644 --- a/drivers/Watchdog.h +++ b/drivers/Watchdog.h @@ -92,7 +92,7 @@ public: * * Otherwise, the system is reset. */ - void process(uint32_t elapsed_ms); + static void process(uint32_t elapsed_ms); protected : /** add_to_list is used to store the registered user into List. diff --git a/platform/mbed_watchdog_mgr.cpp b/platform/mbed_watchdog_mgr.cpp index 7de5677c12..56cc7c6f7d 100644 --- a/platform/mbed_watchdog_mgr.cpp +++ b/platform/mbed_watchdog_mgr.cpp @@ -24,18 +24,12 @@ static bool is_watchdog_started = false; //boolean to control watchdog start and static uint32_t elapsed_ms = (HW_WATCHDOG_TIMEOUT / 2); MBED_STATIC_ASSERT((HW_WATCHDOG_TIMEOUT > 0), "Timeout must be greater than zero"); -/** mbed watchdog manager creates watchdog class instance with zero timeout - * as mbed watchdog manager is not going to register(not going to call "start" method of Watchdog class) - * its only going to call process to verify all registered users/threads in alive state - * - */ -mbed::Watchdog watchdog(0, "Platform Watchdog"); /** Create singleton instance of LowPowerTicker for watchdog periodic call back of kick. */ -static mbed::LowPowerTicker *get_ticker() +static SingletonPtr get_ticker() { - static mbed::LowPowerTicker ticker; - return &ticker; + static SingletonPtr ticker; + return ticker; } /** Refreshes the watchdog timer. @@ -49,7 +43,9 @@ static void mbed_wdog_manager_kick() { core_util_critical_section_enter(); hal_watchdog_kick(); - watchdog.process(((elapsed_ms <= 0) ? 1 : elapsed_ms)); + // mbed watchdog manager will access the watchdog process method to verify + // all registered users/threads in alive state */ + mbed::Watchdog::process(((elapsed_ms <= 0) ? 1 : elapsed_ms)); core_util_critical_section_exit(); } diff --git a/platform/mbed_watchdog_mgr.h b/platform/mbed_watchdog_mgr.h index 20c1f305e8..4a92732cfe 100644 --- a/platform/mbed_watchdog_mgr.h +++ b/platform/mbed_watchdog_mgr.h @@ -24,6 +24,7 @@ #include "mbed_error.h" #include "platform/Callback.h" #include "platform/mbed_critical.h" +#include "platform/SingletonPtr.h" #include "LowPowerTicker.h" #include "Watchdog.h"