| #------------------------------------------------------------------------------- |
| # Copyright (c) 2022-2023, Arm Limited. All rights reserved. |
| # |
| # SPDX-License-Identifier: BSD-3-Clause |
| # |
| #------------------------------------------------------------------------------- |
| |
| set(ROOT_KCONFIG ${CMAKE_SOURCE_DIR}/Kconfig) |
| set(PLATFORM_KCONFIG ${TARGET_PLATFORM_PATH}/Kconfig) |
| |
| if(TFM_PROFILE) |
| # Selecting TF-M profiles is not supported yet. |
| message(FATAL_ERROR "Selecting TF-M profiles is not supported yet in Kconfig system!") |
| endif() |
| |
| if(NOT EXISTS ${PLATFORM_KCONFIG}) |
| message(WARNING "The platform does not have Kconfig file! \ |
| The Kconfig system cannot get its configuration settings. |
| So it is not guaranteed that the Kconfig system works properly.") |
| |
| if(EXISTS ${TARGET_PLATFORM_PATH}/config.cmake) |
| include(${TARGET_PLATFORM_PATH}/config.cmake) |
| endif() |
| endif() |
| |
| find_package(Python3) |
| |
| # Call the tfm_kconfig.py |
| execute_process( |
| COMMAND |
| ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/kconfig/tfm_kconfig.py |
| -k ${ROOT_KCONFIG} -o ${CMAKE_BINARY_DIR} -u gui -p ${TARGET_PLATFORM_PATH} |
| WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} |
| RESULT_VARIABLE ret |
| ) |
| |
| if(NOT ret EQUAL 0) |
| message(FATAL_ERROR "Kconfig tool failed!") |
| endif() |
| |
| # Component configs generated by tfm_kconfig.py |
| if(EXISTS "${CMAKE_BINARY_DIR}/project_config.h") |
| set(PROJECT_CONFIG_HEADER_FILE "${CMAKE_BINARY_DIR}/project_config.h" CACHE STRING "User defined header file for TF-M config") |
| endif() |
| |
| # Load project cmake configs generated by tfm_kconfig.py |
| if(EXISTS "${CMAKE_BINARY_DIR}/project_config.cmake") |
| include("${CMAKE_BINARY_DIR}/project_config.cmake") |
| endif() |
| |
| #################################################################################################### |
| |
| # The Kconfig system does not cover all the config options for the time being. |
| # So part of them still use the CMake config system. |
| |
| # Load regression configs overrided by platform |
| if(EXISTS ${TARGET_PLATFORM_PATH}/reg_config_override.cmake) |
| include(${TARGET_PLATFORM_PATH}/reg_config_override.cmake) |
| endif() |
| |
| # Load build type config, setting options not already set |
| if(EXISTS ${CMAKE_SOURCE_DIR}/config/build_type/${CMAKE_BUILD_TYPE_LOWERCASE}.cmake) |
| include(${CMAKE_SOURCE_DIR}/config/build_type/${CMAKE_BUILD_TYPE_LOWERCASE}.cmake) |
| endif() |
| |
| # Load TF-M model specific default config |
| # Load IPC backend config if isolation level is explicitly specified to 2/3 or IPC backend is |
| # selected via build command line. Otherwise, load SFN backend config by default. |
| # If a pair of invalid settings are passed via command line, it will be captured later via config |
| # check. |
| # Also select IPC model by default for multi-core platform unless it has already selected SFN model |
| if((DEFINED TFM_ISOLATION_LEVEL AND TFM_ISOLATION_LEVEL GREATER 1) OR |
| CONFIG_TFM_SPM_BACKEND STREQUAL "IPC" OR |
| TFM_MULTI_CORE_TOPOLOGY) |
| include(config/tfm_ipc_config_default.cmake) |
| else() |
| #The default backend is SFN |
| include(config/tfm_sfn_config_default.cmake) |
| endif() |
| |
| # Load bl1 config |
| if(BL1 AND PLATFORM_DEFAULT_BL1) |
| include(${CMAKE_SOURCE_DIR}/bl1/config/bl1_config_default.cmake) |
| endif() |
| |
| # Load MCUboot specific default.cmake |
| if(NOT DEFINED BL2 OR BL2) |
| include(${CMAKE_SOURCE_DIR}/bl2/ext/mcuboot/mcuboot_default_config.cmake) |
| endif() |
| |
| # Include FWU partition configs. |
| include(config/tfm_fwu_config.cmake) |
| |
| # Include coprocessor configs |
| include(config/cp_config_default.cmake) |
| |
| # Load defaults, setting options not already set |
| include(config/config_base.cmake) |
| |
| # Set secure log configs |
| # It also depends on regression test config. |
| include(config/tfm_secure_log.cmake) |