Skip to content

Commit

Permalink
cmake: partition_manager: Generate images for S0/S1 to external flash
Browse files Browse the repository at this point in the history
Implemented a fix in MCUBoot for NSIB + Multi-image for nRF53.

This enables partition manager and the build system to generate images
for S1 and S0 with the address of external QSPI flash. If the QSPI node
with XiP is defined in the DTS.

This is the same code used to move the application update into the
secondary slot in external flash.

Ref. NCSDK-19223

Signed-off-by: Sigvart Hovland <sigvart.hovland@nordicsemi.no>
  • Loading branch information
sigvartmh authored and de-nordic committed Aug 23, 2023
1 parent 1b98897 commit 680a3d1
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions cmake/partition_manager.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,27 @@ if (CONFIG_SECURE_BOOT AND CONFIG_BOOTLOADER_MCUBOOT)
# of the symbols used to generate the offset is only available as a
# generator expression when MCUBoots cmake code exectues. This because
# partition manager is performed as the last step in the configuration stage.
math(EXPR s0_offset "${PM_MCUBOOT_SECONDARY_ADDRESS} - ${PM_S0_ADDRESS}")
math(EXPR s1_offset "${PM_MCUBOOT_SECONDARY_ADDRESS} - ${PM_S1_ADDRESS}")
if(CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY AND CONFIG_HAS_HW_NRF_QSPI)
if(DEFINED ext_flash_dev)
get_filename_component(qspi_node ${ext_flash_dev} DIRECTORY)
else()
dt_nodelabel(qspi_node NODELABEL "qspi")
endif()
if(DEFINED qspi_node)
dt_reg_addr(xip_addr PATH ${qspi_node} NAME qspi_mm)
if(NOT DEFINED xip_addr)
message(WARNING "\
Could not find memory mapped address for XIP. Generated update hex files will \
not have the correct base address. Hence they can not be programmed directly \
to the external flash")
endif()
endif()
else()
set(xip_addr 0)
endif()

math(EXPR s0_offset "${xip_addr} + ${PM_MCUBOOT_SECONDARY_ADDRESS} - ${PM_S0_ADDRESS}")
math(EXPR s1_offset "${xip_addr} + ${PM_MCUBOOT_SECONDARY_ADDRESS} - ${PM_S1_ADDRESS}")

set_property(
TARGET partition_manager
Expand Down

0 comments on commit 680a3d1

Please sign in to comment.