You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ma...@apache.org on 2017/05/17 17:14:46 UTC

[6/8] incubator-mynewt-core git commit: boot: Tickle watchdog during image swap and verify

boot: Tickle watchdog during image swap and verify


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

Branch: refs/heads/master
Commit: f3c3b03fb77221a1fea43108df9800e81f7a4f1c
Parents: 31d00cb
Author: Simon Ratner <si...@probablyprime.net>
Authored: Thu May 11 23:40:43 2017 -0700
Committer: Simon Ratner <si...@probablyprime.net>
Committed: Thu May 11 23:40:43 2017 -0700

----------------------------------------------------------------------
 boot/bootutil/src/image_validate.c | 4 ++++
 boot/bootutil/src/loader.c         | 4 ++++
 2 files changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f3c3b03f/boot/bootutil/src/image_validate.c
----------------------------------------------------------------------
diff --git a/boot/bootutil/src/image_validate.c b/boot/bootutil/src/image_validate.c
index 9ab08b7..740616a 100644
--- a/boot/bootutil/src/image_validate.c
+++ b/boot/bootutil/src/image_validate.c
@@ -24,6 +24,7 @@
 
 #include "syscfg/syscfg.h"
 #include "hal/hal_flash.h"
+#include "hal/hal_watchdog.h"
 #include "flash_map/flash_map.h"
 #include "bootutil/image.h"
 #include "bootutil/sign_key.h"
@@ -66,6 +67,9 @@ bootutil_img_hash(struct image_header *hdr, const struct flash_area *fap,
      */
     size = hdr->ih_img_size + hdr->ih_hdr_size;
     for (off = 0; off < size; off += blk_sz) {
+        /* Pet the watchdog, in case it is still enabled after a soft reset. */
+        hal_watchdog_tickle();
+
         blk_sz = size - off;
         if (blk_sz > tmp_buf_sz) {
             blk_sz = tmp_buf_sz;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f3c3b03f/boot/bootutil/src/loader.c
----------------------------------------------------------------------
diff --git a/boot/bootutil/src/loader.c b/boot/bootutil/src/loader.c
index cff5acd..77cce4b 100644
--- a/boot/bootutil/src/loader.c
+++ b/boot/bootutil/src/loader.c
@@ -30,6 +30,7 @@
 #include "sysflash/sysflash.h"
 #include "flash_map/flash_map.h"
 #include <hal/hal_flash.h>
+#include <hal/hal_watchdog.h>
 #include <os/os_malloc.h>
 #include "bootutil/bootutil.h"
 #include "bootutil/image.h"
@@ -867,6 +868,9 @@ boot_copy_image(struct boot_status *bs)
     swap_idx = 0;
     last_sector_idx = boot_data.imgs[0].num_sectors - 1;
     while (last_sector_idx >= 0) {
+        /* Pet the watchdog, in case it is still enabled after a soft reset. */
+        hal_watchdog_tickle();
+
         sz = boot_copy_sz(last_sector_idx, &first_sector_idx);
         if (swap_idx >= bs->idx) {
             boot_swap_sectors(first_sector_idx, sz, bs);