1#-------------------------------------------------------------------------------
2# Copyright (c) 2023, Arm Limited. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7
8if(NOT ${CMAKE_GENERATOR} STREQUAL "Unix Makefiles" AND
9   NOT ${CMAKE_GENERATOR} STREQUAL "Ninja")
10    Message(FATAL_ERROR "Unsupported generator ${CMAKE_GENERATOR}. Hint: Try -G\"Unix Makefiles\"")
11endif()
12
13if(TFM_SYSTEM_DSP)
14    message(FATAL_ERROR "Hardware DSP is currently not supported in TF-M")
15endif()
16
17if(TFM_LIB_MODEL)
18    message(FATAL_ERROR "Library Model is deprecated, please DO NOT use TFM_LIB_MODEL anymore."
19                        "SFN model is a replacement for Library Model.
20                         You can use -DCONFIG_TFM_SPM_BACKEND=SFN to select SFN model.")
21endif()
22
23# The default build type is MinSizeRel. If debug symbols are needed then
24# -DCMAKE_BUILD_TYPE=debug should be used (likewise with other build types)
25if(NOT CMAKE_BUILD_TYPE)
26    set(CMAKE_BUILD_TYPE "MinSizeRel" CACHE STRING "Build type: [Debug, Release, RelWithDebInfo, MinSizeRel]" FORCE)
27endif()
28
29# Configure TFM_PLATFORM
30include(${CMAKE_SOURCE_DIR}/config/tfm_platform.cmake)
31
32# Some compiler flags depend on the CPU / platform config. This include should
33# be run before the toolchain file so the compiler can be configured properly.
34if (NOT EXISTS ${TARGET_PLATFORM_PATH}/preload.cmake)
35    Message(FATAL_ERROR "preload.cmake is not found in ${TFM_PLATFORM}")
36else()
37    include(${TARGET_PLATFORM_PATH}/preload.cmake)
38endif()
39