diff --git a/boot/zephyr/Kconfig b/boot/zephyr/Kconfig index cbdbd594ae..3604964b14 100644 --- a/boot/zephyr/Kconfig +++ b/boot/zephyr/Kconfig @@ -448,6 +448,7 @@ config BOOT_USB_DFU_DETECT_PIN 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 61fe58bec4..eabebfaa28 100644 --- a/boot/zephyr/Kconfig.serial_recovery +++ b/boot/zephyr/Kconfig.serial_recovery @@ -70,6 +70,7 @@ config BOOT_SERIAL_DETECT_PIN 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/boards/actinius_icarus.conf b/boot/zephyr/boards/actinius_icarus.conf index f7bb06852b..ae2fa1e428 100644 --- a/boot/zephyr/boards/actinius_icarus.conf +++ b/boot/zephyr/boards/actinius_icarus.conf @@ -6,6 +6,3 @@ CONFIG_BOOT_MAX_IMG_SECTORS=256 # MCUboot serial recovery CONFIG_MCUBOOT_SERIAL=y -CONFIG_BOOT_SERIAL_DETECT_PORT="GPIO_0" -CONFIG_BOOT_SERIAL_DETECT_PIN=5 -CONFIG_BOOT_SERIAL_DETECT_PIN_VAL=0 diff --git a/boot/zephyr/boards/circuitdojo_feather_nrf9160.conf b/boot/zephyr/boards/circuitdojo_feather_nrf9160.conf index 78d6a317f7..656239c81d 100644 --- a/boot/zephyr/boards/circuitdojo_feather_nrf9160.conf +++ b/boot/zephyr/boards/circuitdojo_feather_nrf9160.conf @@ -9,9 +9,6 @@ CONFIG_BOOT_MAX_IMG_SECTORS=256 # MCUboot serial recovery CONFIG_MCUBOOT_SERIAL=y -CONFIG_BOOT_SERIAL_DETECT_PORT="GPIO_0" -CONFIG_BOOT_SERIAL_DETECT_PIN=12 -CONFIG_BOOT_SERIAL_DETECT_PIN_VAL=0 CONFIG_BOOT_SERIAL_DETECT_DELAY=450 CONFIG_MCUBOOT_INDICATION_LED=y diff --git a/boot/zephyr/boards/nrf52840dongle_nrf52840.conf b/boot/zephyr/boards/nrf52840dongle_nrf52840.conf index 606dadb2e5..c1a9384471 100644 --- a/boot/zephyr/boards/nrf52840dongle_nrf52840.conf +++ b/boot/zephyr/boards/nrf52840dongle_nrf52840.conf @@ -17,8 +17,6 @@ CONFIG_UART_LINE_CTRL=y CONFIG_GPIO=y CONFIG_MCUBOOT_SERIAL=y CONFIG_BOOT_SERIAL_CDC_ACM=y -CONFIG_BOOT_SERIAL_DETECT_PORT="GPIO_1" -CONFIG_BOOT_SERIAL_DETECT_PIN=6 # Required by USB CONFIG_MULTITHREADING=y diff --git a/boot/zephyr/boards/sparkfun_thing_plus_nrf9160.conf b/boot/zephyr/boards/sparkfun_thing_plus_nrf9160.conf index 78d6a317f7..656239c81d 100644 --- a/boot/zephyr/boards/sparkfun_thing_plus_nrf9160.conf +++ b/boot/zephyr/boards/sparkfun_thing_plus_nrf9160.conf @@ -9,9 +9,6 @@ CONFIG_BOOT_MAX_IMG_SECTORS=256 # MCUboot serial recovery CONFIG_MCUBOOT_SERIAL=y -CONFIG_BOOT_SERIAL_DETECT_PORT="GPIO_0" -CONFIG_BOOT_SERIAL_DETECT_PIN=12 -CONFIG_BOOT_SERIAL_DETECT_PIN_VAL=0 CONFIG_BOOT_SERIAL_DETECT_DELAY=450 CONFIG_MCUBOOT_INDICATION_LED=y diff --git a/boot/zephyr/boards/thingy53_nrf5340_cpuapp.conf b/boot/zephyr/boards/thingy53_nrf5340_cpuapp.conf index 7910bc66f6..cde9d45b0e 100644 --- a/boot/zephyr/boards/thingy53_nrf5340_cpuapp.conf +++ b/boot/zephyr/boards/thingy53_nrf5340_cpuapp.conf @@ -24,8 +24,6 @@ CONFIG_GPIO=y CONFIG_MCUBOOT_SERIAL=y CONFIG_MCUBOOT_SERIAL_DIRECT_IMAGE_UPLOAD=y CONFIG_BOOT_SERIAL_CDC_ACM=y -CONFIG_BOOT_SERIAL_DETECT_PORT="GPIO_1" -CONFIG_BOOT_SERIAL_DETECT_PIN=13 # Required by QSPI CONFIG_NORDIC_QSPI_NOR=y diff --git a/boot/zephyr/main.c b/boot/zephyr/main.c index 27fb6568e8..073f4d72a8 100644 --- a/boot/zephyr/main.c +++ b/boot/zephyr/main.c @@ -389,6 +389,9 @@ static const struct gpio_dt_spec button0 = GPIO_DT_SPEC_GET(BUTTON_0_NODE, gpios #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 @@ static const struct gpio_dt_spec button0 = GPIO_DT_SPEC_GET(BUTTON_0_NODE, gpios #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) ?\