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 9703ed3c22530e3e853312c0a0094a9aa879078a
Author: Jerzy Kasenberg <[email protected]>
AuthorDate: Fri May 10 14:12:28 2019 +0200

    hal: Add hal_debug_break functions
    
    Add unified function to set code breakpoint.
---
 hw/mcu/ambiq/apollo2/include/mcu/cortex_m4.h   |  6 ++++++
 hw/mcu/arc/snps/include/mcu/mcu_arc.h          |  8 ++++++--
 hw/mcu/dialog/da1469x/include/mcu/cortex_m33.h |  7 +++++++
 hw/mcu/native/include/mcu/mcu_sim.h            |  2 ++
 hw/mcu/nordic/nrf51xxx/include/mcu/cortex_m0.h |  7 +++++++
 hw/mcu/nordic/nrf52xxx/include/mcu/cortex_m4.h | 10 ++++++++++
 hw/mcu/nxp/MK64F12/include/mcu/cortex_m4.h     |  6 ++++++
 hw/mcu/nxp/mkw41z/include/mcu/cortex_m0.h      |  6 ++++++
 hw/mcu/sifive/fe310/include/mcu/fe310.h        |  6 ++++++
 hw/mcu/stm/stm32f0xx/include/mcu/cortex_m0.h   |  6 ++++++
 hw/mcu/stm/stm32f1xx/include/mcu/cortex_m3.h   |  6 ++++++
 hw/mcu/stm/stm32f3xx/include/mcu/cortex_m4.h   |  6 ++++++
 hw/mcu/stm/stm32f4xx/include/mcu/cortex_m4.h   |  6 ++++++
 hw/mcu/stm/stm32f7xx/include/mcu/cortex_m7.h   |  6 ++++++
 hw/mcu/stm/stm32l0xx/include/mcu/cortex_m0.h   |  6 ++++++
 hw/mcu/stm/stm32l1xx/include/mcu/cortex_m3.h   |  6 ++++++
 hw/mcu/stm/stm32l4xx/include/mcu/cortex_m4.h   |  6 ++++++
 hw/mcu/stm/stm32wbxx/include/mcu/cortex_m4.h   |  6 ++++++
 18 files changed, 110 insertions(+), 2 deletions(-)

