Skip to content

Commit 5ec1717

Browse files
Jianliang-ShenKevin Peng
authored and
Kevin Peng
committed
Kconfig: Add build type support
Signed-off-by: Jianliang Shen <[email protected]> Change-Id: Id66fb82d8f3f3e406111c86040cbaac8f2076bba
1 parent 0de293f commit 5ec1717

File tree

5 files changed

+71
-6
lines changed

5 files changed

+71
-6
lines changed

Kconfig

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ mainmenu "TF-M Configuration"
99

1010
# Load platform Kconfig file if exists
1111
osource "$(PLATFORM_PATH)/Kconfig"
12+
osource "$(TFM_SOURCE_DIR)/config/build_type/Kconfig.$(CMAKE_BUILD_TYPE)"
1213

1314
################################# System options ###############################
1415

config/build_type/Kconfig.debug

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#-------------------------------------------------------------------------------
2+
# Copyright (c) 2023, Arm Limited. All rights reserved.
3+
#
4+
# SPDX-License-Identifier: BSD-3-Clause
5+
#
6+
#-------------------------------------------------------------------------------
7+
8+
config MBEDCRYPTO_BUILD_TYPE
9+
default "relwithdebinfo"
10+
11+
config TFM_SPM_LOG_LEVEL
12+
default 3
13+
14+
config TFM_PARTITION_LOG_LEVEL
15+
default 3
16+
17+
config CONFIG_TFM_HALT_ON_CORE_PANIC
18+
default y

config/build_type/Kconfig.minsizerel

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#-------------------------------------------------------------------------------
2+
# Copyright (c) 2023, Arm Limited. All rights reserved.
3+
#
4+
# SPDX-License-Identifier: BSD-3-Clause
5+
#
6+
#-------------------------------------------------------------------------------
7+
8+
if BL2
9+
config MCUBOOT_LOG_LEVEL
10+
default "OFF"
11+
endif
12+
13+
config TFM_SPM_LOG_LEVEL
14+
default 0
15+
16+
config TFM_PARTITION_LOG_LEVEL
17+
default 0
18+
19+
if BL1 && PLATFORM_DEFAULT_BL1
20+
config TFM_BL1_LOGGING
21+
default n
22+
endif

config/build_type/Kconfig.release

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#-------------------------------------------------------------------------------
2+
# Copyright (c) 2023, Arm Limited. All rights reserved.
3+
#
4+
# SPDX-License-Identifier: BSD-3-Clause
5+
#
6+
#-------------------------------------------------------------------------------
7+
8+
config MBEDCRYPTO_BUILD_TYPE
9+
default "minsizerel"
10+
11+
if BL2
12+
config MCUBOOT_LOG_LEVEL
13+
default "OFF"
14+
endif
15+
16+
config TFM_SPM_LOG_LEVEL
17+
default 0
18+
19+
config TFM_PARTITION_LOG_LEVEL
20+
default 0
21+
22+
if BL1 && PLATFORM_DEFAULT_BL1
23+
config TFM_BL1_LOGGING
24+
default n
25+
endif

config/kconfig.cmake

+5-6
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,10 @@ if(NOT EXISTS ${PLATFORM_KCONFIG})
187187
endif()
188188
get_filename_component(PLATFORM_KCONFIG_PATH ${PLATFORM_KCONFIG} DIRECTORY)
189189

190+
# Build type Kconfig file, for example 'Kconfig.minsizerel', the suffix passed
191+
# by Kconfig environment variables and it shall be lowercase.
192+
string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWERCASE)
193+
190194
# TF-M profile config file
191195
if(TFM_PROFILE)
192196
set(TFM_PROFILE_KCONFIG_FILE ${CMAKE_SOURCE_DIR}/config/profile/${TFM_PROFILE}.conf)
@@ -228,7 +232,7 @@ list(APPEND CONFIG_FILE_LIST
228232
set(KCONFIG_ENV_VARS "TFM_SOURCE_DIR=${CMAKE_SOURCE_DIR} \
229233
TFM_VERSION=${TFM_VERSION} \
230234
PLATFORM_PATH=${PLATFORM_KCONFIG_PATH} \
231-
CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}")
235+
CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE_LOWERCASE}")
232236

233237
if(MENUCONFIG)
234238
# Note: Currently, only GUI menuconfig can be supported with CMake integration
@@ -283,10 +287,5 @@ if(EXISTS ${TARGET_PLATFORM_PATH}/reg_config_override.cmake)
283287
include(${TARGET_PLATFORM_PATH}/reg_config_override.cmake)
284288
endif()
285289

286-
# Load build type config, setting options not already set
287-
if(EXISTS ${CMAKE_SOURCE_DIR}/config/build_type/${CMAKE_BUILD_TYPE_LOWERCASE}.cmake)
288-
include(${CMAKE_SOURCE_DIR}/config/build_type/${CMAKE_BUILD_TYPE_LOWERCASE}.cmake)
289-
endif()
290-
291290
# Load defaults, setting options not already set
292291
include(config/config_base.cmake)

0 commit comments

Comments
 (0)