sys/reboot; if fcb_init() sees data it does not recognize in
the flash area allocated to it, erase that area.


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

Branch: refs/heads/master
Commit: 5155897f8cf7d022332255239c02384b578d2d68
Parents: fe4b763
Author: Marko Kiiskila <[email protected]>
Authored: Fri Apr 7 09:41:08 2017 -0700
Committer: Marko Kiiskila <[email protected]>
Committed: Fri Apr 7 09:41:08 2017 -0700

----------------------------------------------------------------------
 sys/reboot/src/log_reboot.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5155897f/sys/reboot/src/log_reboot.c
----------------------------------------------------------------------
diff --git a/sys/reboot/src/log_reboot.c b/sys/reboot/src/log_reboot.c
index b795e1c..c645338 100644
--- a/sys/reboot/src/log_reboot.c
+++ b/sys/reboot/src/log_reboot.c
@@ -98,7 +98,11 @@ reboot_init_handler(int log_store_type, uint8_t entries)
 
             rc = fcb_init(fcbp);
             if (rc) {
-                return rc;
+                flash_area_erase(ptr, 0, ptr->fa_size);
+                rc = fcb_init(fcbp);
+                if (rc) {
+                    return rc;
+                }
             }
             reboot_log_handler = (struct log_handler *)&log_fcb_handler;
             if (rc) {

Reply via email to