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/09/22 07:07:39 UTC

[1/2] incubator-mynewt-core git commit: Restore newtmgr required API for some packages.

Repository: incubator-mynewt-core
Updated Branches:
  refs/heads/develop 72c74e5b1 -> 4b9def2d6


Restore newtmgr required API for some packages.


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/b7375d0a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/b7375d0a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/b7375d0a

Branch: refs/heads/develop
Commit: b7375d0a8fce6079de365a0fa6dbff0d1de0be47
Parents: 72c74e5
Author: Christopher Collins <cc...@apache.org>
Authored: Wed Sep 21 20:45:19 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Wed Sep 21 22:27:46 2016 -0700

----------------------------------------------------------------------
 libs/crash_test/pkg.yml | 2 ++
 libs/imgmgr/pkg.yml     | 3 +++
 sys/config/pkg.yml      | 4 +++-
 sys/log/pkg.yml         | 5 +++--
 sys/stats/pkg.yml       | 4 ++--
 5 files changed, 13 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/b7375d0a/libs/crash_test/pkg.yml
----------------------------------------------------------------------
diff --git a/libs/crash_test/pkg.yml b/libs/crash_test/pkg.yml
index f823781..c5514d9 100644
--- a/libs/crash_test/pkg.yml
+++ b/libs/crash_test/pkg.yml
@@ -26,6 +26,8 @@ pkg.deps.CRASH_TEST_CLI:
     - libs/shell
 pkg.req_apis.CRASH_TEST_CLI:
     - console
+pkg.req_apis.CRASH_TEST_NEWTMGR:
+    - newtmgr
 
 pkg.deps.CRASH_TEST_NEWTMGR:
     - libs/newtmgr

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/b7375d0a/libs/imgmgr/pkg.yml
----------------------------------------------------------------------
diff --git a/libs/imgmgr/pkg.yml b/libs/imgmgr/pkg.yml
index 5194768..65d12a5 100644
--- a/libs/imgmgr/pkg.yml
+++ b/libs/imgmgr/pkg.yml
@@ -27,6 +27,9 @@ pkg.deps:
     - libs/bootutil
     - libs/util
 
+pkg.req_apis:
+    - newtmgr
+
 pkg.deps.IMGMGR_FS:
     - fs/fs
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/b7375d0a/sys/config/pkg.yml
----------------------------------------------------------------------
diff --git a/sys/config/pkg.yml b/sys/config/pkg.yml
index 2d7c83d..05b1f94 100644
--- a/sys/config/pkg.yml
+++ b/sys/config/pkg.yml
@@ -28,13 +28,15 @@ pkg.deps:
 pkg.deps.CONFIG_CLI:
     - libs/shell
 pkg.deps.CONFIG_NEWTMGR:
-    - libs/newtmgr
     - libs/json
 pkg.deps.CONFIG_FCB:
     - sys/fcb
 pkg.deps.CONFIG_NFFS:
     - fs/nffs
 
+pkg.req_apis.CONFIG_NEWTMGR:
+    - newtmgr
+
 pkg.init_function: config_pkg_init
 pkg.init_stage: 5
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/b7375d0a/sys/log/pkg.yml
----------------------------------------------------------------------
diff --git a/sys/log/pkg.yml b/sys/log/pkg.yml
index dc84d2f..bd57e84 100644
--- a/sys/log/pkg.yml
+++ b/sys/log/pkg.yml
@@ -27,14 +27,15 @@ pkg.keywords:
 pkg.deps:
     - libs/os
     - libs/util
-pkg.deps.LOG_NEWTMGR:
-    - libs/newtmgr
 pkg.deps.LOG_FCB:
     - hw/hal
     - sys/fcb
 pkg.deps.LOG_CLI:
     - libs/shell
 
+pkg.req_apis.LOG_NEWTMGR:
+    - newtmgr
+
 pkg.init_function: log_init
 pkg.init_stage: 1
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/b7375d0a/sys/stats/pkg.yml
----------------------------------------------------------------------
diff --git a/sys/stats/pkg.yml b/sys/stats/pkg.yml
index 9927ef3..bde92c8 100644
--- a/sys/stats/pkg.yml
+++ b/sys/stats/pkg.yml
@@ -29,8 +29,8 @@ pkg.deps:
     - libs/util
 pkg.deps.STATS_CLI:
     - libs/shell
-pkg.deps.STATS_NEWTMGR:
-    - libs/newtmgr
+pkg.req_apis.STATS_NEWTMGR:
+    - newtmgr
 
 pkg.init_function: stats_module_init
 pkg.init_stage: 0


[2/2] incubator-mynewt-core git commit: sys/reboot - Don't require fcb.

Posted by cc...@apache.org.
sys/reboot - Don't require fcb.


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/4b9def2d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/4b9def2d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/4b9def2d

Branch: refs/heads/develop
Commit: 4b9def2d60dfccf5a1a08555298494c310c3ef9c
Parents: b7375d0
Author: Christopher Collins <cc...@apache.org>
Authored: Thu Sep 22 00:07:21 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Thu Sep 22 00:07:21 2016 -0700

----------------------------------------------------------------------
 sys/reboot/pkg.yml          | 11 ++++----
 sys/reboot/src/log_reboot.c | 54 +++++++++++++++++++++++++++++-----------
 2 files changed, 46 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/4b9def2d/sys/reboot/pkg.yml
----------------------------------------------------------------------
diff --git a/sys/reboot/pkg.yml b/sys/reboot/pkg.yml
index afa950b..a34d45c 100644
--- a/sys/reboot/pkg.yml
+++ b/sys/reboot/pkg.yml
@@ -28,9 +28,10 @@ pkg.keywords:
 pkg.deps:
     - libs/os
     - libs/util
