Skip to content

Commit 5ddb364

Browse files
committed
single_slot: Remove default overlay
The default overlay for FW loader sets code-partition to slot1_partition, which stays with direct conflict with the merged slot approach: - slot1_partition must point to the merged partition to allow SMP logic to parse the FW loader magic & version - if FW loader indeed uses slot1_partition with ROM_START_OFFSET, than it is impossible to correctly boot the radio core FW, since it cannot use the same value of the ROM_START_OFFSET (2kB NVM waste) and there is no way to tell the FW loader code in soc.c to boot the radio with a different value of ROM_START_OFFSET. - the size of the code-partition must be different from the size of the partition parsed by the SMP, so there is a protection against potential code partition overflow and the flash area API can reach past the code partition area. One solution would be to change the contents of the FIRMWARE_LOADER_image_default.overlay, but since it would force every user of the FW loader within Zephyr to add a new partition alias, it is far less intrusive to remove this overlay from sysbuild.cmake script in those samples, that use merged slot approach. Ref: NCSDK-36779 Signed-off-by: Tomasz Chyrowicz <[email protected]>
1 parent 0590959 commit 5ddb364

File tree

3 files changed

+31
-10
lines changed

3 files changed

+31
-10
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#
2+
# Copyright (c) 2025 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
cmake_minimum_required(VERSION 3.20.0)
8+
if (SB_CONFIG_MCUBOOT_SIGN_MERGED_BINARY)
9+
# If firmware loader images are merged, there is a necessity to use a different code-partition
10+
# than the slot1_partition, enforced by the FIRMWARE_LOADER_image_default.overlay, configured
11+
# through EXTRA_DTC_OVERLAY_FILE cache variable.
12+
# In the merged slot approach the slot1_partition should be defined as the merged partition and
13+
# code-partition should point to a subpartition of the slot1_partition.
14+
# The code-partition is configured in the image-specific overlay files.
15+
FirmwareUpdaterImage_Get(fw_loader_images)
16+
foreach(image IN LISTS fw_loader_images)
17+
# Remove the default overlay file.
18+
set(${image}_EXTRA_DTC_OVERLAY_FILE "" CACHE INTERNAL "Application extra DTC overlay file"
19+
FORCE)
20+
endforeach()
21+
endif()

samples/dfu/single_slot/sysbuild/ble_mcumgr/boards/nrf54h20dk_nrf54h20_cpuapp.overlay

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
#include "../../nrf54h20.overlay"
88

9-
/* The zephyr,code-partition is always set to fw_loader_partition in firmware
10-
* loader image(s).
11-
*/
12-
/delete-node/ &slot1_partition;
13-
slot1_partition: &fw_loader_partition {};
9+
/ {
10+
chosen {
11+
zephyr,code-partition = &fw_loader_partition;
12+
};
13+
};

samples/dfu/single_slot/sysbuild/fw_loader_ipc_radio.overlay

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
#include "nrf54h20.overlay"
88

9-
/* The zephyr,code-partition is always set to fw_loader_partition in firmware
10-
* loader image(s).
11-
*/
12-
/delete-node/ &slot1_partition;
13-
slot1_partition: &cpurad_slot0_partition {};
9+
/ {
10+
chosen {
11+
zephyr,code-partition = &cpurad_slot0_partition;
12+
};
13+
};

0 commit comments

Comments
 (0)