diff --git a/hw/mcu/ambiq/apollo2/include/mcu/cortex_m4.h 
b/hw/mcu/ambiq/apollo2/include/mcu/cortex_m4.h
index bd67258..6b11382 100644
--- a/hw/mcu/ambiq/apollo2/include/mcu/cortex_m4.h
+++ b/hw/mcu/ambiq/apollo2/include/mcu/cortex_m4.h
@@ -28,6 +28,12 @@ extern "C" {
 
 #define OS_TICKS_PER_SEC    (128)
 
+static inline void
+hal_debug_break(void)
+{
+    __BKPT(1);
+}
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/hw/mcu/arc/snps/include/mcu/mcu_arc.h 
b/hw/mcu/arc/snps/include/mcu/mcu_arc.h
index 4bcd558..fa51beb 100644
--- a/hw/mcu/arc/snps/include/mcu/mcu_arc.h
+++ b/hw/mcu/arc/snps/include/mcu/mcu_arc.h
@@ -20,14 +20,18 @@
 #ifndef __MCU_ARC_H__
 #define __MCU_ARC_H__
 
-#include "os/mynewt.h"
-
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 #define OS_TICKS_PER_SEC    (100)
 
+static inline void
+hal_debug_break(void)
+{
+    asm("BRK_S");
+}
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/hw/mcu/dialog/da1469x/include/mcu/cortex_m33.h 
b/hw/mcu/dialog/da1469x/include/mcu/cortex_m33.h
index ca39ee8..c981e63 100644
--- a/hw/mcu/dialog/da1469x/include/mcu/cortex_m33.h
+++ b/hw/mcu/dialog/da1469x/include/mcu/cortex_m33.h
@@ -21,6 +21,7 @@
 #define __MCU_CORTEX_M33_H_
 
 #include "mcu/mcu.h"
+#include "core_cm33.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -28,6 +29,12 @@ extern "C" {
 
 #define OS_TICKS_PER_SEC    (128)
 
+static inline void
+hal_debug_break(void)
+{
+    __BKPT(1);
+}
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/hw/mcu/native/include/mcu/mcu_sim.h 
b/hw/mcu/native/include/mcu/mcu_sim.h
index 5c9f804..a6e55a9 100644
--- a/hw/mcu/native/include/mcu/mcu_sim.h
+++ b/hw/mcu/native/include/mcu/mcu_sim.h
@@ -31,6 +31,8 @@ extern const char *native_uart_dev_strs[];
 
 void mcu_sim_parse_args(int argc, char **argv);
 
+void static inline hal_debug_break(void) {}
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/hw/mcu/nordic/nrf51xxx/include/mcu/cortex_m0.h 
b/hw/mcu/nordic/nrf51xxx/include/mcu/cortex_m0.h
index 1b87233..d4b6a96 100644
--- a/hw/mcu/nordic/nrf51xxx/include/mcu/cortex_m0.h
+++ b/hw/mcu/nordic/nrf51xxx/include/mcu/cortex_m0.h
@@ -21,6 +21,7 @@
 #define __MCU_CORTEX_M0_H__
 
 #include "nrf51.h"
+#include "core_cm0.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -33,6 +34,12 @@ extern "C" {
  */
 #define OS_TICKS_PER_SEC    (128)
 
+static inline void
+hal_debug_break(void)
+{
+    __BKPT(1);
+}
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/hw/mcu/nordic/nrf52xxx/include/mcu/cortex_m4.h 
b/hw/mcu/nordic/nrf52xxx/include/mcu/cortex_m4.h
index 94a3d5a..6c6105b 100644
--- a/hw/mcu/nordic/nrf52xxx/include/mcu/cortex_m4.h
+++ b/hw/mcu/nordic/nrf52xxx/include/mcu/cortex_m4.h
@@ -21,6 +21,8 @@
 #define __MCU_CORTEX_M4_H__
 
 #include "nrf.h"
+#include "core_cm4.h"
+#include <syscfg/syscfg.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -28,6 +30,14 @@ extern "C" {
 
 #define OS_TICKS_PER_SEC    (128)
 
+static inline void
+hal_debug_break(void)
+{
+#if !MYNEWT_VAL(MCU_DEBUG_IGNORE_BKPT)
+    __BKPT(1);
+#endif
+}
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/hw/mcu/nxp/MK64F12/include/mcu/cortex_m4.h 
b/hw/mcu/nxp/MK64F12/include/mcu/cortex_m4.h
index 10384ab..4480e33 100644
--- a/hw/mcu/nxp/MK64F12/include/mcu/cortex_m4.h
+++ b/hw/mcu/nxp/MK64F12/include/mcu/cortex_m4.h
@@ -32,6 +32,12 @@ extern "C" {
 
 #define OS_TICKS_PER_SEC       (1000)
 
+static inline void
+hal_debug_break(void)
+{
+    __BKPT(1);
+}
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/hw/mcu/nxp/mkw41z/include/mcu/cortex_m0.h 
b/hw/mcu/nxp/mkw41z/include/mcu/cortex_m0.h
index 6955bb0..3c846e0 100644
--- a/hw/mcu/nxp/mkw41z/include/mcu/cortex_m0.h
+++ b/hw/mcu/nxp/mkw41z/include/mcu/cortex_m0.h
@@ -34,6 +34,12 @@ extern "C" {
  */
 #define OS_TICKS_PER_SEC       (1000)
 
+static inline void
+hal_debug_break(void)
+{
+    __BKPT(1);
+}
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/hw/mcu/sifive/fe310/include/mcu/fe310.h 
b/hw/mcu/sifive/fe310/include/mcu/fe310.h
index 8b03211..9ccb65e 100644
--- a/hw/mcu/sifive/fe310/include/mcu/fe310.h
+++ b/hw/mcu/sifive/fe310/include/mcu/fe310.h
@@ -32,6 +32,12 @@ extern "C" {
 
 #define OS_TICKS_PER_SEC    MYNEWT_VAL(OS_TICKS_PER_SEC)
 
+static inline void
+hal_debug_break(void)
+{
+    __asm ("ebreak");
+}
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/hw/mcu/stm/stm32f0xx/include/mcu/cortex_m0.h 
b/hw/mcu/stm/stm32f0xx/include/mcu/cortex_m0.h
index b9c7e6d..c27f1dc 100644
--- a/hw/mcu/stm/stm32f0xx/include/mcu/cortex_m0.h
+++ b/hw/mcu/stm/stm32f0xx/include/mcu/cortex_m0.h
@@ -28,6 +28,12 @@ extern "C" {
 
 #define OS_TICKS_PER_SEC    (1000)
 
+static inline void
+hal_debug_break(void)
+{
+    __BKPT(1);
+}
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/hw/mcu/stm/stm32f1xx/include/mcu/cortex_m3.h 
b/hw/mcu/stm/stm32f1xx/include/mcu/cortex_m3.h
index d03775e..fa61e24 100644
--- a/hw/mcu/stm/stm32f1xx/include/mcu/cortex_m3.h
+++ b/hw/mcu/stm/stm32f1xx/include/mcu/cortex_m3.h
@@ -28,6 +28,12 @@ extern "C" {
 
 #define OS_TICKS_PER_SEC    (1000)
 
+static inline void
+hal_debug_break(void)
+{
+    __BKPT(1);
+}
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/hw/mcu/stm/stm32f3xx/include/mcu/cortex_m4.h 
b/hw/mcu/stm/stm32f3xx/include/mcu/cortex_m4.h
index 5ad99a4..5e00717 100644
--- a/hw/mcu/stm/stm32f3xx/include/mcu/cortex_m4.h
+++ b/hw/mcu/stm/stm32f3xx/include/mcu/cortex_m4.h
@@ -28,6 +28,12 @@ extern "C" {
 
 #define OS_TICKS_PER_SEC    (1000)
 
+static inline void
+hal_debug_break(void)
+{
+    __BKPT(1);
+}
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/hw/mcu/stm/stm32f4xx/include/mcu/cortex_m4.h 
b/hw/mcu/stm/stm32f4xx/include/mcu/cortex_m4.h
index 99d90fc..d846ed1 100644
--- a/hw/mcu/stm/stm32f4xx/include/mcu/cortex_m4.h
+++ b/hw/mcu/stm/stm32f4xx/include/mcu/cortex_m4.h
@@ -28,6 +28,12 @@ extern "C" {
 
 #define OS_TICKS_PER_SEC    (1000)
 
+static inline void
+hal_debug_break(void)
+{
+    __BKPT(1);
+}
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/hw/mcu/stm/stm32f7xx/include/mcu/cortex_m7.h 
b/hw/mcu/stm/stm32f7xx/include/mcu/cortex_m7.h
index 59fd9db..5ffb6dd 100644
--- a/hw/mcu/stm/stm32f7xx/include/mcu/cortex_m7.h
+++ b/hw/mcu/stm/stm32f7xx/include/mcu/cortex_m7.h
@@ -28,6 +28,12 @@ extern "C" {
 
 #define OS_TICKS_PER_SEC    (1000)
 
+static inline void
+hal_debug_break(void)
+{
+    __BKPT(1);
+}
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/hw/mcu/stm/stm32l0xx/include/mcu/cortex_m0.h 
b/hw/mcu/stm/stm32l0xx/include/mcu/cortex_m0.h
index 98e482d..fe0fe12 100644
--- a/hw/mcu/stm/stm32l0xx/include/mcu/cortex_m0.h
+++ b/hw/mcu/stm/stm32l0xx/include/mcu/cortex_m0.h
@@ -28,6 +28,12 @@ extern "C" {
 
 #define OS_TICKS_PER_SEC    (1000)
 
+static inline void
+hal_debug_break(void)
+{
+    __BKPT(1);
+}
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/hw/mcu/stm/stm32l1xx/include/mcu/cortex_m3.h 
b/hw/mcu/stm/stm32l1xx/include/mcu/cortex_m3.h
index cf0f2a6..41d945f 100644
--- a/hw/mcu/stm/stm32l1xx/include/mcu/cortex_m3.h
+++ b/hw/mcu/stm/stm32l1xx/include/mcu/cortex_m3.h
@@ -28,6 +28,12 @@ extern "C" {
 
 #define OS_TICKS_PER_SEC    (1000)
 
+static inline void
+hal_debug_break(void)
+{
+    __BKPT(1);
+}
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/hw/mcu/stm/stm32l4xx/include/mcu/cortex_m4.h 
b/hw/mcu/stm/stm32l4xx/include/mcu/cortex_m4.h
index 22ce8b3..7697201 100644
--- a/hw/mcu/stm/stm32l4xx/include/mcu/cortex_m4.h
+++ b/hw/mcu/stm/stm32l4xx/include/mcu/cortex_m4.h
@@ -28,6 +28,12 @@ extern "C" {
 
 #define OS_TICKS_PER_SEC    (1000)
 
+static inline void
+hal_debug_break(void)
+{
+    __BKPT(1);
+}
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/hw/mcu/stm/stm32wbxx/include/mcu/cortex_m4.h 
b/hw/mcu/stm/stm32wbxx/include/mcu/cortex_m4.h
index 27377da..5a04e73 100644
--- a/hw/mcu/stm/stm32wbxx/include/mcu/cortex_m4.h
+++ b/hw/mcu/stm/stm32wbxx/include/mcu/cortex_m4.h
@@ -28,6 +28,12 @@ extern "C" {
 
 #define OS_TICKS_PER_SEC    (1000)
 
+static inline void
+hal_debug_break(void)
+{
+    __BKPT(1);
+}
+
 #ifdef __cplusplus
 }
 #endif

Reply via email to