zephyr: boot: serial_recovery: Add no application entrace method
Adds a bootloader serial recovery entrance mode that will allow
recovering a module if there is no application that can be booted.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
diff --git a/boot/zephyr/main.c b/boot/zephyr/main.c
index 8c2b98e..4a672fd 100644
--- a/boot/zephyr/main.c
+++ b/boot/zephyr/main.c
@@ -128,7 +128,8 @@
#ifdef CONFIG_MCUBOOT_SERIAL
#if !defined(CONFIG_BOOT_SERIAL_ENTRANCE_GPIO) && \
!defined(CONFIG_BOOT_SERIAL_WAIT_FOR_DFU) && \
- !defined(CONFIG_BOOT_SERIAL_BOOT_MODE)
+ !defined(CONFIG_BOOT_SERIAL_BOOT_MODE) && \
+ !defined(CONFIG_BOOT_SERIAL_NO_APPLICATION)
#error "Serial recovery selected without an entrance mode set"
#endif
#endif
@@ -596,6 +597,19 @@
mcuboot_status_change(MCUBOOT_STATUS_NO_BOOTABLE_IMAGE_FOUND);
+#ifdef CONFIG_BOOT_SERIAL_NO_APPLICATION
+ /* No bootable image and configuration set to remain in serial
+ * recovery mode
+ */
+#ifdef CONFIG_MCUBOOT_INDICATION_LED
+ gpio_pin_set_dt(&led0, 1);
+#endif
+
+ mcuboot_status_change(MCUBOOT_STATUS_SERIAL_DFU_ENTERED);
+ rc = boot_console_init();
+ boot_serial_start(&boot_funcs);
+#endif
+
FIH_PANIC;
}