Fix for Problem copying the instance from BSS to stack

-Created global instance of either LowPowerTicker or Ticker
pull/10645/head
Rajkumar Kanagaraj 2019-04-10 18:21:58 +01:00 committed by Filip Jagodzinski
parent c41d80330e
commit dc9fbfa6fb
1 changed files with 4 additions and 12 deletions

View File

@ -27,19 +27,11 @@ MBED_STATIC_ASSERT((HW_WATCHDOG_TIMEOUT > 0), "Timeout must be greater than zero
#if DEVICE_LPTICKER #if DEVICE_LPTICKER
/** Create singleton instance of LowPowerTicker for watchdog periodic call back of kick. /** Create singleton instance of LowPowerTicker for watchdog periodic call back of kick.
*/ */
static SingletonPtr<mbed::LowPowerTicker> get_ticker() static SingletonPtr<mbed::LowPowerTicker> _ticker;
{
static SingletonPtr<mbed::LowPowerTicker> ticker;
return ticker;
}
#else #else
/** Create singleton instance of Ticker for watchdog periodic call back of kick. /** Create singleton instance of Ticker for watchdog periodic call back of kick.
*/ */
static SingletonPtr<mbed::Ticker> get_ticker() static SingletonPtr<mbed::Ticker> _ticker;
{
static SingletonPtr<mbed::Ticker> ticker;
return ticker;
}
#endif #endif
/** Refreshes the watchdog timer. /** Refreshes the watchdog timer.
@ -83,7 +75,7 @@ bool mbed_wdog_manager_start()
core_util_critical_section_exit(); core_util_critical_section_exit();
if (is_watchdog_started) { if (is_watchdog_started) {
us_timestamp_t timeout = (MS_TO_US(((elapsed_ms <= 0) ? 1 : elapsed_ms))); 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; return is_watchdog_started;
} }
@ -98,7 +90,7 @@ bool mbed_wdog_manager_stop()
if (sts != WATCHDOG_STATUS_OK) { if (sts != WATCHDOG_STATUS_OK) {
msts = false; msts = false;
} else { } else {
get_ticker()->detach(); _ticker->detach();
is_watchdog_started = false; is_watchdog_started = false;
} }