diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf52840dk_nrf52840_ram_load.conf b/samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf52840dk_nrf52840_ram_load.conf new file mode 100644 index 00000000000..4c12994e097 --- /dev/null +++ b/samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf52840dk_nrf52840_ram_load.conf @@ -0,0 +1 @@ +CONFIG_RETAINED_MEM_NRF_GPREGRET=n diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf52840dk_nrf52840_ram_load.overlay b/samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf52840dk_nrf52840_ram_load.overlay new file mode 100644 index 00000000000..2b59fce7065 --- /dev/null +++ b/samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf52840dk_nrf52840_ram_load.overlay @@ -0,0 +1,17 @@ +/delete-node/ &sram0; + +#include "../sysbuild/nrf52840dk_nrf52840_mcuboot_ram_load.overlay" + +/ { + chosen { + zephyr,flash = &flash0; + /delete-property/ zephyr,code-partition; + }; + + soc { + sram0: memory@20006000 { + compatible = "mmio-sram"; + reg = <0x20006000 DT_SIZE_K(200)>; + }; + }; +}; diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/prj_ram_load.conf b/samples/subsys/mgmt/mcumgr/smp_svr/prj_ram_load.conf new file mode 100644 index 00000000000..20f347ae188 --- /dev/null +++ b/samples/subsys/mgmt/mcumgr/smp_svr/prj_ram_load.conf @@ -0,0 +1,48 @@ +# Enable MCUmgr and dependencies. +CONFIG_NET_BUF=y +CONFIG_ZCBOR=y +CONFIG_CRC=y +CONFIG_MCUMGR=y +CONFIG_STREAM_FLASH=y +CONFIG_FLASH_MAP=y + +# Some command handlers require a large stack. +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2304 +CONFIG_MAIN_STACK_SIZE=2048 + +# Ensure an MCUboot-compatible binary is generated. +CONFIG_BOOTLOADER_MCUBOOT=y + +# Enable flash operations. +CONFIG_FLASH=y + +# Required by the `taskstat` command. +CONFIG_THREAD_MONITOR=y + +# Support for taskstat command +CONFIG_MCUMGR_GRP_OS_TASKSTAT=y + +# Enable statistics and statistic names. +CONFIG_STATS=y +CONFIG_STATS_NAMES=y + +# Enable most core commands. +CONFIG_FLASH=y +CONFIG_IMG_MANAGER=y +CONFIG_MCUMGR_GRP_IMG=y +CONFIG_MCUMGR_GRP_OS=y +CONFIG_MCUMGR_GRP_STAT=y + +# Enable logging +CONFIG_LOG=y +CONFIG_MCUBOOT_UTIL_LOG_LEVEL_WRN=y + +# Disable debug logging +CONFIG_LOG_MAX_LEVEL=3 + +# Enable retained memory and retention +CONFIG_RETAINED_MEM=y +CONFIG_RETENTION=y +CONFIG_RETAINED_MEM_ZEPHYR_RAM=y +CONFIG_RETENTION_BOOTLOADER_INFO=y +CONFIG_RETENTION_BOOTLOADER_INFO_TYPE_MCUBOOT=y diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml b/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml index 13cd6d6a299..47a92013967 100644 --- a/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml +++ b/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml @@ -158,3 +158,26 @@ tests: - mg100 integration_platforms: - nrf52840dk/nrf52840 + sample.mcumgr.smp_svr.ram_load: + sysbuild: true + extra_args: FILE_SUFFIX="ram_load" + platform_allow: + - nrf52840dk/nrf52840 + integration_platforms: + - nrf52840dk/nrf52840 + sample.mcumgr.smp_svr.ram_load.serial: + sysbuild: true + extra_args: FILE_SUFFIX="ram_load" + EXTRA_CONF_FILE="overlay-serial.conf" + platform_allow: + - nrf52840dk/nrf52840 + integration_platforms: + - nrf52840dk/nrf52840 + sample.mcumgr.smp_svr.ram_load.serial.fs.shell: + sysbuild: true + extra_args: FILE_SUFFIX="ram_load" + EXTRA_CONF_FILE="overlay-serial.conf;overlay-fs.conf;overlay-shell.conf" + platform_allow: + - nrf52840dk/nrf52840 + integration_platforms: + - nrf52840dk/nrf52840 diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild/CMakeLists.txt b/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild/CMakeLists.txt new file mode 100644 index 00000000000..7eb859ef469 --- /dev/null +++ b/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild/CMakeLists.txt @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: Apache-2.0 + +if("${FILE_SUFFIX}" STREQUAL "ram_load") + set(mcuboot_EXTRA_DTC_OVERLAY_FILE "${CMAKE_CURRENT_LIST_DIR}/nrf52840dk_nrf52840_mcuboot_ram_load.overlay" CACHE INTERNAL "" FORCE) +endif() + +find_package(Sysbuild REQUIRED HINTS $ENV{ZEPHYR_BASE}) + +project(sysbuild LANGUAGES) diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild/mcuboot_ram_load.conf b/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild/mcuboot_ram_load.conf new file mode 100644 index 00000000000..5ca11904135 --- /dev/null +++ b/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild/mcuboot_ram_load.conf @@ -0,0 +1,9 @@ +CONFIG_SRAM_SIZE=30 +CONFIG_RETAINED_MEM=y +CONFIG_RETENTION=y +CONFIG_RETAINED_MEM_ZEPHYR_RAM=y +CONFIG_BOOT_SHARE_DATA=y +CONFIG_BOOT_SHARE_DATA_BOOTINFO=y +CONFIG_BOOT_SHARE_BACKEND_RETENTION=y +CONFIG_FLASH=y +CONFIG_FLASH_MAP=y diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild/nrf52840dk_nrf52840_mcuboot_ram_load.overlay b/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild/nrf52840dk_nrf52840_mcuboot_ram_load.overlay new file mode 100644 index 00000000000..70dd92d78d6 --- /dev/null +++ b/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild/nrf52840dk_nrf52840_mcuboot_ram_load.overlay @@ -0,0 +1,25 @@ +/ { + sram@2003F000 { + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x2003F000 DT_SIZE_K(1)>; + zephyr,memory-region = "RetainedMem"; + status = "okay"; + + retainedmem { + compatible = "zephyr,retained-ram"; + status = "okay"; + #address-cells = <1>; + #size-cells = <1>; + + boot_info0: boot_info@0 { + compatible = "zephyr,retention"; + status = "okay"; + reg = <0x0 0x100>; + }; + }; + }; + + chosen { + zephyr,bootloader-info = &boot_info0; + }; +}; diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild_ram_load.conf b/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild_ram_load.conf new file mode 100644 index 00000000000..e1579f439bb --- /dev/null +++ b/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild_ram_load.conf @@ -0,0 +1,3 @@ +# Enable MCUboot bootloader support and use RAM load mode +SB_CONFIG_BOOTLOADER_MCUBOOT=y +SB_CONFIG_MCUBOOT_MODE_RAM_LOAD=y