diff --git a/samples/light_switch/Kconfig.sysbuild b/samples/light_switch/Kconfig.sysbuild index 3aebd01e..0b705efd 100644 --- a/samples/light_switch/Kconfig.sysbuild +++ b/samples/light_switch/Kconfig.sysbuild @@ -45,6 +45,16 @@ endif # SOC_SERIES_NRF53X if BOARD_NRF54LM20DK config PM_OVERRIDE_EXTERNAL_DRIVER_CHECK + default n + +config PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY + default n + +choice MCUBOOT_MODE + default MCUBOOT_MODE_OVERWRITE_ONLY +endchoice + +config MCUBOOT_COMPRESSED_IMAGE_SUPPORT default y endif # BOARD_NRF54LM20DK diff --git a/samples/light_switch/README.rst b/samples/light_switch/README.rst index 28eb8260..df4f2863 100644 --- a/samples/light_switch/README.rst +++ b/samples/light_switch/README.rst @@ -125,7 +125,9 @@ For example, when building from the command line, use the following command: Alternatively, you can :ref:`configure Zigbee FOTA manually `. .. note:: - You can use the :file:`prj_fota.conf` file only with a development kit that contains the nRF52840, nRF5340, nRF54L15 or nRF54L10 SoC. + You can use the :file:`prj_fota.conf` file only with the nRF52840, nRF5340, nRF54L15, nRF54L10, or nRF54LM20 SoC. + The nRF54LM20 SoC does not use the external flash. + All the images are stored in the internal flash with the compression enabled. To activate the Multiprotocol Bluetooth LE extension, set :makevar:`EXTRA_CONF_FILE` to the :file:`overlay-multiprotocol_ble.conf`. For example, when building from the command line, use the following command: diff --git a/samples/light_switch/boards/nrf54lm20dk_nrf54lm20a_cpuapp_fota.overlay b/samples/light_switch/boards/nrf54lm20dk_nrf54lm20a_cpuapp_fota.overlay index 167e05e4..14920837 100644 --- a/samples/light_switch/boards/nrf54lm20dk_nrf54lm20a_cpuapp_fota.overlay +++ b/samples/light_switch/boards/nrf54lm20dk_nrf54lm20a_cpuapp_fota.overlay @@ -13,7 +13,6 @@ zephyr,zigbee-timer = &timer24; zephyr,code-partition = &slot0_partition; zephyr,ieee802154 = &ieee802154; - nordic,pm-ext-flash = &mx25r64; }; pwmleds { @@ -46,19 +45,6 @@ }; }; -/* Restore full RRAM and SRAM */ -&cpuapp_rram { - reg = <0x0 DT_SIZE_K(2036)>; -}; - -&cpuapp_sram { - reg = <0x20000000 DT_SIZE_K(512)>; -}; - &timer24 { status = "okay"; }; - -&mx25r64 { - status = "okay"; -}; diff --git a/samples/light_switch/sysbuild/mcuboot/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf b/samples/light_switch/sysbuild/mcuboot/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf index 1fc59807..9010d99d 100644 --- a/samples/light_switch/sysbuild/mcuboot/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf +++ b/samples/light_switch/sysbuild/mcuboot/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf @@ -7,13 +7,24 @@ CONFIG_HW_STACK_PROTECTION=n CONFIG_BOOT_WATCHDOG_FEED=n -# nRF54LM20DK uses SPI NOR external flash -CONFIG_GPIO=y -CONFIG_SPI=y -CONFIG_SPI_NOR=y -CONFIG_SPI_NOR_SFDP_DEVICETREE=y -CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 -CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK=y +# Disable all debug features +CONFIG_ASSERT_VERBOSE=n +CONFIG_ASSERT_NO_FILE_INFO=y +CONFIG_PRINTK=n + +# Bootloader size optimization to fit into 28 KB partition. +# These options can be safely disabled because in this configuration, +# the secondary slot resides in the internal RRAM, so features +# needed to handle the external flash are not needed. +CONFIG_SPI_NOR=n +CONFIG_SPI=n # Increase the maximum number of sectors to 512 to fit the big image size (> 1024 kB). CONFIG_BOOT_MAX_IMG_SECTORS=512 + +# Currently, without tickless kernel, the SYSCOUNTER value after the software +# reset is not set properly and due to that the first system interrupt is not called +# in the proper time - the SYSCOUNTER value is set to the value from before +# reset + 1. Hence, the reboot time increases more and more. +# To avoid it enable tickles kernel for mcuboot. +CONFIG_TICKLESS_KERNEL=y diff --git a/samples/light_switch/sysbuild/mcuboot/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/samples/light_switch/sysbuild/mcuboot/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay index d3283eaf..83134e23 100644 --- a/samples/light_switch/sysbuild/mcuboot/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ b/samples/light_switch/sysbuild/mcuboot/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -4,12 +4,10 @@ * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; -}; - +/* Disable the external flash, as it's not needed + * for the configuration with secondary slot residing + * in the internal RRAM. + */ &mx25r64 { - status = "okay"; + status = "disabled"; }; diff --git a/samples/light_switch/sysbuild/mcuboot/prj.conf b/samples/light_switch/sysbuild/mcuboot/prj.conf index e519118a..21f62c5a 100644 --- a/samples/light_switch/sysbuild/mcuboot/prj.conf +++ b/samples/light_switch/sysbuild/mcuboot/prj.conf @@ -4,42 +4,39 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # -CONFIG_PM=n CONFIG_MAIN_STACK_SIZE=10240 -CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" CONFIG_BOOT_SWAP_SAVE_ENCTLV=n -CONFIG_BOOT_ENCRYPT_IMAGE=n - -CONFIG_BOOT_UPGRADE_ONLY=n CONFIG_BOOT_BOOTSTRAP=n - -### mbedTLS has its own heap -# CONFIG_HEAP_MEM_POOL_SIZE is not set - -### We never want Zephyr's copy of tinycrypt. If tinycrypt is needed, -### MCUboot has its own copy in tree. -# CONFIG_TINYCRYPT is not set -# CONFIG_TINYCRYPT_ECC_DSA is not set -# CONFIG_TINYCRYPT_SHA256 is not set +CONFIG_PM=n CONFIG_FLASH=y CONFIG_FPROTECT=y -### Various Zephyr boards enable features that we don't want. -# CONFIG_BT is not set -# CONFIG_BT_CTLR is not set -# CONFIG_I2C is not set - -CONFIG_LOG=y -CONFIG_LOG_MODE_MINIMAL=y # former CONFIG_MODE_MINIMAL -### Ensure Zephyr logging changes don't use more resources -CONFIG_LOG_DEFAULT_LEVEL=0 -### Use info log level by default -CONFIG_MCUBOOT_LOG_LEVEL_INF=y -### Decrease footprint by ~4 KB in comparison to CBPRINTF_COMPLETE=y +# Bootloader size optimization CONFIG_CBPRINTF_NANO=y -CONFIG_NRF_RTC_TIMER_USER_CHAN_COUNT=0 -### Use the minimal C library to reduce flash usage -CONFIG_MINIMAL_LIBC=y +CONFIG_PRINTK=n +CONFIG_CONSOLE=n +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_USE_SEGGER_RTT=n +CONFIG_GPIO=n + +CONFIG_BOOT_MAX_IMG_SECTORS=256 + +CONFIG_LOG=n +CONFIG_CONSOLE_HANDLER=n +CONFIG_BOOT_BANNER=n +CONFIG_NCS_BOOT_BANNER=n +CONFIG_TIMESLICING=n +CONFIG_RESET_ON_FATAL_ERROR=n +CONFIG_MULTITHREADING=n +CONFIG_TICKLESS_KERNEL=n +CONFIG_TIMEOUT_64BIT=n +CONFIG_NRF_ENABLE_ICACHE=n +CONFIG_SIZE_OPTIMIZATIONS=y + +# Activate LTO +CONFIG_LTO=y +CONFIG_ISR_TABLES_LOCAL_DECLARATION=y