Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions cmake/sysbuild/b0_mcuboot_signing.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ function(ncs_secure_boot_mcuboot_sign application bin_files signed_targets prefi
sysbuild_get(CONFIG_BUILD_OUTPUT_HEX IMAGE ${application} VAR CONFIG_BUILD_OUTPUT_HEX KCONFIG)

string(TOUPPER "${application}" application_uppercase)
set(imgtool_rom_command --rom-fixed $<TARGET_PROPERTY:partition_manager,${prefix}PM_${application_uppercase}_ADDRESS>)
set(imgtool_sign ${PYTHON_EXECUTABLE} ${IMGTOOL} sign --version ${SB_CONFIG_SECURE_BOOT_MCUBOOT_VERSION} --align 4 --slot-size $<TARGET_PROPERTY:partition_manager,${prefix}PM_${application_uppercase}_SIZE> --pad-header --header-size ${SB_CONFIG_PM_MCUBOOT_PAD})

if(SB_CONFIG_MCUBOOT_HARDWARE_DOWNGRADE_PREVENTION)
Expand Down Expand Up @@ -70,7 +71,7 @@ function(ncs_secure_boot_mcuboot_sign application bin_files signed_targets prefi
# Hence, if a programmer is given this hex file, it will flash it
# to the secondary slot, and upon reboot mcuboot will swap in the
# contents of the hex file.
${imgtool_sign} ${imgtool_extra} ${CMAKE_BINARY_DIR}/signed_by_b0_${application}.bin ${output}.bin
${imgtool_sign} ${imgtool_extra} ${imgtool_rom_command} ${CMAKE_BINARY_DIR}/signed_by_b0_${application}.bin ${output}.bin

DEPENDS
${application}_extra_byproducts
Expand All @@ -93,7 +94,7 @@ function(ncs_secure_boot_mcuboot_sign application bin_files signed_targets prefi
# Hence, if a programmer is given this hex file, it will flash it
# to the secondary slot, and upon reboot mcuboot will swap in the
# contents of the hex file.
${imgtool_sign} ${imgtool_extra} ${CMAKE_BINARY_DIR}/signed_by_b0_${application}.hex ${output}.hex
${imgtool_sign} ${imgtool_extra} ${imgtool_rom_command} ${CMAKE_BINARY_DIR}/signed_by_b0_${application}.hex ${output}.hex

DEPENDS
${application}_extra_byproducts
Expand Down
11 changes: 5 additions & 6 deletions cmake/sysbuild/image_signing.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ function(zephyr_mcuboot_tasks)
else()
set(imgtool_rom_command --rom-fixed @PM_MCUBOOT_PRIMARY_ADDRESS@)
endif()
else()
set(imgtool_rom_command --rom-fixed @PM_MCUBOOT_PRIMARY_ADDRESS@)
endif()

# Split fields, imgtool_sign_sysbuild is stored in cache which will have fields updated by
Expand All @@ -86,12 +88,9 @@ function(zephyr_mcuboot_tasks)
set(imgtool_sign_sysbuild --slot-size @PM_MCUBOOT_PRIMARY_SIZE@ --pad-header --header-size @PM_MCUBOOT_PAD_SIZE@ ${imgtool_rom_command} CACHE STRING "imgtool sign sysbuild replacement")
set(imgtool_sign ${PYTHON_EXECUTABLE} ${IMGTOOL} sign --version ${CONFIG_MCUBOOT_IMGTOOL_SIGN_VERSION} --align ${write_block_size} ${imgtool_sign_sysbuild})
else()
set(imgtool_rom_command)
if(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP_WITH_REVERT OR CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP)
dt_chosen(code_partition PROPERTY "zephyr,code-partition")
dt_partition_addr(code_partition_offset PATH "${code_partition}" REQUIRED)
set(imgtool_rom_command --rom-fixed ${code_partition_offset})
endif()
dt_chosen(code_partition PROPERTY "zephyr,code-partition")
dt_partition_addr(code_partition_offset PATH "${code_partition}" REQUIRED)
set(imgtool_rom_command --rom-fixed ${code_partition_offset})
set(imgtool_sign ${PYTHON_EXECUTABLE} ${IMGTOOL} sign --version ${CONFIG_MCUBOOT_IMGTOOL_SIGN_VERSION} --align ${write_block_size} --slot-size ${slot_size} --header-size ${CONFIG_ROM_START_OFFSET} ${imgtool_rom_command})
endif()

Expand Down
1 change: 1 addition & 0 deletions cmake/sysbuild/image_signing_firmware_loader.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ function(zephyr_mcuboot_tasks)
# from being updated without a pristine build
# TODO: NCSDK-28461 sysbuild PM fields cannot be updated without a pristine build, will become
# invalid if a static PM file is updated without pristine build
set(imgtool_rom_command --rom-fixed @PM_MCUBOOT_SECONDARY_ADDRESS@)
set(imgtool_sign_sysbuild --slot-size @PM_MCUBOOT_SECONDARY_SIZE@ --pad-header --header-size @PM_MCUBOOT_PAD_SIZE@ ${imgtool_rom_command} CACHE STRING "imgtool sign sysbuild replacement")
set(imgtool_sign ${PYTHON_EXECUTABLE} ${IMGTOOL} sign --version ${CONFIG_MCUBOOT_IMGTOOL_SIGN_VERSION} --align ${write_block_size} ${imgtool_sign_sysbuild})

Expand Down
2 changes: 2 additions & 0 deletions sysbuild/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,8 @@ function(${SYSBUILD_CURRENT_MODULE_NAME}_post_cmake)
if(SB_CONFIG_MCUBOOT_MODE_DIRECT_XIP OR SB_CONFIG_MCUBOOT_MODE_DIRECT_XIP_WITH_REVERT)
get_property(PM_MCUBOOT_PRIMARY_ADDRESS TARGET partition_manager PROPERTY PM_MCUBOOT_PRIMARY_ADDRESS)
get_property(PM_MCUBOOT_SECONDARY_ADDRESS TARGET partition_manager PROPERTY PM_MCUBOOT_SECONDARY_ADDRESS)
else()
get_property(PM_MCUBOOT_PRIMARY_ADDRESS TARGET partition_manager PROPERTY PM_MCUBOOT_PRIMARY_ADDRESS)
endif()

if(SB_CONFIG_MATTER_FACTORY_DATA_GENERATE)
Expand Down
2 changes: 1 addition & 1 deletion west.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ manifest:
compare-by-default: true
- name: mcuboot
repo-path: sdk-mcuboot
revision: 6256d9f6df644231fd196c94a5a92f23c1ad24d4
revision: pull/461/head
path: bootloader/mcuboot
- name: qcbor
url: https://github.com/laurencelundblade/QCBOR
Expand Down
Loading