diff --git a/boot/zephyr/Kconfig b/boot/zephyr/Kconfig index effedfb4f..bf79cd002 100644 --- a/boot/zephyr/Kconfig +++ b/boot/zephyr/Kconfig @@ -382,12 +382,16 @@ config BOOT_ENCRYPTION_KEY_FILE config BOOT_MAX_IMG_SECTORS int "Maximum number of sectors per image slot" + default 512 if $(dt_nodelabel_reg_size_int,slot0_partition) > 1048576 + default 256 if $(dt_nodelabel_reg_size_int,slot0_partition) > 524288 default 128 help This option controls the maximum number of sectors that each of the two image areas can contain. Smaller values reduce MCUboot's memory usage; larger values allow it to support larger images. - If unsure, leave at the default value. + If unsure, leave at the default value. The required condition is + that (IMAGE_SIZE <= (BOOT_MAX_IMG_SECTORS * SECTOR_SIZE)). The + defaults are configured for a SECTOR_SIZE of 4096. config BOOT_SHARE_BACKEND_AVAILABLE bool @@ -748,8 +752,8 @@ comment "Zephyr configuration options" config MULTITHREADING default y if BOOT_SERIAL_CDC_ACM #usb driver requires MULTITHREADING default y if BOOT_USB_DFU_GPIO || BOOT_USB_DFU_WAIT - default n if SOC_FAMILY_NORDIC_NRF default n if SOC_FAMILY_ESPRESSIF_ESP32 && MCUBOOT + default n if SOC_SERIES_NRF51X # Minimal flash available default y config LOG_PROCESS_THREAD @@ -782,4 +786,13 @@ config MCUBOOT_VERIFY_IMG_ADDRESS also be useful when BOOT_DIRECT_XIP is enabled, to ensure that the image linked at the correct address is loaded. +# When used with MCUboot, the external flash page size must match +# the internal SoC flash page size, which is 4096 for Nordic MCUs. +configdefault NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE + default 4096 +# Use a slightly larger default value for stack writes that is unlikely +# to lead to any stack overflows. +configdefault NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE + default 32 + source "Kconfig.zephyr" diff --git a/boot/zephyr/boards/actinius_icarus_bee_nrf9160.conf b/boot/zephyr/boards/actinius_icarus_bee_nrf9160.conf index 2d4f00914..11142f5a7 100644 --- a/boot/zephyr/boards/actinius_icarus_bee_nrf9160.conf +++ b/boot/zephyr/boards/actinius_icarus_bee_nrf9160.conf @@ -1,10 +1,5 @@ # Disable Zephyr console CONFIG_CONSOLE=n -# MCUBoot settings -CONFIG_BOOT_MAX_IMG_SECTORS=256 - # MCUboot serial recovery CONFIG_MCUBOOT_SERIAL=y - -CONFIG_MULTITHREADING=y diff --git a/boot/zephyr/boards/actinius_icarus_nrf9160.conf b/boot/zephyr/boards/actinius_icarus_nrf9160.conf index 2d4f00914..11142f5a7 100644 --- a/boot/zephyr/boards/actinius_icarus_nrf9160.conf +++ b/boot/zephyr/boards/actinius_icarus_nrf9160.conf @@ -1,10 +1,5 @@ # Disable Zephyr console CONFIG_CONSOLE=n -# MCUBoot settings -CONFIG_BOOT_MAX_IMG_SECTORS=256 - # MCUboot serial recovery CONFIG_MCUBOOT_SERIAL=y - -CONFIG_MULTITHREADING=y diff --git a/boot/zephyr/boards/actinius_icarus_som_dk_nrf9160.conf b/boot/zephyr/boards/actinius_icarus_som_dk_nrf9160.conf index 2d4f00914..11142f5a7 100644 --- a/boot/zephyr/boards/actinius_icarus_som_dk_nrf9160.conf +++ b/boot/zephyr/boards/actinius_icarus_som_dk_nrf9160.conf @@ -1,10 +1,5 @@ # Disable Zephyr console CONFIG_CONSOLE=n -# MCUBoot settings -CONFIG_BOOT_MAX_IMG_SECTORS=256 - # MCUboot serial recovery CONFIG_MCUBOOT_SERIAL=y - -CONFIG_MULTITHREADING=y diff --git a/boot/zephyr/boards/actinius_icarus_som_nrf9160.conf b/boot/zephyr/boards/actinius_icarus_som_nrf9160.conf index 2d4f00914..11142f5a7 100644 --- a/boot/zephyr/boards/actinius_icarus_som_nrf9160.conf +++ b/boot/zephyr/boards/actinius_icarus_som_nrf9160.conf @@ -1,10 +1,5 @@ # Disable Zephyr console CONFIG_CONSOLE=n -# MCUBoot settings -CONFIG_BOOT_MAX_IMG_SECTORS=256 - # MCUboot serial recovery CONFIG_MCUBOOT_SERIAL=y - -CONFIG_MULTITHREADING=y diff --git a/boot/zephyr/boards/bl5340_dvk_nrf5340_cpuapp.conf b/boot/zephyr/boards/bl5340_dvk_nrf5340_cpuapp.conf deleted file mode 100644 index 00a8dfb46..000000000 --- a/boot/zephyr/boards/bl5340_dvk_nrf5340_cpuapp.conf +++ /dev/null @@ -1,6 +0,0 @@ -CONFIG_MULTITHREADING=y -# Enable QSPI (MX25R64) - Slot 1 in QSPI -CONFIG_NORDIC_QSPI_NOR=y -CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 -CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=4 -CONFIG_BOOT_MAX_IMG_SECTORS=256 diff --git a/boot/zephyr/boards/circuitdojo_feather_nrf9160.conf b/boot/zephyr/boards/circuitdojo_feather_nrf9160.conf index c23f92ca0..f3ee4eeff 100644 --- a/boot/zephyr/boards/circuitdojo_feather_nrf9160.conf +++ b/boot/zephyr/boards/circuitdojo_feather_nrf9160.conf @@ -1,12 +1,6 @@ # Disable Zephyr console CONFIG_CONSOLE=n -# Multithreading -CONFIG_MULTITHREADING=y - -# MCUBoot settings -CONFIG_BOOT_MAX_IMG_SECTORS=256 - # MCUboot serial recovery CONFIG_MCUBOOT_SERIAL=y CONFIG_BOOT_SERIAL_DETECT_DELAY=450 diff --git a/boot/zephyr/boards/conexio_stratus.conf b/boot/zephyr/boards/conexio_stratus.conf index 79ba798e7..a02d710a2 100644 --- a/boot/zephyr/boards/conexio_stratus.conf +++ b/boot/zephyr/boards/conexio_stratus.conf @@ -3,12 +3,6 @@ CONFIG_CONSOLE=n CONFIG_CONSOLE_HANDLER=n CONFIG_UART_CONSOLE=n -# Multithreading -CONFIG_MULTITHREADING=y - -# MCUBoot settings -CONFIG_BOOT_MAX_IMG_SECTORS=256 - # MCUboot serial recovery CONFIG_MCUBOOT_SERIAL=y CONFIG_BOOT_SERIAL_DETECT_DELAY=450 diff --git a/boot/zephyr/boards/nrf52840dk_nrf52840.conf b/boot/zephyr/boards/nrf52840dk_nrf52840.conf deleted file mode 100644 index 3bd75a29d..000000000 --- a/boot/zephyr/boards/nrf52840dk_nrf52840.conf +++ /dev/null @@ -1,2 +0,0 @@ -# Ensure that the qspi driver is disabled by default -CONFIG_NORDIC_QSPI_NOR=n diff --git a/boot/zephyr/boards/nrf52840dk_qspi_nor.conf b/boot/zephyr/boards/nrf52840dk_qspi_nor.conf deleted file mode 100644 index 3205eafd6..000000000 --- a/boot/zephyr/boards/nrf52840dk_qspi_nor.conf +++ /dev/null @@ -1,3 +0,0 @@ -CONFIG_NORDIC_QSPI_NOR=y -CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 -CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 diff --git a/boot/zephyr/boards/nrf52840dk_qspi_secondary_boot.conf b/boot/zephyr/boards/nrf52840dk_qspi_secondary_boot.conf deleted file mode 100644 index 9f984be4f..000000000 --- a/boot/zephyr/boards/nrf52840dk_qspi_secondary_boot.conf +++ /dev/null @@ -1,2 +0,0 @@ -CONFIG_MULTITHREADING=y -CONFIG_BOOT_MAX_IMG_SECTORS=256 diff --git a/boot/zephyr/boards/nrf52840dongle_nrf52840.conf b/boot/zephyr/boards/nrf52840dongle_nrf52840.conf index d219f351d..ec14f13bb 100644 --- a/boot/zephyr/boards/nrf52840dongle_nrf52840.conf +++ b/boot/zephyr/boards/nrf52840dongle_nrf52840.conf @@ -15,12 +15,7 @@ CONFIG_GPIO=y CONFIG_MCUBOOT_SERIAL=y CONFIG_BOOT_SERIAL_CDC_ACM=y -# Required by USB -CONFIG_MULTITHREADING=y - # USB CONFIG_USB_DEVICE_STACK=y CONFIG_USB_DEVICE_REMOTE_WAKEUP=n CONFIG_USB_DEVICE_PRODUCT="MCUBOOT" - -CONFIG_NORDIC_QSPI_NOR=n diff --git a/boot/zephyr/boards/nrf52_minimal_footprint.conf b/boot/zephyr/boards/nrf52_minimal_footprint.conf index a290312be..08cb251d0 100644 --- a/boot/zephyr/boards/nrf52_minimal_footprint.conf +++ b/boot/zephyr/boards/nrf52_minimal_footprint.conf @@ -26,6 +26,9 @@ CONFIG_THREAD_STACK_INFO=n # CONFIG_TICKLESS_KERNEL is not set CONFIG_FLASH=y +# Multithreading +CONFIG_MULTITHREADING=n + CONFIG_CONSOLE=n CONFIG_DEBUG=n CONFIG_EARLY_CONSOLE=n diff --git a/boot/zephyr/boards/nrf54l15pdk_nrf54l15_cpuapp.conf b/boot/zephyr/boards/nrf54l15pdk_nrf54l15_cpuapp.conf index 33e7e6124..15d13bdbf 100644 --- a/boot/zephyr/boards/nrf54l15pdk_nrf54l15_cpuapp.conf +++ b/boot/zephyr/boards/nrf54l15pdk_nrf54l15_cpuapp.conf @@ -2,9 +2,4 @@ # # SPDX-License-Identifier: Apache-2.0 # -CONFIG_BOOT_MAX_IMG_SECTORS=256 - -# Ensure that the qspi driver is disabled by default -CONFIG_NORDIC_QSPI_NOR=n - CONFIG_BOOT_WATCHDOG_FEED=n diff --git a/boot/zephyr/boards/nrf9161dk_nrf9161_0_7_0.conf b/boot/zephyr/boards/nrf9161dk_nrf9161_0_7_0.conf deleted file mode 100644 index c4ce81acc..000000000 --- a/boot/zephyr/boards/nrf9161dk_nrf9161_0_7_0.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_SPI_NOR=n diff --git a/boot/zephyr/boards/pinnacle_100_dvk_nrf52840.conf b/boot/zephyr/boards/pinnacle_100_dvk_nrf52840.conf deleted file mode 100644 index 00a8dfb46..000000000 --- a/boot/zephyr/boards/pinnacle_100_dvk_nrf52840.conf +++ /dev/null @@ -1,6 +0,0 @@ -CONFIG_MULTITHREADING=y -# Enable QSPI (MX25R64) - Slot 1 in QSPI -CONFIG_NORDIC_QSPI_NOR=y -CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 -CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=4 -CONFIG_BOOT_MAX_IMG_SECTORS=256 diff --git a/boot/zephyr/boards/sparkfun_thing_plus_nrf9160.conf b/boot/zephyr/boards/sparkfun_thing_plus_nrf9160.conf index c23f92ca0..f3ee4eeff 100644 --- a/boot/zephyr/boards/sparkfun_thing_plus_nrf9160.conf +++ b/boot/zephyr/boards/sparkfun_thing_plus_nrf9160.conf @@ -1,12 +1,6 @@ # Disable Zephyr console CONFIG_CONSOLE=n -# Multithreading -CONFIG_MULTITHREADING=y - -# MCUBoot settings -CONFIG_BOOT_MAX_IMG_SECTORS=256 - # MCUboot serial recovery CONFIG_MCUBOOT_SERIAL=y CONFIG_BOOT_SERIAL_DETECT_DELAY=450 diff --git a/boot/zephyr/boards/thingy52_nrf52832.conf b/boot/zephyr/boards/thingy52_nrf52832.conf deleted file mode 100644 index cf4c34c43..000000000 --- a/boot/zephyr/boards/thingy52_nrf52832.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_GPIO_SX1509B=n diff --git a/boot/zephyr/boards/thingy53_nrf5340_cpuapp.conf b/boot/zephyr/boards/thingy53_nrf5340_cpuapp.conf deleted file mode 100644 index f2e42fd64..000000000 --- a/boot/zephyr/boards/thingy53_nrf5340_cpuapp.conf +++ /dev/null @@ -1,3 +0,0 @@ -CONFIG_NORDIC_QSPI_NOR=n -CONFIG_SPI=n -CONFIG_MULTITHREADING=y diff --git a/boot/zephyr/sample.yaml b/boot/zephyr/sample.yaml index 9ab330781..88a69ccf4 100644 --- a/boot/zephyr/sample.yaml +++ b/boot/zephyr/sample.yaml @@ -38,7 +38,6 @@ tests: tags: bootloader_mcuboot sample.bootloader.mcuboot.qspi_nor_slot: extra_args: DTC_OVERLAY_FILE="./boards/nrf52840dk_qspi_nor_secondary.overlay;app.overlay" - OVERLAY_CONFIG="./boards/nrf52840dk_qspi_nor.conf;./boards/nrf52840dk_qspi_secondary_boot.conf" platform_allow: nrf52840dk/nrf52840 integration_platforms: - nrf52840dk/nrf52840