blob: 7e81299ce51ae3074db435080573793594123b5a [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
4# *
5# * Licensed under the Apache License, Version 2.0 (the "License");
6# * you may not use this file except in compliance with the License.
7# * You may obtain a copy of the License at
8# *
9# * http://www.apache.org/licenses/LICENSE-2.0
10# *
11# * Unless required by applicable law or agreed to in writing, software
12# * distributed under the License is distributed on an "AS IS" BASIS,
13# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# * See the License for the specific language governing permissions and
15# * limitations under the License.
16#**/
17
18# Set the minimum required version of CMake for the project
19cmake_minimum_required(VERSION 3.10)
20
21# cmake_policy
22cmake_policy(SET CMP0057 NEW)
23
24# Find python interpreter version 3 or greater
25find_package(PythonInterp 3 REQUIRED)
26# Find Git package
27find_package(Git REQUIRED)
28
29get_filename_component(PSA_ROOT_DIR . ABSOLUTE)
30
Lingkai Dong9d4e7df2021-01-13 16:57:54 +000031include(${PSA_ROOT_DIR}/tools/cmake/common/Utils.cmake)
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +053032include(${PSA_ROOT_DIR}/tools/cmake/common/CMakeSettings.cmake)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +053033include(${PSA_ROOT_DIR}/tools/cmake/common/CMakeExternal.cmake)
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +053034
jotman016d7dd4e2020-11-10 17:32:28 +080035if(NOT DEFINED TFM_PROFILE)
36 message(STATUS "[PSA] : Building Default profile")
37list(APPEND PSA_SUITES
38 "IPC"
39 "CRYPTO"
40 "INTERNAL_TRUSTED_STORAGE"
41 "PROTECTED_STORAGE"
42 "STORAGE"
43 "INITIAL_ATTESTATION"
44)
45else()
46
47if("${TFM_PROFILE}" STREQUAL "profile_small")
48# list of supported suites
49list(APPEND PSA_SUITES
50 "CRYPTO"
51 "INTERNAL_TRUSTED_STORAGE"
52 "INITIAL_ATTESTATION"
53)
54else()
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +053055# list of supported suites
56list(APPEND PSA_SUITES
57 "IPC"
58 "CRYPTO"
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +053059 "INTERNAL_TRUSTED_STORAGE"
jotman016d7dd4e2020-11-10 17:32:28 +080060 "PROTECTED_STORAGE"
Vinay Kumar Kotegowder18fcd402020-04-27 17:38:41 +053061 "STORAGE"
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +053062 "INITIAL_ATTESTATION"
63)
jotman016d7dd4e2020-11-10 17:32:28 +080064endif()
65endif()
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +053066# list of ipc files required
67list(APPEND PSA_IPC_FILES
68 "psa/client.h"
69 "psa/service.h"
Jaykumar Pitambarbhai Patel1c2b0282019-11-06 11:29:13 +053070 "psa/lifecycle.h"
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +053071 "psa_manifest/sid.h"
72 "psa_manifest/pid.h"
Jaykumar Pitambarbhai Patel1c2b0282019-11-06 11:29:13 +053073 "psa_manifest/driver_partition_psa.h"
74 "psa_manifest/client_partition_psa.h"
75 "psa_manifest/server_partition_psa.h"
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +053076)
77
78# list of crypto files required
79list(APPEND PSA_CRYPTO_FILES
80 "psa/crypto.h"
81)
82
83# list of protected_storage files required
84list(APPEND PSA_PROTECTED_STORAGE_FILES
85 "psa/protected_storage.h"
86)
87
88# list of internal_trusted_storage files required
89list(APPEND PSA_INTERNAL_TRUSTED_STORAGE_FILES
90 "psa/internal_trusted_storage.h"
91)
92
Vinay Kumar Kotegowder18fcd402020-04-27 17:38:41 +053093# list of storage files required
94list(APPEND PSA_STORAGE_FILES
95 ${PSA_INTERNAL_TRUSTED_STORAGE_FILES}
96 ${PSA_PROTECTED_STORAGE_FILES}
97)
98
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +053099# list of initial_attestation files required
100list(APPEND PSA_INITIAL_ATTESTATION_FILES
101 "psa/initial_attestation.h"
102 "psa/crypto.h"
103)
104
105# list of supported toolchains
106list(APPEND PSA_TOOLCHAIN_SUPPORT
107 GNUARM
108 ARMCLANG
109 HOST_GCC
jk-arm7e6145a2021-07-19 19:36:14 +0530110 GCC_LINUX
111 INHERIT
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530112)
113
Øyvind Rønningstadc50804e2021-03-12 12:43:25 +0100114# list of supported CROSS_COMPILE toolchains
115list(APPEND CROSS_COMPILE_TOOLCHAIN_SUPPORT
116 GNUARM
jk-arm7e6145a2021-07-19 19:36:14 +0530117 ARMCLANG
118 INHERIT
Øyvind Rønningstadc50804e2021-03-12 12:43:25 +0100119)
120
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530121# list of suported CPU arch
122list(APPEND PSA_CPU_ARCH_SUPPORT
123 armv8m_ml
124 armv8m_bl
125 armv7m
jotman01bed7a152021-05-25 22:57:17 +0800126 armv8a
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530127)
128
129# list of VERBOSE options
130list(APPEND PSA_VERBOSE_OPTIONS 1 2 3 4 5)
131
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530132# list of PLATFORM_PSA_ISOLATION_LEVEL options
jotman016d7dd4e2020-11-10 17:32:28 +0800133if("${TFM_PROFILE}" STREQUAL "profile_medium")
134list(APPEND PLATFORM_PSA_ISOLATION_LEVEL_OPTIONS 1 2)
135else()
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530136list(APPEND PLATFORM_PSA_ISOLATION_LEVEL_OPTIONS 1 2 3)
jotman016d7dd4e2020-11-10 17:32:28 +0800137endif()
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530138
jk-arm01ee3ff2021-10-18 22:41:47 +0530139#list of INCLUDE_PANIC_TESTS options
140list(APPEND PSA_INCLUDE_PANIC_TESTS_OPTIONS 0 1)
141
jk-armbf532fd2021-05-07 13:58:22 +0530142# list of available spec version
143if("${SUITE}" STREQUAL "STORAGE" OR ${SUITE} STREQUAL "INTERNAL_TRUSTED_STORAGE" OR ${SUITE} STREQUAL "PROTECTED_STORAGE")
144list(APPEND PSA_SPEC_VERSION
145 1.0-BETA2
146 1.0
147)
148elseif("${SUITE}" STREQUAL "CRYPTO")
149list(APPEND PSA_SPEC_VERSION
150 1.0-BETA1
151 1.0-BETA2
152 1.0-BETA3
153)
154elseif("${SUITE}" STREQUAL "INITIAL_ATTESTATION")
155list(APPEND PSA_SPEC_VERSION
156 1.0-BETA0
157 1.0.0
158 1.0.1
159 1.0.2
160)
jk-arm957cfea2021-06-18 15:52:12 +0530161elseif("${SUITE}" STREQUAL "IPC")
162list(APPEND PSA_SPEC_VERSION
163 1.0
164 1.1
165)
jk-arm957cfea2021-06-18 15:52:12 +0530166endif()
167
168#list of values available for connection based
169if(${SUITE} STREQUAL "IPC")
170list(APPEND PSA_STATELESS_ROT 0 1)
jk-armbf532fd2021-05-07 13:58:22 +0530171endif()
172
jk-arm01ee3ff2021-10-18 22:41:47 +0530173#list of TESTS_COVERAGE available options
174list(APPEND PSA_TESTS_COVERAGE_OPTIONS
175 "ALL"
176 "PASS"
177)
178
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530179message(STATUS "[PSA] : ----------Process input arguments- start-------------")
180
181# Check for TARGET command line argument
182_check_arguments("TARGET")
183# Check for SUTIE command line argument
184_check_arguments("SUITE")
185# Check for PSA_INCLUDE_PATHS command line argument
186_check_arguments("PSA_INCLUDE_PATHS")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530187
188string(TOLOWER ${SUITE} SUITE_LOWER)
189
190# Check for valid targets
191_get_sub_dir_list(PSA_TARGET_LIST ${PSA_ROOT_DIR}/platform/targets)
192if(NOT ${TARGET} IN_LIST PSA_TARGET_LIST)
Øyvind Rønningstadabbb7272020-11-09 14:50:54 +0100193 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DTARGET=${TARGET}, supported targets are : ${PSA_TARGET_LIST}")
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530194else()
195 message(STATUS "[PSA] : TARGET is set to ${TARGET}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530196endif()
197
198# Check for the presence of required test suite directories
199if((NOT IS_DIRECTORY ${PSA_ROOT_DIR}/dev_apis) OR (NOT IS_DIRECTORY ${PSA_ROOT_DIR}/ff))
200 message(STATUS "[PSA] : Error: Could not find architecture test suite directories in psa root path ${PSA_ROOT_DIR}")
201endif()
202
203if(FALSE)
204# Check for build directory specified
205if(NOT DEFINED BUILD)
206 set(BUILD ${CMAKE_CURRENT_BINARY_DIR}/BUILD CACHE INTERNAL "Defaulting build directory to ${BUILD}" FORCE)
207else()
208 set(BUILD ${CMAKE_CURRENT_BINARY_DIR}/${BUILD}/BUILD CACHE INTERNAL "Defaulting build directory to ${BUILD}" FORCE)
209endif()
210endif()
211
212# Check for valid suite cmake argument passed
213if(NOT ${SUITE} IN_LIST PSA_SUITES)
Øyvind Rønningstadabbb7272020-11-09 14:50:54 +0100214 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 +0530215else()
216 message(STATUS "[PSA] : SUITE is set to ${SUITE}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530217endif()
218
219# Project variables
220set(PSA_TARGET_PRE_BUILD psa_pre_build)
221set(PSA_TARGET_GENERATE_DATABASE_PRE psa_generate_database_prerequisite)
222set(PSA_TARGET_GENERATE_DATABASE psa_generate_database)
223set(PSA_TARGET_GENERATE_DATABASE_POST psa_generate_database_cleanup)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530224if(${SUITE} STREQUAL "INITIAL_ATTESTATION")
Gyorgy Szing42d62332022-02-08 17:50:04 +0000225 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 +0530226endif()
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530227set(PSA_TARGET_PAL_NSPE_LIB pal_nspe)
228set(PSA_TARGET_VAL_NSPE_LIB val_nspe)
229set(PSA_TARGET_TEST_COMBINE_LIB test_combine)
jk-armbf532fd2021-05-07 13:58:22 +0530230set(PSA_TARGET_DRIVER_PARTITION_LIB tfm_psa_rot_partition_driver_partition)
231set(PSA_TARGET_CLIENT_PARTITION_LIB tfm_app_rot_partition_client_partition)
232set(PSA_TARGET_SERVER_PARTITION_LIB tfm_app_rot_partition_server_partition)
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530233if(${SUITE} STREQUAL "IPC")
234 set(PSA_SUITE_DIR ${PSA_ROOT_DIR}/ff/${SUITE_LOWER})
235 set(PSA_SUITE_OUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/ff/${SUITE_LOWER})
Vinay Kumar Kotegowder18fcd402020-04-27 17:38:41 +0530236elseif((${SUITE} STREQUAL "INTERNAL_TRUSTED_STORAGE") OR (${SUITE} STREQUAL "PROTECTED_STORAGE"))
237 set(PSA_SUITE_DIR ${PSA_ROOT_DIR}/dev_apis/storage)
238 set(PSA_SUITE_OUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/dev_apis/storage)
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530239else()
240 set(PSA_SUITE_DIR ${PSA_ROOT_DIR}/dev_apis/${SUITE_LOWER})
241 set(PSA_SUITE_OUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/dev_apis/${SUITE_LOWER})
242endif()
243set(PSA_TARGET_CONFIG_HEADER_GENERATOR ${PSA_ROOT_DIR}/tools/scripts/target_cfg/targetConfigGen.py)
244set(PSA_TESTLIST_GENERATOR ${PSA_ROOT_DIR}/tools/scripts/gen_tests_list.py)
245set(TARGET_CONFIGURATION_FILE ${PSA_ROOT_DIR}/platform/targets/${TARGET}/target.cfg)
246set(TGT_CONFIG_SOURCE_C ${CMAKE_CURRENT_BINARY_DIR}/targetConfigGen.c)
247set(OUTPUT_HEADER target_database.h)
248set(DATABASE_TABLE_NAME target_database)
249set(DATABASE_TABLE_SECTION_NAME "NOSECTION")
Vinay Kumar Kotegowder18fcd402020-04-27 17:38:41 +0530250set(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 +0530251if(NOT DEFINED SPEC_VERSION)
252 if(${SUITE} STREQUAL "INTERNAL_TRUSTED_STORAGE")
253 set(TESTSUITE_DB ${PSA_SUITE_DIR}/its_testsuite.db)
254 elseif((${SUITE} STREQUAL "PROTECTED_STORAGE") OR (${SUITE} STREQUAL "STORAGE"))
255 set(TESTSUITE_DB ${PSA_SUITE_DIR}/ps_testsuite.db)
jothikumar mani18b98e02023-04-05 00:39:23 +0800256 elseif(${SUITE} STREQUAL "CRYPTO")
257 if(DEFINED BESPOKE_SUITE_TESTS)
258 set(TESTSUITE_DB ${PSA_ROOT_DIR}/platform/targets/${TARGET}/${BESPOKE_SUITE_TESTS})
259 else()
260 set(TESTSUITE_DB ${PSA_SUITE_DIR}/testsuite.db)
261 endif()
jk-armbf532fd2021-05-07 13:58:22 +0530262 else()
263 set(TESTSUITE_DB ${PSA_SUITE_DIR}/testsuite.db)
264 endif()
jothikumar mani18b98e02023-04-05 00:39:23 +0800265 message(STATUS "[PSA] : Selected test database file : ${TESTSUITE_DB}")
Vinay Kumar Kotegowder18fcd402020-04-27 17:38:41 +0530266else()
jk-armbf532fd2021-05-07 13:58:22 +0530267 if(${SUITE} STREQUAL "INTERNAL_TRUSTED_STORAGE")
268 if(${SPEC_VERSION} STREQUAL "1.0-BETA2")
269 set(TESTSUITE_DB ${PSA_SUITE_DIR}/its_1.0-beta2_testsuite.db)
270 endif()
271 if(${SPEC_VERSION} STREQUAL "1.0")
272 set(TESTSUITE_DB ${PSA_SUITE_DIR}/its_1.0_testsuite.db)
273 endif()
274 elseif((${SUITE} STREQUAL "PROTECTED_STORAGE") OR (${SUITE} STREQUAL "STORAGE"))
275 if(${SPEC_VERSION} STREQUAL "1.0-BETA2")
276 set(TESTSUITE_DB ${PSA_SUITE_DIR}/ps_1.0-beta2_testsuite.db)
277 endif()
278 if(${SPEC_VERSION} STREQUAL "1.0")
279 set(TESTSUITE_DB ${PSA_SUITE_DIR}/ps_1.0_testsuite.db)
280 endif()
281 elseif(${SUITE} STREQUAL "CRYPTO")
282 if(${SPEC_VERSION} STREQUAL "1.0-BETA1")
283 set(TESTSUITE_DB ${PSA_SUITE_DIR}/1.0-beta1_testsuite.db)
284 endif()
285 if(${SPEC_VERSION} STREQUAL "1.0-BETA2")
286 set(TESTSUITE_DB ${PSA_SUITE_DIR}/1.0-beta2_testsuite.db)
287 endif()
288 if(${SPEC_VERSION} STREQUAL "1.0-BETA3")
289 set(TESTSUITE_DB ${PSA_SUITE_DIR}/1.0-beta3_testsuite.db)
290 endif()
291 elseif(${SUITE} STREQUAL "INITIAL_ATTESTATION")
292 if(${SPEC_VERSION} STREQUAL "1.0-BETA0")
293 set(TESTSUITE_DB ${PSA_SUITE_DIR}/1.0-beta0_testsuite.db)
294 endif()
295 if(${SPEC_VERSION} STREQUAL "1.0.0")
296 set(TESTSUITE_DB ${PSA_SUITE_DIR}/1.0.0_testsuite.db)
297 endif()
298 if(${SPEC_VERSION} STREQUAL "1.0.1")
299 set(TESTSUITE_DB ${PSA_SUITE_DIR}/1.0.1_testsuite.db)
300 endif()
301 if(${SPEC_VERSION} STREQUAL "1.0.2")
302 set(TESTSUITE_DB ${PSA_SUITE_DIR}/1.0.2_testsuite.db)
303 endif()
jk-arm957cfea2021-06-18 15:52:12 +0530304 elseif(${SUITE} STREQUAL "IPC")
305 if(${SPEC_VERSION} STREQUAL "1.1")
306 if(DEFINED STATELESS_ROT_TESTS)
307 if(${STATELESS_ROT_TESTS} EQUAL 1)
308 set(TESTSUITE_DB ${PSA_SUITE_DIR}/stateless_rot_testsuite.db)
309 else()
310 set(TESTSUITE_DB ${PSA_SUITE_DIR}/testsuite.db)
311 endif()
312 else()
313 set(TESTSUITE_DB ${PSA_SUITE_DIR}/testsuite.db)
314 endif()
315 else()
316 set(TESTSUITE_DB ${PSA_SUITE_DIR}/testsuite.db)
317 endif()
318 endif()
Vinay Kumar Kotegowder18fcd402020-04-27 17:38:41 +0530319endif()
320set(PSA_TESTLIST_FILE ${CMAKE_CURRENT_BINARY_DIR}/${SUITE_LOWER}_testlist.txt)
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530321set(PSA_TEST_ENTRY_LIST_INC ${CMAKE_CURRENT_BINARY_DIR}/test_entry_list.inc)
322set(PSA_TEST_ENTRY_FUN_DECLARE_INC ${CMAKE_CURRENT_BINARY_DIR}/test_entry_fn_declare_list.inc)
323set(PSA_CLIENT_TEST_LIST_DELCARE_INC ${CMAKE_CURRENT_BINARY_DIR}/client_tests_list_declare.inc)
324set(PSA_CLIENT_TEST_LIST_INC ${CMAKE_CURRENT_BINARY_DIR}/client_tests_list.inc)
325set(PSA_SERVER_TEST_LIST_DECLARE_INC ${CMAKE_CURRENT_BINARY_DIR}/server_tests_list_declare.inc)
326set(PSA_SERVER_TEST_LIST ${CMAKE_CURRENT_BINARY_DIR}/server_tests_list.inc)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530327if(${SUITE} STREQUAL "INITIAL_ATTESTATION")
Gyorgy Szing42d62332022-02-08 17:50:04 +0000328 set(PSA_QCBOR_INCLUDE_PATH ${PSA_TARGET_QCBOR}/inc)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530329endif()
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530330
331# Validity check for required files for a given suite
332if(NOT DEFINED PSA_${SUITE}_FILES)
333 message(FATAL_ERROR "[PSA] : List of file/s to verify against ${suite} is not defined")
334endif()
335foreach(file_item ${PSA_${SUITE}_FILES})
336 set(PSA_FILE_FOUND FALSE)
337 foreach(include_path ${PSA_INCLUDE_PATHS})
338 if((EXISTS ${include_path}/${file_item}) AND
339 (NOT PSA_FILE_FOUND))
340 set(PSA_FILE_FOUND TRUE)
341 break()
342 endif()
343 endforeach()
344 if(NOT PSA_FILE_FOUND)
345 message(FATAL_ERROR "[PSA] : Couldn't find ${file_item} in ${PSA_INCLUDE_PATHS}")
346 endif()
347endforeach()
348
349# Check for TOOLCHAIN command line argument
350if(NOT DEFINED TOOLCHAIN)
351 set(TOOLCHAIN "GNUARM" CACHE INTERNAL "Compiler used" FORCE)
352 message(STATUS "[PSA] : Defaulting compiler to ${TOOLCHAIN}")
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530353else()
354 message(STATUS "[PSA] : TOOLCHAIN is set to ${TOOLCHAIN}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530355endif()
356
Gowtham Siddarth1d6d4692019-09-16 11:47:29 +0530357if(${TOOLCHAIN} STREQUAL "ARMCLANG" OR ${TOOLCHAIN} STREQUAL "GNUARM")
358 if(NOT DEFINED CPU_ARCH)
359 message(FATAL_ERROR "[PSA] : Error: -DCPU_ARCH option missing")
360 else()
361 # Check for CPU architecture
362 if(NOT ${CPU_ARCH} IN_LIST PSA_CPU_ARCH_SUPPORT)
Øyvind Rønningstadabbb7272020-11-09 14:50:54 +0100363 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 +0530364 endif()
365 endif()
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530366 message(STATUS "[PSA] : CPU_ARCH is set to ${CPU_ARCH}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530367endif()
368
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530369# Check for VERBOSE
370if(NOT DEFINED VERBOSE)
371 set(VERBOSE 3 CACHE INTERNAL "Default VERBOSE value" FORCE)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530372 message(STATUS "[PSA] : Defaulting VERBOSE to ${VERBOSE}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530373else()
374 if(NOT ${VERBOSE} IN_LIST PSA_VERBOSE_OPTIONS)
Øyvind Rønningstadabbb7272020-11-09 14:50:54 +0100375 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DVERBOSE=${VERBOSE}, supported values are : ${PSA_VERBOSE_OPTIONS}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530376 endif()
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530377 message(STATUS "[PSA] : VERBOSE is set to ${VERBOSE}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530378endif()
379
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530380# Check for PLATFORM_PSA_ISOLATION_LEVEL
381if(NOT DEFINED PLATFORM_PSA_ISOLATION_LEVEL)
jotman016d7dd4e2020-11-10 17:32:28 +0800382 if("${TFM_PROFILE}" STREQUAL "profile_medium")
383 set(PLATFORM_PSA_ISOLATION_LEVEL 2 CACHE INTERNAL "Default PLATFORM_PSA_ISOLATION_LEVEL value" FORCE)
384 else()
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530385 set(PLATFORM_PSA_ISOLATION_LEVEL 3 CACHE INTERNAL "Default PLATFORM_PSA_ISOLATION_LEVEL value" FORCE)
jotman016d7dd4e2020-11-10 17:32:28 +0800386 endif()
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530387 if(${SUITE} STREQUAL "IPC")
388 message(STATUS "[PSA] : Defaulting PLATFORM_PSA_ISOLATION_LEVEL to ${PLATFORM_PSA_ISOLATION_LEVEL}")
389 endif()
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530390else()
391 if(NOT ${PLATFORM_PSA_ISOLATION_LEVEL} IN_LIST PLATFORM_PSA_ISOLATION_LEVEL_OPTIONS)
Øyvind Rønningstadabbb7272020-11-09 14:50:54 +0100392 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 +0530393 endif()
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530394 if(${SUITE} STREQUAL "IPC")
395 message(STATUS "[PSA] : PLATFORM_PSA_ISOLATION_LEVEL is set to ${PLATFORM_PSA_ISOLATION_LEVEL}")
396 endif()
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530397endif()
398
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530399if(NOT DEFINED INCLUDE_PANIC_TESTS)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530400 #By default panic tests are disabled
401 set(INCLUDE_PANIC_TESTS 0 CACHE INTERNAL "Default INCLUDE_PANIC_TESTS value" FORCE)
402 message(STATUS "[PSA] : Defaulting INCLUDE_PANIC_TESTS to ${INCLUDE_PANIC_TESTS}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530403else()
jk-arm01ee3ff2021-10-18 22:41:47 +0530404 if(NOT ${INCLUDE_PANIC_TESTS} IN_LIST PSA_INCLUDE_PANIC_TESTS_OPTIONS)
405 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DINCLUDE_PANIC_TESTS=${INCLUDE_PANIC_TESTS}, supported values are : ${PSA_INCLUDE_PANIC_TESTS_OPTIONS}")
406 endif()
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530407 if(INCLUDE_PANIC_TESTS EQUAL 1)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530408 message(STATUS "[PSA] : "
409 "INCLUDE_PANIC_TESTS set to 1, therefore including PSA APIs panic tests into the regression,\n"
410 "\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 +0530411 endif()
412endif()
413
414if(NOT DEFINED WATCHDOG_AVAILABLE)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530415 #Assuming watchdog is available to program by test suite
416 set(WATCHDOG_AVAILABLE 1 CACHE INTERNAL "Default WATCHDOG_AVAILABLE value" FORCE)
417 message(STATUS "[PSA] : Defaulting WATCHDOG_AVAILABLE to ${WATCHDOG_AVAILABLE}")
418else()
419 message(STATUS "[PSA] : WATCHDOG_AVAILABLE is set to ${WATCHDOG_AVAILABLE}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530420endif()
421
422if((INCLUDE_PANIC_TESTS EQUAL 1) AND
423 (WATCHDOG_AVAILABLE EQUAL 0))
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530424 message(WARNING "[PSA]: "
425 "Note that to test PSA APIs panic conditions, test harness may require to access"
426 "the watchdog timer in oder to recover from panic and to be able to continue with"
427 "next test. Ignore this warning if system under test has capability to reset the"
428 "system when it encounters panic condition.")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530429endif()
430
431if(NOT DEFINED SP_HEAP_MEM_SUPP)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530432 #Are dynamic memory functions available to secure partition?
433 set(SP_HEAP_MEM_SUPP 1 CACHE INTERNAL "Default SP_HEAP_MEM_SUPP value" FORCE)
434 message(STATUS "[PSA] : Defaulting SP_HEAP_MEM_SUPP to ${SP_HEAP_MEM_SUPP}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530435endif()
436
Vinay Kumar Kotegowderac218992020-04-03 12:56:00 +0530437if(NOT DEFINED SUITE_TEST_RANGE)
438 set(SUITE_TEST_RANGE_MIN None)
439 set(SUITE_TEST_RANGE_MAX None)
440else()
441 list(LENGTH SUITE_TEST_RANGE SUITE_TEST_RANGE_LENGTH)
442 if(${SUITE_TEST_RANGE_LENGTH} GREATER "2")
443 message(FATAL_ERROR "[PSA] : -DSUITE_TEST_RANGE=<...> value error! accepts two "
444 " numbers in quotes separated with ';'")
445 endif()
446 if(${SUITE_TEST_RANGE_LENGTH} EQUAL "2")
447 list(GET SUITE_TEST_RANGE 0 SUITE_TEST_RANGE_MIN)
448 list(GET SUITE_TEST_RANGE 1 SUITE_TEST_RANGE_MAX)
449 message(STATUS "[PSA] : Testing (${SUITE_TEST_RANGE_MIN}, ${SUITE_TEST_RANGE_MAX}) of ${SUITE} suite")
450 endif()
451 if(${SUITE_TEST_RANGE_LENGTH} EQUAL "1")
452 set(SUITE_TEST_RANGE_MIN ${SUITE_TEST_RANGE})
453 set(SUITE_TEST_RANGE_MAX ${SUITE_TEST_RANGE})
454 message(STATUS "[PSA] : Testing ${SUITE_TEST_RANGE_MIN} of ${SUITE} suite")
455 endif()
456endif()
457
jk-armbf532fd2021-05-07 13:58:22 +0530458if(NOT DEFINED SPEC_VERSION)
459 message(STATUS "[PSA] : Default spec version")
460else()
461 if(NOT ${SPEC_VERSION} IN_LIST PSA_SPEC_VERSION)
462 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DSPEC_VERSION=${SPEC_VERSION}, supported values are : ${PSA_SPEC_VERSION} for ${SUITE}")
463 else()
464 message(STATUS "[PSA] : Testing ${SUITE} for spec version ${SPEC_VERSION}")
465 endif()
466endif()
467
jk-arm957cfea2021-06-18 15:52:12 +0530468if(DEFINED STATELESS_ROT_TESTS)
469 if(NOT ${STATELESS_ROT_TESTS} IN_LIST PSA_STATELESS_ROT)
470 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DSTATELESS_ROT_TESTS=${STATELESS_ROT_TESTS}, supported values are : ${PSA_STATELESS_ROT}")
471 elseif(${STATELESS_ROT_TESTS} EQUAL 1)
472 message(STATUS "[PSA] : Testing ${SUITE} for stateless rot")
473 elseif(${STATELESS_ROT_TESTS} EQUAL 0)
474 message(STATUS "[PSA] : Testing ${SUITE} for connection based")
475 endif()
476
477 if(NOT DEFINED SPEC_VERSION)
478 message(FATAL_ERROR "[PSA] : Error: SPEC_VERSION is require for STATELESS_ROT_TESTS.")
479 elseif(${SUITE} STREQUAL "IPC")
480 if(${SPEC_VERSION} STREQUAL "1.0")
481 message(FATAL_ERROR "[PSA] : Error: STATELESS_ROT_TESTS is only valid for SPEC_VERSION=1.1.")
482 elseif(${SPEC_VERSION} STREQUAL "1.1")
483 add_definitions(-DSPEC_VERSION=11)
484 if(${STATELESS_ROT_TESTS} EQUAL 1)
485 add_definitions(-DSTATELESS_ROT=1)
486 elseif(${STATELESS_ROT_TESTS} EQUAL 0)
487 add_definitions(-DSTATELESS_ROT=0)
488 endif()
489 endif()
490 else()
491 message(FATAL_ERROR "[PSA] : Error: STATELESS_ROT_TESTS is only applicable to IPC Test Suite.")
492 endif()
493else()
494 add_definitions(-DSTATELESS_ROT=0)
495 if(DEFINED SPEC_VERSION)
496 if(${SUITE} STREQUAL "IPC")
497 if(${SPEC_VERSION} STREQUAL "1.0")
498 add_definitions(-DSPEC_VERSION=10)
499 endif()
500 if(${SPEC_VERSION} STREQUAL "1.1")
501 add_definitions(-DSPEC_VERSION=11)
502 endif()
503 endif()
504 endif()
505endif()
506
jk-arm01ee3ff2021-10-18 22:41:47 +0530507if(NOT DEFINED TESTS_COVERAGE)
508 #By default all tests are included
509 set(TESTS_COVERAGE "ALL" CACHE INTERNAL "Default TESTS_COVERAGE value" FORCE)
510 message(STATUS "[PSA] : Defaulting TESTS_COVERAGE to ${TESTS_COVERAGE}")
511else()
512 if(NOT ${TESTS_COVERAGE} IN_LIST PSA_TESTS_COVERAGE_OPTIONS)
513 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DTESTS_COVERAGE=${TESTS_COVERAGE}, supported values are : ${PSA_TESTS_COVERAGE_OPTIONS}")
514 endif()
515 if(TESTS_COVERAGE STREQUAL ALL)
516 message(STATUS "[PSA] : "
517 "TESTS_COVERAGE set to ALL, therefore all tests are included.")
518 endif()
519 if(TESTS_COVERAGE STREQUAL PASS)
520 message(STATUS "[PSA] : "
521 "TESTS_COVERAGE set to PASS, therefore known failure tests are not included.")
522 add_definitions(-DTESTS_COVERAGE)
523 endif()
524endif()
525
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530526message(STATUS "[PSA] : ----------Process input arguments- complete-------------")
527
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530528
Gyorgy Szing42d62332022-02-08 17:50:04 +0000529if((${SUITE} STREQUAL "INITIAL_ATTESTATION") AND (NOT EXISTS ${PSA_TARGET_QCBOR}))
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530530# Clone QCBOR and move to specified tag
531execute_process(COMMAND ${GIT_EXECUTABLE} clone ${PSA_QCBOR_GIT_REPO_LINK} ${PSA_TARGET_QCBOR}
Gyorgy Szing42d62332022-02-08 17:50:04 +0000532 RESULT_VARIABLE qcbor_clone_result
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530533 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
Gyorgy Szing42d62332022-02-08 17:50:04 +0000534if(qcbor_clone_result)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530535 message(FATAL_ERROR "git clone failed for ${PSA_QCBOR_GIT_REPO_LINK}")
536endif()
537
Gyorgy Szing42d62332022-02-08 17:50:04 +0000538if(NOT qcbor_clone_result)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530539execute_process(COMMAND ${GIT_EXECUTABLE} checkout -q "${PSA_QCBOR_GIT_REPO_TAG}"
Gyorgy Szing42d62332022-02-08 17:50:04 +0000540 RESULT_VARIABLE qcbor_checkout_result
541 WORKING_DIRECTORY ${PSA_TARGET_QCBOR})
542if(qcbor_checkout_result)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530543 message(FATAL_ERROR "git checkout failed for Repo : ${PSA_QCBOR_GIT_REPO_LINK}, Tag : ${PSA_QCBOR_GIT_REPO_TAG}")
544endif()
545endif()
546endif()
gowtham siddarth12833042020-02-10 22:11:11 +0530547
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530548# Create PSA clean list
549list(APPEND PSA_CLEAN_LIST
550 ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_HEADER}
551 ${PSA_TESTLIST_FILE}
552 ${PSA_TEST_ENTRY_LIST_INC}
553 ${PSA_TEST_ENTRY_FUN_DECLARE_INC}
554 ${PSA_CLIENT_TEST_LIST_DELCARE_INC}
555 ${PSA_CLIENT_TEST_LIST_INC}
556 ${PSA_SERVER_TEST_LIST_DECLARE_INC}
557 ${PSA_SERVER_TEST_LIST}
558)
559
560# Process testsuite.db
561message(STATUS "[PSA] : Creating testlist.txt 'available at ${PSA_TESTLIST_FILE}'")
562execute_process(COMMAND ${PYTHON_EXECUTABLE} ${PSA_TESTLIST_GENERATOR}
563 ${SUITE_LOWER}
564 ${TESTSUITE_DB}
565 ${INCLUDE_PANIC_TESTS}
jk-arm01ee3ff2021-10-18 22:41:47 +0530566 ${TESTS_COVERAGE}
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530567 ${PSA_TESTLIST_FILE}
568 ${PSA_TEST_ENTRY_LIST_INC}
569 ${PSA_TEST_ENTRY_FUN_DECLARE_INC}
570 ${PSA_CLIENT_TEST_LIST_DELCARE_INC}
571 ${PSA_CLIENT_TEST_LIST_INC}
572 ${PSA_SERVER_TEST_LIST_DECLARE_INC}
Vinay Kumar Kotegowderac218992020-04-03 12:56:00 +0530573 ${PSA_SERVER_TEST_LIST}
574 ${SUITE_TEST_RANGE_MIN}
575 ${SUITE_TEST_RANGE_MAX})
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530576
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530577# Creating CMake list variable from file
578file(READ ${PSA_TESTLIST_FILE} PSA_TEST_LIST)
Vinay Kumar Kotegowderac218992020-04-03 12:56:00 +0530579if(NOT PSA_TEST_LIST)
580 message(FATAL_ERROR "[PSA] : Invalid test number!")
581endif()
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530582string(REGEX REPLACE "\n" ";" PSA_TEST_LIST "${PSA_TEST_LIST}")
583
584add_custom_target(
585 ${PSA_TARGET_GENERATE_DATABASE_PRE}
586 COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/platform
587 COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/val
588 COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/partition
589 COMMAND ${CMAKE_COMMAND} -E make_directory ${PSA_SUITE_OUT_DIR}
590)
591
592# Generate target files from User provided data base
593include(ExternalProject)
594ExternalProject_Add(
595 ${PSA_TARGET_GENERATE_DATABASE}
596 PREFIX ${CMAKE_CURRENT_BINARY_DIR}
597 DOWNLOAD_COMMAND ""
598 UPDATE_COMMAND ""
599 PATCH_COMMAND ""
600 BUILD_COMMAND ""
601 SOURCE_DIR "${PSA_ROOT_DIR}/tools/scripts/target_cfg"
602 CMAKE_ARGS -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
603 -DOUT_DIR=${CMAKE_CURRENT_BINARY_DIR}
604 -DTARGET=${TARGET}
605 -DGENERATOR_FILE=${PSA_TARGET_CONFIG_HEADER_GENERATOR}
606 -DINCLUDE_DIR=${PSA_ROOT_DIR}/val/common
607 -DTARGET_CONFIGURATION_FILE=${TARGET_CONFIGURATION_FILE}
608 -DTGT_CONFIG_SOURCE_C=${TGT_CONFIG_SOURCE_C}
609 -DOUTPUT_HEADER=${OUTPUT_HEADER}
610 -DDATABASE_TABLE_NAME=${DATABASE_TABLE_NAME}
611 -DDATABASE_TABLE_SECTION_NAME=${DATABASE_TABLE_SECTION_NAME}
612 -DTARGET_HEADER_GEN_INCLUDE_PATHS=${TARGET_HEADER_GEN_INCLUDE_PATHS}
613 LIST_SEPARATOR |
614 TEST_COMMAND ""
615)
616
617# Add custom target to clean generated files of the external project
618add_custom_target(
619 ${PSA_TARGET_GENERATE_DATABASE_POST}
620 COMMAND ${CMAKE_COMMAND} --build ${CMAKE_CURRENT_BINARY_DIR}/src/${PSA_TARGET_GENERATE_DATABASE}-build/ -- clean
621)
622
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530623# Check for supported toolchain/s
624if(${TOOLCHAIN} IN_LIST PSA_TOOLCHAIN_SUPPORT)
jk-armbf532fd2021-05-07 13:58:22 +0530625 if (DEFINED CROSS_COMPILE)
jk-arm7e6145a2021-07-19 19:36:14 +0530626 if(NOT (${TOOLCHAIN} IN_LIST CROSS_COMPILE_TOOLCHAIN_SUPPORT))
627 message(FATAL_ERROR "[PSA] : Error: CROSS_COMPILE not supported for this toolchain, supported toolchain are : ${CROSS_COMPILE_TOOLCHAIN_SUPPORT}")
628 endif()
jk-armbf532fd2021-05-07 13:58:22 +0530629 endif()
jk-arm7e6145a2021-07-19 19:36:14 +0530630 include(${PSA_ROOT_DIR}/tools/cmake/compiler/${TOOLCHAIN}.cmake)
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530631else()
jk-arm7e6145a2021-07-19 19:36:14 +0530632 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DTOOLCHAIN=${TOOLCHAIN}, supported toolchain are : ${PSA_TOOLCHAIN_SUPPORT}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530633endif()
634
635# Global macro to identify the PSA test suite cmake build
636add_definitions(-DPSA_CMAKE_BUILD)
637add_definitions(-D${SUITE})
638add_definitions(-DVERBOSE=${VERBOSE})
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530639add_definitions(-DPLATFORM_PSA_ISOLATION_LEVEL=${PLATFORM_PSA_ISOLATION_LEVEL})
Vinay Kumar Kotegowder52bbfc92020-07-03 17:23:59 +0530640add_definitions(-D${TARGET})
jotman016d7dd4e2020-11-10 17:32:28 +0800641if("${TFM_PROFILE}" STREQUAL "profile_small")
642 message(STATUS "[PSA] : Building SMALL profile")
643 add_definitions(-DTF_M_PROFILE_SMALL)
644elseif("${TFM_PROFILE}" STREQUAL "profile_medium")
645 message(STATUS "[PSA] : Building MEDIUM profile")
646 add_definitions(-DTF_M_PROFILE_MEDIUM)
647endif()
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530648if(${SP_HEAP_MEM_SUPP} EQUAL 1)
649 add_definitions(-DSP_HEAP_MEM_SUPP)
650endif()
jotman0138cb53a2023-02-14 16:27:06 +0800651
Summer Qin937a1ed2022-07-13 10:29:26 +0800652if(${CC312_LEGACY_DRIVER_API_ENABLED})
653 add_definitions(-DCC312_LEGACY_DRIVER_API_ENABLED)
654endif()
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530655
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530656# Build PAL NSPE LIB
657include(${PSA_ROOT_DIR}/platform/targets/${TARGET}/target.cmake)
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530658# Build VAL NSPE LIB
659#add_definitions(-DVAL_NSPE_BUILD)
660include(${PSA_ROOT_DIR}/val/val_nspe.cmake)
661# Build test
662include(${PSA_SUITE_DIR}/suite.cmake)
663if(${SUITE} STREQUAL "IPC")
664# Build SPE LIB
665include(${PSA_ROOT_DIR}/val/val_spe.cmake)
666endif()
667
668add_dependencies(${PSA_TARGET_GENERATE_DATABASE} ${PSA_TARGET_GENERATE_DATABASE_PRE})
669add_dependencies(${PSA_TARGET_GENERATE_DATABASE_POST} ${PSA_TARGET_GENERATE_DATABASE})
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530670add_dependencies(${PSA_TARGET_PAL_NSPE_LIB} ${PSA_TARGET_GENERATE_DATABASE_POST})
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530671add_dependencies(${PSA_TARGET_VAL_NSPE_LIB} ${PSA_TARGET_PAL_NSPE_LIB})
672add_dependencies(${PSA_TARGET_TEST_COMBINE_LIB} ${PSA_TARGET_VAL_NSPE_LIB})
673if(${SUITE} STREQUAL "IPC")
674add_dependencies(${PSA_TARGET_DRIVER_PARTITION_LIB} ${PSA_TARGET_TEST_COMBINE_LIB})
675add_dependencies(${PSA_TARGET_CLIENT_PARTITION_LIB} ${PSA_TARGET_DRIVER_PARTITION_LIB})
676add_dependencies(${PSA_TARGET_SERVER_PARTITION_LIB} ${PSA_TARGET_CLIENT_PARTITION_LIB})
677endif()
678
679# Include the files for make clean
680foreach(clean_item ${PSA_CLEAN_LIST})
681 set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${clean_item})
682endforeach()
683
684set_property(TARGET ${PSA_TARGET_VAL_NSPE_LIB} PROPERTY ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/val)
685set_property(TARGET ${PSA_TARGET_PAL_NSPE_LIB} PROPERTY ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/platform)
686set_property(TARGET ${PSA_TARGET_TEST_COMBINE_LIB} PROPERTY ARCHIVE_OUTPUT_DIRECTORY ${PSA_SUITE_OUT_DIR})
687if(${SUITE} STREQUAL "IPC")
688set_property(TARGET ${PSA_TARGET_DRIVER_PARTITION_LIB} PROPERTY ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/partition)
689set_property(TARGET ${PSA_TARGET_CLIENT_PARTITION_LIB} PROPERTY ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/partition)
690set_property(TARGET ${PSA_TARGET_SERVER_PARTITION_LIB} PROPERTY ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/partition)
691endif()