Skip to content

Commit

Permalink
Kconfig.tfm: Add TFM_MCUBOOT_IMAGE_NUMBER config
Browse files Browse the repository at this point in the history
Controlling the number of images in TFM's BL2/mcuboot.

Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
  • Loading branch information
oyvindronningstad authored and ioannisg committed Feb 17, 2021
1 parent 2011030 commit b49e395
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
12 changes: 11 additions & 1 deletion modules/trusted-firmware-m/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
# BUILD_PROFILE profile_small)
function(trusted_firmware_build)
set(options IPC REGRESSION)
set(oneValueArgs BINARY_DIR BOARD BL2 ISOLATION_LEVEL CMAKE_BUILD_TYPE BUILD_PROFILE)
set(oneValueArgs BINARY_DIR BOARD BL2 ISOLATION_LEVEL CMAKE_BUILD_TYPE BUILD_PROFILE
MCUBOOT_IMAGE_NUMBER)
cmake_parse_arguments(TFM "${options}" "${oneValueArgs}" "" ${ARGN})

if(NOT DEFINED TFM_BL2)
Expand Down Expand Up @@ -63,6 +64,9 @@ function(trusted_firmware_build)
set(TFM_PROFILE_ARG -DTFM_PROFILE=${TFM_BUILD_PROFILE})
endif()

if(DEFINED TFM_MCUBOOT_IMAGE_NUMBER)
set(MCUBOOT_IMAGE_NUM_ARG -DMCUBOOT_IMAGE_NUMBER=${TFM_MCUBOOT_IMAGE_NUMBER})
endif()

set(VENEERS_FILE ${TFM_BINARY_DIR}/secure_fw/s_veneers.o)
set(PSA_API_NS_PATH ${TFM_BINARY_DIR}/interface/libpsa_api_ns.a)
Expand Down Expand Up @@ -125,6 +129,7 @@ function(trusted_firmware_build)
${TFM_ISOLATION_LEVEL_ARG}
${TFM_REGRESSION_ARG}
${TFM_PROFILE_ARG}
${MCUBOOT_IMAGE_NUM_ARG}
-DTFM_TEST_REPO_PATH=${ZEPHYR_TRUSTED_FIRMWARE_M_MODULE_DIR}/tf-m-tests
-DMCUBOOT_PATH=${ZEPHYR_TRUSTED_FIRMWARE_M_MODULE_DIR}/../tfm-mcuboot
BUILD_ALWAYS True
Expand Down Expand Up @@ -207,12 +212,17 @@ if (CONFIG_BUILD_WITH_TFM)
elseif (CONFIG_TFM_CMAKE_BUILD_TYPE_RELWITHDEBINFO)
set(TFM_CMAKE_BUILD_TYPE "RelWithDebInfo")
endif()
if (DEFINED CONFIG_TFM_MCUBOOT_IMAGE_NUMBER)
set(TFM_IMAGE_NUMBER_ARG
MCUBOOT_IMAGE_NUMBER ${CONFIG_TFM_MCUBOOT_IMAGE_NUMBER})
endif()

trusted_firmware_build(
BINARY_DIR ${CMAKE_BINARY_DIR}/tfm
BOARD ${CONFIG_TFM_BOARD}
${TFM_ISOLATION_LEVEL_ARG}
${TFM_PROFILE_ARG}
${TFM_IMAGE_NUMBER_ARG}
${TFM_BL2_ARG}
${TFM_IPC_ARG}
${TFM_REGRESSION_ARG}
Expand Down
10 changes: 10 additions & 0 deletions modules/trusted-firmware-m/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,16 @@ config TFM_BL2_FALSE

endchoice

config TFM_MCUBOOT_IMAGE_NUMBER
int "Granularity of FW updates of TFM and app"
range 1 2
default 2
help
How many images the bootloader sees when it looks at TFM and the app.
When this is 1, the S and NS are considered as 1 image and must be
updated in one atomic operation. When this is 2, they are split and
can be updated independently if dependency requirements are met.

config TFM_IPC
bool "IPC"
help
Expand Down

0 comments on commit b49e395

Please sign in to comment.