blob: f5e45c12b06446ca1dbb66c29a1a390fbb398e32 [file] [log] [blame]
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +05301#/** @file
jothikumar mani18b98e02023-04-05 00:39:23 +08002# * Copyright (c) 2019-2023, Arm Limited or its affiliates. All rights reserved.
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +05303# * SPDX-License-Identifier : Apache-2.0
jothikumar mani36b2b862023-05-05 13:51:27 +05304# * Copyright 2023 NXP
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +05305# *
6# * Licensed under the Apache License, Version 2.0 (the "License");
7# * you may not use this file except in compliance with the License.
8# * You may obtain a copy of the License at
9# *
10# * http://www.apache.org/licenses/LICENSE-2.0
11# *
12# * Unless required by applicable law or agreed to in writing, software
13# * distributed under the License is distributed on an "AS IS" BASIS,
14# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# * See the License for the specific language governing permissions and
16# * limitations under the License.
17#**/
18
19# Set the minimum required version of CMake for the project
20cmake_minimum_required(VERSION 3.10)
21
22# cmake_policy
23cmake_policy(SET CMP0057 NEW)
24
25# Find python interpreter version 3 or greater
26find_package(PythonInterp 3 REQUIRED)
27# Find Git package
28find_package(Git REQUIRED)
29
30get_filename_component(PSA_ROOT_DIR . ABSOLUTE)
31
Lingkai Dong9d4e7df2021-01-13 16:57:54 +000032include(${PSA_ROOT_DIR}/tools/cmake/common/Utils.cmake)
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +053033include(${PSA_ROOT_DIR}/tools/cmake/common/CMakeSettings.cmake)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +053034include(${PSA_ROOT_DIR}/tools/cmake/common/CMakeExternal.cmake)
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +053035
jotman016d7dd4e2020-11-10 17:32:28 +080036if(NOT DEFINED TFM_PROFILE)
37 message(STATUS "[PSA] : Building Default profile")
38list(APPEND PSA_SUITES
39 "IPC"
40 "CRYPTO"
41 "INTERNAL_TRUSTED_STORAGE"
42 "PROTECTED_STORAGE"
43 "STORAGE"
44 "INITIAL_ATTESTATION"
45)
46else()
47
48if("${TFM_PROFILE}" STREQUAL "profile_small")
49# list of supported suites
50list(APPEND PSA_SUITES
51 "CRYPTO"
52 "INTERNAL_TRUSTED_STORAGE"
53 "INITIAL_ATTESTATION"
54)
55else()
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +053056# list of supported suites
57list(APPEND PSA_SUITES
58 "IPC"
59 "CRYPTO"
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +053060 "INTERNAL_TRUSTED_STORAGE"
jotman016d7dd4e2020-11-10 17:32:28 +080061 "PROTECTED_STORAGE"
Vinay Kumar Kotegowder18fcd402020-04-27 17:38:41 +053062 "STORAGE"
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +053063 "INITIAL_ATTESTATION"
64)
jotman016d7dd4e2020-11-10 17:32:28 +080065endif()
66endif()
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +053067# list of ipc files required
68list(APPEND PSA_IPC_FILES
69 "psa/client.h"
70 "psa/service.h"
Jaykumar Pitambarbhai Patel1c2b0282019-11-06 11:29:13 +053071 "psa/lifecycle.h"
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +053072 "psa_manifest/sid.h"
73 "psa_manifest/pid.h"
Jaykumar Pitambarbhai Patel1c2b0282019-11-06 11:29:13 +053074 "psa_manifest/driver_partition_psa.h"
75 "psa_manifest/client_partition_psa.h"
76 "psa_manifest/server_partition_psa.h"
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +053077)
78
79# list of crypto files required
80list(APPEND PSA_CRYPTO_FILES
81 "psa/crypto.h"
82)
83
84# list of protected_storage files required
85list(APPEND PSA_PROTECTED_STORAGE_FILES
86 "psa/protected_storage.h"
87)
88
89# list of internal_trusted_storage files required
90list(APPEND PSA_INTERNAL_TRUSTED_STORAGE_FILES
91 "psa/internal_trusted_storage.h"
92)
93
Vinay Kumar Kotegowder18fcd402020-04-27 17:38:41 +053094# list of storage files required
95list(APPEND PSA_STORAGE_FILES
96 ${PSA_INTERNAL_TRUSTED_STORAGE_FILES}
97 ${PSA_PROTECTED_STORAGE_FILES}
98)
99
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530100# list of initial_attestation files required
101list(APPEND PSA_INITIAL_ATTESTATION_FILES
102 "psa/initial_attestation.h"
103 "psa/crypto.h"
104)
105
106# list of supported toolchains
107list(APPEND PSA_TOOLCHAIN_SUPPORT
108 GNUARM
109 ARMCLANG
110 HOST_GCC
jk-arm7e6145a2021-07-19 19:36:14 +0530111 GCC_LINUX
112 INHERIT
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530113)
114
Øyvind Rønningstadc50804e2021-03-12 12:43:25 +0100115# list of supported CROSS_COMPILE toolchains
116list(APPEND CROSS_COMPILE_TOOLCHAIN_SUPPORT
117 GNUARM
jk-arm7e6145a2021-07-19 19:36:14 +0530118 ARMCLANG
119 INHERIT
Øyvind Rønningstadc50804e2021-03-12 12:43:25 +0100120)
121
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530122# list of suported CPU arch
123list(APPEND PSA_CPU_ARCH_SUPPORT
124 armv8m_ml
125 armv8m_bl
Dávid Házi330c4b12023-05-03 11:20:02 +0200126 armv81m_ml
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530127 armv7m
jotman01bed7a152021-05-25 22:57:17 +0800128 armv8a
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530129)
130
131# list of VERBOSE options
132list(APPEND PSA_VERBOSE_OPTIONS 1 2 3 4 5)
133
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530134# list of PLATFORM_PSA_ISOLATION_LEVEL options
jotman016d7dd4e2020-11-10 17:32:28 +0800135if("${TFM_PROFILE}" STREQUAL "profile_medium")
136list(APPEND PLATFORM_PSA_ISOLATION_LEVEL_OPTIONS 1 2)
137else()
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530138list(APPEND PLATFORM_PSA_ISOLATION_LEVEL_OPTIONS 1 2 3)
jotman016d7dd4e2020-11-10 17:32:28 +0800139endif()
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530140
jk-arm01ee3ff2021-10-18 22:41:47 +0530141#list of INCLUDE_PANIC_TESTS options
142list(APPEND PSA_INCLUDE_PANIC_TESTS_OPTIONS 0 1)
143
jk-armbf532fd2021-05-07 13:58:22 +0530144# list of available spec version
145if("${SUITE}" STREQUAL "STORAGE" OR ${SUITE} STREQUAL "INTERNAL_TRUSTED_STORAGE" OR ${SUITE} STREQUAL "PROTECTED_STORAGE")
146list(APPEND PSA_SPEC_VERSION
147 1.0-BETA2
148 1.0
149)
150elseif("${SUITE}" STREQUAL "CRYPTO")
151list(APPEND PSA_SPEC_VERSION
152 1.0-BETA1
153 1.0-BETA2
154 1.0-BETA3
155)
156elseif("${SUITE}" STREQUAL "INITIAL_ATTESTATION")
157list(APPEND PSA_SPEC_VERSION
158 1.0-BETA0
159 1.0.0
160 1.0.1
161 1.0.2
162)
jk-arm957cfea2021-06-18 15:52:12 +0530163elseif("${SUITE}" STREQUAL "IPC")
164list(APPEND PSA_SPEC_VERSION
165 1.0
166 1.1
167)
jk-arm957cfea2021-06-18 15:52:12 +0530168endif()
169
170#list of values available for connection based
171if(${SUITE} STREQUAL "IPC")
172list(APPEND PSA_STATELESS_ROT 0 1)
jk-armbf532fd2021-05-07 13:58:22 +0530173endif()
174
jk-arm01ee3ff2021-10-18 22:41:47 +0530175#list of TESTS_COVERAGE available options
176list(APPEND PSA_TESTS_COVERAGE_OPTIONS
177 "ALL"
178 "PASS"
179)
180
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530181message(STATUS "[PSA] : ----------Process input arguments- start-------------")
182
183# Check for TARGET command line argument
184_check_arguments("TARGET")
185# Check for SUTIE command line argument
186_check_arguments("SUITE")
187# Check for PSA_INCLUDE_PATHS command line argument
188_check_arguments("PSA_INCLUDE_PATHS")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530189
190string(TOLOWER ${SUITE} SUITE_LOWER)
191
192# Check for valid targets
193_get_sub_dir_list(PSA_TARGET_LIST ${PSA_ROOT_DIR}/platform/targets)
194if(NOT ${TARGET} IN_LIST PSA_TARGET_LIST)
Øyvind Rønningstadabbb7272020-11-09 14:50:54 +0100195 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DTARGET=${TARGET}, supported targets are : ${PSA_TARGET_LIST}")
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530196else()
197 message(STATUS "[PSA] : TARGET is set to ${TARGET}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530198endif()
199
200# Check for the presence of required test suite directories
201if((NOT IS_DIRECTORY ${PSA_ROOT_DIR}/dev_apis) OR (NOT IS_DIRECTORY ${PSA_ROOT_DIR}/ff))
202 message(STATUS "[PSA] : Error: Could not find architecture test suite directories in psa root path ${PSA_ROOT_DIR}")
203endif()
204
205if(FALSE)
206# Check for build directory specified
207if(NOT DEFINED BUILD)
208 set(BUILD ${CMAKE_CURRENT_BINARY_DIR}/BUILD CACHE INTERNAL "Defaulting build directory to ${BUILD}" FORCE)
209else()
210 set(BUILD ${CMAKE_CURRENT_BINARY_DIR}/${BUILD}/BUILD CACHE INTERNAL "Defaulting build directory to ${BUILD}" FORCE)
211endif()
212endif()
213
214# Check for valid suite cmake argument passed
215if(NOT ${SUITE} IN_LIST PSA_SUITES)
Øyvind Rønningstadabbb7272020-11-09 14:50:54 +0100216 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DSUITE=${SUITE}, select one from supported suites which are : ${PSA_SUITES}")
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530217else()
218 message(STATUS "[PSA] : SUITE is set to ${SUITE}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530219endif()
220
221# Project variables
222set(PSA_TARGET_PRE_BUILD psa_pre_build)
223set(PSA_TARGET_GENERATE_DATABASE_PRE psa_generate_database_prerequisite)
224set(PSA_TARGET_GENERATE_DATABASE psa_generate_database)
225set(PSA_TARGET_GENERATE_DATABASE_POST psa_generate_database_cleanup)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530226if(${SUITE} STREQUAL "INITIAL_ATTESTATION")
Gyorgy Szing42d62332022-02-08 17:50:04 +0000227 set(PSA_TARGET_QCBOR ${CMAKE_CURRENT_BINARY_DIR}/psa_qcbor CACHE PATH "Location of Q_CBOR sources.")
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530228endif()
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530229set(PSA_TARGET_PAL_NSPE_LIB pal_nspe)
230set(PSA_TARGET_VAL_NSPE_LIB val_nspe)
231set(PSA_TARGET_TEST_COMBINE_LIB test_combine)
jk-armbf532fd2021-05-07 13:58:22 +0530232set(PSA_TARGET_DRIVER_PARTITION_LIB tfm_psa_rot_partition_driver_partition)
233set(PSA_TARGET_CLIENT_PARTITION_LIB tfm_app_rot_partition_client_partition)
234set(PSA_TARGET_SERVER_PARTITION_LIB tfm_app_rot_partition_server_partition)
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530235if(${SUITE} STREQUAL "IPC")
236 set(PSA_SUITE_DIR ${PSA_ROOT_DIR}/ff/${SUITE_LOWER})
237 set(PSA_SUITE_OUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/ff/${SUITE_LOWER})
Vinay Kumar Kotegowder18fcd402020-04-27 17:38:41 +0530238elseif((${SUITE} STREQUAL "INTERNAL_TRUSTED_STORAGE") OR (${SUITE} STREQUAL "PROTECTED_STORAGE"))
239 set(PSA_SUITE_DIR ${PSA_ROOT_DIR}/dev_apis/storage)
240 set(PSA_SUITE_OUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/dev_apis/storage)
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530241else()
242 set(PSA_SUITE_DIR ${PSA_ROOT_DIR}/dev_apis/${SUITE_LOWER})
243 set(PSA_SUITE_OUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/dev_apis/${SUITE_LOWER})
244endif()
245set(PSA_TARGET_CONFIG_HEADER_GENERATOR ${PSA_ROOT_DIR}/tools/scripts/target_cfg/targetConfigGen.py)
246set(PSA_TESTLIST_GENERATOR ${PSA_ROOT_DIR}/tools/scripts/gen_tests_list.py)
247set(TARGET_CONFIGURATION_FILE ${PSA_ROOT_DIR}/platform/targets/${TARGET}/target.cfg)
248set(TGT_CONFIG_SOURCE_C ${CMAKE_CURRENT_BINARY_DIR}/targetConfigGen.c)
249set(OUTPUT_HEADER target_database.h)
250set(DATABASE_TABLE_NAME target_database)
251set(DATABASE_TABLE_SECTION_NAME "NOSECTION")
Vinay Kumar Kotegowder18fcd402020-04-27 17:38:41 +0530252set(TARGET_HEADER_GEN_INCLUDE_PATHS "${PSA_ROOT_DIR}/val/nspe|${PSA_ROOT_DIR}/val/common|${PSA_ROOT_DIR}/platform/targets/common/nspe|${PSA_ROOT_DIR}/platform/targets/common/nspe/crypto|${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe")
jk-armbf532fd2021-05-07 13:58:22 +0530253if(NOT DEFINED SPEC_VERSION)
254 if(${SUITE} STREQUAL "INTERNAL_TRUSTED_STORAGE")
255 set(TESTSUITE_DB ${PSA_SUITE_DIR}/its_testsuite.db)
256 elseif((${SUITE} STREQUAL "PROTECTED_STORAGE") OR (${SUITE} STREQUAL "STORAGE"))
257 set(TESTSUITE_DB ${PSA_SUITE_DIR}/ps_testsuite.db)
jothikumar mani18b98e02023-04-05 00:39:23 +0800258 elseif(${SUITE} STREQUAL "CRYPTO")
259 if(DEFINED BESPOKE_SUITE_TESTS)
260 set(TESTSUITE_DB ${PSA_ROOT_DIR}/platform/targets/${TARGET}/${BESPOKE_SUITE_TESTS})
261 else()
262 set(TESTSUITE_DB ${PSA_SUITE_DIR}/testsuite.db)
263 endif()
jk-armbf532fd2021-05-07 13:58:22 +0530264 else()
265 set(TESTSUITE_DB ${PSA_SUITE_DIR}/testsuite.db)
266 endif()
jothikumar mani18b98e02023-04-05 00:39:23 +0800267 message(STATUS "[PSA] : Selected test database file : ${TESTSUITE_DB}")
Vinay Kumar Kotegowder18fcd402020-04-27 17:38:41 +0530268else()
jk-armbf532fd2021-05-07 13:58:22 +0530269 if(${SUITE} STREQUAL "INTERNAL_TRUSTED_STORAGE")
270 if(${SPEC_VERSION} STREQUAL "1.0-BETA2")
271 set(TESTSUITE_DB ${PSA_SUITE_DIR}/its_1.0-beta2_testsuite.db)
272 endif()
273 if(${SPEC_VERSION} STREQUAL "1.0")
274 set(TESTSUITE_DB ${PSA_SUITE_DIR}/its_1.0_testsuite.db)
275 endif()
276 elseif((${SUITE} STREQUAL "PROTECTED_STORAGE") OR (${SUITE} STREQUAL "STORAGE"))
277 if(${SPEC_VERSION} STREQUAL "1.0-BETA2")
278 set(TESTSUITE_DB ${PSA_SUITE_DIR}/ps_1.0-beta2_testsuite.db)
279 endif()
280 if(${SPEC_VERSION} STREQUAL "1.0")
281 set(TESTSUITE_DB ${PSA_SUITE_DIR}/ps_1.0_testsuite.db)
282 endif()
283 elseif(${SUITE} STREQUAL "CRYPTO")
284 if(${SPEC_VERSION} STREQUAL "1.0-BETA1")
285 set(TESTSUITE_DB ${PSA_SUITE_DIR}/1.0-beta1_testsuite.db)
286 endif()
287 if(${SPEC_VERSION} STREQUAL "1.0-BETA2")
288 set(TESTSUITE_DB ${PSA_SUITE_DIR}/1.0-beta2_testsuite.db)
289 endif()
290 if(${SPEC_VERSION} STREQUAL "1.0-BETA3")
291 set(TESTSUITE_DB ${PSA_SUITE_DIR}/1.0-beta3_testsuite.db)
292 endif()
293 elseif(${SUITE} STREQUAL "INITIAL_ATTESTATION")
294 if(${SPEC_VERSION} STREQUAL "1.0-BETA0")
295 set(TESTSUITE_DB ${PSA_SUITE_DIR}/1.0-beta0_testsuite.db)
296 endif()
297 if(${SPEC_VERSION} STREQUAL "1.0.0")
298 set(TESTSUITE_DB ${PSA_SUITE_DIR}/1.0.0_testsuite.db)
299 endif()
300 if(${SPEC_VERSION} STREQUAL "1.0.1")
301 set(TESTSUITE_DB ${PSA_SUITE_DIR}/1.0.1_testsuite.db)
302 endif()
303 if(${SPEC_VERSION} STREQUAL "1.0.2")
304 set(TESTSUITE_DB ${PSA_SUITE_DIR}/1.0.2_testsuite.db)
305 endif()
jk-arm957cfea2021-06-18 15:52:12 +0530306 elseif(${SUITE} STREQUAL "IPC")
307 if(${SPEC_VERSION} STREQUAL "1.1")
308 if(DEFINED STATELESS_ROT_TESTS)
309 if(${STATELESS_ROT_TESTS} EQUAL 1)
310 set(TESTSUITE_DB ${PSA_SUITE_DIR}/stateless_rot_testsuite.db)
311 else()
312 set(TESTSUITE_DB ${PSA_SUITE_DIR}/testsuite.db)
313 endif()
314 else()
315 set(TESTSUITE_DB ${PSA_SUITE_DIR}/testsuite.db)
316 endif()
317 else()
318 set(TESTSUITE_DB ${PSA_SUITE_DIR}/testsuite.db)
319 endif()
320 endif()
Vinay Kumar Kotegowder18fcd402020-04-27 17:38:41 +0530321endif()
322set(PSA_TESTLIST_FILE ${CMAKE_CURRENT_BINARY_DIR}/${SUITE_LOWER}_testlist.txt)
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530323set(PSA_TEST_ENTRY_LIST_INC ${CMAKE_CURRENT_BINARY_DIR}/test_entry_list.inc)
324set(PSA_TEST_ENTRY_FUN_DECLARE_INC ${CMAKE_CURRENT_BINARY_DIR}/test_entry_fn_declare_list.inc)
325set(PSA_CLIENT_TEST_LIST_DELCARE_INC ${CMAKE_CURRENT_BINARY_DIR}/client_tests_list_declare.inc)
326set(PSA_CLIENT_TEST_LIST_INC ${CMAKE_CURRENT_BINARY_DIR}/client_tests_list.inc)
327set(PSA_SERVER_TEST_LIST_DECLARE_INC ${CMAKE_CURRENT_BINARY_DIR}/server_tests_list_declare.inc)
328set(PSA_SERVER_TEST_LIST ${CMAKE_CURRENT_BINARY_DIR}/server_tests_list.inc)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530329if(${SUITE} STREQUAL "INITIAL_ATTESTATION")
Gyorgy Szing42d62332022-02-08 17:50:04 +0000330 set(PSA_QCBOR_INCLUDE_PATH ${PSA_TARGET_QCBOR}/inc)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530331endif()
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530332
333# Validity check for required files for a given suite
334if(NOT DEFINED PSA_${SUITE}_FILES)
335 message(FATAL_ERROR "[PSA] : List of file/s to verify against ${suite} is not defined")
336endif()
337foreach(file_item ${PSA_${SUITE}_FILES})
338 set(PSA_FILE_FOUND FALSE)
339 foreach(include_path ${PSA_INCLUDE_PATHS})
340 if((EXISTS ${include_path}/${file_item}) AND
341 (NOT PSA_FILE_FOUND))
342 set(PSA_FILE_FOUND TRUE)
343 break()
344 endif()
345 endforeach()
346 if(NOT PSA_FILE_FOUND)
347 message(FATAL_ERROR "[PSA] : Couldn't find ${file_item} in ${PSA_INCLUDE_PATHS}")
348 endif()
349endforeach()
350
351# Check for TOOLCHAIN command line argument
352if(NOT DEFINED TOOLCHAIN)
353 set(TOOLCHAIN "GNUARM" CACHE INTERNAL "Compiler used" FORCE)
354 message(STATUS "[PSA] : Defaulting compiler to ${TOOLCHAIN}")
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530355else()
356 message(STATUS "[PSA] : TOOLCHAIN is set to ${TOOLCHAIN}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530357endif()
358
Gowtham Siddarth1d6d4692019-09-16 11:47:29 +0530359if(${TOOLCHAIN} STREQUAL "ARMCLANG" OR ${TOOLCHAIN} STREQUAL "GNUARM")
360 if(NOT DEFINED CPU_ARCH)
361 message(FATAL_ERROR "[PSA] : Error: -DCPU_ARCH option missing")
362 else()
363 # Check for CPU architecture
364 if(NOT ${CPU_ARCH} IN_LIST PSA_CPU_ARCH_SUPPORT)
Øyvind Rønningstadabbb7272020-11-09 14:50:54 +0100365 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DCPU_ARCH=${CPU_ARCH}, supported CPU arch are : ${PSA_CPU_ARCH_SUPPORT}")
Gowtham Siddarth1d6d4692019-09-16 11:47:29 +0530366 endif()
367 endif()
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530368 message(STATUS "[PSA] : CPU_ARCH is set to ${CPU_ARCH}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530369endif()
370
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530371# Check for VERBOSE
372if(NOT DEFINED VERBOSE)
373 set(VERBOSE 3 CACHE INTERNAL "Default VERBOSE value" FORCE)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530374 message(STATUS "[PSA] : Defaulting VERBOSE to ${VERBOSE}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530375else()
376 if(NOT ${VERBOSE} IN_LIST PSA_VERBOSE_OPTIONS)
Øyvind Rønningstadabbb7272020-11-09 14:50:54 +0100377 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DVERBOSE=${VERBOSE}, supported values are : ${PSA_VERBOSE_OPTIONS}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530378 endif()
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530379 message(STATUS "[PSA] : VERBOSE is set to ${VERBOSE}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530380endif()
381
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530382# Check for PLATFORM_PSA_ISOLATION_LEVEL
383if(NOT DEFINED PLATFORM_PSA_ISOLATION_LEVEL)
jotman016d7dd4e2020-11-10 17:32:28 +0800384 if("${TFM_PROFILE}" STREQUAL "profile_medium")
385 set(PLATFORM_PSA_ISOLATION_LEVEL 2 CACHE INTERNAL "Default PLATFORM_PSA_ISOLATION_LEVEL value" FORCE)
386 else()
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530387 set(PLATFORM_PSA_ISOLATION_LEVEL 3 CACHE INTERNAL "Default PLATFORM_PSA_ISOLATION_LEVEL value" FORCE)
jotman016d7dd4e2020-11-10 17:32:28 +0800388 endif()
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530389 if(${SUITE} STREQUAL "IPC")
390 message(STATUS "[PSA] : Defaulting PLATFORM_PSA_ISOLATION_LEVEL to ${PLATFORM_PSA_ISOLATION_LEVEL}")
391 endif()
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530392else()
393 if(NOT ${PLATFORM_PSA_ISOLATION_LEVEL} IN_LIST PLATFORM_PSA_ISOLATION_LEVEL_OPTIONS)
Øyvind Rønningstadabbb7272020-11-09 14:50:54 +0100394 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DPLATFORM_PSA_ISOLATION_LEVEL=${PLATFORM_PSA_ISOLATION_LEVEL}, supported values are : ${PLATFORM_PSA_ISOLATION_LEVEL_OPTIONS}")
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530395 endif()
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530396 if(${SUITE} STREQUAL "IPC")
397 message(STATUS "[PSA] : PLATFORM_PSA_ISOLATION_LEVEL is set to ${PLATFORM_PSA_ISOLATION_LEVEL}")
398 endif()
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530399endif()
400
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530401if(NOT DEFINED INCLUDE_PANIC_TESTS)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530402 #By default panic tests are disabled
403 set(INCLUDE_PANIC_TESTS 0 CACHE INTERNAL "Default INCLUDE_PANIC_TESTS value" FORCE)
404 message(STATUS "[PSA] : Defaulting INCLUDE_PANIC_TESTS to ${INCLUDE_PANIC_TESTS}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530405else()
jk-arm01ee3ff2021-10-18 22:41:47 +0530406 if(NOT ${INCLUDE_PANIC_TESTS} IN_LIST PSA_INCLUDE_PANIC_TESTS_OPTIONS)
407 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DINCLUDE_PANIC_TESTS=${INCLUDE_PANIC_TESTS}, supported values are : ${PSA_INCLUDE_PANIC_TESTS_OPTIONS}")
408 endif()
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530409 if(INCLUDE_PANIC_TESTS EQUAL 1)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530410 message(STATUS "[PSA] : "
411 "INCLUDE_PANIC_TESTS set to 1, therefore including PSA APIs panic tests into the regression,\n"
412 "\tensure that watchdog.num is set to 1 in ${PSA_ROOT_DIR}/platform/targets/${TARGET}/target.cfg")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530413 endif()
414endif()
415
416if(NOT DEFINED WATCHDOG_AVAILABLE)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530417 #Assuming watchdog is available to program by test suite
418 set(WATCHDOG_AVAILABLE 1 CACHE INTERNAL "Default WATCHDOG_AVAILABLE value" FORCE)
419 message(STATUS "[PSA] : Defaulting WATCHDOG_AVAILABLE to ${WATCHDOG_AVAILABLE}")
420else()
421 message(STATUS "[PSA] : WATCHDOG_AVAILABLE is set to ${WATCHDOG_AVAILABLE}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530422endif()
423
424if((INCLUDE_PANIC_TESTS EQUAL 1) AND
425 (WATCHDOG_AVAILABLE EQUAL 0))
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530426 message(WARNING "[PSA]: "
427 "Note that to test PSA APIs panic conditions, test harness may require to access"
428 "the watchdog timer in oder to recover from panic and to be able to continue with"
429 "next test. Ignore this warning if system under test has capability to reset the"
430 "system when it encounters panic condition.")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530431endif()
432
433if(NOT DEFINED SP_HEAP_MEM_SUPP)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530434 #Are dynamic memory functions available to secure partition?
435 set(SP_HEAP_MEM_SUPP 1 CACHE INTERNAL "Default SP_HEAP_MEM_SUPP value" FORCE)
436 message(STATUS "[PSA] : Defaulting SP_HEAP_MEM_SUPP to ${SP_HEAP_MEM_SUPP}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530437endif()
438
Vinay Kumar Kotegowderac218992020-04-03 12:56:00 +0530439if(NOT DEFINED SUITE_TEST_RANGE)
440 set(SUITE_TEST_RANGE_MIN None)
441 set(SUITE_TEST_RANGE_MAX None)
442else()
443 list(LENGTH SUITE_TEST_RANGE SUITE_TEST_RANGE_LENGTH)
444 if(${SUITE_TEST_RANGE_LENGTH} GREATER "2")
445 message(FATAL_ERROR "[PSA] : -DSUITE_TEST_RANGE=<...> value error! accepts two "
446 " numbers in quotes separated with ';'")
447 endif()
448 if(${SUITE_TEST_RANGE_LENGTH} EQUAL "2")
449 list(GET SUITE_TEST_RANGE 0 SUITE_TEST_RANGE_MIN)
450 list(GET SUITE_TEST_RANGE 1 SUITE_TEST_RANGE_MAX)
451 message(STATUS "[PSA] : Testing (${SUITE_TEST_RANGE_MIN}, ${SUITE_TEST_RANGE_MAX}) of ${SUITE} suite")
452 endif()
453 if(${SUITE_TEST_RANGE_LENGTH} EQUAL "1")
454 set(SUITE_TEST_RANGE_MIN ${SUITE_TEST_RANGE})
455 set(SUITE_TEST_RANGE_MAX ${SUITE_TEST_RANGE})
456 message(STATUS "[PSA] : Testing ${SUITE_TEST_RANGE_MIN} of ${SUITE} suite")
457 endif()
458endif()
459
jk-armbf532fd2021-05-07 13:58:22 +0530460if(NOT DEFINED SPEC_VERSION)
461 message(STATUS "[PSA] : Default spec version")
462else()
463 if(NOT ${SPEC_VERSION} IN_LIST PSA_SPEC_VERSION)
464 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DSPEC_VERSION=${SPEC_VERSION}, supported values are : ${PSA_SPEC_VERSION} for ${SUITE}")
465 else()
466 message(STATUS "[PSA] : Testing ${SUITE} for spec version ${SPEC_VERSION}")
467 endif()
468endif()
469
jk-arm957cfea2021-06-18 15:52:12 +0530470if(DEFINED STATELESS_ROT_TESTS)
471 if(NOT ${STATELESS_ROT_TESTS} IN_LIST PSA_STATELESS_ROT)
472 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DSTATELESS_ROT_TESTS=${STATELESS_ROT_TESTS}, supported values are : ${PSA_STATELESS_ROT}")
473 elseif(${STATELESS_ROT_TESTS} EQUAL 1)
474 message(STATUS "[PSA] : Testing ${SUITE} for stateless rot")
475 elseif(${STATELESS_ROT_TESTS} EQUAL 0)
476 message(STATUS "[PSA] : Testing ${SUITE} for connection based")
477 endif()
478
479 if(NOT DEFINED SPEC_VERSION)
480 message(FATAL_ERROR "[PSA] : Error: SPEC_VERSION is require for STATELESS_ROT_TESTS.")
481 elseif(${SUITE} STREQUAL "IPC")
482 if(${SPEC_VERSION} STREQUAL "1.0")
483 message(FATAL_ERROR "[PSA] : Error: STATELESS_ROT_TESTS is only valid for SPEC_VERSION=1.1.")
484 elseif(${SPEC_VERSION} STREQUAL "1.1")
485 add_definitions(-DSPEC_VERSION=11)
486 if(${STATELESS_ROT_TESTS} EQUAL 1)
487 add_definitions(-DSTATELESS_ROT=1)
488 elseif(${STATELESS_ROT_TESTS} EQUAL 0)
489 add_definitions(-DSTATELESS_ROT=0)
490 endif()
491 endif()
492 else()
493 message(FATAL_ERROR "[PSA] : Error: STATELESS_ROT_TESTS is only applicable to IPC Test Suite.")
494 endif()
495else()
496 add_definitions(-DSTATELESS_ROT=0)
497 if(DEFINED SPEC_VERSION)
498 if(${SUITE} STREQUAL "IPC")
499 if(${SPEC_VERSION} STREQUAL "1.0")
500 add_definitions(-DSPEC_VERSION=10)
501 endif()
502 if(${SPEC_VERSION} STREQUAL "1.1")
503 add_definitions(-DSPEC_VERSION=11)
504 endif()
505 endif()
506 endif()
507endif()
508
jk-arm01ee3ff2021-10-18 22:41:47 +0530509if(NOT DEFINED TESTS_COVERAGE)
510 #By default all tests are included
511 set(TESTS_COVERAGE "ALL" CACHE INTERNAL "Default TESTS_COVERAGE value" FORCE)
512 message(STATUS "[PSA] : Defaulting TESTS_COVERAGE to ${TESTS_COVERAGE}")
513else()
514 if(NOT ${TESTS_COVERAGE} IN_LIST PSA_TESTS_COVERAGE_OPTIONS)
515 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DTESTS_COVERAGE=${TESTS_COVERAGE}, supported values are : ${PSA_TESTS_COVERAGE_OPTIONS}")
516 endif()
517 if(TESTS_COVERAGE STREQUAL ALL)
518 message(STATUS "[PSA] : "
519 "TESTS_COVERAGE set to ALL, therefore all tests are included.")
520 endif()
521 if(TESTS_COVERAGE STREQUAL PASS)
522 message(STATUS "[PSA] : "
523 "TESTS_COVERAGE set to PASS, therefore known failure tests are not included.")
524 add_definitions(-DTESTS_COVERAGE)
525 endif()
526endif()
527
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530528message(STATUS "[PSA] : ----------Process input arguments- complete-------------")
529
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530530
Gyorgy Szing42d62332022-02-08 17:50:04 +0000531if((${SUITE} STREQUAL "INITIAL_ATTESTATION") AND (NOT EXISTS ${PSA_TARGET_QCBOR}))
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530532# Clone QCBOR and move to specified tag
533execute_process(COMMAND ${GIT_EXECUTABLE} clone ${PSA_QCBOR_GIT_REPO_LINK} ${PSA_TARGET_QCBOR}
Gyorgy Szing42d62332022-02-08 17:50:04 +0000534 RESULT_VARIABLE qcbor_clone_result
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530535 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
Gyorgy Szing42d62332022-02-08 17:50:04 +0000536if(qcbor_clone_result)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530537 message(FATAL_ERROR "git clone failed for ${PSA_QCBOR_GIT_REPO_LINK}")
538endif()
539
Gyorgy Szing42d62332022-02-08 17:50:04 +0000540if(NOT qcbor_clone_result)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530541execute_process(COMMAND ${GIT_EXECUTABLE} checkout -q "${PSA_QCBOR_GIT_REPO_TAG}"
Gyorgy Szing42d62332022-02-08 17:50:04 +0000542 RESULT_VARIABLE qcbor_checkout_result
543 WORKING_DIRECTORY ${PSA_TARGET_QCBOR})
544if(qcbor_checkout_result)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530545 message(FATAL_ERROR "git checkout failed for Repo : ${PSA_QCBOR_GIT_REPO_LINK}, Tag : ${PSA_QCBOR_GIT_REPO_TAG}")
546endif()
547endif()
548endif()
gowtham siddarth12833042020-02-10 22:11:11 +0530549
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530550# Create PSA clean list
551list(APPEND PSA_CLEAN_LIST
552 ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_HEADER}
553 ${PSA_TESTLIST_FILE}
554 ${PSA_TEST_ENTRY_LIST_INC}
555 ${PSA_TEST_ENTRY_FUN_DECLARE_INC}
556 ${PSA_CLIENT_TEST_LIST_DELCARE_INC}
557 ${PSA_CLIENT_TEST_LIST_INC}
558 ${PSA_SERVER_TEST_LIST_DECLARE_INC}
559 ${PSA_SERVER_TEST_LIST}
560)
561
562# Process testsuite.db
563message(STATUS "[PSA] : Creating testlist.txt 'available at ${PSA_TESTLIST_FILE}'")
564execute_process(COMMAND ${PYTHON_EXECUTABLE} ${PSA_TESTLIST_GENERATOR}
565 ${SUITE_LOWER}
566 ${TESTSUITE_DB}
567 ${INCLUDE_PANIC_TESTS}
jk-arm01ee3ff2021-10-18 22:41:47 +0530568 ${TESTS_COVERAGE}
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530569 ${PSA_TESTLIST_FILE}
570 ${PSA_TEST_ENTRY_LIST_INC}
571 ${PSA_TEST_ENTRY_FUN_DECLARE_INC}
572 ${PSA_CLIENT_TEST_LIST_DELCARE_INC}
573 ${PSA_CLIENT_TEST_LIST_INC}
574 ${PSA_SERVER_TEST_LIST_DECLARE_INC}
Vinay Kumar Kotegowderac218992020-04-03 12:56:00 +0530575 ${PSA_SERVER_TEST_LIST}
576 ${SUITE_TEST_RANGE_MIN}
577 ${SUITE_TEST_RANGE_MAX})
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530578
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530579# Creating CMake list variable from file
580file(READ ${PSA_TESTLIST_FILE} PSA_TEST_LIST)
Vinay Kumar Kotegowderac218992020-04-03 12:56:00 +0530581if(NOT PSA_TEST_LIST)
582 message(FATAL_ERROR "[PSA] : Invalid test number!")
583endif()
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530584string(REGEX REPLACE "\n" ";" PSA_TEST_LIST "${PSA_TEST_LIST}")
585
586add_custom_target(
587 ${PSA_TARGET_GENERATE_DATABASE_PRE}
588 COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/platform
589 COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/val
590 COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/partition
591 COMMAND ${CMAKE_COMMAND} -E make_directory ${PSA_SUITE_OUT_DIR}
592)
593
594# Generate target files from User provided data base
595include(ExternalProject)
596ExternalProject_Add(
597 ${PSA_TARGET_GENERATE_DATABASE}
598 PREFIX ${CMAKE_CURRENT_BINARY_DIR}
599 DOWNLOAD_COMMAND ""
600 UPDATE_COMMAND ""
601 PATCH_COMMAND ""
jothikumar manied3f1c02023-04-28 16:17:25 +0800602 BUILD_ALWAYS TRUE
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530603 SOURCE_DIR "${PSA_ROOT_DIR}/tools/scripts/target_cfg"
604 CMAKE_ARGS -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
605 -DOUT_DIR=${CMAKE_CURRENT_BINARY_DIR}
606 -DTARGET=${TARGET}
607 -DGENERATOR_FILE=${PSA_TARGET_CONFIG_HEADER_GENERATOR}
608 -DINCLUDE_DIR=${PSA_ROOT_DIR}/val/common
609 -DTARGET_CONFIGURATION_FILE=${TARGET_CONFIGURATION_FILE}
610 -DTGT_CONFIG_SOURCE_C=${TGT_CONFIG_SOURCE_C}
611 -DOUTPUT_HEADER=${OUTPUT_HEADER}
612 -DDATABASE_TABLE_NAME=${DATABASE_TABLE_NAME}
613 -DDATABASE_TABLE_SECTION_NAME=${DATABASE_TABLE_SECTION_NAME}
614 -DTARGET_HEADER_GEN_INCLUDE_PATHS=${TARGET_HEADER_GEN_INCLUDE_PATHS}
615 LIST_SEPARATOR |
616 TEST_COMMAND ""
617)
618
619# Add custom target to clean generated files of the external project
620add_custom_target(
621 ${PSA_TARGET_GENERATE_DATABASE_POST}
622 COMMAND ${CMAKE_COMMAND} --build ${CMAKE_CURRENT_BINARY_DIR}/src/${PSA_TARGET_GENERATE_DATABASE}-build/ -- clean
623)
624
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530625# Check for supported toolchain/s
626if(${TOOLCHAIN} IN_LIST PSA_TOOLCHAIN_SUPPORT)
jk-armbf532fd2021-05-07 13:58:22 +0530627 if (DEFINED CROSS_COMPILE)
jk-arm7e6145a2021-07-19 19:36:14 +0530628 if(NOT (${TOOLCHAIN} IN_LIST CROSS_COMPILE_TOOLCHAIN_SUPPORT))
629 message(FATAL_ERROR "[PSA] : Error: CROSS_COMPILE not supported for this toolchain, supported toolchain are : ${CROSS_COMPILE_TOOLCHAIN_SUPPORT}")
630 endif()
jk-armbf532fd2021-05-07 13:58:22 +0530631 endif()
jk-arm7e6145a2021-07-19 19:36:14 +0530632 include(${PSA_ROOT_DIR}/tools/cmake/compiler/${TOOLCHAIN}.cmake)
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530633else()
jk-arm7e6145a2021-07-19 19:36:14 +0530634 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DTOOLCHAIN=${TOOLCHAIN}, supported toolchain are : ${PSA_TOOLCHAIN_SUPPORT}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530635endif()
636
637# Global macro to identify the PSA test suite cmake build
638add_definitions(-DPSA_CMAKE_BUILD)
639add_definitions(-D${SUITE})
640add_definitions(-DVERBOSE=${VERBOSE})
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530641add_definitions(-DPLATFORM_PSA_ISOLATION_LEVEL=${PLATFORM_PSA_ISOLATION_LEVEL})
Vinay Kumar Kotegowder52bbfc92020-07-03 17:23:59 +0530642add_definitions(-D${TARGET})
jotman016d7dd4e2020-11-10 17:32:28 +0800643if("${TFM_PROFILE}" STREQUAL "profile_small")
644 message(STATUS "[PSA] : Building SMALL profile")
645 add_definitions(-DTF_M_PROFILE_SMALL)
646elseif("${TFM_PROFILE}" STREQUAL "profile_medium")
647 message(STATUS "[PSA] : Building MEDIUM profile")
648 add_definitions(-DTF_M_PROFILE_MEDIUM)
649endif()
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530650if(${SP_HEAP_MEM_SUPP} EQUAL 1)
651 add_definitions(-DSP_HEAP_MEM_SUPP)
652endif()
jotman0138cb53a2023-02-14 16:27:06 +0800653
Summer Qin937a1ed2022-07-13 10:29:26 +0800654if(${CC312_LEGACY_DRIVER_API_ENABLED})
655 add_definitions(-DCC312_LEGACY_DRIVER_API_ENABLED)
656endif()
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530657
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530658# Build PAL NSPE LIB
Bruno De Smet593db412023-03-15 18:47:19 +0100659include(${PSA_ROOT_DIR}/platform/targets/common/nspe/pal_nspe.cmake)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530660include(${PSA_ROOT_DIR}/platform/targets/${TARGET}/target.cmake)
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530661# Build VAL NSPE LIB
662#add_definitions(-DVAL_NSPE_BUILD)
663include(${PSA_ROOT_DIR}/val/val_nspe.cmake)
664# Build test
665include(${PSA_SUITE_DIR}/suite.cmake)
666if(${SUITE} STREQUAL "IPC")
667# Build SPE LIB
668include(${PSA_ROOT_DIR}/val/val_spe.cmake)
669endif()
670
671add_dependencies(${PSA_TARGET_GENERATE_DATABASE} ${PSA_TARGET_GENERATE_DATABASE_PRE})
672add_dependencies(${PSA_TARGET_GENERATE_DATABASE_POST} ${PSA_TARGET_GENERATE_DATABASE})
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530673add_dependencies(${PSA_TARGET_PAL_NSPE_LIB} ${PSA_TARGET_GENERATE_DATABASE_POST})
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530674add_dependencies(${PSA_TARGET_VAL_NSPE_LIB} ${PSA_TARGET_PAL_NSPE_LIB})
675add_dependencies(${PSA_TARGET_TEST_COMBINE_LIB} ${PSA_TARGET_VAL_NSPE_LIB})
676if(${SUITE} STREQUAL "IPC")
677add_dependencies(${PSA_TARGET_DRIVER_PARTITION_LIB} ${PSA_TARGET_TEST_COMBINE_LIB})
678add_dependencies(${PSA_TARGET_CLIENT_PARTITION_LIB} ${PSA_TARGET_DRIVER_PARTITION_LIB})
679add_dependencies(${PSA_TARGET_SERVER_PARTITION_LIB} ${PSA_TARGET_CLIENT_PARTITION_LIB})
680endif()
681
682# Include the files for make clean
683foreach(clean_item ${PSA_CLEAN_LIST})
684 set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${clean_item})
685endforeach()
686
687set_property(TARGET ${PSA_TARGET_VAL_NSPE_LIB} PROPERTY ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/val)
688set_property(TARGET ${PSA_TARGET_PAL_NSPE_LIB} PROPERTY ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/platform)
689set_property(TARGET ${PSA_TARGET_TEST_COMBINE_LIB} PROPERTY ARCHIVE_OUTPUT_DIRECTORY ${PSA_SUITE_OUT_DIR})
690if(${SUITE} STREQUAL "IPC")
691set_property(TARGET ${PSA_TARGET_DRIVER_PARTITION_LIB} PROPERTY ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/partition)
692set_property(TARGET ${PSA_TARGET_CLIENT_PARTITION_LIB} PROPERTY ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/partition)
693set_property(TARGET ${PSA_TARGET_SERVER_PARTITION_LIB} PROPERTY ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/partition)
694endif()