blob: 8d393254c5037dca6247134c7633a7a8afa70d67 [file] [log] [blame]
David Vincze58131252023-12-22 14:34:22 +01001# Copyright (c) 2022-2024, Arm Limited. All rights reserved.
Mate Toth-Pal14ba4af2022-10-21 14:24:49 +02002#
3# SPDX-License-Identifier: BSD-3-Clause
4#
5
laurenw-arm15aac382023-07-17 12:32:46 -05006$(eval $(call add_define,PLATFORM_TESTS))
7
Tamas Bandc15bf42024-02-22 11:35:28 +01008ifeq (${PLATFORM_TEST},rse-nv-counters)
9 include drivers/arm/rse/rse_comms.mk
laurenw-arm15aac382023-07-17 12:32:46 -050010
11 # Test code.
12 BL31_SOURCES += plat/arm/board/tc/nv_counter_test.c
13
14 # Code under testing.
Tamas Bandc15bf42024-02-22 11:35:28 +010015 BL31_SOURCES += lib/psa/rse_platform.c \
16 ${RSE_COMMS_SOURCES}
laurenw-arm15aac382023-07-17 12:32:46 -050017
18 PLAT_INCLUDES += -Iinclude/lib/psa
19
20 $(eval $(call add_define,PLATFORM_TEST_NV_COUNTERS))
Tamas Bandc15bf42024-02-22 11:35:28 +010021else ifeq (${PLATFORM_TEST},rse-rotpk)
22 include drivers/arm/rse/rse_comms.mk
laurenw-arm15aac382023-07-17 12:32:46 -050023
24 # Test code.
25 BL31_SOURCES += plat/arm/board/tc/rotpk_test.c
26
27 # Code under testing.
Tamas Bandc15bf42024-02-22 11:35:28 +010028 BL31_SOURCES += lib/psa/rse_platform.c \
29 ${RSE_COMMS_SOURCES}
laurenw-arm15aac382023-07-17 12:32:46 -050030
31 PLAT_INCLUDES += -Iinclude/lib/psa
32
33 $(eval $(call add_define,PLATFORM_TEST_ROTPK))
34else ifeq (${PLATFORM_TEST},tfm-testsuite)
Tamas Bandc15bf42024-02-22 11:35:28 +010035 include drivers/arm/rse/rse_comms.mk
Mate Toth-Pal14ba4af2022-10-21 14:24:49 +020036
37 # The variables need to be set to compile the platform test:
38 ifeq (${TF_M_TESTS_PATH},)
Tamas Bandc15bf42024-02-22 11:35:28 +010039 # Example: ../rse/tf-m-tests
Mate Toth-Pal14ba4af2022-10-21 14:24:49 +020040 $(error Error: TF_M_TESTS_PATH not set)
41 endif
42 ifeq (${TF_M_EXTRAS_PATH},)
Tamas Bandc15bf42024-02-22 11:35:28 +010043 # Example: ../rse/tf-m-extras
Mate Toth-Pal14ba4af2022-10-21 14:24:49 +020044 $(error Error: TF_M_EXTRAS_PATH not set)
45 endif
46 ifeq (${MEASUREMENT_VALUE_SIZE},)
47 MEASUREMENT_VALUE_SIZE := 32
48 endif
49 ifeq (${MEASURED_BOOT_HASH_ALG},)
50 MEASURED_BOOT_HASH_ALG := "PSA_ALG_SHA_256"
51 endif
52
53 DELEGATED_ATTEST_TESTS_PATH = $(TF_M_EXTRAS_PATH)/partitions/delegated_attestation/test
54 MEASURED_BOOT_TESTS_PATH = $(TF_M_EXTRAS_PATH)/partitions/measured_boot/test
55
56 MBEDTLS_CONFIG_FILE = "<plat_tc_mbedtls_config.h>"
57
David Vincze58131252023-12-22 14:34:22 +010058 LIBMBEDTLS_SRCS += $(addprefix ${MBEDTLS_DIR}/library/, \
Mate Toth-Pal14ba4af2022-10-21 14:24:49 +020059 entropy.c \
60 entropy_poll.c \
61 hmac_drbg.c \
62 psa_crypto.c \
63 psa_crypto_client.c \
Jimmy Brisson640d9912024-04-10 10:20:13 -050064 psa_crypto_driver_wrappers_no_static.c \
Mate Toth-Pal14ba4af2022-10-21 14:24:49 +020065 psa_crypto_hash.c \
66 psa_crypto_rsa.c \
67 psa_crypto_ecp.c \
68 psa_crypto_slot_management.c \
Jimmy Brisson640d9912024-04-10 10:20:13 -050069 psa_util.c \
Mate Toth-Pal14ba4af2022-10-21 14:24:49 +020070 )
71
Tamas Bandc15bf42024-02-22 11:35:28 +010072 BL31_SOURCES += ${RSE_COMMS_SOURCES} \
David Vincze58131252023-12-22 14:34:22 +010073 plat/arm/common/arm_dyn_cfg.c \
Tamas Bandc15bf42024-02-22 11:35:28 +010074 ${TC_BASE}/rse_ap_tests.c \
75 ${TC_BASE}/rse_ap_testsuites.c \
76 ${TC_BASE}/rse_ap_test_stubs.c \
David Vincze58131252023-12-22 14:34:22 +010077 $(TF_M_TESTS_PATH)/tests_reg/test/framework/test_framework.c \
Mate Toth-Pal14ba4af2022-10-21 14:24:49 +020078 $(MEASURED_BOOT_TESTS_PATH)/measured_boot_common.c \
79 $(MEASURED_BOOT_TESTS_PATH)/measured_boot_tests_common.c \
80 $(DELEGATED_ATTEST_TESTS_PATH)/delegated_attest_test.c \
David Vincze58131252023-12-22 14:34:22 +010081 drivers/auth/mbedtls/mbedtls_common.c \
82 lib/psa/measured_boot.c \
Mate Toth-Pal14ba4af2022-10-21 14:24:49 +020083 lib/psa/delegated_attestation.c
84
85 PLAT_INCLUDES += -I$(TF_M_EXTRAS_PATH)/partitions/measured_boot/interface/include \
86 -I$(TF_M_EXTRAS_PATH)/partitions/delegated_attestation/interface/include \
David Vincze58131252023-12-22 14:34:22 +010087 -I$(TF_M_TESTS_PATH)/tests_reg/test/framework \
88 -I$(TF_M_TESTS_PATH)/tests_reg/test/secure_fw/suites/extra \
89 -I$(TF_M_TESTS_PATH)/lib/log \
90 -I$(MEASURED_BOOT_TESTS_PATH)/non_secure \
91 -I$(DELEGATED_ATTEST_TESTS_PATH) \
92 -I$(DELEGATED_ATTEST_TESTS_PATH)/non_secure \
93 -Iplat/arm/board/tc \
94 -Iinclude/drivers/auth/mbedtls \
95 -Iinclude/drivers/arm \
96 -Iinclude/lib/psa
Mate Toth-Pal14ba4af2022-10-21 14:24:49 +020097
98 # Some of the PSA functions are declared in multiple header files, that
99 # triggers this warning.
100 TF_CFLAGS += -Wno-error=redundant-decls
101
102 # TODO: Created patch for warning in tf-m-tests
103 TF_CFLAGS += -Wno-error=return-type
104
105 # Define macros that are used by the code coming from the tf-m-extras repo.
106 $(eval $(call add_define,MEASUREMENT_VALUE_SIZE))
107 $(eval $(call add_define,MEASURED_BOOT_HASH_ALG))
108 $(eval $(call add_define,DELEG_ATTEST_DUMP_TOKEN_AND_KEY))
109
Tamas Ban15b79da2023-04-21 09:31:48 +0200110 $(eval $(call add_define,PLATFORM_TEST_TFM_TESTSUITE))
laurenw-arm15aac382023-07-17 12:32:46 -0500111else
112 $(error "Unsupported PLATFORM_TEST value")
Mate Toth-Pal14ba4af2022-10-21 14:24:49 +0200113endif