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 2016/10/08 19:54:25 UTC
[2/2] incubator-mynewt-core git commit: Flash map config in bsp.yml
Flash map config in bsp.yml
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/5d711b27
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/5d711b27
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/5d711b27
Branch: refs/heads/develop
Commit: 5d711b274d8aca3df433e7c5b2964077d491b720
Parents: 20da189
Author: Christopher Collins <cc...@apache.org>
Authored: Mon Oct 3 19:43:43 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Sat Oct 8 12:54:01 2016 -0700
----------------------------------------------------------------------
apps/bletest/src/main.c | 2 +-
apps/boot/src/boot.c | 6 +-
apps/ffs2native/src/main.c | 2 +-
apps/slinky/src/main.c | 3 +-
apps/splitty/src/main.c | 2 +-
boot/boot_serial/pkg.yml | 1 +
boot/boot_serial/src/boot_serial.c | 12 +-
boot/boot_serial/test/src/boot_test.c | 3 +-
boot/bootutil/include/bootutil/bootutil_misc.h | 2 +
boot/bootutil/pkg.yml | 1 +
boot/bootutil/src/bootutil_misc.c | 19 +-
boot/bootutil/src/loader.c | 36 ++--
boot/bootutil/test/src/boot_test.c | 8 +-
boot/split/src/split.c | 12 +-
fs/fcb/include/fcb/fcb.h | 4 +-
fs/fcb/pkg.yml | 1 +
fs/fcb/test/src/fcb_test.c | 8 +-
fs/nffs/pkg.yml | 1 +
fs/nffs/src/nffs.c | 6 +-
fs/nffs/src/nffs_misc.c | 6 +-
fs/nffs/syscfg.yml | 6 +
hw/bsp/arduino_primo_nrf52/bsp.yml | 58 +++++++
hw/bsp/arduino_primo_nrf52/pkg.yml | 9 +-
.../src/arch/cortex_m4/gcc_startup_nrf52.s | 2 +-
.../arch/cortex_m4/gcc_startup_nrf52_split.s | 2 +-
hw/bsp/arduino_primo_nrf52/src/os_bsp.c | 65 +------
hw/bsp/arduino_primo_nrf52/syscfg.yml | 6 +
hw/bsp/bmd300eval/bsp.yml | 58 +++++++
hw/bsp/bmd300eval/pkg.yml | 9 +-
.../src/arch/cortex_m4/gcc_startup_nrf52.s | 2 +-
.../arch/cortex_m4/gcc_startup_nrf52_split.s | 2 +-
hw/bsp/bmd300eval/src/os_bsp.c | 65 +------
hw/bsp/bmd300eval/syscfg.yml | 6 +
hw/bsp/native/bsp.yml | 54 ++++++
hw/bsp/native/pkg.yml | 5 +-
hw/bsp/native/src/os_bsp.c | 63 +------
hw/bsp/nrf51-arduino_101/bsp.yml | 57 ++++++
hw/bsp/nrf51-arduino_101/pkg.yml | 8 +-
hw/bsp/nrf51-arduino_101/src/os_bsp.c | 54 +-----
hw/bsp/nrf51-arduino_101/syscfg.yml | 6 +
hw/bsp/nrf51-blenano/bsp.yml | 58 +++++++
hw/bsp/nrf51-blenano/include/bsp/bsp.h | 3 -
hw/bsp/nrf51-blenano/pkg.yml | 9 +-
.../src/arch/cortex_m0/gcc_startup_nrf51.s | 2 +-
.../arch/cortex_m0/gcc_startup_nrf51_split.s | 2 +-
hw/bsp/nrf51-blenano/src/os_bsp.c | 61 +------
hw/bsp/nrf51-blenano/syscfg.yml | 6 +
hw/bsp/nrf51dk-16kbram/bsp.yml | 58 +++++++
hw/bsp/nrf51dk-16kbram/pkg.yml | 9 +-
.../src/arch/cortex_m0/gcc_startup_nrf51.s | 2 +-
.../arch/cortex_m0/gcc_startup_nrf51_split.s | 2 +-
hw/bsp/nrf51dk-16kbram/src/os_bsp.c | 60 +------
hw/bsp/nrf51dk-16kbram/syscfg.yml | 6 +
hw/bsp/nrf51dk/bsp.yml | 58 +++++++
hw/bsp/nrf51dk/pkg.yml | 9 +-
.../src/arch/cortex_m0/gcc_startup_nrf51.s | 2 +-
.../arch/cortex_m0/gcc_startup_nrf51_split.s | 2 +-
hw/bsp/nrf51dk/src/os_bsp.c | 60 +------
hw/bsp/nrf51dk/syscfg.yml | 6 +
hw/bsp/nrf52dk/bsp.yml | 58 +++++++
hw/bsp/nrf52dk/pkg.yml | 9 +-
.../src/arch/cortex_m4/gcc_startup_nrf52.s | 2 +-
.../arch/cortex_m4/gcc_startup_nrf52_split.s | 2 +-
hw/bsp/nrf52dk/src/os_bsp.c | 72 +-------
hw/bsp/nrf52dk/syscfg.yml | 8 +-
hw/bsp/nucleo-f401re/bsp.yml | 57 ++++++
hw/bsp/nucleo-f401re/pkg.yml | 9 +-
hw/bsp/nucleo-f401re/src/os_bsp.c | 52 +-----
hw/bsp/olimex_stm32-e407_devboard/bsp.yml | 57 ++++++
hw/bsp/olimex_stm32-e407_devboard/pkg.yml | 9 +-
hw/bsp/olimex_stm32-e407_devboard/src/os_bsp.c | 54 +-----
hw/bsp/olimex_stm32-e407_devboard/syscfg.yml | 6 +
hw/bsp/stm32f4discovery/bsp.yml | 57 ++++++
hw/bsp/stm32f4discovery/pkg.yml | 9 +-
hw/bsp/stm32f4discovery/src/os_bsp.c | 52 +-----
hw/hal/include/hal/flash_map.h | 103 -----------
hw/hal/include/hal/hal_bsp.h | 5 -
hw/hal/src/flash_map.c | 120 -------------
hw/hal/test/pkg.yml | 30 ----
hw/hal/test/src/flash_map_test.c | 171 ------------------
libs/imgmgr/include/imgmgr/imgmgr.h | 2 +
libs/imgmgr/pkg.yml | 4 +
libs/imgmgr/src/imgmgr.c | 32 ++--
libs/imgmgr/src/imgmgr_boot.c | 2 +-
libs/imgmgr/src/imgmgr_cli.c | 6 +-
libs/imgmgr/src/imgmgr_coredump.c | 9 +-
libs/imgmgr/src/imgmgr_priv.h | 1 +
sys/config/src/config_init.c | 7 +-
sys/config/syscfg.yml | 11 +-
sys/coredump/pkg.yml | 1 +
sys/coredump/src/coredump.c | 16 +-
sys/coredump/syscfg.yml | 26 +++
sys/flash_map/include/flash_map/flash_map.h | 95 ++++++++++
sys/flash_map/pkg.yml | 33 ++++
sys/flash_map/src/flash_map.c | 159 +++++++++++++++++
sys/flash_map/test/pkg.yml | 29 ++++
sys/flash_map/test/src/flash_map_test.c | 172 +++++++++++++++++++
sys/log/pkg.yml | 1 +
sys/log/src/log_fcb.c | 4 +-
sys/log/syscfg.yml | 19 +-
sys/reboot/pkg.yml | 5 +-
sys/reboot/src/log_reboot.c | 7 +-
sys/reboot/syscfg.yml | 9 +
103 files changed, 1433 insertions(+), 1246 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/apps/bletest/src/main.c
----------------------------------------------------------------------
diff --git a/apps/bletest/src/main.c b/apps/bletest/src/main.c
index 09969cb..34f57b1 100755
--- a/apps/bletest/src/main.c
+++ b/apps/bletest/src/main.c
@@ -29,7 +29,7 @@
#include "console/console.h"
#include "shell/shell.h"
#include "stats/stats.h"
-#include "hal/flash_map.h"
+#include "flash_map/flash_map.h"
/* BLE */
#include "nimble/ble.h"
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/apps/boot/src/boot.c
----------------------------------------------------------------------
diff --git a/apps/boot/src/boot.c b/apps/boot/src/boot.c
index ce546af..ffad2d5 100755
--- a/apps/boot/src/boot.c
+++ b/apps/boot/src/boot.c
@@ -21,7 +21,7 @@
#include <stddef.h>
#include <inttypes.h>
#include "syscfg/syscfg.h"
-#include <hal/flash_map.h>
+#include <flash_map/flash_map.h>
#include <os/os.h>
#include <bsp/bsp.h>
#include <hal/hal_bsp.h>
@@ -65,12 +65,10 @@ main(void)
#if MYNEWT_VAL(BOOT_SERIAL)
sysinit();
#else
+ flash_map_init();
bsp_init();
#endif
- rc = hal_flash_init();
- assert(rc == 0);
-
rc = boot_build_request(&req, AREA_DESC_MAX);
assert(rc == 0);
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/apps/ffs2native/src/main.c
----------------------------------------------------------------------
diff --git a/apps/ffs2native/src/main.c b/apps/ffs2native/src/main.c
index a01b3b0..661e5ca 100644
--- a/apps/ffs2native/src/main.c
+++ b/apps/ffs2native/src/main.c
@@ -30,7 +30,7 @@
#include <bsp/bsp.h>
#include <nffs/nffs.h>
#include <hal/hal_flash.h>
-#include <hal/flash_map.h>
+#include <flash_map/flash_map.h>
#ifdef ARCH_sim
#include <mcu/mcu_sim.h>
#endif
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/apps/slinky/src/main.c
----------------------------------------------------------------------
diff --git a/apps/slinky/src/main.c b/apps/slinky/src/main.c
index f8b8793..1e63f3a 100755
--- a/apps/slinky/src/main.c
+++ b/apps/slinky/src/main.c
@@ -19,6 +19,7 @@
#include "syscfg/syscfg.h"
#include "sysinit/sysinit.h"
+#include "sysflash/sysflash.h"
#include <os/os.h>
#include <bsp/bsp.h>
#include <hal/hal_gpio.h>
@@ -28,7 +29,7 @@
#include <log/log.h>
#include <stats/stats.h>
#include <config/config.h>
-#include <hal/flash_map.h>
+#include "flash_map/flash_map.h"
#include <hal/hal_system.h>
#if MYNEWT_VAL(SPLIT_LOADER)
#include "split/split.h"
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/apps/splitty/src/main.c
----------------------------------------------------------------------
diff --git a/apps/splitty/src/main.c b/apps/splitty/src/main.c
index 19f01dd..02aabb1 100755
--- a/apps/splitty/src/main.c
+++ b/apps/splitty/src/main.c
@@ -26,7 +26,7 @@
#include <log/log.h>
#include <stats/stats.h>
#include <config/config.h>
-#include <hal/flash_map.h>
+#include <flash_map/flash_map.h>
#include <hal/hal_system.h>
#include <newtmgr/newtmgr.h>
#include <bootutil/image.h>
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/boot/boot_serial/pkg.yml
----------------------------------------------------------------------
diff --git a/boot/boot_serial/pkg.yml b/boot/boot_serial/pkg.yml
index 7921360..6cf45ec 100644
--- a/boot/boot_serial/pkg.yml
+++ b/boot/boot_serial/pkg.yml
@@ -30,6 +30,7 @@ pkg.deps:
- kernel/os
- boot/bootutil
- encoding/base64
+ - sys/flash_map
- util/crc
pkg.req_apis:
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/boot/boot_serial/src/boot_serial.c
----------------------------------------------------------------------
diff --git a/boot/boot_serial/src/boot_serial.c b/boot/boot_serial/src/boot_serial.c
index b07e494..ef7ffc0 100644
--- a/boot/boot_serial/src/boot_serial.c
+++ b/boot/boot_serial/src/boot_serial.c
@@ -22,9 +22,11 @@
#include <ctype.h>
#include <stdio.h>
+#include "sysflash/sysflash.h"
+
#include <bsp/bsp.h>
-#include <hal/flash_map.h>
+#include <flash_map/flash_map.h>
#include <hal/hal_flash.h>
#include <hal/hal_system.h>
@@ -89,6 +91,7 @@ bs_list(char *buf, int len)
uint8_t tmpbuf[64];
const struct flash_area *fap = NULL;
int good_img, need_comma = 0;
+ int area_id;
int rc;
int i;
@@ -97,8 +100,9 @@ bs_list(char *buf, int len)
return;
}
len = snprintf(ptr, BOOT_SERIAL_OUT_MAX, "{\"images\":[");
- for (i = FLASH_AREA_IMAGE_0; i <= FLASH_AREA_IMAGE_1; i++) {
- rc = flash_area_open(i, &fap);
+ for (i = 0; i < 2; i++) {
+ area_id = flash_area_id_from_image_slot(i);
+ rc = flash_area_open(area_id, &fap);
if (rc) {
continue;
}
@@ -106,7 +110,7 @@ bs_list(char *buf, int len)
flash_area_read(fap, 0, &hdr, sizeof(hdr));
if (hdr.ih_magic == IMAGE_MAGIC &&
- bootutil_img_validate(&hdr, fap->fa_flash_id, fap->fa_off,
+ bootutil_img_validate(&hdr, fap->fa_device_id, fap->fa_off,
tmpbuf, sizeof(tmpbuf), NULL, 0, NULL) == 0) {
good_img = 1;
} else {
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/boot/boot_serial/test/src/boot_test.c
----------------------------------------------------------------------
diff --git a/boot/boot_serial/test/src/boot_test.c b/boot/boot_serial/test/src/boot_test.c
index 669e84b..b965bcd 100644
--- a/boot/boot_serial/test/src/boot_test.c
+++ b/boot/boot_serial/test/src/boot_test.c
@@ -24,12 +24,13 @@
#include <string.h>
#include <inttypes.h>
#include "syscfg/syscfg.h"
+#include "sysflash/sysflash.h"
#include "os/endian.h"
#include "base64/base64.h"
#include "crc/crc16.h"
#include "testutil/testutil.h"
#include "hal/hal_flash.h"
-#include "hal/flash_map.h"
+#include "flash_map/flash_map.h"
#include "boot_serial_priv.h"
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/boot/bootutil/include/bootutil/bootutil_misc.h
----------------------------------------------------------------------
diff --git a/boot/bootutil/include/bootutil/bootutil_misc.h b/boot/bootutil/include/bootutil/bootutil_misc.h
index 784820e..3df048e 100644
--- a/boot/bootutil/include/bootutil/bootutil_misc.h
+++ b/boot/bootutil/include/bootutil/bootutil_misc.h
@@ -29,6 +29,8 @@ int boot_vect_read_main(int *slot);
int boot_vect_write_test(int slot);
int boot_vect_write_main(void);
+void boot_set_image_slot_split(void);
+
#ifdef __cplusplus
}
#endif
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/boot/bootutil/pkg.yml
----------------------------------------------------------------------
diff --git a/boot/bootutil/pkg.yml b/boot/bootutil/pkg.yml
index b35633c..060898e 100644
--- a/boot/bootutil/pkg.yml
+++ b/boot/bootutil/pkg.yml
@@ -29,3 +29,4 @@ pkg.deps:
- hw/hal
- crypto/mbedtls
- kernel/os
+ - sys/flash_map
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/boot/bootutil/src/bootutil_misc.c
----------------------------------------------------------------------
diff --git a/boot/bootutil/src/bootutil_misc.c b/boot/bootutil/src/bootutil_misc.c
index f64d2a4..4483379 100644
--- a/boot/bootutil/src/bootutil_misc.c
+++ b/boot/bootutil/src/bootutil_misc.c
@@ -22,15 +22,18 @@
#include <inttypes.h>
#include "syscfg/syscfg.h"
+#include "sysflash/sysflash.h"
#include "hal/hal_bsp.h"
#include "hal/hal_flash.h"
-#include "hal/flash_map.h"
+#include "flash_map/flash_map.h"
#include "os/os.h"
#include "bootutil/image.h"
#include "bootutil/loader.h"
#include "bootutil/bootutil_misc.h"
#include "bootutil_priv.h"
+int boot_current_slot;
+
/*
* Read the image trailer from a given slot.
*/
@@ -40,8 +43,10 @@ boot_vect_read_img_trailer(int slot, struct boot_img_trailer *bit)
int rc;
const struct flash_area *fap;
uint32_t off;
+ int area_id;
- rc = flash_area_open(slot, &fap);
+ area_id = flash_area_id_from_image_slot(slot);
+ rc = flash_area_open(area_id, &fap);
if (rc) {
return rc;
}
@@ -67,8 +72,8 @@ boot_vect_read_test(int *slot)
int i;
int rc;
- for (i = FLASH_AREA_IMAGE_0; i <= FLASH_AREA_IMAGE_1; i++) {
- if (i == bsp_imgr_current_slot()) {
+ for (i = 0; i < 2; i++) {
+ if (i == boot_current_slot) {
continue;
}
rc = boot_vect_read_img_trailer(i, &bit);
@@ -317,3 +322,9 @@ boot_clear_status(void)
off += sizeof(uint32_t);
hal_flash_write(flash_id, off, &val, sizeof(val));
}
+
+void
+boot_set_image_slot_split(void)
+{
+ boot_current_slot = 1;
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/boot/bootutil/src/loader.c
----------------------------------------------------------------------
diff --git a/boot/bootutil/src/loader.c b/boot/bootutil/src/loader.c
index e2d4cfa..8a8045c 100644
--- a/boot/bootutil/src/loader.c
+++ b/boot/bootutil/src/loader.c
@@ -22,7 +22,8 @@
#include <inttypes.h>
#include <stdlib.h>
#include <string.h>
-#include <hal/flash_map.h>
+#include "sysflash/sysflash.h"
+#include "flash_map/flash_map.h"
#include <hal/hal_flash.h>
#include <os/os_malloc.h>
#include "bootutil/loader.h"
@@ -72,7 +73,8 @@ boot_build_request(struct boot_req *preq, int area_descriptor_max)
return -1;
}
- rc = flash_area_to_sectors(FLASH_AREA_IMAGE_1, &cnt, &descs[total]);
+ rc = flash_area_to_sectors(FLASH_AREA_IMAGE_1, &cnt,
+ &descs[total]);
if(rc != 0) {
return -2;
}
@@ -84,7 +86,8 @@ boot_build_request(struct boot_req *preq, int area_descriptor_max)
return -3;
}
- rc = flash_area_to_sectors(FLASH_AREA_IMAGE_SCRATCH, &cnt, &descs[total]);
+ rc = flash_area_to_sectors(FLASH_AREA_IMAGE_SCRATCH, &cnt,
+ &descs[total]);
if(rc != 0) {
return -4;
}
@@ -116,7 +119,7 @@ boot_slot_addr(int slot_num, struct boot_image_location *loc)
area_idx = boot_req->br_slot_areas[slot_num];
area_desc = boot_req->br_area_descs + area_idx;
- loc->bil_flash_id = area_desc->fa_flash_id;
+ loc->bil_flash_id = area_desc->fa_device_id;
loc->bil_address = area_desc->fa_off;
}
@@ -152,7 +155,7 @@ boot_scratch_loc(uint8_t *flash_id, uint32_t *off)
int cnt;
scratch = &boot_req->br_area_descs[boot_req->br_scratch_area_idx];
- *flash_id = scratch->fa_flash_id;
+ *flash_id = scratch->fa_device_id;
/*
* Calculate where the boot status would be, if it was copied to scratch.
@@ -209,7 +212,7 @@ boot_image_info(void)
boot_state.elem_sz = hal_flash_align(boot_img[0].loc.bil_flash_id);
scratch = &boot_req->br_area_descs[boot_req->br_scratch_area_idx];
- i = hal_flash_align(scratch->fa_flash_id);
+ i = hal_flash_align(scratch->fa_device_id);
if (i > boot_state.elem_sz) {
boot_state.elem_sz = i;
}
@@ -243,8 +246,10 @@ boot_image_check(struct image_header *hdr, struct boot_image_location *loc)
static int
-split_image_check(struct image_header *app_hdr, struct boot_image_location *app_loc,
- struct image_header *loader_hdr, struct boot_image_location *loader_loc)
+split_image_check(struct image_header *app_hdr,
+ struct boot_image_location *app_loc,
+ struct image_header *loader_hdr,
+ struct boot_image_location *loader_loc)
{
static void *tmpbuf;
uint8_t loader_hash[32];
@@ -255,12 +260,15 @@ split_image_check(struct image_header *app_hdr, struct boot_image_location *app_
return BOOT_ENOMEM;
}
}
- if (bootutil_img_validate(loader_hdr, loader_loc->bil_flash_id, loader_loc->bil_address,
- tmpbuf, BOOT_TMPBUF_SZ, NULL, 0, loader_hash)) {
+ if (bootutil_img_validate(loader_hdr, loader_loc->bil_flash_id,
+ loader_loc->bil_address, tmpbuf, BOOT_TMPBUF_SZ,
+ NULL, 0, loader_hash)) {
+
return BOOT_EBADIMAGE;
}
- if (bootutil_img_validate(app_hdr, app_loc->bil_flash_id, app_loc->bil_address,
+ if (bootutil_img_validate(app_hdr, app_loc->bil_flash_id,
+ app_loc->bil_address,
tmpbuf, BOOT_TMPBUF_SZ, loader_hash, 32, NULL)) {
return BOOT_EBADIMAGE;
}
@@ -370,7 +378,7 @@ boot_erase_area(int area_idx, uint32_t sz)
int rc;
area_desc = boot_req->br_area_descs + area_idx;
- rc = hal_flash_erase(area_desc->fa_flash_id, area_desc->fa_off, sz);
+ rc = hal_flash_erase(area_desc->fa_device_id, area_desc->fa_off, sz);
if (rc != 0) {
return BOOT_EFLASH;
}
@@ -414,14 +422,14 @@ boot_copy_area(int from_area_idx, int to_area_idx, uint32_t sz)
}
from_addr = from_area_desc->fa_off + off;
- rc = hal_flash_read(from_area_desc->fa_flash_id, from_addr, buf,
+ rc = hal_flash_read(from_area_desc->fa_device_id, from_addr, buf,
chunk_sz);
if (rc != 0) {
return rc;
}
to_addr = to_area_desc->fa_off + off;
- rc = hal_flash_write(to_area_desc->fa_flash_id, to_addr, buf,
+ rc = hal_flash_write(to_area_desc->fa_device_id, to_addr, buf,
chunk_sz);
if (rc != 0) {
return rc;
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/boot/bootutil/test/src/boot_test.c
----------------------------------------------------------------------
diff --git a/boot/bootutil/test/src/boot_test.c b/boot/bootutil/test/src/boot_test.c
index 10cd045..a04635b 100644
--- a/boot/bootutil/test/src/boot_test.c
+++ b/boot/bootutil/test/src/boot_test.c
@@ -26,7 +26,7 @@
#include "syscfg/syscfg.h"
#include "testutil/testutil.h"
#include "hal/hal_flash.h"
-#include "hal/flash_map.h"
+#include "flash_map/flash_map.h"
#include "bootutil/image.h"
#include "bootutil/loader.h"
#include "bootutil/bootutil_misc.h"
@@ -276,7 +276,7 @@ boot_test_util_verify_area(const struct flash_area *area_desc,
img_size = hdr->ih_img_size;
if (addr == image_addr) {
- rc = hal_flash_read(area_desc->fa_flash_id, image_addr,
+ rc = hal_flash_read(area_desc->fa_device_id, image_addr,
&temp_hdr, sizeof temp_hdr);
TEST_ASSERT(rc == 0);
TEST_ASSERT(memcmp(&temp_hdr, hdr, sizeof *hdr) == 0);
@@ -307,7 +307,7 @@ boot_test_util_verify_area(const struct flash_area *area_desc,
chunk_sz = rem_area;
}
- rc = hal_flash_read(area_desc->fa_flash_id, addr, buf, chunk_sz);
+ rc = hal_flash_read(area_desc->fa_device_id, addr, buf, chunk_sz);
TEST_ASSERT(rc == 0);
for (i = 0; i < chunk_sz; i++) {
@@ -354,7 +354,7 @@ boot_test_util_verify_flash(const struct image_header *hdr0, int orig_slot_0,
while (1) {
area_desc = boot_test_area_descs + area_idx;
if (area_desc->fa_off == boot_test_img_addrs[1].address &&
- area_desc->fa_flash_id == boot_test_img_addrs[1].flash_id) {
+ area_desc->fa_device_id == boot_test_img_addrs[1].flash_id) {
break;
}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/boot/split/src/split.c
----------------------------------------------------------------------
diff --git a/boot/split/src/split.c b/boot/split/src/split.c
index 548f7ca..8b91256 100644
--- a/boot/split/src/split.c
+++ b/boot/split/src/split.c
@@ -18,11 +18,12 @@
*/
#include <assert.h>
-#include <bootutil/bootutil_misc.h>
-#include <bootutil/image.h>
-#include <bootutil/loader.h>
-#include <split/split.h>
-#include <split/split_priv.h>
+#include "bootutil/bootutil_misc.h"
+#include "bootutil/image.h"
+#include "bootutil/loader.h"
+#include "imgmgr/imgmgr.h"
+#include "split/split.h"
+#include "split/split_priv.h"
#define LOADER_IMAGE_SLOT 0
#define SPLIT_IMAGE_SLOT 1
@@ -92,4 +93,3 @@ split_app_go(void **entry, int toboot)
return (rc);
}
-
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/fs/fcb/include/fcb/fcb.h
----------------------------------------------------------------------
diff --git a/fs/fcb/include/fcb/fcb.h b/fs/fcb/include/fcb/fcb.h
index 2632f4a..69f14a7 100644
--- a/fs/fcb/include/fcb/fcb.h
+++ b/fs/fcb/include/fcb/fcb.h
@@ -29,9 +29,9 @@ extern "C" {
#include <inttypes.h>
#include <limits.h>
-#include <hal/flash_map.h>
+#include "flash_map/flash_map.h"
-#include <os/os_mutex.h>
+#include "os/os_mutex.h"
#define FCB_MAX_LEN (CHAR_MAX | CHAR_MAX << 7) /* Max length of element */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/fs/fcb/pkg.yml
----------------------------------------------------------------------
diff --git a/fs/fcb/pkg.yml b/fs/fcb/pkg.yml
index daa5557..8e7ab48 100644
--- a/fs/fcb/pkg.yml
+++ b/fs/fcb/pkg.yml
@@ -27,3 +27,4 @@ pkg.keywords:
pkg.deps:
- kernel/os
- util/crc
+ - sys/flash_map
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/fs/fcb/test/src/fcb_test.c
----------------------------------------------------------------------
diff --git a/fs/fcb/test/src/fcb_test.c b/fs/fcb/test/src/fcb_test.c
index b172eb0..47df15c 100644
--- a/fs/fcb/test/src/fcb_test.c
+++ b/fs/fcb/test/src/fcb_test.c
@@ -31,22 +31,22 @@ static struct fcb test_fcb;
static struct flash_area test_fcb_area[] = {
[0] = {
- .fa_flash_id = 0,
+ .fa_device_id = 0,
.fa_off = 0,
.fa_size = 0x4000, /* 16K */
},
[1] = {
- .fa_flash_id = 0,
+ .fa_device_id = 0,
.fa_off = 0x4000,
.fa_size = 0x4000
},
[2] = {
- .fa_flash_id = 0,
+ .fa_device_id = 0,
.fa_off = 0x8000,
.fa_size = 0x4000
},
[3] = {
- .fa_flash_id = 0,
+ .fa_device_id = 0,
.fa_off = 0xc000,
.fa_size = 0x4000
}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/fs/nffs/pkg.yml
----------------------------------------------------------------------
diff --git a/fs/nffs/pkg.yml b/fs/nffs/pkg.yml
index 0719b6f..6010aae 100644
--- a/fs/nffs/pkg.yml
+++ b/fs/nffs/pkg.yml
@@ -32,6 +32,7 @@ pkg.deps:
- hw/hal
- kernel/os
- test/testutil
+ - sys/flash_map
- sys/log
- sys/stats
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/fs/nffs/src/nffs.c
----------------------------------------------------------------------
diff --git a/fs/nffs/src/nffs.c b/fs/nffs/src/nffs.c
index 23cccaf..eda1c62 100644
--- a/fs/nffs/src/nffs.c
+++ b/fs/nffs/src/nffs.c
@@ -23,9 +23,10 @@
#include <assert.h>
#include "sysinit/sysinit.h"
+#include "sysflash/sysflash.h"
#include "bsp/bsp.h"
#include "hal/hal_flash.h"
-#include "hal/flash_map.h"
+#include "flash_map/flash_map.h"
#include "os/os_mempool.h"
#include "os/os_mutex.h"
#include "os/os_malloc.h"
@@ -754,7 +755,8 @@ nffs_pkg_init(void)
* of nffs area descriptors.
*/
cnt = NFFS_AREA_MAX;
- rc = nffs_misc_desc_from_flash_area(FLASH_AREA_NFFS, &cnt, descs);
+ rc = nffs_misc_desc_from_flash_area(
+ MYNEWT_VAL(NFFS_FLASH_AREA), &cnt, descs);
SYSINIT_PANIC_ASSERT(rc == 0);
/* Attempt to restore an existing nffs file system from flash. */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/fs/nffs/src/nffs_misc.c
----------------------------------------------------------------------
diff --git a/fs/nffs/src/nffs_misc.c b/fs/nffs/src/nffs_misc.c
index 4410b73..09fbc12 100644
--- a/fs/nffs/src/nffs_misc.c
+++ b/fs/nffs/src/nffs_misc.c
@@ -18,7 +18,7 @@
*/
#include <assert.h>
-#include "hal/flash_map.h"
+#include "flash_map/flash_map.h"
#include "hal/hal_bsp.h"
#include "hal/hal_flash_int.h"
#include "os/os_malloc.h"
@@ -470,7 +470,7 @@ nffs_misc_desc_from_flash_area(int idx, int *cnt, struct nffs_area_desc *nad)
fa = &flash_map[idx];
- hf = bsp_flash_dev(fa->fa_flash_id);
+ hf = bsp_flash_dev(fa->fa_device_id);
for (i = 0; i < hf->hf_sector_cnt; i++) {
hf->hf_itf->hff_sector_info(i, &start, &size);
if (start >= fa->fa_off && start < fa->fa_off + fa->fa_size) {
@@ -492,7 +492,7 @@ nffs_misc_desc_from_flash_area(int idx, int *cnt, struct nffs_area_desc *nad)
for (i = first_idx, j = 0; i < last_idx + 1; i++) {
hf->hf_itf->hff_sector_info(i, &start, &size);
if (move_on) {
- nad[j].nad_flash_id = fa->fa_flash_id;
+ nad[j].nad_flash_id = fa->fa_device_id;
nad[j].nad_offset = start;
nad[j].nad_length = size;
*cnt = *cnt + 1;
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/fs/nffs/syscfg.yml
----------------------------------------------------------------------
diff --git a/fs/nffs/syscfg.yml b/fs/nffs/syscfg.yml
index a7c9629..657ab0c 100644
--- a/fs/nffs/syscfg.yml
+++ b/fs/nffs/syscfg.yml
@@ -1,6 +1,12 @@
# Package: fs/nffs
syscfg.defs:
+ NFFS_FLASH_AREA:
+ description: 'TBD'
+ type: flash_owner
+ value:
+ restrictions:
+ - $notnull
NFFS_DETECT_FAIL:
description: 'TBD'
value: 'NFFS_DETECT_FAIL_FORMAT'
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/hw/bsp/arduino_primo_nrf52/bsp.yml
----------------------------------------------------------------------
diff --git a/hw/bsp/arduino_primo_nrf52/bsp.yml b/hw/bsp/arduino_primo_nrf52/bsp.yml
new file mode 100644
index 0000000..79cc731
--- /dev/null
+++ b/hw/bsp/arduino_primo_nrf52/bsp.yml
@@ -0,0 +1,58 @@
+#
+# 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.
+#
+
+bsp.arch: cortex_m4
+bsp.compiler: compiler/arm-none-eabi-m4
+bsp.linkerscript: "primo.ld"
+bsp.linkerscript.BOOT_LOADER.OVERWRITE: "boot-primo.ld"
+bsp.part2linkerscript: "split-primo.ld"
+bsp.downloadscript: primo_download.sh
+bsp.debugscript: primo_debug.sh
+
+bsp.flash_map:
+ areas:
+ # System areas.
+ FLASH_AREA_BOOTLOADER:
+ device: 0
+ offset: 0x00000000
+ size: 16kB
+ FLASH_AREA_IMAGE_0:
+ device: 0
+ offset: 0x00008000
+ size: 232kB
+ FLASH_AREA_IMAGE_1:
+ device: 0
+ offset: 0x00042000
+ size: 232kB
+ FLASH_AREA_IMAGE_SCRATCH:
+ device: 0
+ offset: 0x0007c000
+ size: 4kB
+
+ # User areas.
+ FLASH_AREA_REBOOT_LOG:
+ user_id: 0
+ device: 0
+ offset: 0x00004000
+ size: 16kB
+ FLASH_AREA_NFFS:
+ user_id: 1
+ device: 0
+ offset: 0x0007d000
+ size: 12kB
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/hw/bsp/arduino_primo_nrf52/pkg.yml
----------------------------------------------------------------------
diff --git a/hw/bsp/arduino_primo_nrf52/pkg.yml b/hw/bsp/arduino_primo_nrf52/pkg.yml
index 8aa8a0e..4b6d5dc 100644
--- a/hw/bsp/arduino_primo_nrf52/pkg.yml
+++ b/hw/bsp/arduino_primo_nrf52/pkg.yml
@@ -27,21 +27,16 @@ pkg.keywords:
- arduino
- primo
-pkg.arch: cortex_m4
-pkg.compiler: compiler/arm-none-eabi-m4
-pkg.linkerscript: "primo.ld"
-pkg.linkerscript.BOOT_LOADER.OVERWRITE: "boot-primo.ld"
-pkg.part2linkerscript: "split-primo.ld"
-pkg.downloadscript: primo_download.sh
-pkg.debugscript: primo_debug.sh
pkg.cflags:
# Nordic SDK files require these defines.
- '-DNRF52'
- '-DSPI_MASTER_0_ENABLE'
pkg.deps:
+ - boot/bootutil
- hw/mcu/nordic/nrf52xxx
- libc/baselibc
+ - sys/flash_map
pkg.deps.BLE_DEVICE:
- hw/drivers/nimble/nrf52
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/hw/bsp/arduino_primo_nrf52/src/arch/cortex_m4/gcc_startup_nrf52.s
----------------------------------------------------------------------
diff --git a/hw/bsp/arduino_primo_nrf52/src/arch/cortex_m4/gcc_startup_nrf52.s b/hw/bsp/arduino_primo_nrf52/src/arch/cortex_m4/gcc_startup_nrf52.s
index de2a2fa..54b76ad 100755
--- a/hw/bsp/arduino_primo_nrf52/src/arch/cortex_m4/gcc_startup_nrf52.s
+++ b/hw/bsp/arduino_primo_nrf52/src/arch/cortex_m4/gcc_startup_nrf52.s
@@ -141,7 +141,7 @@ Reset_Handler:
/* This is called but current_slot is in the data section so it is
* overwritten. its only called here to ensure that the global and this
* function are linked into the loader */
- BL bsp_slot_init_split_application
+ BL boot_set_image_slot_split
/* Loop to copy data from read only memory to RAM. The ranges
* of copy from/to are specified by following symbols evaluated in
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/hw/bsp/arduino_primo_nrf52/src/arch/cortex_m4/gcc_startup_nrf52_split.s
----------------------------------------------------------------------
diff --git a/hw/bsp/arduino_primo_nrf52/src/arch/cortex_m4/gcc_startup_nrf52_split.s b/hw/bsp/arduino_primo_nrf52/src/arch/cortex_m4/gcc_startup_nrf52_split.s
index 43b4753..26bb3a8 100755
--- a/hw/bsp/arduino_primo_nrf52/src/arch/cortex_m4/gcc_startup_nrf52_split.s
+++ b/hw/bsp/arduino_primo_nrf52/src/arch/cortex_m4/gcc_startup_nrf52_split.s
@@ -136,7 +136,7 @@ Reset_Handler_split:
LDR R1, =__HeapLimit
BL _sbrkInit
- BL bsp_slot_init_split_application
+ BL boot_set_image_slot_split
LDR R0, =SystemInit
BLX R0
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/hw/bsp/arduino_primo_nrf52/src/os_bsp.c
----------------------------------------------------------------------
diff --git a/hw/bsp/arduino_primo_nrf52/src/os_bsp.c b/hw/bsp/arduino_primo_nrf52/src/os_bsp.c
index abd5a9e..1cd0f1e 100644
--- a/hw/bsp/arduino_primo_nrf52/src/os_bsp.c
+++ b/hw/bsp/arduino_primo_nrf52/src/os_bsp.c
@@ -20,7 +20,7 @@
#include <assert.h>
#include "syscfg/syscfg.h"
-#include "hal/flash_map.h"
+#include "flash_map/flash_map.h"
#include "hal/hal_bsp.h"
#include "hal/hal_cputime.h"
#include "hal/hal_flash.h"
@@ -50,34 +50,6 @@
#include "adc_nrf52/adc_nrf52.h"
#endif
-static struct flash_area bsp_flash_areas[] = {
- [FLASH_AREA_BOOTLOADER] = {
- .fa_flash_id = 0, /* internal flash */
- .fa_off = 0x00000000, /* beginning */
- .fa_size = (32 * 1024)
- },
- /* 2*16K and 1*64K sectors here */
- [FLASH_AREA_IMAGE_0] = {
- .fa_flash_id = 0,
- .fa_off = 0x00008000,
- .fa_size = (232 * 1024)
- },
- [FLASH_AREA_IMAGE_1] = {
- .fa_flash_id = 0,
- .fa_off = 0x00042000,
- .fa_size = (232 * 1024)
- },
- [FLASH_AREA_IMAGE_SCRATCH] = {
- .fa_flash_id = 0,
- .fa_off = 0x0007c000,
- .fa_size = (4 * 1024)
- },
- [FLASH_AREA_NFFS] = {
- .fa_flash_id = 0,
- .fa_off = 0x0007d000,
- .fa_size = (12 * 1024)
- }
-};
#if MYNEWT_VAL(UART_0)
static struct uart_dev os_bsp_uart0;
@@ -107,30 +79,6 @@ static nrf_drv_saadc_config_t os_bsp_adc0_config = {
};
#endif
-/*
- * Returns the flash map slot where the currently active image is located.
- * If executing from internal flash from fixed location, that slot would
- * be easy to find.
- * If images are in external flash, and copied to RAM for execution, then
- * this routine would have to figure out which one of those slots is being
- * used.
- */
-
-/* extern this so compiler knows its global */
-extern int current_image_slot;
-
-int current_image_slot = 1;
-
-int
-bsp_imgr_current_slot(void)
-{
- return current_image_slot;
-}
-
-void bsp_slot_init_split_application(void) {
- current_image_slot = FLASH_AREA_IMAGE_1;
-}
-
void
bsp_init(void)
{
@@ -143,21 +91,10 @@ bsp_init(void)
nrf_drv_spis_config_t spi_cfg = NRF_DRV_SPIS_DEFAULT_CONFIG(0);
#endif
- /*
- * XXX this reference is here to keep this function in.
- */
- (void)_sbrk;
-
/* Set cputime to count at 1 usec increments */
rc = cputime_init(MYNEWT_VAL(CLOCK_FREQ));
assert(rc == 0);
- flash_area_init(bsp_flash_areas,
- sizeof(bsp_flash_areas) / sizeof(bsp_flash_areas[0]));
-
- rc = hal_flash_init();
- assert(rc == 0);
-
#if MYNEWT_VAL(SPI_MASTER)
rc = hal_spi_init(0, &spi_cfg, HAL_SPI_TYPE_MASTER);
assert(rc == 0);
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/hw/bsp/arduino_primo_nrf52/syscfg.yml
----------------------------------------------------------------------
diff --git a/hw/bsp/arduino_primo_nrf52/syscfg.yml b/hw/bsp/arduino_primo_nrf52/syscfg.yml
index fd5585f..e6faa8d 100644
--- a/hw/bsp/arduino_primo_nrf52/syscfg.yml
+++ b/hw/bsp/arduino_primo_nrf52/syscfg.yml
@@ -95,3 +95,9 @@ syscfg.defs:
TIMER_4_INTERRUPT_PRIORITY:
description: 'TBD'
value: '((1 << __NVIC_PRIO_BITS) - 1)'
+
+syscfg.vals:
+ CONFIG_FCB_FLASH_AREA: FLASH_AREA_NFFS
+ REBOOT_LOG_FLASH_AREA: FLASH_AREA_REBOOT_LOG
+ NFFS_FLASH_AREA: FLASH_AREA_REBOOT_LOG
+ COREDUMP_FLASH_AREA: FLASH_AREA_IMAGE_1
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/hw/bsp/bmd300eval/bsp.yml
----------------------------------------------------------------------
diff --git a/hw/bsp/bmd300eval/bsp.yml b/hw/bsp/bmd300eval/bsp.yml
new file mode 100644
index 0000000..c01e1ec
--- /dev/null
+++ b/hw/bsp/bmd300eval/bsp.yml
@@ -0,0 +1,58 @@
+#
+# 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.
+#
+
+bsp.arch: cortex_m4
+bsp.compiler: compiler/arm-none-eabi-m4
+bsp.linkerscript: "bmd300eval.ld"
+bsp.linkerscript.BOOT_LOADER.OVERWRITE: "boot-bmd300eval.ld"
+bsp.part2linkerscript: "split-bmd300eval.ld"
+bsp.downloadscript: bmd300eval_download.sh
+bsp.debugscript: bmd300eval_debug.sh
+
+bsp.flash_map:
+ areas:
+ # System areas.
+ FLASH_AREA_BOOTLOADER:
+ device: 0
+ offset: 0x00000000
+ size: 16kB
+ FLASH_AREA_IMAGE_0:
+ device: 0
+ offset: 0x00008000
+ size: 232kB
+ FLASH_AREA_IMAGE_1:
+ device: 0
+ offset: 0x00042000
+ size: 232kB
+ FLASH_AREA_IMAGE_SCRATCH:
+ device: 0
+ offset: 0x0007c000
+ size: 4kB
+
+ # User areas.
+ FLASH_AREA_REBOOT_LOG:
+ user_id: 0
+ device: 0
+ offset: 0x00004000
+ size: 16kB
+ FLASH_AREA_NFFS:
+ user_id: 1
+ device: 0
+ offset: 0x0007d000
+ size: 12kB
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/hw/bsp/bmd300eval/pkg.yml
----------------------------------------------------------------------
diff --git a/hw/bsp/bmd300eval/pkg.yml b/hw/bsp/bmd300eval/pkg.yml
index 8e37b1a..a62b5ff 100644
--- a/hw/bsp/bmd300eval/pkg.yml
+++ b/hw/bsp/bmd300eval/pkg.yml
@@ -26,21 +26,16 @@ pkg.keywords:
- nrf52
- bmd300eval
-pkg.arch: cortex_m4
-pkg.compiler: compiler/arm-none-eabi-m4
-pkg.linkerscript: "bmd300eval.ld"
-pkg.linkerscript.BOOT_LOADER.OVERWRITE: "boot-bmd300eval.ld"
-pkg.part2linkerscript: "split-bmd300eval.ld"
-pkg.downloadscript: bmd300eval_download.sh
-pkg.debugscript: bmd300eval_debug.sh
pkg.cflags:
# Nordic SDK files require these defines.
- '-DNRF52'
- '-DSPI_MASTER_0_ENABLE'
pkg.deps:
+ - boot/bootutil
- hw/mcu/nordic/nrf52xxx
- libc/baselibc
+ - sys/flash_map
pkg.deps.BLE_DEVICE:
- hw/drivers/nimble/nrf52
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/hw/bsp/bmd300eval/src/arch/cortex_m4/gcc_startup_nrf52.s
----------------------------------------------------------------------
diff --git a/hw/bsp/bmd300eval/src/arch/cortex_m4/gcc_startup_nrf52.s b/hw/bsp/bmd300eval/src/arch/cortex_m4/gcc_startup_nrf52.s
index 8c667f9..d37a701 100755
--- a/hw/bsp/bmd300eval/src/arch/cortex_m4/gcc_startup_nrf52.s
+++ b/hw/bsp/bmd300eval/src/arch/cortex_m4/gcc_startup_nrf52.s
@@ -141,7 +141,7 @@ Reset_Handler:
/* This is called but current_slot is in the data section so it is
* overwritten. its only called here to ensure that the global and this
* function are linked into the loader */
- BL bsp_slot_init_split_application
+ BL boot_set_image_slot_split
/* Loop to copy data from read only memory to RAM. The ranges
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/hw/bsp/bmd300eval/src/arch/cortex_m4/gcc_startup_nrf52_split.s
----------------------------------------------------------------------
diff --git a/hw/bsp/bmd300eval/src/arch/cortex_m4/gcc_startup_nrf52_split.s b/hw/bsp/bmd300eval/src/arch/cortex_m4/gcc_startup_nrf52_split.s
index 43b4753..26bb3a8 100755
--- a/hw/bsp/bmd300eval/src/arch/cortex_m4/gcc_startup_nrf52_split.s
+++ b/hw/bsp/bmd300eval/src/arch/cortex_m4/gcc_startup_nrf52_split.s
@@ -136,7 +136,7 @@ Reset_Handler_split:
LDR R1, =__HeapLimit
BL _sbrkInit
- BL bsp_slot_init_split_application
+ BL boot_set_image_slot_split
LDR R0, =SystemInit
BLX R0
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/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 a3d12eb..a72baff 100644
--- a/hw/bsp/bmd300eval/src/os_bsp.c
+++ b/hw/bsp/bmd300eval/src/os_bsp.c
@@ -20,7 +20,7 @@
#include <assert.h>
#include "syscfg/syscfg.h"
-#include "hal/flash_map.h"
+#include "flash_map/flash_map.h"
#include "hal/hal_bsp.h"
#include "hal/hal_cputime.h"
#include "hal/hal_flash.h"
@@ -47,34 +47,6 @@
#include "adc_nrf52/adc_nrf52.h"
#endif
-static struct flash_area bsp_flash_areas[] = {
- [FLASH_AREA_BOOTLOADER] = {
- .fa_flash_id = 0, /* internal flash */
- .fa_off = 0x00000000, /* beginning */
- .fa_size = (32 * 1024)
- },
- /* 2*16K and 1*64K sectors here */
- [FLASH_AREA_IMAGE_0] = {
- .fa_flash_id = 0,
- .fa_off = 0x00008000,
- .fa_size = (232 * 1024)
- },
- [FLASH_AREA_IMAGE_1] = {
- .fa_flash_id = 0,
- .fa_off = 0x00042000,
- .fa_size = (232 * 1024)
- },
- [FLASH_AREA_IMAGE_SCRATCH] = {
- .fa_flash_id = 0,
- .fa_off = 0x0007c000,
- .fa_size = (4 * 1024)
- },
- [FLASH_AREA_NFFS] = {
- .fa_flash_id = 0,
- .fa_off = 0x0007d000,
- .fa_size = (12 * 1024)
- }
-};
#if MYNEWT_VAL(UART_0)
static struct uart_dev os_bsp_uart0;
@@ -104,30 +76,6 @@ static nrf_drv_saadc_config_t os_bsp_adc0_config = {
};
#endif
-/*
- * Returns the flash map slot where the currently active image is located.
- * If executing from internal flash from fixed location, that slot would
- * be easy to find.
- * If images are in external flash, and copied to RAM for execution, then
- * this routine would have to figure out which one of those slots is being
- * used.
- */
-
-/* extern this so compiler knows its global */
-extern int current_image_slot;
-
-int current_image_slot = 1;
-
-int
-bsp_imgr_current_slot(void)
-{
- return current_image_slot;
-}
-
-void bsp_slot_init_split_application(void) {
- current_image_slot = FLASH_AREA_IMAGE_1;
-}
-
void
bsp_init(void)
{
@@ -140,21 +88,10 @@ bsp_init(void)
nrf_drv_spis_config_t spi_cfg = NRF_DRV_SPIS_DEFAULT_CONFIG(0);
#endif
- /*
- * XXX this reference is here to keep this function in.
- */
- (void)_sbrk;
-
/* Set cputime to count at 1 usec increments */
rc = cputime_init(MYNEWT_VAL(CLOCK_FREQ));
assert(rc == 0);
- flash_area_init(bsp_flash_areas,
- sizeof(bsp_flash_areas) / sizeof(bsp_flash_areas[0]));
-
- rc = hal_flash_init();
- assert(rc == 0);
-
#if MYNEWT_VAL(SPI_MASTER)
rc = hal_spi_init(0, &spi_cfg, HAL_SPI_TYPE_MASTER);
assert(rc == 0);
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/hw/bsp/bmd300eval/syscfg.yml
----------------------------------------------------------------------
diff --git a/hw/bsp/bmd300eval/syscfg.yml b/hw/bsp/bmd300eval/syscfg.yml
index 7ff692e..5fa72b4 100644
--- a/hw/bsp/bmd300eval/syscfg.yml
+++ b/hw/bsp/bmd300eval/syscfg.yml
@@ -83,3 +83,9 @@ syscfg.defs:
TIMER_4_INTERRUPT_PRIORITY:
description: 'TBD'
value: '((1 << __NVIC_PRIO_BITS) - 1)'
+
+syscfg.vals:
+ CONFIG_FCB_FLASH_AREA: FLASH_AREA_NFFS
+ REBOOT_LOG_FLASH_AREA: FLASH_AREA_REBOOT_LOG
+ NFFS_FLASH_AREA: FLASH_AREA_REBOOT_LOG
+ COREDUMP_FLASH_AREA: FLASH_AREA_IMAGE_1
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/hw/bsp/native/bsp.yml
----------------------------------------------------------------------
diff --git a/hw/bsp/native/bsp.yml b/hw/bsp/native/bsp.yml
new file mode 100644
index 0000000..30ca687
--- /dev/null
+++ b/hw/bsp/native/bsp.yml
@@ -0,0 +1,54 @@
+#
+# 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.
+#
+
+bsp.arch: sim
+bsp.compiler: compiler/sim
+bsp.debugscript: "native_debug.sh"
+
+bsp.flash_map:
+ areas:
+ # System areas.
+ FLASH_AREA_BOOTLOADER:
+ device: 0
+ offset: 0x00000000
+ size: 16kB
+ FLASH_AREA_IMAGE_0:
+ device: 0
+ offset: 0x00020000
+ size: 384kB
+ FLASH_AREA_IMAGE_1:
+ device: 0
+ offset: 0x00080000
+ size: 384kB
+ FLASH_AREA_IMAGE_SCRATCH:
+ device: 0
+ offset: 0x000e0000
+ size: 128kB
+
+ # User areas.
+ FLASH_AREA_REBOOT_LOG:
+ user_id: 0
+ device: 0
+ offset: 0x00004000
+ size: 16kB
+ FLASH_AREA_NFFS:
+ user_id: 1
+ device: 0
+ offset: 0x00008000
+ size: 32kB
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/hw/bsp/native/pkg.yml
----------------------------------------------------------------------
diff --git a/hw/bsp/native/pkg.yml b/hw/bsp/native/pkg.yml
index fad2eea..471610f 100644
--- a/hw/bsp/native/pkg.yml
+++ b/hw/bsp/native/pkg.yml
@@ -25,13 +25,12 @@ pkg.homepage: "http://mynewt.apache.org/"
pkg.keywords:
- native
- bsp
-pkg.debugscript: "native_debug.sh"
-pkg.arch: sim
-pkg.compiler: compiler/sim
pkg.deps:
+ - boot/bootutil
- hw/mcu/native
- hw/drivers/uart/uart_hal
+ - sys/flash_map
pkg.deps.BLE_DEVICE:
- hw/drivers/nimble/native
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/hw/bsp/native/src/os_bsp.c
----------------------------------------------------------------------
diff --git a/hw/bsp/native/src/os_bsp.c b/hw/bsp/native/src/os_bsp.c
index 7f312d6..df939d9 100644
--- a/hw/bsp/native/src/os_bsp.c
+++ b/hw/bsp/native/src/os_bsp.c
@@ -18,71 +18,20 @@
*/
#include <assert.h>
-#include <os/os.h>
-#include <hal/flash_map.h>
-#include <uart/uart.h>
-#include <uart_hal/uart_hal.h>
-#include <mcu/native_bsp.h>
-
-static struct flash_area bsp_flash_areas[] = {
- [FLASH_AREA_BOOTLOADER] = {
- .fa_flash_id = 0, /* internal flash */
- .fa_off = 0x00000000, /* beginning */
- .fa_size = (16 * 1024)
- },
- /* 2 * 16K and 1*64K sectors here */
- [FLASH_AREA_IMAGE_0] = {
- .fa_flash_id = 0,
- .fa_off = 0x00020000,
- .fa_size = (384 * 1024)
- },
- [FLASH_AREA_IMAGE_1] = {
- .fa_flash_id = 0,
- .fa_off = 0x00080000,
- .fa_size = (384 * 1024)
- },
- [FLASH_AREA_IMAGE_SCRATCH] = {
- .fa_flash_id = 0,
- .fa_off = 0x000e0000,
- .fa_size = (128 * 1024)
- },
- [FLASH_AREA_NFFS] = {
- .fa_flash_id = 0,
- .fa_off = 0x00008000,
- .fa_size = (32 * 1024)
- },
- [FLASH_AREA_REBOOT_LOG] = {
- .fa_flash_id = 0,
- .fa_off = 0x00004000,
- .fa_size = (16 * 1024)
- },
-};
+#include "sysflash/sysflash.h"
+#include "os/os.h"
+#include "flash_map/flash_map.h"
+#include "uart/uart.h"
+#include "uart_hal/uart_hal.h"
+#include "mcu/native_bsp.h"
static struct uart_dev os_bsp_uart0;
-/*
- * Returns the flash map slot where the currently active image is located.
- * If executing from internal flash from fixed location, that slot would
- * be easy to find.
- * If images are in external flash, and copied to RAM for execution, then
- * this routine would have to figure out which one of those slots is being
- * used.
- */
-int
-bsp_imgr_current_slot(void)
-{
- return FLASH_AREA_IMAGE_0;
-}
-
-
void
bsp_init(void)
{
int rc;
- flash_area_init(bsp_flash_areas,
- sizeof(bsp_flash_areas) / sizeof(bsp_flash_areas[0]));
-
rc = os_dev_create((struct os_dev *) &os_bsp_uart0, "uart0",
OS_DEV_INIT_PRIMARY, 0, uart_hal_init, (void *) NULL);
assert(rc == 0);
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/hw/bsp/nrf51-arduino_101/bsp.yml
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf51-arduino_101/bsp.yml b/hw/bsp/nrf51-arduino_101/bsp.yml
new file mode 100644
index 0000000..9e587a8
--- /dev/null
+++ b/hw/bsp/nrf51-arduino_101/bsp.yml
@@ -0,0 +1,57 @@
+#
+# 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.
+#
+
+bsp.arch: cortex_m0
+bsp.compiler: compiler/arm-none-eabi-m0
+bsp.linkerscript: "nrf51-arduino_101.ld"
+bsp.linkerscript.BOOT_LOADER.OVERWRITE: "boot-nrf51-arduino_101.ld"
+bsp.downloadscript: nrf51dk-16kbram_download.sh
+bsp.debugscript: nrf51dk-16kbram_debug.sh
+
+bsp.flash_map:
+ areas:
+ # System areas.
+ FLASH_AREA_BOOTLOADER:
+ device: 0
+ offset: 0x00000000
+ size: 16kB
+ FLASH_AREA_IMAGE_0:
+ device: 0
+ offset: 0x00008000
+ size: 110kB
+ FLASH_AREA_IMAGE_1:
+ device: 0
+ offset: 0x00023800
+ size: 110kB
+ FLASH_AREA_IMAGE_SCRATCH:
+ device: 0
+ offset: 0x0003f000
+ size: 2kB
+
+ # User areas.
+ FLASH_AREA_REBOOT_LOG:
+ user_id: 0
+ device: 0
+ offset: 0x00004000
+ size: 16kB
+ FLASH_AREA_NFFS:
+ user_id: 1
+ device: 0
+ offset: 0x0003f800
+ size: 2kB
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/hw/bsp/nrf51-arduino_101/pkg.yml
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf51-arduino_101/pkg.yml b/hw/bsp/nrf51-arduino_101/pkg.yml
index 02523b9..9942659 100644
--- a/hw/bsp/nrf51-arduino_101/pkg.yml
+++ b/hw/bsp/nrf51-arduino_101/pkg.yml
@@ -26,19 +26,15 @@ pkg.keywords:
- nrf51
- nrf51dk
-pkg.arch: cortex_m0
-pkg.compiler: compiler/arm-none-eabi-m0
-pkg.linkerscript: "nrf51-arduino_101.ld"
-pkg.linkerscript.BOOT_LOADER.OVERWRITE: "boot-nrf51-arduino_101.ld"
-pkg.downloadscript: nrf51dk-16kbram_download.sh
-pkg.debugscript: nrf51dk-16kbram_debug.sh
pkg.cflags:
# Nordic SDK files require these defines.
- '-DNRF51'
pkg.deps:
+ - boot/bootutil
- hw/mcu/nordic/nrf51xxx
- libc/baselibc
+ - sys/flash_map
pkg.deps.BLE_DEVICE:
- hw/drivers/nimble/nrf51
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/hw/bsp/nrf51-arduino_101/src/os_bsp.c
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf51-arduino_101/src/os_bsp.c b/hw/bsp/nrf51-arduino_101/src/os_bsp.c
index 4fef74c..7effdd2 100644
--- a/hw/bsp/nrf51-arduino_101/src/os_bsp.c
+++ b/hw/bsp/nrf51-arduino_101/src/os_bsp.c
@@ -18,7 +18,7 @@
*/
#include <assert.h>
#include "syscfg/syscfg.h"
-#include "hal/flash_map.h"
+#include "flash_map/flash_map.h"
#include "hal/hal_flash.h"
#include "hal/hal_bsp.h"
#include "bsp/cmsis_nvic.h"
@@ -32,33 +32,6 @@
#define BSP_LOWEST_PRIO ((1 << __NVIC_PRIO_BITS) - 1)
-static struct flash_area bsp_flash_areas[] = {
- [FLASH_AREA_BOOTLOADER] = {
- .fa_flash_id = 0, /* internal flash */
- .fa_off = 0x00000000, /* beginning */
- .fa_size = (32 * 1024)
- },
- [FLASH_AREA_IMAGE_0] = {
- .fa_flash_id = 0,
- .fa_off = 0x00008000,
- .fa_size = (110 * 1024)
- },
- [FLASH_AREA_IMAGE_1] = {
- .fa_flash_id = 0,
- .fa_off = 0x00023800,
- .fa_size = (110 * 1024)
- },
- [FLASH_AREA_IMAGE_SCRATCH] = {
- .fa_flash_id = 0,
- .fa_off = 0x0003f000,
- .fa_size = (2 * 1024)
- },
- [FLASH_AREA_NFFS] = {
- .fa_flash_id = 0,
- .fa_off = 0x0003f800,
- .fa_size = (2 * 1024)
- }
-};
#if MYNEWT_VAL(UART_0)
static struct uart_dev os_bsp_uart0;
@@ -70,20 +43,6 @@ static const struct nrf51_uart_cfg os_bsp_uart0_cfg = {
};
#endif
-/*
- * Returns the flash map slot where the currently active image is located.
- * If executing from internal flash from fixed location, that slot would
- * be easy to find.
- * If images are in external flash, and copied to RAM for execution, then
- * this routine would have to figure out which one of those slots is being
- * used.
- */
-int
-bsp_imgr_current_slot(void)
-{
- return FLASH_AREA_IMAGE_0;
-}
-
void
bsp_init(void)
{
@@ -95,20 +54,9 @@ bsp_init(void)
assert(rc == 0);
#endif
- /*
- * XXX this reference is here to keep this function in.
- */
- _sbrk(0);
-
/* Set cputime to count at 1 usec increments */
rc = cputime_init(MYNEWT_VAL(CLOCK_FREQ));
assert(rc == 0);
-
- flash_area_init(bsp_flash_areas,
- sizeof(bsp_flash_areas) / sizeof(bsp_flash_areas[0]));
-
- rc = hal_flash_init();
- assert(rc == 0);
}
extern void timer_handler(void);
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/hw/bsp/nrf51-arduino_101/syscfg.yml
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf51-arduino_101/syscfg.yml b/hw/bsp/nrf51-arduino_101/syscfg.yml
index 46ac7de..9e86176 100644
--- a/hw/bsp/nrf51-arduino_101/syscfg.yml
+++ b/hw/bsp/nrf51-arduino_101/syscfg.yml
@@ -64,3 +64,9 @@ syscfg.defs:
TIMER_2_INTERRUPT_PRIORITY:
description: 'TBD'
value: '((1 << __NVIC_PRIO_BITS) - 1)'
+
+syscfg.vals:
+ CONFIG_FCB_FLASH_AREA: FLASH_AREA_NFFS
+ REBOOT_LOG_FLASH_AREA: FLASH_AREA_REBOOT_LOG
+ NFFS_FLASH_AREA: FLASH_AREA_REBOOT_LOG
+ COREDUMP_FLASH_AREA: FLASH_AREA_IMAGE_1
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/hw/bsp/nrf51-blenano/bsp.yml
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf51-blenano/bsp.yml b/hw/bsp/nrf51-blenano/bsp.yml
new file mode 100644
index 0000000..7bf5d0a
--- /dev/null
+++ b/hw/bsp/nrf51-blenano/bsp.yml
@@ -0,0 +1,58 @@
+#
+# 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.
+#
+
+bsp.arch: cortex_m0
+bsp.compiler: compiler/arm-none-eabi-m0
+bsp.linkerscript: "nrf51dk.ld"
+bsp.linkerscript.BOOT_LOADER.OVERWRITE: "boot-nrf51dk.ld"
+bsp.part2linkerscript: "split-nrf51dk.ld"
+bsp.downloadscript: nrf51dk_download.sh
+bsp.debugscript: nrf51dk_debug.sh
+
+bsp.flash_map:
+ areas:
+ # System areas.
+ FLASH_AREA_BOOTLOADER:
+ device: 0
+ offset: 0x00000000
+ size: 16kB
+ FLASH_AREA_IMAGE_0:
+ device: 0
+ offset: 0x00008000
+ size: 110kB
+ FLASH_AREA_IMAGE_1:
+ device: 0
+ offset: 0x00023800
+ size: 110kB
+ FLASH_AREA_IMAGE_SCRATCH:
+ device: 0
+ offset: 0x0003f000
+ size: 2kB
+
+ # User areas.
+ FLASH_AREA_REBOOT_LOG:
+ user_id: 0
+ device: 0
+ offset: 0x00004000
+ size: 16kB
+ FLASH_AREA_NFFS:
+ user_id: 1
+ device: 0
+ offset: 0x0003f800
+ size: 2kB
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/hw/bsp/nrf51-blenano/include/bsp/bsp.h
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf51-blenano/include/bsp/bsp.h b/hw/bsp/nrf51-blenano/include/bsp/bsp.h
index 65caf62..16a3c45 100644
--- a/hw/bsp/nrf51-blenano/include/bsp/bsp.h
+++ b/hw/bsp/nrf51-blenano/include/bsp/bsp.h
@@ -38,11 +38,8 @@ extern "C" {
#define CONSOLE_UART "uart0"
#define CONSOLE_UART_SPEED 115200
-int bsp_imgr_current_slot(void);
-
#define NFFS_AREA_MAX (8)
-
#ifdef __cplusplus
}
#endif
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/hw/bsp/nrf51-blenano/pkg.yml
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf51-blenano/pkg.yml b/hw/bsp/nrf51-blenano/pkg.yml
index a1b3ec5..a736e17 100644
--- a/hw/bsp/nrf51-blenano/pkg.yml
+++ b/hw/bsp/nrf51-blenano/pkg.yml
@@ -27,20 +27,15 @@ pkg.keywords:
- mk20
- blenano
-pkg.arch: cortex_m0
-pkg.compiler: compiler/arm-none-eabi-m0
-pkg.linkerscript: "nrf51dk.ld"
-pkg.linkerscript.BOOT_LOADER.OVERWRITE: "boot-nrf51dk.ld"
-pkg.part2linkerscript: "split-nrf51dk.ld"
-pkg.downloadscript: nrf51dk_download.sh
-pkg.debugscript: nrf51dk_debug.sh
pkg.cflags:
# Nordic SDK files require this define.
- '-DNRF51'
pkg.deps:
+ - boot/bootutil
- hw/mcu/nordic/nrf51xxx
- libc/baselibc
+ - sys/flash_map
pkg.deps.BLE_DEVICE:
- hw/drivers/nimble/nrf51
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/hw/bsp/nrf51-blenano/src/arch/cortex_m0/gcc_startup_nrf51.s
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf51-blenano/src/arch/cortex_m0/gcc_startup_nrf51.s b/hw/bsp/nrf51-blenano/src/arch/cortex_m0/gcc_startup_nrf51.s
index 0773621..4c1a09a 100755
--- a/hw/bsp/nrf51-blenano/src/arch/cortex_m0/gcc_startup_nrf51.s
+++ b/hw/bsp/nrf51-blenano/src/arch/cortex_m0/gcc_startup_nrf51.s
@@ -152,7 +152,7 @@ Reset_Handler:
/* This is called but current_slot is in the data section so it is
* overwritten. its only called here to ensure that the global and this
* function are linked into the loader */
- BL bsp_slot_init_split_application
+ BL boot_set_image_slot_split
/* Loop to copy data from read only memory to RAM. The ranges
* of copy from/to are specified by following symbols evaluated in
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/hw/bsp/nrf51-blenano/src/arch/cortex_m0/gcc_startup_nrf51_split.s
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf51-blenano/src/arch/cortex_m0/gcc_startup_nrf51_split.s b/hw/bsp/nrf51-blenano/src/arch/cortex_m0/gcc_startup_nrf51_split.s
index 545b975..88998f4 100755
--- a/hw/bsp/nrf51-blenano/src/arch/cortex_m0/gcc_startup_nrf51_split.s
+++ b/hw/bsp/nrf51-blenano/src/arch/cortex_m0/gcc_startup_nrf51_split.s
@@ -151,7 +151,7 @@ Reset_Handler_split:
LDR R1, =__HeapLimit
BL _sbrkInit
- BL bsp_slot_init_split_application
+ BL boot_set_image_slot_split
LDR R0, =SystemInit
BLX R0
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/hw/bsp/nrf51-blenano/src/os_bsp.c
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf51-blenano/src/os_bsp.c b/hw/bsp/nrf51-blenano/src/os_bsp.c
index d07be59..15d5d37 100644
--- a/hw/bsp/nrf51-blenano/src/os_bsp.c
+++ b/hw/bsp/nrf51-blenano/src/os_bsp.c
@@ -18,8 +18,7 @@
*/
#include <assert.h>
#include "syscfg/syscfg.h"
-#include "bsp.h"
-#include "hal/flash_map.h"
+#include "flash_map/flash_map.h"
#include "hal/hal_flash.h"
#include "hal/hal_bsp.h"
#include "hal/hal_spi.h"
@@ -37,33 +36,6 @@
#include "uart/uart.h"
#include "uart_hal/uart_hal.h"
-static struct flash_area bsp_flash_areas[] = {
- [FLASH_AREA_BOOTLOADER] = {
- .fa_flash_id = 0, /* internal flash */
- .fa_off = 0x00000000, /* beginning */
- .fa_size = (32 * 1024)
- },
- [FLASH_AREA_IMAGE_0] = {
- .fa_flash_id = 0,
- .fa_off = 0x00008000,
- .fa_size = (110 * 1024)
- },
- [FLASH_AREA_IMAGE_1] = {
- .fa_flash_id = 0,
- .fa_off = 0x00023800,
- .fa_size = (110 * 1024)
- },
- [FLASH_AREA_IMAGE_SCRATCH] = {
- .fa_flash_id = 0,
- .fa_off = 0x0003f000,
- .fa_size = (2 * 1024)
- },
- [FLASH_AREA_NFFS] = {
- .fa_flash_id = 0,
- .fa_off = 0x0003f800,
- .fa_size = (2 * 1024)
- }
-};
#if MYNEWT_VAL(UART_0)
static struct uart_dev os_bsp_uart0;
@@ -75,26 +47,6 @@ static const struct nrf51_uart_cfg os_bsp_uart0_cfg = {
};
#endif
-/*
- * Returns the flash map slot where the currently active image is located.
- * If executing from internal flash from fixed location, that slot would
- * be easy to find.
- * If images are in external flash, and copied to RAM for execution, then
- * this routine would have to figure out which one of those slots is being
- * used.
- */
-int current_image_slot = 1;
-
-int
-bsp_imgr_current_slot(void)
-{
- return current_image_slot;
-}
-
-void bsp_slot_init_split_application(void) {
- current_image_slot = FLASH_AREA_IMAGE_1;
-}
-
void
bsp_init(void)
{
@@ -115,21 +67,10 @@ bsp_init(void)
nrf_drv_spis_config_t spi_cfg = NRF_DRV_SPIS_DEFAULT_CONFIG(1);
#endif
- /*
- * XXX this reference is here to keep this function in.
- */
- _sbrk(0);
-
/* Set cputime to count at 1 usec increments */
rc = cputime_init(MYNEWT_VAL(CLOCK_FREQ));
assert(rc == 0);
- flash_area_init(bsp_flash_areas,
- sizeof(bsp_flash_areas) / sizeof(bsp_flash_areas[0]));
-
- rc = hal_flash_init();
- assert(rc == 0);
-
#if MYNEWT_VAL(SPI_MASTER)
rc = hal_spi_init(0, &spi_cfg, HAL_SPI_TYPE_MASTER);
assert(rc == 0);
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/hw/bsp/nrf51-blenano/syscfg.yml
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf51-blenano/syscfg.yml b/hw/bsp/nrf51-blenano/syscfg.yml
index fadd98f..71528ef 100644
--- a/hw/bsp/nrf51-blenano/syscfg.yml
+++ b/hw/bsp/nrf51-blenano/syscfg.yml
@@ -61,3 +61,9 @@ syscfg.defs:
TIMER_2_INTERRUPT_PRIORITY:
description: 'TBD'
value: '((1 << __NVIC_PRIO_BITS) - 1)'
+
+syscfg.vals:
+ CONFIG_FCB_FLASH_AREA: FLASH_AREA_NFFS
+ REBOOT_LOG_FLASH_AREA: FLASH_AREA_REBOOT_LOG
+ NFFS_FLASH_AREA: FLASH_AREA_REBOOT_LOG
+ COREDUMP_FLASH_AREA: FLASH_AREA_IMAGE_1
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/hw/bsp/nrf51dk-16kbram/bsp.yml
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf51dk-16kbram/bsp.yml b/hw/bsp/nrf51dk-16kbram/bsp.yml
new file mode 100644
index 0000000..b1615e0
--- /dev/null
+++ b/hw/bsp/nrf51dk-16kbram/bsp.yml
@@ -0,0 +1,58 @@
+#
+# 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.
+#
+
+bsp.arch: cortex_m0
+bsp.compiler: compiler/arm-none-eabi-m0
+bsp.linkerscript: "nrf51dk-16kbram.ld"
+bsp.linkerscript.BOOT_LOADER.OVERWRITE: "boot-nrf51dk-16kbram.ld"
+bsp.part2linkerscript: "split-nrf51dk-16kbram.ld"
+bsp.downloadscript: nrf51dk-16kbram_download.sh
+bsp.debugscript: nrf51dk-16kbram_debug.sh
+
+bsp.flash_map:
+ areas:
+ # System areas.
+ FLASH_AREA_BOOTLOADER:
+ device: 0
+ offset: 0x00000000
+ size: 16kB
+ FLASH_AREA_IMAGE_0:
+ device: 0
+ offset: 0x00008000
+ size: 110kB
+ FLASH_AREA_IMAGE_1:
+ device: 0
+ offset: 0x00023800
+ size: 110kB
+ FLASH_AREA_IMAGE_SCRATCH:
+ device: 0
+ offset: 0x0003f000
+ size: 2kB
+
+ # User areas.
+ FLASH_AREA_REBOOT_LOG:
+ user_id: 0
+ device: 0
+ offset: 0x00004000
+ size: 16kB
+ FLASH_AREA_NFFS:
+ user_id: 1
+ device: 0
+ offset: 0x0003f800
+ size: 2kB
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/hw/bsp/nrf51dk-16kbram/pkg.yml
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf51dk-16kbram/pkg.yml b/hw/bsp/nrf51dk-16kbram/pkg.yml
index 9b260e6..3f9a55e 100644
--- a/hw/bsp/nrf51dk-16kbram/pkg.yml
+++ b/hw/bsp/nrf51dk-16kbram/pkg.yml
@@ -26,20 +26,15 @@ pkg.keywords:
- nrf51
- nrf51dk
-pkg.arch: cortex_m0
-pkg.compiler: compiler/arm-none-eabi-m0
-pkg.linkerscript: "nrf51dk-16kbram.ld"
-pkg.linkerscript.BOOT_LOADER.OVERWRITE: "boot-nrf51dk-16kbram.ld"
-pkg.part2linkerscript: "split-nrf51dk-16kbram.ld"
-pkg.downloadscript: nrf51dk-16kbram_download.sh
-pkg.debugscript: nrf51dk-16kbram_debug.sh
pkg.cflags:
# Nordic SDK files require this define.
- '-DNRF51'
pkg.deps:
+ - boot/bootutil
- hw/mcu/nordic/nrf51xxx
- libc/baselibc
+ - sys/flash_map
pkg.deps.BLE_DEVICE:
- hw/drivers/nimble/nrf51
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/hw/bsp/nrf51dk-16kbram/src/arch/cortex_m0/gcc_startup_nrf51.s
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf51dk-16kbram/src/arch/cortex_m0/gcc_startup_nrf51.s b/hw/bsp/nrf51dk-16kbram/src/arch/cortex_m0/gcc_startup_nrf51.s
index 85086e2..aa89b81 100755
--- a/hw/bsp/nrf51dk-16kbram/src/arch/cortex_m0/gcc_startup_nrf51.s
+++ b/hw/bsp/nrf51dk-16kbram/src/arch/cortex_m0/gcc_startup_nrf51.s
@@ -152,7 +152,7 @@ Reset_Handler:
/* This is called but current_slot is in the data section so it is
* overwritten. its only called here to ensure that the global and this
* function are linked into the loader */
- BL bsp_slot_init_split_application
+ BL boot_set_image_slot_split
/* Loop to copy data from read only memory to RAM. The ranges
* of copy from/to are specified by following symbols evaluated in
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/hw/bsp/nrf51dk-16kbram/src/arch/cortex_m0/gcc_startup_nrf51_split.s
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf51dk-16kbram/src/arch/cortex_m0/gcc_startup_nrf51_split.s b/hw/bsp/nrf51dk-16kbram/src/arch/cortex_m0/gcc_startup_nrf51_split.s
index 782c206..8eac1a5 100755
--- a/hw/bsp/nrf51dk-16kbram/src/arch/cortex_m0/gcc_startup_nrf51_split.s
+++ b/hw/bsp/nrf51dk-16kbram/src/arch/cortex_m0/gcc_startup_nrf51_split.s
@@ -151,7 +151,7 @@ Reset_Handler_split:
LDR R1, =__HeapLimit
BL _sbrkInit
- BL bsp_slot_init_split_application
+ BL boot_set_image_slot_split
LDR R0, =SystemInit
BLX R0
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/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 d07be59..a1e56e4 100644
--- a/hw/bsp/nrf51dk-16kbram/src/os_bsp.c
+++ b/hw/bsp/nrf51dk-16kbram/src/os_bsp.c
@@ -19,7 +19,7 @@
#include <assert.h>
#include "syscfg/syscfg.h"
#include "bsp.h"
-#include "hal/flash_map.h"
+#include "flash_map/flash_map.h"
#include "hal/hal_flash.h"
#include "hal/hal_bsp.h"
#include "hal/hal_spi.h"
@@ -37,33 +37,6 @@
#include "uart/uart.h"
#include "uart_hal/uart_hal.h"
-static struct flash_area bsp_flash_areas[] = {
- [FLASH_AREA_BOOTLOADER] = {
- .fa_flash_id = 0, /* internal flash */
- .fa_off = 0x00000000, /* beginning */
- .fa_size = (32 * 1024)
- },
- [FLASH_AREA_IMAGE_0] = {
- .fa_flash_id = 0,
- .fa_off = 0x00008000,
- .fa_size = (110 * 1024)
- },
- [FLASH_AREA_IMAGE_1] = {
- .fa_flash_id = 0,
- .fa_off = 0x00023800,
- .fa_size = (110 * 1024)
- },
- [FLASH_AREA_IMAGE_SCRATCH] = {
- .fa_flash_id = 0,
- .fa_off = 0x0003f000,
- .fa_size = (2 * 1024)
- },
- [FLASH_AREA_NFFS] = {
- .fa_flash_id = 0,
- .fa_off = 0x0003f800,
- .fa_size = (2 * 1024)
- }
-};
#if MYNEWT_VAL(UART_0)
static struct uart_dev os_bsp_uart0;
@@ -75,26 +48,6 @@ static const struct nrf51_uart_cfg os_bsp_uart0_cfg = {
};
#endif
-/*
- * Returns the flash map slot where the currently active image is located.
- * If executing from internal flash from fixed location, that slot would
- * be easy to find.
- * If images are in external flash, and copied to RAM for execution, then
- * this routine would have to figure out which one of those slots is being
- * used.
- */
-int current_image_slot = 1;
-
-int
-bsp_imgr_current_slot(void)
-{
- return current_image_slot;
-}
-
-void bsp_slot_init_split_application(void) {
- current_image_slot = FLASH_AREA_IMAGE_1;
-}
-
void
bsp_init(void)
{
@@ -115,21 +68,10 @@ bsp_init(void)
nrf_drv_spis_config_t spi_cfg = NRF_DRV_SPIS_DEFAULT_CONFIG(1);
#endif
- /*
- * XXX this reference is here to keep this function in.
- */
- _sbrk(0);
-
/* Set cputime to count at 1 usec increments */
rc = cputime_init(MYNEWT_VAL(CLOCK_FREQ));
assert(rc == 0);
- flash_area_init(bsp_flash_areas,
- sizeof(bsp_flash_areas) / sizeof(bsp_flash_areas[0]));
-
- rc = hal_flash_init();
- assert(rc == 0);
-
#if MYNEWT_VAL(SPI_MASTER)
rc = hal_spi_init(0, &spi_cfg, HAL_SPI_TYPE_MASTER);
assert(rc == 0);
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/hw/bsp/nrf51dk-16kbram/syscfg.yml
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf51dk-16kbram/syscfg.yml b/hw/bsp/nrf51dk-16kbram/syscfg.yml
index abf0fd9..7090137 100644
--- a/hw/bsp/nrf51dk-16kbram/syscfg.yml
+++ b/hw/bsp/nrf51dk-16kbram/syscfg.yml
@@ -61,3 +61,9 @@ syscfg.defs:
TIMER_2_INTERRUPT_PRIORITY:
description: 'TBD'
value: '((1 << __NVIC_PRIO_BITS) - 1)'
+
+syscfg.vals:
+ CONFIG_FCB_FLASH_AREA: FLASH_AREA_NFFS
+ REBOOT_LOG_FLASH_AREA: FLASH_AREA_REBOOT_LOG
+ NFFS_FLASH_AREA: FLASH_AREA_REBOOT_LOG
+ COREDUMP_FLASH_AREA: FLASH_AREA_IMAGE_1
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/hw/bsp/nrf51dk/bsp.yml
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf51dk/bsp.yml b/hw/bsp/nrf51dk/bsp.yml
new file mode 100644
index 0000000..7bf5d0a
--- /dev/null
+++ b/hw/bsp/nrf51dk/bsp.yml
@@ -0,0 +1,58 @@
+#
+# 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.
+#
+
+bsp.arch: cortex_m0
+bsp.compiler: compiler/arm-none-eabi-m0
+bsp.linkerscript: "nrf51dk.ld"
+bsp.linkerscript.BOOT_LOADER.OVERWRITE: "boot-nrf51dk.ld"
+bsp.part2linkerscript: "split-nrf51dk.ld"
+bsp.downloadscript: nrf51dk_download.sh
+bsp.debugscript: nrf51dk_debug.sh
+
+bsp.flash_map:
+ areas:
+ # System areas.
+ FLASH_AREA_BOOTLOADER:
+ device: 0
+ offset: 0x00000000
+ size: 16kB
+ FLASH_AREA_IMAGE_0:
+ device: 0
+ offset: 0x00008000
+ size: 110kB
+ FLASH_AREA_IMAGE_1:
+ device: 0
+ offset: 0x00023800
+ size: 110kB
+ FLASH_AREA_IMAGE_SCRATCH:
+ device: 0
+ offset: 0x0003f000
+ size: 2kB
+
+ # User areas.
+ FLASH_AREA_REBOOT_LOG:
+ user_id: 0
+ device: 0
+ offset: 0x00004000
+ size: 16kB
+ FLASH_AREA_NFFS:
+ user_id: 1
+ device: 0
+ offset: 0x0003f800
+ size: 2kB
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/hw/bsp/nrf51dk/pkg.yml
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf51dk/pkg.yml b/hw/bsp/nrf51dk/pkg.yml
index e679df0..7770784 100644
--- a/hw/bsp/nrf51dk/pkg.yml
+++ b/hw/bsp/nrf51dk/pkg.yml
@@ -26,20 +26,15 @@ pkg.keywords:
- nrf51
- nrf51dk
-pkg.arch: cortex_m0
-pkg.compiler: compiler/arm-none-eabi-m0
-pkg.linkerscript: "nrf51dk.ld"
-pkg.linkerscript.BOOT_LOADER.OVERWRITE: "boot-nrf51dk.ld"
-pkg.part2linkerscript: "split-nrf51dk.ld"
-pkg.downloadscript: nrf51dk_download.sh
-pkg.debugscript: nrf51dk_debug.sh
pkg.cflags:
# Nordic SDK files require this define.
- '-DNRF51'
pkg.deps:
+ - boot/bootutil
- hw/mcu/nordic/nrf51xxx
- libc/baselibc
+ - sys/flash_map
pkg.deps.BLE_DEVICE:
- hw/drivers/nimble/nrf51
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/hw/bsp/nrf51dk/src/arch/cortex_m0/gcc_startup_nrf51.s
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf51dk/src/arch/cortex_m0/gcc_startup_nrf51.s b/hw/bsp/nrf51dk/src/arch/cortex_m0/gcc_startup_nrf51.s
index 9a29de1..7fbba5c 100755
--- a/hw/bsp/nrf51dk/src/arch/cortex_m0/gcc_startup_nrf51.s
+++ b/hw/bsp/nrf51dk/src/arch/cortex_m0/gcc_startup_nrf51.s
@@ -152,7 +152,7 @@ Reset_Handler:
/* This is called but current_slot is in the data section so it is
* overwritten. its only called here to ensure that the global and this
* function are linked into the loader */
- BL bsp_slot_init_split_application
+ BL boot_set_image_slot_split
/* Loop to copy data from read only memory to RAM. The ranges
* of copy from/to are specified by following symbols evaluated in
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/hw/bsp/nrf51dk/src/arch/cortex_m0/gcc_startup_nrf51_split.s
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf51dk/src/arch/cortex_m0/gcc_startup_nrf51_split.s b/hw/bsp/nrf51dk/src/arch/cortex_m0/gcc_startup_nrf51_split.s
index 545b975..88998f4 100755
--- a/hw/bsp/nrf51dk/src/arch/cortex_m0/gcc_startup_nrf51_split.s
+++ b/hw/bsp/nrf51dk/src/arch/cortex_m0/gcc_startup_nrf51_split.s
@@ -151,7 +151,7 @@ Reset_Handler_split:
LDR R1, =__HeapLimit
BL _sbrkInit
- BL bsp_slot_init_split_application
+ BL boot_set_image_slot_split
LDR R0, =SystemInit
BLX R0
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/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 d07be59..a1e56e4 100644
--- a/hw/bsp/nrf51dk/src/os_bsp.c
+++ b/hw/bsp/nrf51dk/src/os_bsp.c
@@ -19,7 +19,7 @@
#include <assert.h>
#include "syscfg/syscfg.h"
#include "bsp.h"
-#include "hal/flash_map.h"
+#include "flash_map/flash_map.h"
#include "hal/hal_flash.h"
#include "hal/hal_bsp.h"
#include "hal/hal_spi.h"
@@ -37,33 +37,6 @@
#include "uart/uart.h"
#include "uart_hal/uart_hal.h"
-static struct flash_area bsp_flash_areas[] = {
- [FLASH_AREA_BOOTLOADER] = {
- .fa_flash_id = 0, /* internal flash */
- .fa_off = 0x00000000, /* beginning */
- .fa_size = (32 * 1024)
- },
- [FLASH_AREA_IMAGE_0] = {
- .fa_flash_id = 0,
- .fa_off = 0x00008000,
- .fa_size = (110 * 1024)
- },
- [FLASH_AREA_IMAGE_1] = {
- .fa_flash_id = 0,
- .fa_off = 0x00023800,
- .fa_size = (110 * 1024)
- },
- [FLASH_AREA_IMAGE_SCRATCH] = {
- .fa_flash_id = 0,
- .fa_off = 0x0003f000,
- .fa_size = (2 * 1024)
- },
- [FLASH_AREA_NFFS] = {
- .fa_flash_id = 0,
- .fa_off = 0x0003f800,
- .fa_size = (2 * 1024)
- }
-};
#if MYNEWT_VAL(UART_0)
static struct uart_dev os_bsp_uart0;
@@ -75,26 +48,6 @@ static const struct nrf51_uart_cfg os_bsp_uart0_cfg = {
};
#endif
-/*
- * Returns the flash map slot where the currently active image is located.
- * If executing from internal flash from fixed location, that slot would
- * be easy to find.
- * If images are in external flash, and copied to RAM for execution, then
- * this routine would have to figure out which one of those slots is being
- * used.
- */
-int current_image_slot = 1;
-
-int
-bsp_imgr_current_slot(void)
-{
- return current_image_slot;
-}
-
-void bsp_slot_init_split_application(void) {
- current_image_slot = FLASH_AREA_IMAGE_1;
-}
-
void
bsp_init(void)
{
@@ -115,21 +68,10 @@ bsp_init(void)
nrf_drv_spis_config_t spi_cfg = NRF_DRV_SPIS_DEFAULT_CONFIG(1);
#endif
- /*
- * XXX this reference is here to keep this function in.
- */
- _sbrk(0);
-
/* Set cputime to count at 1 usec increments */
rc = cputime_init(MYNEWT_VAL(CLOCK_FREQ));
assert(rc == 0);
- flash_area_init(bsp_flash_areas,
- sizeof(bsp_flash_areas) / sizeof(bsp_flash_areas[0]));
-
- rc = hal_flash_init();
- assert(rc == 0);
-
#if MYNEWT_VAL(SPI_MASTER)
rc = hal_spi_init(0, &spi_cfg, HAL_SPI_TYPE_MASTER);
assert(rc == 0);
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/hw/bsp/nrf51dk/syscfg.yml
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf51dk/syscfg.yml b/hw/bsp/nrf51dk/syscfg.yml
index a11aa61..4ae23a1 100644
--- a/hw/bsp/nrf51dk/syscfg.yml
+++ b/hw/bsp/nrf51dk/syscfg.yml
@@ -61,3 +61,9 @@ syscfg.defs:
TIMER_2_INTERRUPT_PRIORITY:
description: 'TBD'
value: '((1 << __NVIC_PRIO_BITS) - 1)'
+
+syscfg.vals:
+ CONFIG_FCB_FLASH_AREA: FLASH_AREA_NFFS
+ REBOOT_LOG_FLASH_AREA: FLASH_AREA_REBOOT_LOG
+ NFFS_FLASH_AREA: FLASH_AREA_REBOOT_LOG
+ COREDUMP_FLASH_AREA: FLASH_AREA_IMAGE_1
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/hw/bsp/nrf52dk/bsp.yml
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf52dk/bsp.yml b/hw/bsp/nrf52dk/bsp.yml
new file mode 100644
index 0000000..8409c13
--- /dev/null
+++ b/hw/bsp/nrf52dk/bsp.yml
@@ -0,0 +1,58 @@
+#
+# 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.
+#
+
+bsp.arch: cortex_m4
+bsp.compiler: compiler/arm-none-eabi-m4
+bsp.linkerscript: "nrf52dk.ld"
+bsp.linkerscript.BOOT_LOADER.OVERWRITE: "boot-nrf52dk.ld"
+bsp.part2linkerscript: "split-nrf52dk.ld"
+bsp.downloadscript: nrf52dk_download.sh
+bsp.debugscript: nrf52dk_debug.sh
+
+bsp.flash_map:
+ areas:
+ # System areas.
+ FLASH_AREA_BOOTLOADER:
+ device: 0
+ offset: 0x00000000
+ size: 16kB
+ FLASH_AREA_IMAGE_0:
+ device: 0
+ offset: 0x00008000
+ size: 232kB
+ FLASH_AREA_IMAGE_1:
+ device: 0
+ offset: 0x00042000
+ size: 232kB
+ FLASH_AREA_IMAGE_SCRATCH:
+ device: 0
+ offset: 0x0007c000
+ size: 4kB
+
+ # User areas.
+ FLASH_AREA_REBOOT_LOG:
+ user_id: 0
+ device: 0
+ offset: 0x00004000
+ size: 16kB
+ FLASH_AREA_NFFS:
+ user_id: 1
+ device: 0
+ offset: 0x0007d000
+ size: 12kB
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/hw/bsp/nrf52dk/pkg.yml
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf52dk/pkg.yml b/hw/bsp/nrf52dk/pkg.yml
index d15c0e3..f93b9b0 100644
--- a/hw/bsp/nrf52dk/pkg.yml
+++ b/hw/bsp/nrf52dk/pkg.yml
@@ -26,21 +26,16 @@ pkg.keywords:
- nrf52
- nrf52dk
-pkg.arch: cortex_m4
-pkg.compiler: compiler/arm-none-eabi-m4
-pkg.linkerscript: "nrf52dk.ld"
-pkg.linkerscript.BOOT_LOADER.OVERWRITE: "boot-nrf52dk.ld"
-pkg.part2linkerscript: "split-nrf52dk.ld"
-pkg.downloadscript: nrf52dk_download.sh
-pkg.debugscript: nrf52dk_debug.sh
pkg.cflags:
# Nordic SDK files require these defines.
- '-DNRF52'
- '-DSPI_MASTER_0_ENABLE'
pkg.deps:
+ - boot/bootutil
- hw/mcu/nordic/nrf52xxx
- libc/baselibc
+ - sys/flash_map
pkg.deps.BLE_DEVICE:
- hw/drivers/nimble/nrf52
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/hw/bsp/nrf52dk/src/arch/cortex_m4/gcc_startup_nrf52.s
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf52dk/src/arch/cortex_m4/gcc_startup_nrf52.s b/hw/bsp/nrf52dk/src/arch/cortex_m4/gcc_startup_nrf52.s
index de2a2fa..54b76ad 100755
--- a/hw/bsp/nrf52dk/src/arch/cortex_m4/gcc_startup_nrf52.s
+++ b/hw/bsp/nrf52dk/src/arch/cortex_m4/gcc_startup_nrf52.s
@@ -141,7 +141,7 @@ Reset_Handler:
/* This is called but current_slot is in the data section so it is
* overwritten. its only called here to ensure that the global and this
* function are linked into the loader */
- BL bsp_slot_init_split_application
+ BL boot_set_image_slot_split
/* Loop to copy data from read only memory to RAM. The ranges
* of copy from/to are specified by following symbols evaluated in
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5d711b27/hw/bsp/nrf52dk/src/arch/cortex_m4/gcc_startup_nrf52_split.s
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf52dk/src/arch/cortex_m4/gcc_startup_nrf52_split.s b/hw/bsp/nrf52dk/src/arch/cortex_m4/gcc_startup_nrf52_split.s
index 43b4753..26bb3a8 100755
--- a/hw/bsp/nrf52dk/src/arch/cortex_m4/gcc_startup_nrf52_split.s
+++ b/hw/bsp/nrf52dk/src/arch/cortex_m4/gcc_startup_nrf52_split.s
@@ -136,7 +136,7 @@ Reset_Handler_split:
LDR R1, =__HeapLimit
BL _sbrkInit
- BL bsp_slot_init_split_application
+ BL boot_set_image_slot_split
LDR R0, =SystemInit
BLX R0