You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ma...@apache.org on 2016/05/19 16:51:24 UTC

[12/18] incubator-mynewt-core git commit: hal/bsp; add hal_bsp.h, which exports common BSP APIs.

hal/bsp; add hal_bsp.h, which exports common BSP APIs.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/0b3ca007
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/0b3ca007
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/0b3ca007

Branch: refs/heads/develop
Commit: 0b3ca0075ba60e8f736740af1e702bb9a5ee5638
Parents: e157f02
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Tue May 17 20:34:26 2016 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Thu May 19 09:35:45 2016 -0700

----------------------------------------------------------------------
 hw/bsp/bmd300eval/include/bsp/bsp.h             |  2 -
 hw/bsp/bmd300eval/src/libc_stubs.c              |  2 +-
 hw/bsp/bmd300eval/src/os_bsp.c                  |  2 +-
 hw/bsp/bmd300eval/src/sbrk.c                    |  1 +
 hw/bsp/native/include/bsp/bsp.h                 |  2 -
 hw/bsp/native/src/sbrk.c                        |  2 +
 hw/bsp/nrf51dk-16kbram/include/bsp/bsp.h        |  2 -
 hw/bsp/nrf51dk-16kbram/src/hal_bsp.c            |  3 +-
 hw/bsp/nrf51dk-16kbram/src/libc_stubs.c         |  2 +-
 hw/bsp/nrf51dk-16kbram/src/os_bsp.c             |  2 +-
 hw/bsp/nrf51dk-16kbram/src/sbrk.c               |  1 +
 hw/bsp/nrf51dk/include/bsp/bsp.h                |  2 -
 hw/bsp/nrf51dk/src/libc_stubs.c                 |  2 +-
 hw/bsp/nrf51dk/src/os_bsp.c                     |  2 +-
 hw/bsp/nrf51dk/src/sbrk.c                       |  1 +
 hw/bsp/nrf52dk/include/bsp/bsp.h                |  2 -
 hw/bsp/nrf52dk/src/libc_stubs.c                 |  2 +-
 hw/bsp/nrf52dk/src/os_bsp.c                     |  2 +-
 hw/bsp/nrf52dk/src/sbrk.c                       |  1 +
 hw/bsp/nrf52pdk/include/bsp/bsp.h               |  2 -
 hw/bsp/nrf52pdk/src/hal_bsp.c                   |  4 +-
 hw/bsp/nrf52pdk/src/libc_stubs.c                |  2 +-
 hw/bsp/nrf52pdk/src/os_bsp.c                    |  2 +-
 hw/bsp/nrf52pdk/src/sbrk.c                      |  1 +
 .../include/bsp/bsp.h                           |  2 -
 hw/bsp/olimex_stm32-e407_devboard/src/hal_bsp.c |  1 +
 .../olimex_stm32-e407_devboard/src/libc_stubs.c |  2 +-
 hw/bsp/olimex_stm32-e407_devboard/src/os_bsp.c  |  2 +-
 hw/hal/include/hal/hal_bsp.h                    | 43 ++++++++++++++++++++
 hw/hal/include/hal/hal_flash_int.h              |  3 --
 hw/hal/src/flash_map.c                          |  2 +
 hw/hal/src/test/flash_map_test.c                |  2 +-
 libs/flash_test/src/flash_test/flash_test.c     |  3 +-
 libs/imgmgr/src/imgmgr.c                        |  2 +-
 libs/imgmgr/src/imgmgr_boot.c                   |  2 +-
 libs/os/include/os/arch/cortex_m0/os/os_arch.h  |  1 -
 libs/os/include/os/arch/cortex_m4/os/os_arch.h  |  1 -
 libs/os/include/os/arch/sim/os/os_arch.h        |  2 -
 libs/os/src/arch/cortex_m0/os_arch_arm.c        |  1 +
 libs/os/src/arch/cortex_m4/os_arch_arm.c        |  1 +
 libs/os/src/arch/sim/os_arch_sim.c              |  2 +
 sys/coredump/src/coredump.c                     |  3 +-
 42 files changed, 80 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0b3ca007/hw/bsp/bmd300eval/include/bsp/bsp.h
