Skip to content

Commit f8d8004

Browse files
joerchannordicjm
authored andcommitted
boot: zephyr: Allow disabling NRFX_WDT on nRF devices
Allow disabling feeding the watchdog on nrf devices directly using the nrfx_wdt functions. The imply on NRFX_WDT cannot be disabled since NRFX_WDT is a promptless symbol and cannot be assigned in a config fragment. Not even deleting the wdt0 node in a devicetree overlay works since the configuration takes predence and ends in a #error without any nrfx_wdt instances. To fix this create new Kconfig option with prompt and change the imply to this option. That way the option can be assigned to off by the user. This is needed to support the use case of an external watchdog controlled using the zephyr watchdog API instead of the wdt peripheral. Signed-off-by: Joakim Andersson <[email protected]>
1 parent fe26c28 commit f8d8004

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

boot/zephyr/Kconfig

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -736,16 +736,21 @@ config BOOT_WATCHDOG_FEED
736736
bool "Feed the watchdog while doing swap"
737737
default y if WATCHDOG
738738
default y if SOC_FAMILY_NORDIC_NRF
739-
# for nRF nrfx based implementation is available
740-
imply NRFX_WDT if SOC_FAMILY_NORDIC_NRF
741-
imply NRFX_WDT0 if SOC_FAMILY_NORDIC_NRF
742-
imply NRFX_WDT1 if SOC_FAMILY_NORDIC_NRF
743-
imply NRFX_WDT30 if SOC_FAMILY_NORDIC_NRF
744-
imply NRFX_WDT31 if SOC_FAMILY_NORDIC_NRF
739+
imply BOOT_WATCHDOG_FEED_NRFX_WDT if SOC_FAMILY_NORDIC_NRF
745740
help
746741
Enables implementation of MCUBOOT_WATCHDOG_FEED() macro which is
747742
used to feed watchdog while doing time consuming operations.
748743

744+
config BOOT_WATCHDOG_FEED_NRFX_WDT
745+
bool "Feed the watchdog using NRFX WDT directly"
746+
depends on SOC_FAMILY_NORDIC_NRF
747+
# for nRF nrfx based implementation is available
748+
imply NRFX_WDT
749+
imply NRFX_WDT0
750+
imply NRFX_WDT1
751+
imply NRFX_WDT30
752+
imply NRFX_WDT31
753+
749754
config BOOT_IMAGE_ACCESS_HOOKS
750755
bool "Enable hooks for overriding MCUboot's native routines"
751756
help

boot/zephyr/include/mcuboot_config/mcuboot_config.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@
330330
#endif
331331

332332
#if CONFIG_BOOT_WATCHDOG_FEED
333-
#if CONFIG_NRFX_WDT
333+
#if CONFIG_BOOT_WATCHDOG_FEED_NRFX_WDT
334334
#include <nrfx_wdt.h>
335335

336336
#define FEED_WDT_INST(id) \
@@ -367,7 +367,7 @@
367367
#error "No NRFX WDT instances enabled"
368368
#endif
369369

370-
#elif DT_NODE_HAS_STATUS(DT_ALIAS(watchdog0), okay) /* CONFIG_NRFX_WDT */
370+
#elif DT_NODE_HAS_STATUS(DT_ALIAS(watchdog0), okay) /* CONFIG_BOOT_WATCHDOG_FEED_NRFX_WDT */
371371
#include <zephyr/device.h>
372372
#include <zephyr/drivers/watchdog.h>
373373

0 commit comments

Comments
 (0)