Mate Toth-Pal | 65c935e | 2018-01-17 18:42:13 +0100 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
| 2 | # Copyright (c) 2018, Arm Limited. All rights reserved. |
| 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | #------------------------------------------------------------------------------- |
| 7 | |
| 8 | if(NOT DEFINED REGRESSION) |
| 9 | message(FATAL_ERROR "ERROR: Incomplete Configuration: REGRESSION not defined, Include this file from a Config*.cmake") |
| 10 | elseif(NOT DEFINED CORE_TEST) |
| 11 | message(FATAL_ERROR "ERROR: Incomplete Configuration: CORE_TEST not defined, Include this file from a Config*.cmake") |
| 12 | elseif(NOT DEFINED BL2) |
| 13 | message(FATAL_ERROR "ERROR: Incomplete Configuration: BL2 not defined, Include this file from a Config*.cmake") |
| 14 | endif() |
| 15 | |
Mate Toth-Pal | 48fc6a0 | 2018-01-24 09:50:14 +0100 | [diff] [blame] | 16 | set(BUILD_CMSIS_CORE Off) |
| 17 | set(BUILD_RETARGET Off) |
| 18 | set(BUILD_NATIVE_DRIVERS Off) |
| 19 | set(BUILD_TIME Off) |
| 20 | set(BUILD_STARTUP Off) |
| 21 | set(BUILD_TARGET_CFG Off) |
| 22 | set(BUILD_TARGET_HARDWARE_KEYS Off) |
| 23 | set(BUILD_CMSIS_DRIVERS Off) |
| 24 | set(BUILD_UART_STDOUT Off) |
| 25 | set(BUILD_FLASH Off) |
| 26 | if(NOT DEFINED PLATFORM_CMAKE_FILE) |
| 27 | message (FATAL_ERROR "Platform specific CMake is not defined. Please set PLATFORM_CMAKE_FILE.") |
| 28 | elseif(NOT EXISTS ${PLATFORM_CMAKE_FILE}) |
| 29 | message (FATAL_ERROR "Platform specific CMake \"${PLATFORM_CMAKE_FILE}\" file does not exist. Please fix value of PLATFORM_CMAKE_FILE.") |
| 30 | else() |
| 31 | include(${PLATFORM_CMAKE_FILE}) |
| 32 | endif() |
| 33 | |
| 34 | |
| 35 | #Use any ARMCLANG version found on PATH. Note: Only versions supported by the |
| 36 | #build system will work. A file cmake/Common/CompilerArmClangXY.cmake |
| 37 | #must be present with a matching version. |
| 38 | include("Common/FindArmClang") |
| 39 | include("Common/${ARMCLANG_MODULE}") |
| 40 | |
Mate Toth-Pal | 65c935e | 2018-01-17 18:42:13 +0100 | [diff] [blame] | 41 | ##Shared compiler and linker settings. |
| 42 | function(config_setting_shared_flags tgt) |
| 43 | embedded_set_target_compile_flags(TARGET ${tgt} LANGUAGE C FLAGS -xc -std=c99 -fshort-enums -mfpu=none -fshort-wchar -funsigned-char -mcmse -Wall -Werror) |
| 44 | embedded_set_target_link_flags(TARGET ${tgt} FLAGS --strict --map --symbols --xref --entry=Reset_Handler --info=summarysizes,sizes,totals,unused,veneers) |
| 45 | endfunction() |
| 46 | |
| 47 | #Settings which shall be set for all projects the same way based |
| 48 | # on the variables above. |
Mate Toth-Pal | 349714a | 2018-02-23 15:30:24 +0100 | [diff] [blame] | 49 | set (TFM_PARTITION_TEST_CORE OFF) |
Mate Toth-Pal | 65c935e | 2018-01-17 18:42:13 +0100 | [diff] [blame] | 50 | set (CORE_TEST_POSITIVE OFF) |
| 51 | set (CORE_TEST_INTERACTIVE OFF) |
Mate Toth-Pal | 349714a | 2018-02-23 15:30:24 +0100 | [diff] [blame] | 52 | set (TFM_PARTITION_TEST_SST OFF) |
Miklos Balint | f13ec02 | 2018-04-06 17:21:22 +0200 | [diff] [blame] | 53 | set (REFERENCE_PLATFORM OFF) |
| 54 | |
| 55 | if(${TARGET_PLATFORM} STREQUAL "AN521" OR ${TARGET_PLATFORM} STREQUAL "AN519") |
| 56 | set (REFERENCE_PLATFORM ON) |
Avinash Mehta | 788036c | 2018-03-15 12:38:43 +0000 | [diff] [blame^] | 57 | elseif(${TARGET_PLATFORM} STREQUAL "MUSCA_A") |
| 58 | add_definitions(-DTARGET_MUSCA_A) |
Miklos Balint | f13ec02 | 2018-04-06 17:21:22 +0200 | [diff] [blame] | 59 | endif() |
Mate Toth-Pal | 65c935e | 2018-01-17 18:42:13 +0100 | [diff] [blame] | 60 | |
| 61 | if (REGRESSION) |
| 62 | set(SERVICES_TEST_ENABLED ON) |
| 63 | else() |
| 64 | set(SERVICES_TEST_ENABLED OFF) |
| 65 | endif() |
| 66 | |
| 67 | if (SERVICES_TEST_ENABLED) |
| 68 | set(SERVICE_TEST_S ON) |
| 69 | set(SERVICE_TEST_NS ON) |
Miklos Balint | f13ec02 | 2018-04-06 17:21:22 +0200 | [diff] [blame] | 70 | if (REFERENCE_PLATFORM) |
| 71 | set(CORE_TEST_POSITIVE ON) |
| 72 | endif() |
Mate Toth-Pal | 65c935e | 2018-01-17 18:42:13 +0100 | [diff] [blame] | 73 | endif() |
| 74 | |
| 75 | if (CORE_TEST) |
| 76 | set(CORE_TEST_POSITIVE ON) |
| 77 | set(CORE_TEST_INTERACTIVE OFF) |
| 78 | endif() |
| 79 | |
| 80 | if(CORE_TEST_INTERACTIVE) |
| 81 | add_definitions(-DCORE_TEST_INTERACTIVE) |
| 82 | set(TEST_FRAMEWORK_NS ON) |
Mate Toth-Pal | 349714a | 2018-02-23 15:30:24 +0100 | [diff] [blame] | 83 | set(TFM_PARTITION_TEST_CORE ON) |
Mate Toth-Pal | 65c935e | 2018-01-17 18:42:13 +0100 | [diff] [blame] | 84 | endif() |
| 85 | |
| 86 | if(CORE_TEST_POSITIVE) |
| 87 | add_definitions(-DCORE_TEST_POSITIVE) |
| 88 | set(TEST_FRAMEWORK_NS ON) |
Mate Toth-Pal | 349714a | 2018-02-23 15:30:24 +0100 | [diff] [blame] | 89 | set(TFM_PARTITION_TEST_CORE ON) |
Mate Toth-Pal | 65c935e | 2018-01-17 18:42:13 +0100 | [diff] [blame] | 90 | endif() |
| 91 | |
| 92 | if (SERVICE_TEST_S) |
| 93 | add_definitions(-DSERVICES_TEST_S) |
| 94 | set(TEST_FRAMEWORK_S ON) |
| 95 | endif() |
| 96 | |
| 97 | if (SERVICE_TEST_NS) |
| 98 | add_definitions(-DSERVICES_TEST_NS) |
| 99 | set(TEST_FRAMEWORK_NS ON) |
Mate Toth-Pal | 349714a | 2018-02-23 15:30:24 +0100 | [diff] [blame] | 100 | set(TFM_PARTITION_TEST_SST ON) |
Mate Toth-Pal | 65c935e | 2018-01-17 18:42:13 +0100 | [diff] [blame] | 101 | endif() |
| 102 | |
| 103 | if(TEST_FRAMEWORK_S) |
| 104 | add_definitions(-DTEST_FRAMEWORK_S) |
| 105 | endif() |
| 106 | |
| 107 | if(TEST_FRAMEWORK_NS) |
| 108 | add_definitions(-DTEST_FRAMEWORK_NS) |
| 109 | endif() |
| 110 | |
Mate Toth-Pal | 349714a | 2018-02-23 15:30:24 +0100 | [diff] [blame] | 111 | if (TFM_PARTITION_TEST_CORE) |
| 112 | add_definitions(-DTFM_PARTITION_TEST_CORE) |
Mate Toth-Pal | 65c935e | 2018-01-17 18:42:13 +0100 | [diff] [blame] | 113 | endif() |
| 114 | |
Mate Toth-Pal | 349714a | 2018-02-23 15:30:24 +0100 | [diff] [blame] | 115 | if (TFM_PARTITION_TEST_SST) |
| 116 | add_definitions(-DTFM_PARTITION_TEST_SST) |
Jamie Fox | 5592db0 | 2017-12-18 16:48:29 +0000 | [diff] [blame] | 117 | endif() |
| 118 | |
Mate Toth-Pal | 65c935e | 2018-01-17 18:42:13 +0100 | [diff] [blame] | 119 | if (BL2) |
| 120 | add_definitions(-DBL2) |
| 121 | endif() |
| 122 | |
| 123 | ##Secure side |
| 124 | config_setting_shared_flags(tfm_s) |
Mate Toth-Pal | 65c935e | 2018-01-17 18:42:13 +0100 | [diff] [blame] | 125 | |
| 126 | ##Non secure side |
| 127 | config_setting_shared_flags(tfm_ns) |
Mate Toth-Pal | 65c935e | 2018-01-17 18:42:13 +0100 | [diff] [blame] | 128 | |
| 129 | ##TF-M storage |
| 130 | config_setting_shared_flags(tfm_storage) |
Marc Moreno Berengue | 44af927 | 2018-01-25 17:18:00 +0000 | [diff] [blame] | 131 | set(MBEDTLS_C_FLAGS "-D__ARM_FEATURE_CMSE=3 -D__thumb2__ -fshort-enums -mfpu=none -fshort-wchar -funsigned-char -mcmse -DMBEDTLS_CONFIG_FILE=\\\\\\\"mbedtls_config.h\\\\\\\" -I${CMAKE_CURRENT_LIST_DIR}/platform/ext/common") |
Mate Toth-Pal | 65c935e | 2018-01-17 18:42:13 +0100 | [diff] [blame] | 132 | |
| 133 | set (SST_ENCRYPTION ON) |
| 134 | set (SST_RAM_FS ON) |
| 135 | set (SST_VALIDATE_METADATA_FROM_FLASH ON) |
| 136 | set (ENABLE_SECURE_STORAGE ON) |
| 137 | set (MBEDTLS_DEBUG ON) |
| 138 | |
| 139 | ##Tests |
| 140 | config_setting_shared_flags(tfm_secure_tests) |
| 141 | config_setting_shared_flags(tfm_non_secure_tests) |
| 142 | |
| 143 | ##BL2 |
| 144 | config_setting_shared_flags(mcuboot) |
Marc Moreno Berengue | a1f296f | 2018-01-25 15:21:22 +0000 | [diff] [blame] | 145 | set(MBEDTLS_C_FLAGS_BL2 "-D__ARM_FEATURE_CMSE=3 -D__thumb2__ -fshort-enums -mfpu=none -fshort-wchar -funsigned-char -mcmse -DMBEDTLS_CONFIG_FILE=\\\\\\\"config-boot.h\\\\\\\" -I${CMAKE_CURRENT_LIST_DIR}/bl2/ext/mcuboot/include") |