You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2018/10/23 17:48:30 UTC

[mynewt-core] branch master updated (8f7fb3a -> decc256)

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

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


    from 8f7fb3a  Merge pull request #1474 from ccollins476ad/slinky_oic_stack
     new 0784342  kernel/os: Create `OS_CRASH()` macro
     new decc256  sys/sys: Add `DEBUG_PANIC()` macro

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 kernel/os/include/os/mynewt.h                             |  1 +
 kernel/os/include/os/os_fault.h                           |  8 +++++++-
 kernel/os/syscfg.yml                                      |  5 +++++
 libc/baselibc/include/assert.h                            | 15 ++-------------
 libc/baselibc/syscfg.yml                                  |  5 ++---
 .../json_test.h => sys/sys/include/sys/debug_panic.h      | 11 +++++++----
 {hw/mcu/mips/danube => sys/sys}/syscfg.yml                |  7 +++----
 7 files changed, 27 insertions(+), 25 deletions(-)
 copy encoding/json/test/include/json_test/json_test.h => sys/sys/include/sys/debug_panic.h (84%)
 copy {hw/mcu/mips/danube => sys/sys}/syscfg.yml (84%)


[mynewt-core] 02/02: sys/sys: Add `DEBUG_PANIC()` macro

Posted by cc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit decc2561fe73e6eabfae2893d8fb722fb25a033c
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Fri Oct 19 10:32:55 2018 -0700

    sys/sys: Add `DEBUG_PANIC()` macro
    
    The `DEBUG_PANIC()` macro triggers a crash if the `DEBUG_PANIC_ENABLED`
    syscfg setting is enabled.  If this setting is disabled, the macro
    expands to nothing.
---
 kernel/os/include/os/mynewt.h                      |  1 +
 .../mynewt.h => sys/sys/include/sys/debug_panic.h  | 16 ++++++++-------
 sys/sys/syscfg.yml                                 | 23 ++++++++++++++++++++++
 3 files changed, 33 insertions(+), 7 deletions(-)

diff --git a/kernel/os/include/os/mynewt.h b/kernel/os/include/os/mynewt.h
index 3f6943e..ca544ee 100644
--- a/kernel/os/include/os/mynewt.h
+++ b/kernel/os/include/os/mynewt.h
@@ -25,5 +25,6 @@
 #include "sysflash/sysflash.h"
 #include "os/os.h"
 #include "defs/error.h"
+#include "sys/debug_panic.h"
 
 #endif
diff --git a/kernel/os/include/os/mynewt.h b/sys/sys/include/sys/debug_panic.h
similarity index 82%
copy from kernel/os/include/os/mynewt.h
copy to sys/sys/include/sys/debug_panic.h
index 3f6943e..1c3ef70 100644
--- a/kernel/os/include/os/mynewt.h
+++ b/sys/sys/include/sys/debug_panic.h
@@ -17,13 +17,15 @@
  * under the License.
  */
 
-#ifndef H_OS_MYNEWT_
-#define H_OS_MYNEWT_
+#ifndef H_DEBUG_PANIC_
+#define H_DEBUG_PANIC_
 
-#include "syscfg/syscfg.h"
-#include "sysinit/sysinit.h"
-#include "sysflash/sysflash.h"
-#include "os/os.h"
-#include "defs/error.h"
+#include "os/mynewt.h"
+
+#if MYNEWT_VAL(DEBUG_PANIC_ENABLED)
+#define DEBUG_PANIC() OS_CRASH()
+#else
+#define DEBUG_PANIC()
+#endif
 
 #endif
diff --git a/sys/sys/syscfg.yml b/sys/sys/syscfg.yml
new file mode 100644
index 0000000..f910e31
--- /dev/null
+++ b/sys/sys/syscfg.yml
@@ -0,0 +1,23 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+syscfg.defs:
+    DEBUG_PANIC_ENABLED:
+        description: >
+            If enabled, the `DEBUG_PANIC()` macro to trigger a crash.  When
+            disabled, `DEBUG_PANIC()` has no effect.
+        value: 1


