Kevin Peng | d0e4971 | 2022-12-07 11:13:01 +0800 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
| 2 | # Copyright (c) 2023, Arm Limited. All rights reserved. |
| 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | #------------------------------------------------------------------------------- |
| 7 | |
| 8 | if(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\"") |
| 11 | endif() |
| 12 | |
| 13 | if(TFM_SYSTEM_DSP) |
| 14 | message(FATAL_ERROR "Hardware DSP is currently not supported in TF-M") |
| 15 | endif() |
| 16 | |
| 17 | if(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.") |
| 21 | endif() |
| 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) |
| 25 | if(NOT CMAKE_BUILD_TYPE) |
| 26 | set(CMAKE_BUILD_TYPE "MinSizeRel" CACHE STRING "Build type: [Debug, Release, RelWithDebInfo, MinSizeRel]" FORCE) |
| 27 | endif() |
| 28 | |
| 29 | # Configure TFM_PLATFORM |
| 30 | include(${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. |
| 34 | if (NOT EXISTS ${TARGET_PLATFORM_PATH}/preload.cmake) |
| 35 | Message(FATAL_ERROR "preload.cmake is not found in ${TFM_PLATFORM}") |
| 36 | else() |
| 37 | include(${TARGET_PLATFORM_PATH}/preload.cmake) |
| 38 | endif() |