----------------------------------------------------------------------
diff --git a/hw/bsp/bmd300eval/include/bsp/bsp.h b/hw/bsp/bmd300eval/include/bsp/bsp.h
index d2a32c5..7638ff5 100644
--- a/hw/bsp/bmd300eval/include/bsp/bsp.h
+++ b/hw/bsp/bmd300eval/include/bsp/bsp.h
@@ -38,8 +38,6 @@ extern "C" {
 /* UART info */
 #define CONSOLE_UART    0
 
-int bsp_imgr_current_slot(void);
-
 #define NFFS_AREA_MAX    (8)
 
 #ifdef __cplusplus

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0b3ca007/hw/bsp/bmd300eval/src/libc_stubs.c
----------------------------------------------------------------------
diff --git a/hw/bsp/bmd300eval/src/libc_stubs.c b/hw/bsp/bmd300eval/src/libc_stubs.c
index 84f855e..b1b6b8b 100644
--- a/hw/bsp/bmd300eval/src/libc_stubs.c
+++ b/hw/bsp/bmd300eval/src/libc_stubs.c
@@ -17,8 +17,8 @@
  * under the License.
  */
 #include <hal/hal_system.h>
+#include <hal/hal_bsp.h>
 
-void * _sbrk(int c);
 int _close(int fd);
 int _fstat(int fd, void *s);
 void _exit(int s);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0b3ca007/hw/bsp/bmd300eval/src/os_bsp.c
----------------------------------------------------------------------
diff --git a/hw/bsp/bmd300eval/src/os_bsp.c b/hw/bsp/bmd300eval/src/os_bsp.c
index c05b208..66c1ceb 100644
--- a/hw/bsp/bmd300eval/src/os_bsp.c
+++ b/hw/bsp/bmd300eval/src/os_bsp.c
@@ -17,6 +17,7 @@
  * under the License.
  */
 #include <hal/flash_map.h>
+#include <hal/hal_bsp.h>
 
 static struct flash_area bsp_flash_areas[] = {
     [FLASH_AREA_BOOTLOADER] = {
@@ -47,7 +48,6 @@ static struct flash_area bsp_flash_areas[] = {
     }
 };
 
-void *_sbrk(int incr);
 void _close(int fd);
 
 /*

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0b3ca007/hw/bsp/bmd300eval/src/sbrk.c
----------------------------------------------------------------------
diff --git a/hw/bsp/bmd300eval/src/sbrk.c b/hw/bsp/bmd300eval/src/sbrk.c
index 0fd7a41..8549266 100644
--- a/hw/bsp/bmd300eval/src/sbrk.c
+++ b/hw/bsp/bmd300eval/src/sbrk.c
@@ -18,6 +18,7 @@
  */
 
 #include <errno.h>
+#include <hal/hal_bsp.h>
 
 extern char __HeapBase;
 extern char __HeapLimit;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0b3ca007/hw/bsp/native/include/bsp/bsp.h
----------------------------------------------------------------------
diff --git a/hw/bsp/native/include/bsp/bsp.h b/hw/bsp/native/include/bsp/bsp.h
index fb684c3..42a53f4 100644
--- a/hw/bsp/native/include/bsp/bsp.h
+++ b/hw/bsp/native/include/bsp/bsp.h
@@ -38,8 +38,6 @@ extern "C" {
 #define UART_CNT	2
 #define CONSOLE_UART	0
 
-int bsp_imgr_current_slot(void);
-
 #define NFFS_AREA_MAX    (8)
 
 #ifdef __cplusplus

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0b3ca007/hw/bsp/native/src/sbrk.c
----------------------------------------------------------------------
diff --git a/hw/bsp/native/src/sbrk.c b/hw/bsp/native/src/sbrk.c
index 64000b7..3ec8a90 100644
--- a/hw/bsp/native/src/sbrk.c
+++ b/hw/bsp/native/src/sbrk.c
@@ -21,6 +21,8 @@
 #include <unistd.h>
 #include <errno.h>
 
+#include <hal/hal_bsp.h>
+
 extern int getpagesize(void);
 
 static void *cont;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0b3ca007/hw/bsp/nrf51dk-16kbram/include/bsp/bsp.h
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf51dk-16kbram/include/bsp/bsp.h b/hw/bsp/nrf51dk-16kbram/include/bsp/bsp.h
index 1392712..72370ff 100644
--- a/hw/bsp/nrf51dk-16kbram/include/bsp/bsp.h
+++ b/hw/bsp/nrf51dk-16kbram/include/bsp/bsp.h
@@ -37,8 +37,6 @@ extern "C" {
 /* UART info */
 #define CONSOLE_UART    0
 
-int bsp_imgr_current_slot(void);
-
 #define NFFS_AREA_MAX    (8)
 
 #ifdef __cplusplus

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0b3ca007/hw/bsp/nrf51dk-16kbram/src/hal_bsp.c
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf51dk-16kbram/src/hal_bsp.c b/hw/bsp/nrf51dk-16kbram/src/hal_bsp.c
index bfca6f9..868ace8 100644
--- a/hw/bsp/nrf51dk-16kbram/src/hal_bsp.c
+++ b/hw/bsp/nrf51dk-16kbram/src/hal_bsp.c
@@ -19,7 +19,8 @@
 
 #include <stdint.h>
 #include <stddef.h>
-#include "mcu/nrf51_hal.h"
+#include <hal/hal_bsp.h>
+#include <mcu/nrf51_hal.h>
 
 static const struct nrf51_uart_cfg uart_cfg = {
     .suc_pin_tx = 9,

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0b3ca007/hw/bsp/nrf51dk-16kbram/src/libc_stubs.c
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf51dk-16kbram/src/libc_stubs.c b/hw/bsp/nrf51dk-16kbram/src/libc_stubs.c
index da54ed1..de047ea 100644
--- a/hw/bsp/nrf51dk-16kbram/src/libc_stubs.c
+++ b/hw/bsp/nrf51dk-16kbram/src/libc_stubs.c
@@ -18,8 +18,8 @@
  */
 
 #include <hal/hal_system.h>
+#include <hal/hal_bsp.h>
 
-void * _sbrk(int c);
 int _close(int fd);
 int _fstat(int fd, void *s);
 void _exit(int s);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0b3ca007/hw/bsp/nrf51dk-16kbram/src/os_bsp.c
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf51dk-16kbram/src/os_bsp.c b/hw/bsp/nrf51dk-16kbram/src/os_bsp.c
index 2b88f27..07230b0 100644
--- a/hw/bsp/nrf51dk-16kbram/src/os_bsp.c
+++ b/hw/bsp/nrf51dk-16kbram/src/os_bsp.c
@@ -17,6 +17,7 @@
  * under the License.
  */
 #include <hal/flash_map.h>
+#include <hal/hal_bsp.h>
 
 static struct flash_area bsp_flash_areas[] = {
     [FLASH_AREA_BOOTLOADER] = {
@@ -46,7 +47,6 @@ static struct flash_area bsp_flash_areas[] = {
     }
 };
 
-void *_sbrk(int incr);
 void _close(int fd);
 
 /*

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0b3ca007/hw/bsp/nrf51dk-16kbram/src/sbrk.c
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf51dk-16kbram/src/sbrk.c b/hw/bsp/nrf51dk-16kbram/src/sbrk.c
index f06d124..7daef1a 100644
--- a/hw/bsp/nrf51dk-16kbram/src/sbrk.c
+++ b/hw/bsp/nrf51dk-16kbram/src/sbrk.c
@@ -18,6 +18,7 @@
  */
 
 #include <errno.h>
+#include <hal/hal_bsp.h>
 
 extern char __HeapBase;
 extern char __HeapLimit;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0b3ca007/hw/bsp/nrf51dk/include/bsp/bsp.h
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf51dk/include/bsp/bsp.h b/hw/bsp/nrf51dk/include/bsp/bsp.h
index 2bdfa56..6e2ab08 100644
--- a/hw/bsp/nrf51dk/include/bsp/bsp.h
+++ b/hw/bsp/nrf51dk/include/bsp/bsp.h
@@ -37,8 +37,6 @@ extern "C" {
 /* UART info */
 #define CONSOLE_UART    0
 
-int bsp_imgr_current_slot(void);
-
 #define NFFS_AREA_MAX    (8)
 
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0b3ca007/hw/bsp/nrf51dk/src/libc_stubs.c
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf51dk/src/libc_stubs.c b/hw/bsp/nrf51dk/src/libc_stubs.c
index da54ed1..de047ea 100644
--- a/hw/bsp/nrf51dk/src/libc_stubs.c
+++ b/hw/bsp/nrf51dk/src/libc_stubs.c
@@ -18,8 +18,8 @@
  */
 
 #include <hal/hal_system.h>
+#include <hal/hal_bsp.h>
 
-void * _sbrk(int c);
 int _close(int fd);
 int _fstat(int fd, void *s);
 void _exit(int s);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0b3ca007/hw/bsp/nrf51dk/src/os_bsp.c
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf51dk/src/os_bsp.c b/hw/bsp/nrf51dk/src/os_bsp.c
index 2b88f27..07230b0 100644
--- a/hw/bsp/nrf51dk/src/os_bsp.c
+++ b/hw/bsp/nrf51dk/src/os_bsp.c
@@ -17,6 +17,7 @@
  * under the License.
  */
 #include <hal/flash_map.h>
+#include <hal/hal_bsp.h>
 
 static struct flash_area bsp_flash_areas[] = {
     [FLASH_AREA_BOOTLOADER] = {
@@ -46,7 +47,6 @@ static struct flash_area bsp_flash_areas[] = {
     }
 };
 
-void *_sbrk(int incr);
 void _close(int fd);
 
 /*

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0b3ca007/hw/bsp/nrf51dk/src/sbrk.c
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf51dk/src/sbrk.c b/hw/bsp/nrf51dk/src/sbrk.c
index f06d124..7daef1a 100644
--- a/hw/bsp/nrf51dk/src/sbrk.c
+++ b/hw/bsp/nrf51dk/src/sbrk.c
@@ -18,6 +18,7 @@
  */
 
 #include <errno.h>
+#include <hal/hal_bsp.h>
 
 extern char __HeapBase;
 extern char __HeapLimit;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0b3ca007/hw/bsp/nrf52dk/include/bsp/bsp.h
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf52dk/include/bsp/bsp.h b/hw/bsp/nrf52dk/include/bsp/bsp.h
index d2a32c5..7638ff5 100644
--- a/hw/bsp/nrf52dk/include/bsp/bsp.h
+++ b/hw/bsp/nrf52dk/include/bsp/bsp.h
@@ -38,8 +38,6 @@ extern "C" {
 /* UART info */
 #define CONSOLE_UART    0
 
-int bsp_imgr_current_slot(void);
-
 #define NFFS_AREA_MAX    (8)
 
 #ifdef __cplusplus

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0b3ca007/hw/bsp/nrf52dk/src/libc_stubs.c
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf52dk/src/libc_stubs.c b/hw/bsp/nrf52dk/src/libc_stubs.c
index 84f855e..b1b6b8b 100644
--- a/hw/bsp/nrf52dk/src/libc_stubs.c
+++ b/hw/bsp/nrf52dk/src/libc_stubs.c
@@ -17,8 +17,8 @@
  * under the License.
  */
 #include <hal/hal_system.h>
+#include <hal/hal_bsp.h>
 
-void * _sbrk(int c);
 int _close(int fd);
 int _fstat(int fd, void *s);
 void _exit(int s);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0b3ca007/hw/bsp/nrf52dk/src/os_bsp.c
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf52dk/src/os_bsp.c b/hw/bsp/nrf52dk/src/os_bsp.c
index c05b208..66c1ceb 100644
--- a/hw/bsp/nrf52dk/src/os_bsp.c
+++ b/hw/bsp/nrf52dk/src/os_bsp.c
@@ -17,6 +17,7 @@
  * under the License.
  */
 #include <hal/flash_map.h>
+#include <hal/hal_bsp.h>
 
 static struct flash_area bsp_flash_areas[] = {
     [FLASH_AREA_BOOTLOADER] = {
@@ -47,7 +48,6 @@ static struct flash_area bsp_flash_areas[] = {
     }
 };
 
-void *_sbrk(int incr);
 void _close(int fd);
 
 /*

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0b3ca007/hw/bsp/nrf52dk/src/sbrk.c
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf52dk/src/sbrk.c b/hw/bsp/nrf52dk/src/sbrk.c
index 0fd7a41..8549266 100644
--- a/hw/bsp/nrf52dk/src/sbrk.c
+++ b/hw/bsp/nrf52dk/src/sbrk.c
@@ -18,6 +18,7 @@
  */
 
 #include <errno.h>
+#include <hal/hal_bsp.h>
 
 extern char __HeapBase;
 extern char __HeapLimit;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0b3ca007/hw/bsp/nrf52pdk/include/bsp/bsp.h
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf52pdk/include/bsp/bsp.h b/hw/bsp/nrf52pdk/include/bsp/bsp.h
index d2a32c5..7638ff5 100644
--- a/hw/bsp/nrf52pdk/include/bsp/bsp.h
+++ b/hw/bsp/nrf52pdk/include/bsp/bsp.h
@@ -38,8 +38,6 @@ extern "C" {
 /* UART info */
 #define CONSOLE_UART    0
 
-int bsp_imgr_current_slot(void);
-
 #define NFFS_AREA_MAX    (8)
 
 #ifdef __cplusplus

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0b3ca007/hw/bsp/nrf52pdk/src/hal_bsp.c
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf52pdk/src/hal_bsp.c b/hw/bsp/nrf52pdk/src/hal_bsp.c
index 0b04610..521aa61 100644
--- a/hw/bsp/nrf52pdk/src/hal_bsp.c
+++ b/hw/bsp/nrf52pdk/src/hal_bsp.c
@@ -18,7 +18,9 @@
  */
 #include <stdint.h>
 #include <stddef.h>
-#include "mcu/nrf52_hal.h"
+
+#include <hal/hal_bsp.h>
+#include <mcu/nrf52_hal.h>
 
 static const struct nrf52_uart_cfg uart_cfg = {
     .suc_pin_tx = 6,

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0b3ca007/hw/bsp/nrf52pdk/src/libc_stubs.c
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf52pdk/src/libc_stubs.c b/hw/bsp/nrf52pdk/src/libc_stubs.c
index 84f855e..b1b6b8b 100644
--- a/hw/bsp/nrf52pdk/src/libc_stubs.c
+++ b/hw/bsp/nrf52pdk/src/libc_stubs.c
@@ -17,8 +17,8 @@
  * under the License.
  */
 #include <hal/hal_system.h>
+#include <hal/hal_bsp.h>
 
-void * _sbrk(int c);
 int _close(int fd);
 int _fstat(int fd, void *s);
 void _exit(int s);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0b3ca007/hw/bsp/nrf52pdk/src/os_bsp.c
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf52pdk/src/os_bsp.c b/hw/bsp/nrf52pdk/src/os_bsp.c
index 1c5a7a9..9f2e337 100644
--- a/hw/bsp/nrf52pdk/src/os_bsp.c
+++ b/hw/bsp/nrf52pdk/src/os_bsp.c
@@ -17,6 +17,7 @@
  * under the License.
  */
 #include <hal/flash_map.h>
+#include <hal/hal_bsp.h>
 
 static struct flash_area bsp_flash_areas[] = {
     [FLASH_AREA_BOOTLOADER] = {
@@ -47,7 +48,6 @@ static struct flash_area bsp_flash_areas[] = {
     }
 };
 
-void *_sbrk(int incr);
 void _close(int fd);
 
 /*

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0b3ca007/hw/bsp/nrf52pdk/src/sbrk.c
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf52pdk/src/sbrk.c b/hw/bsp/nrf52pdk/src/sbrk.c
index 0fd7a41..8549266 100644
--- a/hw/bsp/nrf52pdk/src/sbrk.c
+++ b/hw/bsp/nrf52pdk/src/sbrk.c
@@ -18,6 +18,7 @@
  */
 
 #include <errno.h>
+#include <hal/hal_bsp.h>
 
 extern char __HeapBase;
 extern char __HeapLimit;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0b3ca007/hw/bsp/olimex_stm32-e407_devboard/include/bsp/bsp.h
----------------------------------------------------------------------
diff --git a/hw/bsp/olimex_stm32-e407_devboard/include/bsp/bsp.h b/hw/bsp/olimex_stm32-e407_devboard/include/bsp/bsp.h
index 828b3d0..d39ddca 100644
--- a/hw/bsp/olimex_stm32-e407_devboard/include/bsp/bsp.h
+++ b/hw/bsp/olimex_stm32-e407_devboard/include/bsp/bsp.h
@@ -38,8 +38,6 @@ extern "C" {
 #define UART_CNT 1
 #define CONSOLE_UART 0
 
-int bsp_imgr_current_slot(void);
-
 #define NFFS_AREA_MAX    (8)
 
 #ifdef __cplusplus

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0b3ca007/hw/bsp/olimex_stm32-e407_devboard/src/hal_bsp.c
----------------------------------------------------------------------
diff --git a/hw/bsp/olimex_stm32-e407_devboard/src/hal_bsp.c b/hw/bsp/olimex_stm32-e407_devboard/src/hal_bsp.c
index d469817..ec1d2a4 100644
--- a/hw/bsp/olimex_stm32-e407_devboard/src/hal_bsp.c
+++ b/hw/bsp/olimex_stm32-e407_devboard/src/hal_bsp.c
@@ -16,6 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+#include "hal/hal_bsp.h"
 #include "hal/hal_gpio.h"
 #include "hal/hal_flash_int.h"
 #include "mcu/stm32f407xx.h"

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0b3ca007/hw/bsp/olimex_stm32-e407_devboard/src/libc_stubs.c
----------------------------------------------------------------------
diff --git a/hw/bsp/olimex_stm32-e407_devboard/src/libc_stubs.c b/hw/bsp/olimex_stm32-e407_devboard/src/libc_stubs.c
index 84f855e..b1b6b8b 100644
--- a/hw/bsp/olimex_stm32-e407_devboard/src/libc_stubs.c
+++ b/hw/bsp/olimex_stm32-e407_devboard/src/libc_stubs.c
@@ -17,8 +17,8 @@
  * under the License.
  */
 #include <hal/hal_system.h>
+#include <hal/hal_bsp.h>
 
-void * _sbrk(int c);
 int _close(int fd);
 int _fstat(int fd, void *s);
 void _exit(int s);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0b3ca007/hw/bsp/olimex_stm32-e407_devboard/src/os_bsp.c
----------------------------------------------------------------------
diff --git a/hw/bsp/olimex_stm32-e407_devboard/src/os_bsp.c b/hw/bsp/olimex_stm32-e407_devboard/src/os_bsp.c
index ab622db..5cdc35a 100644
--- a/hw/bsp/olimex_stm32-e407_devboard/src/os_bsp.c
+++ b/hw/bsp/olimex_stm32-e407_devboard/src/os_bsp.c
@@ -21,6 +21,7 @@
  * XXXX for now have this here.
  */
 #include <hal/flash_map.h>
+#include <hal/hal_bsp.h>
 
 static struct flash_area bsp_flash_areas[] = {
     [FLASH_AREA_BOOTLOADER] = {
@@ -51,7 +52,6 @@ static struct flash_area bsp_flash_areas[] = {
     }
 };
 
-void *_sbrk(int incr);
 void _close(int fd);
 
 /*

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0b3ca007/hw/hal/include/hal/hal_bsp.h
----------------------------------------------------------------------
diff --git a/hw/hal/include/hal/hal_bsp.h b/hw/hal/include/hal/hal_bsp.h
new file mode 100644
index 0000000..a491507
--- /dev/null
+++ b/hw/hal/include/hal/hal_bsp.h
@@ -0,0 +1,43 @@
+/**
+ * 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.
+ */
+
+#ifndef __HAL_BSP_H_
+#define __HAL_BSP_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <inttypes.h>
+
+/* External function prototypes supplied by BSP */
+struct hal_flash;
+const struct hal_flash *bsp_flash_dev(uint8_t flash_id);
+
+int bsp_imgr_current_slot(void);
+
+void os_bsp_init(void);
+
+void *_sbrk(int incr);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0b3ca007/hw/hal/include/hal/hal_flash_int.h
----------------------------------------------------------------------
diff --git a/hw/hal/include/hal/hal_flash_int.h b/hw/hal/include/hal/hal_flash_int.h
index 3be4572..99bf329 100644
--- a/hw/hal/include/hal/hal_flash_int.h
+++ b/hw/hal/include/hal/hal_flash_int.h
@@ -50,9 +50,6 @@ struct hal_flash {
  */
 uint32_t hal_flash_sector_size(const struct hal_flash *hf, int sec_idx);
 
-/* External function prototype supplied by BSP */
-const struct hal_flash *bsp_flash_dev(uint8_t flash_id);
-
 
 #ifdef __cplusplus
 }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0b3ca007/hw/hal/src/flash_map.c
----------------------------------------------------------------------
diff --git a/hw/hal/src/flash_map.c b/hw/hal/src/flash_map.c
index 8cae5cf..4b06c29 100644
--- a/hw/hal/src/flash_map.c
+++ b/hw/hal/src/flash_map.c
@@ -16,8 +16,10 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+#include <inttypes.h>
 #include <string.h>
 
+#include "hal/hal_bsp.h"
 #include "hal/hal_flash.h"
 #include "hal/hal_flash_int.h"
 #ifdef NFFS_PRESENT

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0b3ca007/hw/hal/src/test/flash_map_test.c
----------------------------------------------------------------------
diff --git a/hw/hal/src/test/flash_map_test.c b/hw/hal/src/test/flash_map_test.c
index c9df88c..06e065d 100644
--- a/hw/hal/src/test/flash_map_test.c
+++ b/hw/hal/src/test/flash_map_test.c
@@ -22,7 +22,7 @@
 #include <os/os.h>
 #include <testutil/testutil.h>
 #include "hal/flash_map.h"
-
+#include "hal/hal_bsp.h"
 #include "hal/hal_flash.h"
 #include "hal/hal_flash_int.h"
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0b3ca007/libs/flash_test/src/flash_test/flash_test.c
----------------------------------------------------------------------
diff --git a/libs/flash_test/src/flash_test/flash_test.c b/libs/flash_test/src/flash_test/flash_test.c
index 5a9bdad..980cbba 100644
--- a/libs/flash_test/src/flash_test/flash_test.c
+++ b/libs/flash_test/src/flash_test/flash_test.c
@@ -16,10 +16,11 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
+#include <inttypes.h>
 #include <os/os.h>
 #include <console/console.h>
 #include <flash_test/flash_test.h>
+#include <hal/hal_bsp.h>
 #include <hal/hal_flash.h>
 #include <hal/hal_flash_int.h>
 #include <shell/shell.h>

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0b3ca007/libs/imgmgr/src/imgmgr.c
----------------------------------------------------------------------
diff --git a/libs/imgmgr/src/imgmgr.c b/libs/imgmgr/src/imgmgr.c
index b730d66..21d0225 100644
--- a/libs/imgmgr/src/imgmgr.c
+++ b/libs/imgmgr/src/imgmgr.c
@@ -17,11 +17,11 @@
  * under the License.
  */
 #include <os/endian.h>
-#include <bsp/bsp.h>
 
 #include <limits.h>
 #include <assert.h>
 #include <string.h>
+#include <hal/hal_bsp.h>
 #include <hal/flash_map.h>
 #include <newtmgr/newtmgr.h>
 #include <json/json.h>

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0b3ca007/libs/imgmgr/src/imgmgr_boot.c
----------------------------------------------------------------------
diff --git a/libs/imgmgr/src/imgmgr_boot.c b/libs/imgmgr/src/imgmgr_boot.c
index 3e4f9cf..2927f3e 100644
--- a/libs/imgmgr/src/imgmgr_boot.c
+++ b/libs/imgmgr/src/imgmgr_boot.c
@@ -31,7 +31,7 @@
 #include <fs/fsutil.h>
 #include <json/json.h>
 #include <util/base64.h>
-#include <bsp/bsp.h>
+#include <hal/hal_bsp.h>
 
 #include "imgmgr/imgmgr.h"
 #include "imgmgr_priv.h"

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0b3ca007/libs/os/include/os/arch/cortex_m0/os/os_arch.h
----------------------------------------------------------------------
diff --git a/libs/os/include/os/arch/cortex_m0/os/os_arch.h b/libs/os/include/os/arch/cortex_m0/os/os_arch.h
index 7231cb7..e986702 100755
--- a/libs/os/include/os/arch/cortex_m0/os/os_arch.h
+++ b/libs/os/include/os/arch/cortex_m0/os/os_arch.h
@@ -69,7 +69,6 @@ void os_default_irq_asm(void);
 
 /* External function prototypes supplied by BSP */
 void os_bsp_systick_init(uint32_t os_ticks_per_sec, int prio);
-void os_bsp_init(void);
 void os_bsp_ctx_sw(void);
 
 #endif /* _OS_ARCH_X86_H */ 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0b3ca007/libs/os/include/os/arch/cortex_m4/os/os_arch.h
----------------------------------------------------------------------
diff --git a/libs/os/include/os/arch/cortex_m4/os/os_arch.h b/libs/os/include/os/arch/cortex_m4/os/os_arch.h
index 590542a..8c67f09 100755
--- a/libs/os/include/os/arch/cortex_m4/os/os_arch.h
+++ b/libs/os/include/os/arch/cortex_m4/os/os_arch.h
@@ -69,7 +69,6 @@ void os_default_irq_asm(void);
 
 /* External function prototypes supplied by BSP */
 void os_bsp_systick_init(uint32_t os_tick_per_sec, int prio);
-void os_bsp_init(void);
 void os_bsp_idle(os_time_t ticks);
 void os_bsp_ctx_sw(void);
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0b3ca007/libs/os/include/os/arch/sim/os/os_arch.h
----------------------------------------------------------------------
diff --git a/libs/os/include/os/arch/sim/os/os_arch.h b/libs/os/include/os/arch/sim/os/os_arch.h
index 6b98b8e..d9570c8 100644
--- a/libs/os/include/os/arch/sim/os/os_arch.h
+++ b/libs/os/include/os/arch/sim/os/os_arch.h
@@ -71,6 +71,4 @@ os_error_t os_arch_os_init(void);
 void os_arch_os_stop(void);
 os_error_t os_arch_os_start(void);
 
-void os_bsp_init(void);
-
 #endif /* _OS_ARCH_SIM_H */

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0b3ca007/libs/os/src/arch/cortex_m0/os_arch_arm.c
----------------------------------------------------------------------
diff --git a/libs/os/src/arch/cortex_m0/os_arch_arm.c b/libs/os/src/arch/cortex_m0/os_arch_arm.c
index f5403f3..12df443 100755
--- a/libs/os/src/arch/cortex_m0/os_arch_arm.c
+++ b/libs/os/src/arch/cortex_m0/os_arch_arm.c
@@ -19,6 +19,7 @@
 
 #include "os/os.h"
 #include "os/os_arch.h"
+#include <hal/hal_bsp.h>
 #include <hal/hal_os_tick.h>
 #include <bsp/cmsis_nvic.h>
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0b3ca007/libs/os/src/arch/cortex_m4/os_arch_arm.c
----------------------------------------------------------------------
diff --git a/libs/os/src/arch/cortex_m4/os_arch_arm.c b/libs/os/src/arch/cortex_m4/os_arch_arm.c
index 6023eca..a02c217 100755
--- a/libs/os/src/arch/cortex_m4/os_arch_arm.c
+++ b/libs/os/src/arch/cortex_m4/os_arch_arm.c
@@ -19,6 +19,7 @@
 
 #include "os/os.h"
 #include "os/os_arch.h"
+#include <hal/hal_bsp.h>
 #include <hal/hal_os_tick.h>
 #include <bsp/cmsis_nvic.h>
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0b3ca007/libs/os/src/arch/sim/os_arch_sim.c
----------------------------------------------------------------------
diff --git a/libs/os/src/arch/sim/os_arch_sim.c b/libs/os/src/arch/sim/os_arch_sim.c
index 14316c5..4fbf2bb 100644
--- a/libs/os/src/arch/sim/os_arch_sim.c
+++ b/libs/os/src/arch/sim/os_arch_sim.c
@@ -20,6 +20,8 @@
 #include "os/os.h"
 #include "os_priv.h"
 
+#include <hal/hal_bsp.h>
+
 #ifdef __APPLE__
 #define _XOPEN_SOURCE
 #endif

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0b3ca007/sys/coredump/src/coredump.c
----------------------------------------------------------------------
diff --git a/sys/coredump/src/coredump.c b/sys/coredump/src/coredump.c
index 97ef749..b9743d0 100644
--- a/sys/coredump/src/coredump.c
+++ b/sys/coredump/src/coredump.c
@@ -16,8 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-#include <bsp/bsp.h>
-
+#include <hal/hal_bsp.h>
 #include <hal/flash_map.h>
 #include <bootutil/image.h>
 #include <imgmgr/imgmgr.h>