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 | |
| 16 | ##Shared compiler and linker settings. |
| 17 | function(config_setting_shared_flags tgt) |
| 18 | embedded_set_target_compile_flags(TARGET ${tgt} LANGUAGE C FLAGS -xc -std=c99 -fshort-enums -mfpu=none -fshort-wchar -funsigned-char -mcmse -Wall -Werror) |
| 19 | embedded_set_target_link_flags(TARGET ${tgt} FLAGS --strict --map --symbols --xref --entry=Reset_Handler --info=summarysizes,sizes,totals,unused,veneers) |
| 20 | endfunction() |
| 21 | |
| 22 | #Settings which shall be set for all projects the same way based |
| 23 | # on the variables above. |
| 24 | set (CORE_TEST_SERVICES OFF) |
| 25 | set (CORE_TEST_POSITIVE OFF) |
| 26 | set (CORE_TEST_INTERACTIVE OFF) |
| 27 | |
| 28 | if (REGRESSION) |
| 29 | set(SERVICES_TEST_ENABLED ON) |
| 30 | else() |
| 31 | set(SERVICES_TEST_ENABLED OFF) |
| 32 | endif() |
| 33 | |
| 34 | if (SERVICES_TEST_ENABLED) |
| 35 | set(SERVICE_TEST_S ON) |
| 36 | set(SERVICE_TEST_NS ON) |
| 37 | set(CORE_TEST_POSITIVE ON) |
| 38 | set(CORE_TEST_INTERACTIVE OFF) |
| 39 | endif() |
| 40 | |
| 41 | if (CORE_TEST) |
| 42 | set(CORE_TEST_POSITIVE ON) |
| 43 | set(CORE_TEST_INTERACTIVE OFF) |
| 44 | endif() |
| 45 | |
| 46 | if(CORE_TEST_INTERACTIVE) |
| 47 | add_definitions(-DCORE_TEST_INTERACTIVE) |
| 48 | set(TEST_FRAMEWORK_NS ON) |
| 49 | set(CORE_TEST_SERVICES ON) |
| 50 | endif() |
| 51 | |
| 52 | if(CORE_TEST_POSITIVE) |
| 53 | add_definitions(-DCORE_TEST_POSITIVE) |
| 54 | set(TEST_FRAMEWORK_NS ON) |
| 55 | set(CORE_TEST_SERVICES ON) |
| 56 | endif() |
| 57 | |
| 58 | if (SERVICE_TEST_S) |
| 59 | add_definitions(-DSERVICES_TEST_S) |
| 60 | set(TEST_FRAMEWORK_S ON) |
| 61 | endif() |
| 62 | |
| 63 | if (SERVICE_TEST_NS) |
| 64 | add_definitions(-DSERVICES_TEST_NS) |
| 65 | set(TEST_FRAMEWORK_NS ON) |
| 66 | endif() |
| 67 | |
| 68 | if(TEST_FRAMEWORK_S) |
| 69 | add_definitions(-DTEST_FRAMEWORK_S) |
| 70 | endif() |
| 71 | |
| 72 | if(TEST_FRAMEWORK_NS) |
| 73 | add_definitions(-DTEST_FRAMEWORK_NS) |
| 74 | endif() |
| 75 | |
| 76 | if (CORE_TEST_SERVICES) |
| 77 | add_definitions(-DCORE_TEST_SERVICES) |
| 78 | endif() |
| 79 | |
| 80 | if (BL2) |
| 81 | add_definitions(-DBL2) |
| 82 | endif() |
| 83 | |
| 84 | ##Secure side |
| 85 | config_setting_shared_flags(tfm_s) |
| 86 | embedded_set_target_linker_file(TARGET tfm_s PATH "${CMAKE_CURRENT_LIST_DIR}/platform/ext/target/sse_200_mps2/sse_200/armclang/sse_200_s.sct") |
| 87 | |
| 88 | ##Non secure side |
| 89 | config_setting_shared_flags(tfm_ns) |
| 90 | embedded_set_target_linker_file(TARGET tfm_ns PATH "${CMAKE_CURRENT_LIST_DIR}/platform/ext/target/sse_200_mps2/sse_200/armclang/sse_200_ns.sct") |
| 91 | |
| 92 | ##TF-M storage |
| 93 | config_setting_shared_flags(tfm_storage) |
| 94 | 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/target/common") |
| 95 | |
| 96 | set (SST_ENCRYPTION ON) |
| 97 | set (SST_RAM_FS ON) |
| 98 | set (SST_VALIDATE_METADATA_FROM_FLASH ON) |
| 99 | set (ENABLE_SECURE_STORAGE ON) |
| 100 | set (MBEDTLS_DEBUG ON) |
| 101 | |
| 102 | ##Tests |
| 103 | config_setting_shared_flags(tfm_secure_tests) |
| 104 | config_setting_shared_flags(tfm_non_secure_tests) |
| 105 | |
| 106 | ##BL2 |
| 107 | config_setting_shared_flags(mcuboot) |
| 108 | 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") |