[mynewt-mcumgr] 32/42: smp_svr - Update zephyr port for compatibility.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit add6e0e63735a83efce770474ab5c42500f551de
Author: Christopher Collins 
AuthorDate: Thu Feb 8 15:05:09 2018 -0800

smp_svr - Update zephyr port for compatibility.
---
 samples/smp_svr/zephyr/prj.conf   | 6 ++
 samples/smp_svr/zephyr/src/main.c | 9 +
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/samples/smp_svr/zephyr/prj.conf b/samples/smp_svr/zephyr/prj.conf
index fc2f99c..9e04c3c 100644
--- a/samples/smp_svr/zephyr/prj.conf
+++ b/samples/smp_svr/zephyr/prj.conf
@@ -1,3 +1,6 @@
+# Enable mcumgr.
+CONFIG_MCUMGR=y
+
 # Some command handlers require a large stack.
 CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
 
@@ -16,6 +19,9 @@ CONFIG_BT_RX_BUF_LEN=260
 CONFIG_MCUMGR_SMP_BT=y
 CONFIG_MCUMGR_SMP_SHELL=y
 
+# Enable flash operations.
+CONFIG_FLASH=y
+
 # Enable the NFFS file system.
 CONFIG_FILE_SYSTEM=y
 CONFIG_FILE_SYSTEM_NFFS=y
diff --git a/samples/smp_svr/zephyr/src/main.c 
b/samples/smp_svr/zephyr/src/main.c
index 47e5de2..3e06e40 100644
--- a/samples/smp_svr/zephyr/src/main.c
+++ b/samples/smp_svr/zephyr/src/main.c
@@ -151,11 +151,10 @@ static int init_fcb(void)
 .f_version = MDLOG_VERSION,
 .f_sector_cnt = sector_cnt - 1,
 .f_scratch_cnt = 1,
-.f_area_id = 4,
 .f_sectors = sectors,
 };
 
-rc = fcb_init(_svr_fcb);
+rc = fcb_init(4, _svr_fcb);
 if (rc != 0) {
 return rc;
 }
@@ -168,7 +167,9 @@ void main(void)
 int rc;
 
 rc = init_fcb();
-assert(rc == 0);
+if (rc != 0) {
+printk("Failed to initialize FCB; rc=%d\n", rc);
+}
 
 #ifdef CONFIG_REBOOT_LOG
 reboot_log_configure(_svr_log);
@@ -205,7 +206,7 @@ void main(void)
 /* Initialize the Bluetooth mcumgr transport. */
 smp_bt_register();
 
-#ifdef CONFIG_MDLOG
+#if defined(CONFIG_MDLOG) && defined(CONFIG_FCB)
 mdlog_register("smp_svr", _svr_log, _fcb_handler, _svr_fcb,
MDLOG_LEVEL_DEBUG);
 #endif

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.


[mynewt-mcumgr] 32/42: smp_svr - Update zephyr port for compatibility.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit e6dc5b64af391c1db2282b00e48a9325cab8339c
Author: Christopher Collins 
AuthorDate: Thu Feb 8 15:05:09 2018 -0800

smp_svr - Update zephyr port for compatibility.
---
 samples/smp_svr/zephyr/prj.conf   | 6 ++
 samples/smp_svr/zephyr/src/main.c | 9 +
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/samples/smp_svr/zephyr/prj.conf b/samples/smp_svr/zephyr/prj.conf
index fc2f99c..9e04c3c 100644
--- a/samples/smp_svr/zephyr/prj.conf
+++ b/samples/smp_svr/zephyr/prj.conf
@@ -1,3 +1,6 @@
+# Enable mcumgr.
+CONFIG_MCUMGR=y
+
 # Some command handlers require a large stack.
 CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
 
@@ -16,6 +19,9 @@ CONFIG_BT_RX_BUF_LEN=260
 CONFIG_MCUMGR_SMP_BT=y
 CONFIG_MCUMGR_SMP_SHELL=y
 
+# Enable flash operations.
+CONFIG_FLASH=y
+
 # Enable the NFFS file system.
 CONFIG_FILE_SYSTEM=y
 CONFIG_FILE_SYSTEM_NFFS=y
diff --git a/samples/smp_svr/zephyr/src/main.c 
b/samples/smp_svr/zephyr/src/main.c
index 47e5de2..3e06e40 100644
--- a/samples/smp_svr/zephyr/src/main.c
+++ b/samples/smp_svr/zephyr/src/main.c
@@ -151,11 +151,10 @@ static int init_fcb(void)
 .f_version = MDLOG_VERSION,
 .f_sector_cnt = sector_cnt - 1,
 .f_scratch_cnt = 1,
-.f_area_id = 4,
 .f_sectors = sectors,
 };
 
-rc = fcb_init(_svr_fcb);
+rc = fcb_init(4, _svr_fcb);
 if (rc != 0) {
 return rc;
 }
@@ -168,7 +167,9 @@ void main(void)
 int rc;
 
 rc = init_fcb();
-assert(rc == 0);
+if (rc != 0) {
+printk("Failed to initialize FCB; rc=%d\n", rc);
+}
 
 #ifdef CONFIG_REBOOT_LOG
 reboot_log_configure(_svr_log);
@@ -205,7 +206,7 @@ void main(void)
 /* Initialize the Bluetooth mcumgr transport. */
 smp_bt_register();
 
-#ifdef CONFIG_MDLOG
+#if defined(CONFIG_MDLOG) && defined(CONFIG_FCB)
 mdlog_register("smp_svr", _svr_log, _fcb_handler, _svr_fcb,
MDLOG_LEVEL_DEBUG);
 #endif

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.