diff --git a/samples/zephyr/hello_world_mini_boot/CMakeLists.txt b/samples/zephyr/hello_world_mini_boot/CMakeLists.txt new file mode 100644 index 00000000000..5cea844b5d9 --- /dev/null +++ b/samples/zephyr/hello_world_mini_boot/CMakeLists.txt @@ -0,0 +1,11 @@ +# +# Copyright (c) 2025 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(hello_world_mini_boot) + +target_sources(app PRIVATE ${ZEPHYR_BASE}/samples/subsys/mgmt/mcumgr/smp_svr/src/main.c) diff --git a/samples/zephyr/hello_world_mini_boot/VERSION b/samples/zephyr/hello_world_mini_boot/VERSION new file mode 100644 index 00000000000..083d7bf3119 --- /dev/null +++ b/samples/zephyr/hello_world_mini_boot/VERSION @@ -0,0 +1,5 @@ +VERSION_MAJOR = 1 +VERSION_MINOR = 0 +PATCHLEVEL = 0 +VERSION_TWEAK = 0 +EXTRAVERSION = dev diff --git a/samples/zephyr/hello_world_mini_boot/prj.conf b/samples/zephyr/hello_world_mini_boot/prj.conf new file mode 100644 index 00000000000..2a250e4f807 --- /dev/null +++ b/samples/zephyr/hello_world_mini_boot/prj.conf @@ -0,0 +1,49 @@ +# NOTE: Copied from smp_svr_mini_boot + +# 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=2176 + +# Ensure an MCUboot-compatible binary is generated. +CONFIG_BOOTLOADER_MCUBOOT=y + +# Enable flash operations. +CONFIG_FLASH=y + +# Enable most core commands. +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 the Shell mcumgr transport. +CONFIG_BASE64=y +CONFIG_CRC=y +CONFIG_SHELL=y +CONFIG_SHELL_BACKEND_SERIAL=y +CONFIG_MCUMGR_TRANSPORT_SHELL=y + +CONFIG_MCUMGR_TRANSPORT_NETBUF_SIZE=1220 +CONFIG_MCUMGR_GRP_OS_MCUMGR_PARAMS=y +CONFIG_MCUMGR_TRANSPORT_WORKQUEUE_STACK_SIZE=4608 + +# Disable shell commands that are not needed +CONFIG_CLOCK_CONTROL_NRF_SHELL=n +CONFIG_DEVICE_SHELL=n +CONFIG_DEVMEM_SHELL=n +CONFIG_FLASH_SHELL=n diff --git a/samples/zephyr/hello_world_mini_boot/sysbuild.conf b/samples/zephyr/hello_world_mini_boot/sysbuild.conf new file mode 100644 index 00000000000..0f4dda0350c --- /dev/null +++ b/samples/zephyr/hello_world_mini_boot/sysbuild.conf @@ -0,0 +1,4 @@ +# Enable MCUboot bootloader support +SB_CONFIG_BOOTLOADER_MCUBOOT=y +SB_CONFIG_BOOT_SIGNATURE_TYPE_ECDSA_P256=y +SB_CONFIG_MCUBOOT_MODE_DIRECT_XIP=y diff --git a/samples/zephyr/hello_world_mini_boot/sysbuild/mcuboot/prj.conf b/samples/zephyr/hello_world_mini_boot/sysbuild/mcuboot/prj.conf new file mode 100644 index 00000000000..ababbaf7d33 --- /dev/null +++ b/samples/zephyr/hello_world_mini_boot/sysbuild/mcuboot/prj.conf @@ -0,0 +1,62 @@ +# INFO: Config below from mcuboot's prj.conf + +CONFIG_MAIN_STACK_SIZE=10240 + +CONFIG_FLASH=y + +# TODO: Uncomment to enable mcuboot logs +# CONFIG_LOG=y +# CONFIG_LOG_MODE_MINIMAL=y +# CONFIG_LOG_DEFAULT_LEVEL=0 +# CONFIG_MCUBOOT_LOG_LEVEL_DBG=y +# TODO: Comment-out to enable mcuboot logs (increases footprint by ~ 1KiB) +CONFIG_SERIAL=n +CONFIG_CONSOLE=n +CONFIG_UART_CONSOLE=n + +# INFO: Config below from mcuboot's soc/nrf54l05_cpuapp.conf + +CONFIG_SPI_NOR=n + +CONFIG_BOOT_WATCHDOG_FEED=n + +# Ensure the fastest RRAM write operations +# NOTE: Default value is 1. +# Setting it to 32 increases binary size by 8B. +# According to the comment above, RRAM write speed might decrease without it. +# CONFIG_NRF_RRAM_WRITE_BUFFER_SIZE=32 + + +# INFO: Section below is from smp_svr_mini_boot + +# NOTE: No direct impact on binary size, as the option is set to y anyway. +# However considering the purpose of the minimal config, it might be worth to set it explicitly. +CONFIG_SIZE_OPTIMIZATIONS=y + +CONFIG_BOOT_BANNER=n +CONFIG_NCS_BOOT_BANNER=n +CONFIG_PRINTK=n +CONFIG_GPIO=n + +# WARN: Using this prevents app showing logs but saves 0.1 KiB of flash +# NOTE: When logs are disabled, uncommenting this has no influence on size and app logs correctly +# CONFIG_NRF_GRTC_START_SYSCOUNTER=n + +CONFIG_MINIMAL_LIBC=y +CONFIG_LTO=y +CONFIG_ISR_TABLES_LOCAL_DECLARATION=y + +# INFO: Configs below were originally in boards/nrf54l15dk_nrf54l05_cpuapp.conf +# Moved here for simpler structure, as the sample is intended only for l05 for now. + +CONFIG_SYS_CLOCK_EXISTS=n +CONFIG_NRF_GRTC_TIMER=n + +CONFIG_PSA_CRYPTO_DRIVER_CRACEN=n +CONFIG_PSA_CRYPTO_DRIVER_OBERON=n + +CONFIG_NRF_OBERON=y +CONFIG_BOOT_ECDSA_NRF_OBERON_EXPERIMENT=y + +# NOTE: Needed for direct-xip +CONFIG_PM_PARTITION_SIZE_MCUBOOT=0x7000 diff --git a/west.yml b/west.yml index bc409a25b4f..58bc7803114 100644 --- a/west.yml +++ b/west.yml @@ -126,7 +126,7 @@ manifest: compare-by-default: true - name: mcuboot repo-path: sdk-mcuboot - revision: 459288d6a13cede9fa09e314b21a979a6cc6e3f2 + revision: pull/559/head path: bootloader/mcuboot - name: qcbor url: https://github.com/laurencelundblade/QCBOR