You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by an...@apache.org on 2018/11/21 16:34:01 UTC

[mynewt-core] branch master updated: kernel/os: Fix os_trace APIs

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

andk 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 f598bc4  kernel/os: Fix os_trace APIs
f598bc4 is described below

commit f598bc4bf0b28aaa51f0bf7f9b9318848cef8c77
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Wed Nov 21 15:37:32 2018 +0100

    kernel/os: Fix os_trace APIs
    
    os_trace_api.h uses local #defined symbols from .c file to determine
    whether traces should be enabled for given file or not. In order for
    this to work properly it has to be includes only after such symbols
    are #defined.
    
    However, assert.h includes os/mynewt.h and the nasty side-effect is
    that we have os_everything included by including one of std library
    includes.
    
    Let's assert.h just include os_fault.h instead as this should not have
    any side-effects.
---
 hw/mcu/nordic/nrf51xxx/src/nrf51_clock.c | 2 ++
 hw/mcu/nordic/nrf52xxx/src/nrf52_clock.c | 2 ++
 kernel/os/include/os/os_fault.h          | 2 ++
 libc/baselibc/include/assert.h           | 2 +-
 4 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/hw/mcu/nordic/nrf51xxx/src/nrf51_clock.c b/hw/mcu/nordic/nrf51xxx/src/nrf51_clock.c
index 0c6fcc5..65019b0 100644
--- a/hw/mcu/nordic/nrf51xxx/src/nrf51_clock.c
+++ b/hw/mcu/nordic/nrf51xxx/src/nrf51_clock.c
@@ -17,7 +17,9 @@
  * under the License.
  */
 #include <assert.h>
+#include <stdint.h>
 #include "mcu/nrf51_hal.h"
+#include "nrfx.h"
 
 static uint8_t nrf51_clock_hfxo_refcnt;
 
diff --git a/hw/mcu/nordic/nrf52xxx/src/nrf52_clock.c b/hw/mcu/nordic/nrf52xxx/src/nrf52_clock.c
index 9bdd0ac..98b8a50 100644
--- a/hw/mcu/nordic/nrf52xxx/src/nrf52_clock.c
+++ b/hw/mcu/nordic/nrf52xxx/src/nrf52_clock.c
@@ -17,7 +17,9 @@
  * under the License.
  */
 #include <assert.h>
+#include <stdint.h>
 #include "mcu/nrf52_hal.h"
+#include "nrfx.h"
 
 static uint8_t nrf52_clock_hfxo_refcnt;
 
diff --git a/kernel/os/include/os/os_fault.h b/kernel/os/include/os/os_fault.h
index 63b1309..1a3c6f5 100644
--- a/kernel/os/include/os/os_fault.h
+++ b/kernel/os/include/os/os_fault.h
@@ -20,6 +20,8 @@
 #ifndef _OS_FAULT_H
 #define _OS_FAULT_H
 
+#include "syscfg/syscfg.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
diff --git a/libc/baselibc/include/assert.h b/libc/baselibc/include/assert.h
index 147f452..15bc944 100644
--- a/libc/baselibc/include/assert.h
+++ b/libc/baselibc/include/assert.h
@@ -21,7 +21,7 @@ extern "C" {
 
 #else
 #include <stddef.h>
-#include "os/mynewt.h"
+#include "os/os_fault.h"
 
 #define assert(x) ((x) ? (void)0 : OS_CRASH())