Skip to content

Commit 05f70dd

Browse files
committed
modules: trusted-firmware-m: Add STM32_FLASH_LAYOUT_BEGIN_OFFSET
Add TF-M directive STM32_FLASH_LAYOUT_BEGIN_OFFSET needed to specify the gap needed by external boot stage resources at flash beginning. The offset tells STM32 TF-M firmware the base offset in the flash where the several TF-M and non-secure image areas shall be located. The CMake directive was introduced mainline TF-M commit [1] and merged in Zephyr TF-M repository [2]. Link: TrustedFirmware-M/trusted-firmware-m@fc035b8 [1] Link: zephyrproject-rtos/trusted-firmware-m@954dc80 [2] Signed-off-by: Etienne Carriere <[email protected]>
1 parent 97fc2b7 commit 05f70dd

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

modules/trusted-firmware-m/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,12 @@ if (CONFIG_BUILD_WITH_TFM)
281281
list(APPEND TFM_CMAKE_ARGS -DETHOS_DRIVER_PATH=${CONFIG_TFM_ETHOS_DRIVER_PATH_LOCAL})
282282
endif()
283283

284+
if(CONFIG_TFM_STM32_FLASH_LAYOUT_BEGIN_OFFSET)
285+
list(APPEND TFM_CMAKE_ARGS
286+
-DSTM32_FLASH_LAYOUT_BEGIN_OFFSET=${CONFIG_TFM_STM32_FLASH_LAYOUT_BEGIN_OFFSET}
287+
)
288+
endif()
289+
284290
file(MAKE_DIRECTORY ${TFM_BINARY_DIR})
285291
add_custom_target(tfm_cmake
286292
DEPENDS ${TFM_BINARY_DIR}/CMakeCache.txt

modules/trusted-firmware-m/Kconfig.tfm

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,4 +517,14 @@ config TFM_EXCEPTION_INFO_DUMP
517517
On fatal errors in the secure firmware, capture info about the exception.
518518
Print the info if the SPM log level is sufficient.
519519

520+
config TFM_STM32_FLASH_LAYOUT_BEGIN_OFFSET
521+
int "Offset gap at beginning of flash layout"
522+
depends on SOC_FAMILY_STM32
523+
default 0
524+
help
525+
Set an offset at the beginning of the STM32 platform flash
526+
layout above which TF-M resources location start. The platform uses
527+
this gap for platform specific reason, as for example when a
528+
bootloader that is external to TF-M is used.
529+
520530
endif # BUILD_WITH_TFM

0 commit comments

Comments
 (0)