Commit 86678000 authored by Benedek Kupper's avatar Benedek Kupper Committed by Jamie
Browse files

zephyr: use REQUIRED in dt_nodelabel calls to fail early and with meaningful message



When the devicetree was missing a label, I'd get this kind of errors,
which were not very helpful:
CMake Error at workspace/zephyr/cmake/modules/extensions.cmake:3979 (message):
  dt_prop(erase_size_slot1 ...) missing required argument: PATH
Call Stack (most recent call first):
  CMakeLists.txt:496 (dt_prop)

The new error message looks like this:
CMake Error at workspace/zephyr/cmake/modules/extensions.cmake:3748 (message):
  required nodelabel not found: slot1_partition

Signed-off-by: default avatarBenedek Kupper <kupper.benedek@gmail.com>
parent 351eb15a
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -478,7 +478,7 @@ function(dt_get_parent node)
  set(${node} "${${node}}" PARENT_SCOPE)
endfunction()

dt_nodelabel(slot0_flash NODELABEL "slot0_partition")
dt_nodelabel(slot0_flash NODELABEL "slot0_partition" REQUIRED)
dt_prop(slot0_size PATH "${slot0_flash}" PROPERTY "reg" INDEX 1)
dt_get_parent(slot0_flash)
dt_get_parent(slot0_flash)
@@ -496,7 +496,7 @@ if(CONFIG_BOOT_SWAP_USING_MOVE OR CONFIG_BOOT_SWAP_USING_OFFSET)
endif()

if(NOT CONFIG_SINGLE_APPLICATION_SLOT AND NOT CONFIG_SINGLE_APPLICATION_SLOT_RAM_LOAD)
  dt_nodelabel(slot1_flash NODELABEL "slot1_partition")
  dt_nodelabel(slot1_flash NODELABEL "slot1_partition" REQUIRED)
  dt_prop(slot1_size PATH "${slot1_flash}" PROPERTY "reg" INDEX 1)
  dt_get_parent(slot1_flash)
  dt_get_parent(slot1_flash)
@@ -556,12 +556,12 @@ endif()
if(SYSBUILD)
  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)
    # TODO: RAM LOAD support
    dt_nodelabel(slot0_flash NODELABEL "slot0_partition")
    dt_nodelabel(slot0_flash NODELABEL "slot0_partition" REQUIRED)
    dt_get_parent(slot0_flash)
    dt_get_parent(slot0_flash)

    if(NOT CONFIG_SINGLE_APPLICATION_SLOT)
      dt_nodelabel(slot1_flash NODELABEL "slot1_partition")
      dt_nodelabel(slot1_flash NODELABEL "slot1_partition" REQUIRED)
      dt_get_parent(slot1_flash)
      dt_get_parent(slot1_flash)