Skip to content

Commit 2fa1190

Browse files
MarekPietanvlsianpu
authored andcommitted
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 <[email protected]>
1 parent 73d69e9 commit 2fa1190

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

boot/zephyr/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,7 @@ config BOOT_USB_DFU_DETECT_PIN
448448
default 13 if BOARD_NRF52DK_NRF52832
449449
default 23 if BOARD_NRF5340_DK_NRF5340_CPUAPP || BOARD_NRF5340_DK_NRF5340_CPUAPP_NS
450450
default 43 if BOARD_BL5340_DVK_CPUAPP || BOARD_BL5340_DVK_CPUAPP_NS
451+
default -1
451452
help
452453
Pin on the DFU detect port that triggers DFU mode.
453454

boot/zephyr/Kconfig.serial_recovery

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ config BOOT_SERIAL_DETECT_PIN
7070
default 13 if BOARD_NRF52DK_NRF52832 || BOARD_NRF52833DK_NRF52833
7171
default 23 if BOARD_NRF5340PDK_NRF5340_CPUAPP || BOARD_NRF5340PDK_NRF5340_CPUAPP_NS || \
7272
BOARD_NRF5340DK_NRF5340_CPUAPP || BOARD_NRF5340DK_NRF5340_CPUAPP_NS
73+
default -1
7374
help
7475
Pin on the serial detect port that triggers serial recovery mode.
7576

boot/zephyr/main.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,9 @@ static const struct gpio_dt_spec button0 = GPIO_DT_SPEC_GET(BUTTON_0_NODE, gpios
389389

390390
#if defined(CONFIG_MCUBOOT_SERIAL)
391391

392+
/* The value of -1 is used by default. It must be properly specified for a board before used. */
393+
BUILD_ASSERT(CONFIG_BOOT_SERIAL_DETECT_PIN != -1);
394+
392395
#define BUTTON_0_GPIO_LABEL CONFIG_BOOT_SERIAL_DETECT_PORT
393396
#define BUTTON_0_GPIO_PIN CONFIG_BOOT_SERIAL_DETECT_PIN
394397
#define BUTTON_0_GPIO_FLAGS ((CONFIG_BOOT_SERIAL_DETECT_PIN_VAL) ?\
@@ -397,6 +400,9 @@ static const struct gpio_dt_spec button0 = GPIO_DT_SPEC_GET(BUTTON_0_NODE, gpios
397400

398401
#elif defined(CONFIG_BOOT_USB_DFU_GPIO)
399402

403+
/* The value of -1 is used by default. It must be properly specified for a board before used. */
404+
BUILD_ASSERT(CONFIG_BOOT_USB_DFU_DETECT_PIN != -1);
405+
400406
#define BUTTON_0_GPIO_LABEL CONFIG_BOOT_USB_DFU_DETECT_PORT
401407
#define BUTTON_0_GPIO_PIN CONFIG_BOOT_USB_DFU_DETECT_PIN
402408
#define BUTTON_0_GPIO_FLAGS ((CONFIG_BOOT_USB_DFU_DETECT_PIN_VAL) ?\

0 commit comments

Comments
 (0)