Skip to content

Commit 376b006

Browse files
committed
trusted-firmware-m: Set --confirm when signing
The current behavior when signing an image adds --pad but does not confirm the image. This appears to be a mistake, as the user should inspect the image status in the Firmware Upgrade software. If an image is not --confirmed, the FSM cannot infer the correct states. This sets the image as confirmed to resolve the issue. Signed-off-by: BUDKE Gerson Fernando <[email protected]>
1 parent e402ea2 commit 376b006

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

modules/trusted-firmware-m/CMakeLists.txt

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -502,14 +502,18 @@ if (CONFIG_BUILD_WITH_TFM)
502502
endif()
503503
endif()
504504

505-
function(tfm_sign OUT_ARG SUFFIX HEADER TRAILER MAX_SECTORS INPUT_FILE OUTPUT_FILE)
505+
function(tfm_sign OUT_ARG SUFFIX HEADER TRAILER CONFIRM MAX_SECTORS INPUT_FILE OUTPUT_FILE)
506506
if(HEADER AND TRAILER)
507507
set(pad_args --pad --pad-header)
508508
elseif(HEADER)
509509
set(pad_args --pad-header)
510510
elseif(TRAILER)
511511
set(pad_args --pad)
512512
endif()
513+
if(CONFIRM)
514+
# --confirm imply PAD
515+
set(confirm --confirm)
516+
endif()
513517
# Secure + Non-secure images are signed the same way as a secure only
514518
# build, but with a different layout file.
515519
set(layout_file ${PREPROCESSED_FILE_${SUFFIX}})
@@ -529,6 +533,7 @@ if (CONFIG_BUILD_WITH_TFM)
529533
--max-sectors ${MAX_SECTORS}
530534
-v ${CONFIG_TFM_IMAGE_VERSION_${SUFFIX}}
531535
${pad_args}
536+
${confirm}
532537
${HEX_ADDR_ARGS_${SUFFIX}}
533538
${ADD_${SUFFIX}_IMAGE_MIN_VER}
534539
-s ${CONFIG_TFM_IMAGE_SECURITY_COUNTER}
@@ -567,7 +572,7 @@ if (CONFIG_BUILD_WITH_TFM)
567572
)
568573

569574
elseif(CONFIG_TFM_MCUBOOT_IMAGE_NUMBER STREQUAL "1")
570-
tfm_sign(sign_cmd S_NS TRUE TRUE ${S_NS_MAX_SECTORS} ${S_NS_FILE} ${S_NS_SIGNED_FILE})
575+
tfm_sign(sign_cmd S_NS TRUE TRUE TRUE ${S_NS_MAX_SECTORS} ${S_NS_FILE} ${S_NS_SIGNED_FILE})
571576

572577
set_property(GLOBAL APPEND PROPERTY extra_post_build_commands
573578
COMMAND ${PYTHON_EXECUTABLE} ${ZEPHYR_BASE}/scripts/build/mergehex.py
@@ -592,12 +597,12 @@ if (CONFIG_BUILD_WITH_TFM)
592597

593598
else()
594599
if (CONFIG_TFM_USE_NS_APP)
595-
tfm_sign(sign_cmd_ns NS TRUE TRUE ${S_NS_MAX_SECTORS} ${NS_APP_FILE} ${NS_SIGNED_FILE})
600+
tfm_sign(sign_cmd_ns NS TRUE TRUE TRUE ${S_NS_MAX_SECTORS} ${NS_APP_FILE} ${NS_SIGNED_FILE})
596601
else()
597-
tfm_sign(sign_cmd_ns NS FALSE TRUE ${S_NS_MAX_SECTORS} ${NS_APP_FILE} ${NS_SIGNED_FILE})
602+
tfm_sign(sign_cmd_ns NS FALSE TRUE TRUE ${S_NS_MAX_SECTORS} ${NS_APP_FILE} ${NS_SIGNED_FILE})
598603
endif()
599604

600-
tfm_sign(sign_cmd_s S TRUE TRUE ${S_NS_MAX_SECTORS} $<TARGET_PROPERTY:tfm,TFM_S_HEX_FILE>
605+
tfm_sign(sign_cmd_s S TRUE TRUE TRUE ${S_NS_MAX_SECTORS} $<TARGET_PROPERTY:tfm,TFM_S_HEX_FILE>
601606
${S_SIGNED_FILE})
602607

603608
#Create and sign for concatenated binary image, should align with the TF-M BL2

0 commit comments

Comments
 (0)