Skip to content

Commit e96b790

Browse files
nordicjmde-nordic
authored andcommitted
boot: zephyr: cmake: Add support for sub-partitions
Adds support for having slots placed in sub-partition nodes when working the overhead of MCUboot images Signed-off-by: Jamie McCrae <[email protected]>
1 parent 6faf53a commit e96b790

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

boot/zephyr/CMakeLists.txt

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -424,11 +424,11 @@ function(align_up num align result)
424424
set(${result} "${out}" PARENT_SCOPE)
425425
endfunction()
426426

427-
function(dt_get_parent node)
428-
string(FIND "${${node}}" "/" pos REVERSE)
427+
function(dt_get_flash_device node)
428+
string(FIND "${${node}}" "/partitions" pos)
429429

430430
if(pos EQUAL -1)
431-
message(FATAL_ERROR "Unable to get parent of node: ${${node}}")
431+
message(FATAL_ERROR "Cannot find partitions node in node: ${${node}}")
432432
endif()
433433

434434
string(SUBSTRING "${${node}}" 0 ${pos} ${node})
@@ -437,8 +437,7 @@ endfunction()
437437

438438
dt_nodelabel(slot0_flash NODELABEL "slot0_partition" REQUIRED)
439439
dt_prop(slot0_size PATH "${slot0_flash}" PROPERTY "reg" INDEX 1)
440-
dt_get_parent(slot0_flash)
441-
dt_get_parent(slot0_flash)
440+
dt_get_flash_device(slot0_flash)
442441
dt_prop(erase_size_slot0 PATH "${slot0_flash}" PROPERTY "erase-block-size")
443442
dt_prop(write_size_slot0 PATH "${slot0_flash}" PROPERTY "write-block-size")
444443

@@ -455,8 +454,7 @@ endif()
455454
if(NOT CONFIG_SINGLE_APPLICATION_SLOT AND NOT CONFIG_SINGLE_APPLICATION_SLOT_RAM_LOAD)
456455
dt_nodelabel(slot1_flash NODELABEL "slot1_partition" REQUIRED)
457456
dt_prop(slot1_size PATH "${slot1_flash}" PROPERTY "reg" INDEX 1)
458-
dt_get_parent(slot1_flash)
459-
dt_get_parent(slot1_flash)
457+
dt_get_flash_device(slot1_flash)
460458
dt_prop(erase_size_slot1 PATH "${slot1_flash}" PROPERTY "erase-block-size")
461459
dt_prop(write_size_slot1 PATH "${slot1_flash}" PROPERTY "write-block-size")
462460

@@ -514,13 +512,11 @@ if(SYSBUILD)
514512
if(CONFIG_SINGLE_APPLICATION_SLOT OR CONFIG_BOOT_FIRMWARE_LOADER OR CONFIG_BOOT_SWAP_USING_SCRATCH OR CONFIG_BOOT_SWAP_USING_MOVE OR CONFIG_BOOT_SWAP_USING_OFFSET OR CONFIG_BOOT_UPGRADE_ONLY OR CONFIG_BOOT_DIRECT_XIP OR CONFIG_BOOT_RAM_LOAD)
515513
# TODO: RAM LOAD support
516514
dt_nodelabel(slot0_flash NODELABEL "slot0_partition" REQUIRED)
517-
dt_get_parent(slot0_flash)
518-
dt_get_parent(slot0_flash)
515+
dt_get_flash_device(slot0_flash)
519516

520517
if(NOT CONFIG_SINGLE_APPLICATION_SLOT)
521518
dt_nodelabel(slot1_flash NODELABEL "slot1_partition" REQUIRED)
522-
dt_get_parent(slot1_flash)
523-
dt_get_parent(slot1_flash)
519+
dt_get_flash_device(slot1_flash)
524520

525521
if(NOT "${slot0_flash}" STREQUAL "${slot1_flash}")
526522
# Check both slots for the one with the largest write/erase block size

0 commit comments

Comments
 (0)