Fix some leftovers after mynewt move (PR #52)
- caps.c was now updated (missed this one!).
- *_OVERWRITE_ONLY flag was now also updated.
diff --git a/Makefile b/Makefile
index 1f3283f..7d39640 100644
--- a/Makefile
+++ b/Makefile
@@ -23,7 +23,7 @@
# Enable this option to not use the swapping code and just overwrite
# the image on upgrade.
-#CFLAGS += -DBOOTUTIL_OVERWRITE_ONLY
+#CFLAGS += -DMCUBOOT_OVERWRITE_ONLY
##############################
# End of configuration blocks.
diff --git a/boot/bootutil/src/caps.c b/boot/bootutil/src/caps.c
index ae67939..61d4f3f 100644
--- a/boot/bootutil/src/caps.c
+++ b/boot/bootutil/src/caps.c
@@ -20,16 +20,16 @@
{
uint32_t res = 0;
-#ifdef BOOTUTIL_SIGN_RSA
+#if defined(MCUBOOT_SIGN_RSA)
res |= BOOTUTIL_CAP_RSA2048;
#endif
-#ifdef BOOTUTIL_SIGN_EC
+#if defined(MCUBOOT_SIGN_EC)
res |= BOOTUTIL_CAP_ECDSA_P224;
#endif
-#ifdef BOOTUTIL_SIGN_EC256
+#if defined(MCUBOOT_SIGN_EC256)
res |= BOOTUTIL_CAP_ECDSA_P256;
#endif
-#ifdef BOOTUTIL_OVERWRITE_ONLY
+#if defined(MCUBOOT_OVERWRITE_ONLY)
res |= BOOTUTIL_CAP_OVERWRITE_UPGRADE;
#else
res |= BOOTUTIL_CAP_SWAP_UPGRADE;
diff --git a/boot/bootutil/src/loader.c b/boot/bootutil/src/loader.c
index a328172..d42c40e 100644
--- a/boot/bootutil/src/loader.c
+++ b/boot/bootutil/src/loader.c
@@ -645,7 +645,7 @@
* @return The number of bytes comprised by the
* [first-sector, last-sector] range.
*/
-#ifndef BOOTUTIL_OVERWRITE_ONLY
+#ifndef MCUBOOT_OVERWRITE_ONLY
static uint32_t
boot_copy_sz(int last_sector_idx, int *out_first_sector_idx)
{
@@ -669,7 +669,7 @@
*out_first_sector_idx = i + 1;
return sz;
}
-#endif /* not BOOTUTIL_OVERWRITE_ONLY */
+#endif /* !MCUBOOT_OVERWRITE_ONLY */
/**
* Erases a region of flash.
@@ -845,7 +845,7 @@
*
* @return 0 on success; nonzero on failure.
*/
-#ifndef BOOTUTIL_OVERWRITE_ONLY
+#ifndef MCUBOOT_OVERWRITE_ONLY
static void
boot_swap_sectors(int idx, uint32_t sz, struct boot_status *bs)
{
@@ -978,7 +978,7 @@
assert(rc == 0);
}
}
-#endif /* not BOOTUTIL_OVERWRITE_ONLY */
+#endif /* !MCUBOOT_OVERWRITE_ONLY */
/**
* Swaps the two images in flash. If a prior copy operation was interrupted
@@ -992,7 +992,7 @@
*
* @return 0 on success; nonzero on failure.
*/
-#ifdef BOOTUTIL_OVERWRITE_ONLY
+#ifdef MCUBOOT_OVERWRITE_ONLY
static int
boot_copy_image(struct boot_status *bs)
{
diff --git a/boot/mynewt/include/mynewt/config.h b/boot/mynewt/include/mynewt/config.h
index 9be051d..513878d 100644
--- a/boot/mynewt/include/mynewt/config.h
+++ b/boot/mynewt/include/mynewt/config.h
@@ -42,5 +42,8 @@
#if MYNEWT_VAL(BOOTUTIL_USE_TINYCRYPT)
#define MCUBOOT_USE_TINYCRYPT 1
#endif
+#if MYNEWT_VAL(BOOTUTIL_OVERWRITE_ONLY)
+#define MCUBOOT_OVERWRITE_ONLY 1
+#endif
#endif /* __BOOT_CONFIG_H__ */
diff --git a/boot/mynewt/syscfg.yml b/boot/mynewt/syscfg.yml
index de4f190..afeaabe 100644
--- a/boot/mynewt/syscfg.yml
+++ b/boot/mynewt/syscfg.yml
@@ -43,6 +43,9 @@
BOOTUTIL_USE_TINYCRYPT:
description: 'Use tinycrypt for crypto operations.'
value: 0
+ BOOTUTIL_OVERWRITE_ONLY:
+ description: 'Non-swapping upgrades, copy from slot 1 to slot 0 only.'
+ value: 0
syscfg.vals:
SYSINIT_CONSTRAIN_INIT: 0
diff --git a/sim/build.rs b/sim/build.rs
index 1932b8e..572b1d3 100644
--- a/sim/build.rs
+++ b/sim/build.rs
@@ -18,7 +18,7 @@
conf.debug(true);
conf.flag("-Wall");
conf.define("__BOOTSIM__", None);
- // conf.define("BOOTUTIL_OVERWRITE_ONLY", None);
+ // conf.define("MCUBOOT_OVERWRITE_ONLY", None);
conf.compile("libbootutil.a");
walk_dir("../boot").unwrap();
walk_dir("csupport").unwrap();