mynewt: Add call to custom pre-boot function
Custom boot_preboot() function can be used to start
DFU in similar way as is already done in zephyr.
Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
diff --git a/boot/mynewt/src/main.c b/boot/mynewt/src/main.c
index c032626..0d8294d 100755
--- a/boot/mynewt/src/main.c
+++ b/boot/mynewt/src/main.c
@@ -51,6 +51,10 @@
void boot_custom_start(uintptr_t flash_base, struct boot_rsp *rsp);
#endif
+#if MYNEWT_VAL(BOOT_PREBOOT)
+void boot_preboot(void);
+#endif
+
#if defined(MCUBOOT_SERIAL)
#define BOOT_SERIAL_REPORT_DUR \
(MYNEWT_VAL(OS_CPUTIME_FREQ) / MYNEWT_VAL(BOOT_SERIAL_REPORT_FREQ))
@@ -239,6 +243,9 @@
flash_map_init();
#endif
+#if MYNEWT_VAL(BOOT_PREBOOT)
+ boot_preboot();
+#endif
FIH_CALL(boot_go, fih_rc, &rsp);
if (fih_not_eq(fih_rc, FIH_SUCCESS)) {
assert(fih_int_decode(fih_rc) == FIH_POSITIVE_VALUE);
diff --git a/boot/mynewt/syscfg.yml b/boot/mynewt/syscfg.yml
index d472c20..8334444 100644
--- a/boot/mynewt/syscfg.yml
+++ b/boot/mynewt/syscfg.yml
@@ -28,6 +28,9 @@
BOOT_CUSTOM_START:
description: 'Override hal_system_start with a custom start routine'
value: 0
+ BOOT_PREBOOT:
+ description: 'Call boot_preboot() function before booting application'
+ value:
syscfg.vals:
SYSINIT_CONSTRAIN_INIT: 0