Skip to content

Commit e883037

Browse files
committed
module: trusted-firmware-m: Add 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 185991e commit e883037

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-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 (NOT CONFIG_TFM_STM32_FLASH_LAYOUT_BEGIN_OFFSET EQUAL 0)
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: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,4 +517,12 @@ 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+
default 0
523+
help
524+
Add an offset at the beginning of the platform flash layout defined by
525+
TF-M. The platform uses this gap for platform specific reason, as for
526+
example when a bootloader that is external to TF-M is used.
527+
520528
endif # BUILD_WITH_TFM

0 commit comments

Comments
 (0)