Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions boot/zephyr/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,14 @@ config BOOT_WATCHDOG_FEED_NRFX_WDT
imply NRFX_WDT30
imply NRFX_WDT31

config MCUBOOT_WATCHDOG_TIMEOUT
int "Watchdog timeout in milliseconds"
default 0
depends on BOOT_WATCHDOG_FEED
help
Specify the watchdog timeout for devices that require a timeout
installed to setup the watchdog.

config BOOT_IMAGE_ACCESS_HOOKS
bool "Enable hooks for overriding MCUboot's native routines"
help
Expand Down
17 changes: 17 additions & 0 deletions boot/zephyr/include/mcuboot_config/mcuboot_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,22 @@
#include <zephyr/device.h>
#include <zephyr/drivers/watchdog.h>

#if CONFIG_MCUBOOT_WATCHDOG_TIMEOUT
#define MCUBOOT_WATCHDOG_INSTALL_TIMEOUT() \
do { \
struct wdt_timeout_cfg wdtConfig = { \
.flags = WDT_FLAG_RESET_SOC, \
.window.min = 0, \
.window.max = CONFIG_MCUBOOT_WATCHDOG_TIMEOUT \
}; \
wdt_install_timeout(wdt, &wdtConfig); \
} while (0)
#else
#define MCUBOOT_WATCHDOG_INSTALL_TIMEOUT() \
do { \
} while (0)
#endif /* CONFIG_MCUBOOT_WATCHDOG_TIMEOUT */

#define MCUBOOT_WATCHDOG_SETUP() \
do { \
const struct device* wdt = \
Expand All @@ -385,6 +401,7 @@
const struct device* wdt = \
DEVICE_DT_GET(DT_ALIAS(watchdog0)); \
if (device_is_ready(wdt)) { \
MCUBOOT_WATCHDOG_INSTALL_TIMEOUT(); \
wdt_feed(wdt, 0); \
} \
} while (0)
Expand Down
Loading