boot: zephyr: Add default values of boot detect pins
Change introduces default values of CONFIG_BOOT_SERIAL_DETECT_PIN
and CONFIG_BOOT_USB_DFU_DETECT_PIN. This is needed to prevent build
issues caused by uninitialized Kconfig.
Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
diff --git a/boot/zephyr/Kconfig b/boot/zephyr/Kconfig
index cbdbd59..3604964 100644
--- a/boot/zephyr/Kconfig
+++ b/boot/zephyr/Kconfig
@@ -448,6 +448,7 @@
default 13 if BOARD_NRF52DK_NRF52832
default 23 if BOARD_NRF5340_DK_NRF5340_CPUAPP || BOARD_NRF5340_DK_NRF5340_CPUAPP_NS
default 43 if BOARD_BL5340_DVK_CPUAPP || BOARD_BL5340_DVK_CPUAPP_NS
+ default -1
help
Pin on the DFU detect port that triggers DFU mode.
diff --git a/boot/zephyr/Kconfig.serial_recovery b/boot/zephyr/Kconfig.serial_recovery
index 61fe58b..eabebfa 100644
--- a/boot/zephyr/Kconfig.serial_recovery
+++ b/boot/zephyr/Kconfig.serial_recovery
@@ -70,6 +70,7 @@
default 13 if BOARD_NRF52DK_NRF52832 || BOARD_NRF52833DK_NRF52833
default 23 if BOARD_NRF5340PDK_NRF5340_CPUAPP || BOARD_NRF5340PDK_NRF5340_CPUAPP_NS || \
BOARD_NRF5340DK_NRF5340_CPUAPP || BOARD_NRF5340DK_NRF5340_CPUAPP_NS
+ default -1
help
Pin on the serial detect port that triggers serial recovery mode.
diff --git a/boot/zephyr/main.c b/boot/zephyr/main.c
index 27fb656..073f4d7 100644
--- a/boot/zephyr/main.c
+++ b/boot/zephyr/main.c
@@ -389,6 +389,9 @@
#if defined(CONFIG_MCUBOOT_SERIAL)
+/* The value of -1 is used by default. It must be properly specified for a board before used. */
+BUILD_ASSERT(CONFIG_BOOT_SERIAL_DETECT_PIN != -1);
+
#define BUTTON_0_GPIO_LABEL CONFIG_BOOT_SERIAL_DETECT_PORT
#define BUTTON_0_GPIO_PIN CONFIG_BOOT_SERIAL_DETECT_PIN
#define BUTTON_0_GPIO_FLAGS ((CONFIG_BOOT_SERIAL_DETECT_PIN_VAL) ?\
@@ -397,6 +400,9 @@
#elif defined(CONFIG_BOOT_USB_DFU_GPIO)
+/* The value of -1 is used by default. It must be properly specified for a board before used. */
+BUILD_ASSERT(CONFIG_BOOT_USB_DFU_DETECT_PIN != -1);
+
#define BUTTON_0_GPIO_LABEL CONFIG_BOOT_USB_DFU_DETECT_PORT
#define BUTTON_0_GPIO_PIN CONFIG_BOOT_USB_DFU_DETECT_PIN
#define BUTTON_0_GPIO_FLAGS ((CONFIG_BOOT_USB_DFU_DETECT_PIN_VAL) ?\