Commit 56d28f0c authored by Hein Wessels's avatar Hein Wessels Committed by Fabio Utzig
Browse files

boot: zephyr: stm32: watchdog support

Adds support for STM32 IWDG.

Also now feeds watchdog in serial recovery.

Signed-off-by: default avatarHein Wessels <heinwessels93@gmail.com>
parent 5dad5b79
Loading
Loading
Loading
Loading
+1 −0
Changes for boot/boot_serial/src/boot_serial.c: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -667,6 +667,7 @@ boot_serial_start(const struct boot_uart_funcs *f)
    off = 0;
    while (1) {
        MCUBOOT_CPU_IDLE();
        MCUBOOT_WATCHDOG_FEED();
        rc = f->read(in_buf + off, sizeof(in_buf) - off, &full_line);
        if (rc <= 0 && !full_line) {
            continue;
+13 −2
Changes for boot/zephyr/include/mcuboot_config/mcuboot_config.h: 13 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -244,13 +244,24 @@
#error "No NRFX WDT instances enabled"
#endif /* defined(CONFIG_NRFX_WDT0) && defined(CONFIG_NRFX_WDT1) */

#else /* CONFIG_NRFX_WDT */
#elif CONFIG_IWDG_STM32 /* CONFIG_NRFX_WDT */
#include <drivers/watchdog.h>

#define MCUBOOT_WATCHDOG_FEED() \
    do {                        \
        const struct device* wdt =                          \
            device_get_binding(                             \
                DT_LABEL(DT_INST(0, st_stm32_watchdog)));   \
        wdt_feed(wdt, 0);                                   \
    } while (0)

#else /* CONFIG_IWDG_STM32 */
#warning "MCUBOOT_WATCHDOG_FEED() is no-op"
/* No vendor implementation, no-op for historical reasons */
#define MCUBOOT_WATCHDOG_FEED()         \
    do {                                \
    } while (0)
#endif /* CONFIG_NRFX_WDT */
#endif
#else  /* CONFIG_BOOT_WATCHDOG_FEED */
/* Not enabled, no feed activity */
#define MCUBOOT_WATCHDOG_FEED()         \