From dc9fbfa6fb2744bb98460db194b4417925287195 Mon Sep 17 00:00:00 2001 From: Rajkumar Kanagaraj Date: Wed, 10 Apr 2019 18:21:58 +0100 Subject: [PATCH] Fix for Problem copying the instance from BSS to stack -Created global instance of either LowPowerTicker or Ticker --- platform/mbed_watchdog_mgr.cpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/platform/mbed_watchdog_mgr.cpp b/platform/mbed_watchdog_mgr.cpp index f9d51bce04..ed297fb450 100644 --- a/platform/mbed_watchdog_mgr.cpp +++ b/platform/mbed_watchdog_mgr.cpp @@ -27,19 +27,11 @@ MBED_STATIC_ASSERT((HW_WATCHDOG_TIMEOUT > 0), "Timeout must be greater than zero #if DEVICE_LPTICKER /** Create singleton instance of LowPowerTicker for watchdog periodic call back of kick. */ -static SingletonPtr get_ticker() -{ - static SingletonPtr ticker; - return ticker; -} +static SingletonPtr _ticker; #else /** Create singleton instance of Ticker for watchdog periodic call back of kick. */ -static SingletonPtr get_ticker() -{ - static SingletonPtr ticker; - return ticker; -} +static SingletonPtr _ticker; #endif /** Refreshes the watchdog timer. @@ -83,7 +75,7 @@ bool mbed_wdog_manager_start() core_util_critical_section_exit(); if (is_watchdog_started) { us_timestamp_t timeout = (MS_TO_US(((elapsed_ms <= 0) ? 1 : elapsed_ms))); - get_ticker()->attach_us(mbed::callback(&mbed_wdog_manager_kick), timeout); + _ticker->attach_us(mbed::callback(&mbed_wdog_manager_kick), timeout); } return is_watchdog_started; } @@ -98,7 +90,7 @@ bool mbed_wdog_manager_stop() if (sts != WATCHDOG_STATUS_OK) { msts = false; } else { - get_ticker()->detach(); + _ticker->detach(); is_watchdog_started = false; }