1# Copyright (c) 2022-2023, Arm Limited. All rights reserved. 2# 3# SPDX-License-Identifier: BSD-3-Clause 4# 5 6$(eval $(call add_define,PLATFORM_TESTS)) 7 8ifeq (${PLATFORM_TEST},rss-nv-counters) 9 include drivers/arm/rss/rss_comms.mk 10 11 # Test code. 12 BL31_SOURCES += plat/arm/board/tc/nv_counter_test.c 13 14 # Code under testing. 15 BL31_SOURCES += lib/psa/rss_platform.c \ 16 drivers/arm/rss/rss_comms.c \ 17 ${RSS_COMMS_SOURCES} 18 19 PLAT_INCLUDES += -Iinclude/lib/psa 20 21 $(eval $(call add_define,PLATFORM_TEST_NV_COUNTERS)) 22else ifeq (${PLATFORM_TEST},rss-rotpk) 23 include drivers/arm/rss/rss_comms.mk 24 25 # Test code. 26 BL31_SOURCES += plat/arm/board/tc/rotpk_test.c 27 28 # Code under testing. 29 BL31_SOURCES += lib/psa/rss_platform.c \ 30 drivers/arm/rss/rss_comms.c \ 31 ${RSS_COMMS_SOURCES} 32 33 PLAT_INCLUDES += -Iinclude/lib/psa 34 35 $(eval $(call add_define,PLATFORM_TEST_ROTPK)) 36else ifeq (${PLATFORM_TEST},tfm-testsuite) 37 38 # The variables need to be set to compile the platform test: 39 ifeq (${TF_M_TESTS_PATH},) 40 # Example: ../rss/tf-m-tests 41 $(error Error: TF_M_TESTS_PATH not set) 42 endif 43 ifeq (${TF_M_EXTRAS_PATH},) 44 # Example: ../rss/tf-m-extras 45 $(error Error: TF_M_EXTRAS_PATH not set) 46 endif 47 ifeq (${MEASUREMENT_VALUE_SIZE},) 48 MEASUREMENT_VALUE_SIZE := 32 49 endif 50 ifeq (${MEASURED_BOOT_HASH_ALG},) 51 MEASURED_BOOT_HASH_ALG := "PSA_ALG_SHA_256" 52 endif 53 54 DELEGATED_ATTEST_TESTS_PATH = $(TF_M_EXTRAS_PATH)/partitions/delegated_attestation/test 55 MEASURED_BOOT_TESTS_PATH = $(TF_M_EXTRAS_PATH)/partitions/measured_boot/test 56 57 MBEDTLS_CONFIG_FILE = "<plat_tc_mbedtls_config.h>" 58 59 LIBMBEDTLS_SRCS += $(addprefix ${MBEDTLS_DIR}/library/, \ 60 entropy.c \ 61 entropy_poll.c \ 62 hmac_drbg.c \ 63 psa_crypto.c \ 64 psa_crypto_client.c \ 65 psa_crypto_driver_wrappers.c \ 66 psa_crypto_hash.c \ 67 psa_crypto_rsa.c \ 68 psa_crypto_ecp.c \ 69 psa_crypto_slot_management.c \ 70 ) 71 72 BL31_SOURCES += ${RSS_COMMS_SOURCES} \ 73 plat/arm/common/arm_dyn_cfg.c \ 74 ${TC_BASE}/rss_ap_tests.c \ 75 ${TC_BASE}/rss_ap_testsuites.c \ 76 ${TC_BASE}/rss_ap_test_stubs.c \ 77 $(TF_M_TESTS_PATH)/test/framework/test_framework.c \ 78 $(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 \ 81 drivers/auth/mbedtls/mbedtls_common.c \ 82 lib/psa/measured_boot.c \ 83 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 \ 87 -I$(TF_M_TESTS_PATH)/test/framework \ 88 -I$(TF_M_TESTS_PATH)/log \ 89 -I$(TF_M_TESTS_PATH)/test/secure_fw/suites/extra \ 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 97 # Some of the PSA functions are declared in multiple header files, that 98 # triggers this warning. 99 TF_CFLAGS += -Wno-error=redundant-decls 100 101 # TODO: Created patch for warning in tf-m-tests 102 TF_CFLAGS += -Wno-error=return-type 103 104 # Define macros that are used by the code coming from the tf-m-extras repo. 105 $(eval $(call add_define,MEASUREMENT_VALUE_SIZE)) 106 $(eval $(call add_define,MEASURED_BOOT_HASH_ALG)) 107 $(eval $(call add_define,DELEG_ATTEST_DUMP_TOKEN_AND_KEY)) 108 109 $(eval $(call add_define,PLATFORM_TEST_TFM_TESTSUITE)) 110else 111 $(error "Unsupported PLATFORM_TEST value") 112endif 113