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 2019/11/07 13:30:04 UTC

[mynewt-core] 05/07: hal_system: Use HAL_DEBUG_BREAK

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

commit 6c2195d9fde7e9ae1559a06c9ef7442f2bf1d35e
Author: Jerzy Kasenberg <je...@codecoup.pl>
AuthorDate: Fri May 10 15:20:16 2019 +0200

    hal_system: Use HAL_DEBUG_BREAK
    
    in hal_system_reset() use HAL_DEBUG_BREAK() instead of
    explicit asm code.
---
 hw/mcu/ambiq/apollo2/src/hal_system.c    |  7 +------
 hw/mcu/arc/snps/src/hal_system.c         |  7 +------
 hw/mcu/dialog/da1469x/src/hal_system.c   |  4 +---
 hw/mcu/nordic/nrf52xxx/src/hal_system.c  | 11 +++--------
 hw/mcu/nxp/MK64F12/src/hal_system.c      |  7 +------
 hw/mcu/sifive/fe310/src/hal_system.c     |  6 ++----
 hw/mcu/stm/stm32_common/src/hal_system.c |  7 +------
 7 files changed, 10 insertions(+), 39 deletions(-)

diff --git a/hw/mcu/ambiq/apollo2/src/hal_system.c b/hw/mcu/ambiq/apollo2/src/hal_system.c
index 6b9f850..43058d8 100644
--- a/hw/mcu/ambiq/apollo2/src/hal_system.c
+++ b/hw/mcu/ambiq/apollo2/src/hal_system.c
@@ -39,12 +39,7 @@ hal_system_reset(void)
 #endif
 
     while (1) {
-        if (hal_debugger_connected()) {
-            /*
-             * If debugger is attached, breakpoint here.
-             */
-            asm("bkpt");
-        }
+        HAL_DEBUG_BREAK();
         NVIC_SystemReset();
     }
 }
diff --git a/hw/mcu/arc/snps/src/hal_system.c b/hw/mcu/arc/snps/src/hal_system.c
index a1d1c9a..758f88e 100644
--- a/hw/mcu/arc/snps/src/hal_system.c
+++ b/hw/mcu/arc/snps/src/hal_system.c
@@ -44,12 +44,7 @@ hal_system_reset(void)
 #endif
 
     while (1) {
-        if (hal_debugger_connected()) {
-            /*
-             * If debugger is attached, breakpoint here.
-             */
-            asm("BRK_S");
-        }
+        HAL_DEBUG_BREAK();
 /* TODO: Reset system! */
         //NVIC_SystemReset();
     }
diff --git a/hw/mcu/dialog/da1469x/src/hal_system.c b/hw/mcu/dialog/da1469x/src/hal_system.c
index 7c260ee..53baf10 100644
--- a/hw/mcu/dialog/da1469x/src/hal_system.c
+++ b/hw/mcu/dialog/da1469x/src/hal_system.c
@@ -72,9 +72,7 @@ hal_system_reset(void)
 #endif
 
     while (1) {
-        if (hal_debugger_connected()) {
-            asm("bkpt");
-        }
+        HAL_DEBUG_BREAK();
         NVIC_SystemReset();
     }
 }
diff --git a/hw/mcu/nordic/nrf52xxx/src/hal_system.c b/hw/mcu/nordic/nrf52xxx/src/hal_system.c
index 64bd94d..bc39088 100644
--- a/hw/mcu/nordic/nrf52xxx/src/hal_system.c
+++ b/hw/mcu/nordic/nrf52xxx/src/hal_system.c
@@ -18,7 +18,9 @@
  */
 
 #include "syscfg/syscfg.h"
+#include "mcu/cortex_m4.h"
 #include "hal/hal_system.h"
+#include "hal/hal_debug.h"
 #include "nrf.h"
 
 /**
@@ -48,14 +50,7 @@ hal_system_reset(void)
 #endif
 
     while (1) {
-        if (hal_debugger_connected()) {
-            /*
-             * If debugger is attached, breakpoint here.
-             */
-#if !MYNEWT_VAL(MCU_DEBUG_IGNORE_BKPT)
-            asm("bkpt");
-#endif
-        }
+        HAL_DEBUG_BREAK();
         NVIC_SystemReset();
     }
 }
diff --git a/hw/mcu/nxp/MK64F12/src/hal_system.c b/hw/mcu/nxp/MK64F12/src/hal_system.c
index 6d141cf..eb85e5e 100644
--- a/hw/mcu/nxp/MK64F12/src/hal_system.c
+++ b/hw/mcu/nxp/MK64F12/src/hal_system.c
@@ -34,12 +34,7 @@ void hal_system_reset(void)
 #endif
 
     while (1) {
-        if (hal_debugger_connected()) {
-            /*
-             * If debugger is attached, breakpoint here.
-             */
-            asm("bkpt");
-        }
+        HAL_DEBUG_BREAK();
         NVIC_SystemReset();
     }
 }
diff --git a/hw/mcu/sifive/fe310/src/hal_system.c b/hw/mcu/sifive/fe310/src/hal_system.c
index 2a3ac7c..e8dda0e 100644
--- a/hw/mcu/sifive/fe310/src/hal_system.c
+++ b/hw/mcu/sifive/fe310/src/hal_system.c
@@ -29,10 +29,8 @@ hal_system_reset(void)
     hal_system_reset_cb();
 #endif
 
-    while(1) {
-        if (hal_debugger_connected()) {
-            asm ("ebreak");
-        }
+    while (1) {
+        HAL_DEBUG_BREAK();
     }
 }
 
diff --git a/hw/mcu/stm/stm32_common/src/hal_system.c b/hw/mcu/stm/stm32_common/src/hal_system.c
index f201678..04dc298 100644
--- a/hw/mcu/stm/stm32_common/src/hal_system.c
+++ b/hw/mcu/stm/stm32_common/src/hal_system.c
@@ -30,12 +30,7 @@ hal_system_reset(void)
 #endif
 
     while (1) {
-        if (hal_debugger_connected()) {
-            /*
-             * If debugger is attached, breakpoint here.
-             */
-            asm("bkpt");
-        }
+        HAL_DEBUG_BREAK();
         NVIC_SystemReset();
     }
 }