Skip to content

Commit b5ccb1b

Browse files
Kconfig.tfm: Add TFM_CMAKE_BUILD_TYPE config
Controlling the build type of the TFM build system. Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
1 parent dfa52a3 commit b5ccb1b

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

modules/trusted-firmware-m/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,15 @@ if (CONFIG_BUILD_WITH_TFM)
198198
if (CONFIG_TFM_PROFILE)
199199
set(TFM_PROFILE_ARG BUILD_PROFILE ${CONFIG_TFM_PROFILE})
200200
endif()
201+
if (CONFIG_TFM_CMAKE_BUILD_TYPE_RELEASE)
202+
set(TFM_CMAKE_BUILD_TYPE "Release")
203+
elseif (CONFIG_TFM_CMAKE_BUILD_TYPE_MINSIZEREL)
204+
set(TFM_CMAKE_BUILD_TYPE "MinSizeRel")
205+
elseif (CONFIG_TFM_CMAKE_BUILD_TYPE_DEBUG)
206+
set(TFM_CMAKE_BUILD_TYPE "Debug")
207+
elseif (CONFIG_TFM_CMAKE_BUILD_TYPE_RELWITHDEBINFO)
208+
set(TFM_CMAKE_BUILD_TYPE "RelWithDebInfo")
209+
endif()
201210

202211
trusted_firmware_build(
203212
BINARY_DIR ${CMAKE_BINARY_DIR}/tfm
@@ -207,6 +216,7 @@ if (CONFIG_BUILD_WITH_TFM)
207216
${TFM_BL2_ARG}
208217
${TFM_IPC_ARG}
209218
${TFM_REGRESSION_ARG}
219+
CMAKE_BUILD_TYPE ${TFM_CMAKE_BUILD_TYPE}
210220
)
211221

212222
zephyr_link_libraries(tfm_api)

modules/trusted-firmware-m/Kconfig

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,27 @@ config TFM_PROFILE
6969
profile_medium and profile_small. The default profile does not need
7070
to have this configuration set.
7171

72+
choice TFM_CMAKE_BUILD_TYPE
73+
prompt "The build type for TFM"
74+
default TFM_CMAKE_BUILD_TYPE_RELEASE if SPEED_OPTIMIZATIONS && BUILD_OUTPUT_STRIPPED
75+
default TFM_CMAKE_BUILD_TYPE_MINSIZEREL if SIZE_OPTIMIZATIONS
76+
default TFM_CMAKE_BUILD_TYPE_DEBUG if DEBUG_OPTIMIZATIONS
77+
default TFM_CMAKE_BUILD_TYPE_RELWITHDEBINFO
78+
79+
config TFM_CMAKE_BUILD_TYPE_RELEASE
80+
bool "Release build"
81+
82+
config TFM_CMAKE_BUILD_TYPE_RELWITHDEBINFO
83+
bool "Release build with Debug info"
84+
85+
config TFM_CMAKE_BUILD_TYPE_MINSIZEREL
86+
bool "Release build, optimized for size"
87+
88+
config TFM_CMAKE_BUILD_TYPE_DEBUG
89+
bool "Debug build"
90+
91+
endchoice
92+
7293
config TFM_ISOLATION_LEVEL
7394
int "Isolation level setting."
7495
range 1 3

0 commit comments

Comments
 (0)