[mynewt-core] 01/02: kernel/os: Create `OS_CRASH()` macro

Posted by cc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 07843426952df45530c5dd95b47454b5707b2d86
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Fri Oct 19 10:32:39 2018 -0700

    kernel/os: Create `OS_CRASH()` macro
    
    This macro just expands to a call to `__assert_func()`.  Unlike the
    `assert()` macro, defining `NDEBUG` does not disable this macro.
    
    This macro can be used to trigger an unconditional crash.
---
 kernel/os/include/os/os_fault.h |  8 +++++++-
 kernel/os/syscfg.yml            |  5 +++++
 libc/baselibc/include/assert.h  | 15 ++-------------
 libc/baselibc/syscfg.yml        |  5 ++---
 4 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/kernel/os/include/os/os_fault.h b/kernel/os/include/os/os_fault.h
index 60f5faa..63b1309 100644
--- a/kernel/os/include/os/os_fault.h
+++ b/kernel/os/include/os/os_fault.h
@@ -24,9 +24,15 @@
 extern "C" {
 #endif
 
-void __assert_func(const char *, int, const char *, const char *)
+void __assert_func(const char *file, int line, const char *func, const char *e)
     __attribute((noreturn));
 
+#if MYNEWT_VAL(OS_CRASH_FILE_LINE)
+#define OS_CRASH() __assert_func(__FILE__, __LINE__, NULL, NULL)
+#else
+#define OS_CRASH() __assert_func(NULL, 0, NULL, NULL)
+#endif
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/kernel/os/syscfg.yml b/kernel/os/syscfg.yml
index 45c4664..108dfec 100644
--- a/kernel/os/syscfg.yml
+++ b/kernel/os/syscfg.yml
@@ -135,6 +135,11 @@ syscfg.defs:
         description: >
             Enables debug runtime checks for time-related functionality.
         value: 0
+    OS_CRASH_FILE_LINE:
+        description: >
+            Include filename and line number in crash messages.  Aids in
+            debugging, but increases text size.
+        value: 0
 
 syscfg.vals.OS_DEBUG_MODE:
     OS_CRASH_STACKTRACE: 1
diff --git a/libc/baselibc/include/assert.h b/libc/baselibc/include/assert.h
index 8a131b5..147f452 100644
--- a/libc/baselibc/include/assert.h
+++ b/libc/baselibc/include/assert.h
@@ -5,8 +5,6 @@
 #ifndef _ASSERT_H
 #define _ASSERT_H
 
-#include "syscfg/syscfg.h"
-
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -23,18 +21,9 @@ extern "C" {
 
 #else
 #include <stddef.h>
+#include "os/mynewt.h"
 
-extern void __assert_func(const char *, int, const char *, const char *)
-    __attribute((noreturn));
-
-#if MYNEWT_VAL(BASELIBC_ASSERT_FILE_LINE)
-#define assert(x) ((x) ? (void)0 : \
-    __assert_func(__FILE__, __LINE__, NULL, NULL))
-#else
-#define assert(x) ((x) ? (void)0 : \
-    __assert_func(NULL, 0, NULL, NULL))
-#endif
-
+#define assert(x) ((x) ? (void)0 : OS_CRASH())
 
 #endif
 
diff --git a/libc/baselibc/syscfg.yml b/libc/baselibc/syscfg.yml
index 0912490..7f6dc3c 100644
--- a/libc/baselibc/syscfg.yml
+++ b/libc/baselibc/syscfg.yml
@@ -23,7 +23,6 @@ syscfg.defs:
         value: 1
 
     BASELIBC_ASSERT_FILE_LINE:
-        description: >
-            Include filename and line number in assert messages.  Aids in
-            debugging, but increases text size.
+        defunct: 1
+        description: 'Use OS_CRASH_FILE_LINE instead'
         value: 0