Commit 51c9d707 authored by Rajavardhan Gundi's avatar Rajavardhan Gundi Committed by Andrzej Puzdrowski
Browse files

dfu: Introduce CONFIG_BOOT_WAIT_FOR_USB_DFU

This Kconfig parameter makes MCUboot wait for a prescribed duration
of time to allow for USB DFU to be invoked.

Signed-off-by: default avatarRajavardhan Gundi <rajavardhan.gundi@intel.com>
parent 048168aa
Loading
Loading
Loading
Loading
+11
Changes for boot/zephyr/Kconfig: 11 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -122,6 +122,17 @@ config BOOT_ERASE_PROGRESSIVELY
	 on some hardware that has long erase times, to prevent long wait
	 times at the beginning of the DFU process.

config BOOT_WAIT_FOR_USB_DFU
	bool "Wait for a prescribed duration to see if USB DFU is invoked"
	default n
	select USB
	select USB_DFU_CLASS
	select IMG_MANAGER
	help
	  If y, MCUboot waits for a prescribed duration of time to allow
	  for USB DFU to be invoked. Please note DFU always updates the
	  slot1 image.

config ZEPHYR_TRY_MASS_ERASE
	bool "Try to mass erase flash when flashing MCUboot image"
	default y
+10
Changes for boot/zephyr/main.c: 10 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -40,6 +40,10 @@ const struct boot_uart_funcs boot_funcs = {
};
#endif

#ifdef CONFIG_BOOT_WAIT_FOR_USB_DFU
#include <usb/class/usb_dfu.h>
#endif

MCUBOOT_LOG_MODULE_REGISTER(mcuboot);

void os_heap_init(void);
@@ -197,6 +201,12 @@ void main(void)
    }
#endif

#ifdef CONFIG_BOOT_WAIT_FOR_USB_DFU
    BOOT_LOG_INF("Waiting for USB DFU");
    wait_for_usb_dfu();
    BOOT_LOG_INF("USB DFU wait time elapsed");
#endif

    rc = boot_go(&rsp);
    if (rc != 0) {
        BOOT_LOG_ERR("Unable to find bootable image");