-    - sys/fcb
     - sys/log
     - libs/imgmgr
+pkg.deps.REBOOT_LOG_FCB:
+    - sys/fcb
 pkg.req_apis:
     - console
 
@@ -38,9 +39,9 @@ pkg.init_function: log_reboot_pkg_init
 pkg.init_stage: 2
 
 pkg.syscfg_defs:
-    REBOOT_LOG_0_TYPE:
+    REBOOT_LOG_FCB:
         description: 'TBD'
-        value: LOG_STORE_CONSOLE
-    REBOOT_LOG_0_ENTRY_COUNT:
+        value: 0
+    REBOOT_LOG_ENTRY_COUNT:
         description: 'TBD'
-        value:  10
+        value: 10

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/4b9def2d/sys/reboot/src/log_reboot.c
----------------------------------------------------------------------
diff --git a/sys/reboot/src/log_reboot.c b/sys/reboot/src/log_reboot.c
index 6a6bb63..73cbda0 100644
--- a/sys/reboot/src/log_reboot.c
+++ b/sys/reboot/src/log_reboot.c
@@ -22,7 +22,6 @@
 #include "sysinit/sysinit.h"
 #include "syscfg/syscfg.h"
 #include "os/os.h"
-#include "fcb/fcb.h"
 #include "console/console.h"
 #include "log/log.h"
 #include "bootutil/image.h"
@@ -32,6 +31,11 @@
 #include "config/config_file.h"
 #include "reboot/log_reboot.h"
 #include "bsp/bsp.h"
+#include "hal/flash_map.h"
+
+#if MYNEWT_VAL(REBOOT_LOG_FCB)
+#include "fcb/fcb.h"
+#endif
 
 static struct log_handler *reboot_log_handler;
 static struct log reboot_log;
@@ -41,9 +45,6 @@ static char reboot_cnt_str[12];
 static char soft_reboot_str[12];
 static char *reboot_cnt_get(int argc, char **argv, char *buf, int max_len);
 static int reboot_cnt_set(int argc, char **argv, char *val);
-static struct flash_area sector;
-
-static struct fcb_log reboot_log_fcb;
 
 struct conf_handler reboot_conf_handler = {
     .ch_name = "reboot",
@@ -53,6 +54,11 @@ struct conf_handler reboot_conf_handler = {
     .ch_export = NULL
 };
 
+#if MYNEWT_VAL(REBOOT_LOG_FCB)
+static struct fcb_log reboot_log_fcb;
+static struct flash_area sector;
+#endif
+
 /**
  * Reboot log initilization
  * @param type of log(console or storage); number of entries to restore
@@ -61,17 +67,25 @@ struct conf_handler reboot_conf_handler = {
 int
 reboot_init_handler(int log_store_type, uint8_t entries)
 {
-    int rc;
+#if MYNEWT_VAL(REBOOT_LOG_FCB)
     const struct flash_area *ptr;
     struct fcb *fcbp = &reboot_log_fcb.fl_fcb;
+#endif
+    void *arg;
+    int rc;
 
     rc = conf_register(&reboot_conf_handler);
+    if (rc != 0) {
+        return rc;
+    }
 
     switch (log_store_type) {
+#if MYNEWT_VAL(REBOOT_LOG_FCB)
         case LOG_STORE_FCB:
             if (flash_area_open(FLASH_AREA_REBOOT_LOG, &ptr)) {
-                goto err;
+                return rc;
             }
+            fcbp = &reboot_log_fcb.fl_fcb;
             sector = *ptr;
             fcbp->f_sectors = &sector;
             fcbp->f_sector_cnt = 1;
@@ -82,15 +96,18 @@ reboot_init_handler(int log_store_type, uint8_t entries)
 
             rc = fcb_init(fcbp);
             if (rc) {
-                goto err;
+                return rc;
             }
             reboot_log_handler = (struct log_handler *)&log_fcb_handler;
             if (rc) {
-                goto err;
+                return rc;
             }
+            arg = &reboot_log_fcb;
             break;
+#endif
        case LOG_STORE_CONSOLE:
             reboot_log_handler = (struct log_handler *)&log_console_handler;
+            arg = NULL;
             break;
        default:
             assert(0);
@@ -98,9 +115,12 @@ reboot_init_handler(int log_store_type, uint8_t entries)
 
     rc = log_register("reboot_log", &reboot_log,
                       (struct log_handler *)reboot_log_handler,
-                      &reboot_log_fcb);
-err:
-    return (rc);
+                      arg);
+    if (rc != 0) {
+        return rc;
+    }
+
+    return 0;
 }
 
 /**
@@ -207,13 +227,19 @@ err:
 void
 log_reboot_pkg_init(void)
 {
+    int type;
     int rc;
 
     (void)rc;
+    (void)type;
 
-#if MYNEWT_VAL(REBOOT_LOG_0_TYPE)
-    rc = reboot_init_handler(MYNEWT_VAL(REBOOT_LOG_0_TYPE),
-                             MYNEWT_VAL(REBOOT_LOG_0_ENTRY_COUNT));
+#if MYNEWT_VAL(REBOOT_LOG_ENTRY_COUNT)
+#if MYNEWT_VAL(REBOOT_LOG_FCB)
+    type = LOG_STORE_FCB;
+#else
+    type = LOG_STORE_CONSOLE;
+#endif
+    rc = reboot_init_handler(type, MYNEWT_VAL(REBOOT_LOG_ENTRY_COUNT));
     SYSINIT_PANIC_ASSERT(rc == 0);
 #endif
 }