You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by je...@apache.org on 2020/03/05 20:46:29 UTC

[mynewt-core] branch master updated: add ifdefs to avoid calling watchdog if WATCHDOG_INTERVAL is 0

This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
     new 6998514  add ifdefs to avoid calling watchdog if WATCHDOG_INTERVAL is 0
6998514 is described below

commit 69985141404347d8bce6f3cb47569823b574cd35
Author: Brian Wyld <br...@wyres.fr>
AuthorDate: Tue Mar 3 14:07:46 2020 +0100

    add ifdefs to avoid calling watchdog if WATCHDOG_INTERVAL is 0
---
 kernel/os/src/os.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/kernel/os/src/os.c b/kernel/os/src/os.c
index 6e9e58e..bc88ef9 100644
--- a/kernel/os/src/os.c
+++ b/kernel/os/src/os.c
@@ -69,10 +69,11 @@ OS_TASK_STACK_DEFINE(g_os_main_stack, OS_MAIN_STACK_SIZE);
 static struct hal_timer os_wdog_monitor;
 #endif
 
+#if MYNEWT_VAL(WATCHDOG_INTERVAL) > 0
 #if MYNEWT_VAL(WATCHDOG_INTERVAL) - 200 < MYNEWT_VAL(SANITY_INTERVAL)
 #error "Watchdog interval - 200 < sanity interval"
 #endif
-
+#endif
 
 /* Default zero.  Set by the architecture specific code when os is started.
  */
@@ -270,8 +271,10 @@ os_start(void)
 #if MYNEWT_VAL(OS_SCHEDULING)
     os_error_t err;
 
+#if MYNEWT_VAL(WATCHDOG_INTERVAL) > 0
     /* Enable the watchdog prior to starting the OS */
     hal_watchdog_enable();
+#endif
 
     err = os_arch_os_start();
     assert(err == OS_OK);
@@ -289,11 +292,13 @@ os_reboot(int reason)
 void
 os_system_reset(void)
 {
+#if MYNEWT_VAL(WATCHDOG_INTERVAL) > 0
     /* Tickle watchdog just before re-entering bootloader.  Depending on what
      * the system has been doing lately, the watchdog timer might be close to
      * firing.
      */
     hal_watchdog_tickle();
+#endif
     hal_system_reset();
 }