David Vincze | 5813125 | 2023-12-22 14:34:22 +0100 | [diff] [blame] | 1 | # Copyright (c) 2022-2024, Arm Limited. All rights reserved. |
Mate Toth-Pal | 14ba4af | 2022-10-21 14:24:49 +0200 | [diff] [blame] | 2 | # |
| 3 | # SPDX-License-Identifier: BSD-3-Clause |
| 4 | # |
| 5 | |
laurenw-arm | 15aac38 | 2023-07-17 12:32:46 -0500 | [diff] [blame] | 6 | $(eval $(call add_define,PLATFORM_TESTS)) |
| 7 | |
Tamas Ban | dc15bf4 | 2024-02-22 11:35:28 +0100 | [diff] [blame] | 8 | ifeq (${PLATFORM_TEST},rse-nv-counters) |
| 9 | include drivers/arm/rse/rse_comms.mk |
laurenw-arm | 15aac38 | 2023-07-17 12:32:46 -0500 | [diff] [blame] | 10 | |
| 11 | # Test code. |
| 12 | BL31_SOURCES += plat/arm/board/tc/nv_counter_test.c |
| 13 | |
| 14 | # Code under testing. |
Tamas Ban | dc15bf4 | 2024-02-22 11:35:28 +0100 | [diff] [blame] | 15 | BL31_SOURCES += lib/psa/rse_platform.c \ |
| 16 | ${RSE_COMMS_SOURCES} |
laurenw-arm | 15aac38 | 2023-07-17 12:32:46 -0500 | [diff] [blame] | 17 | |
| 18 | PLAT_INCLUDES += -Iinclude/lib/psa |
| 19 | |
| 20 | $(eval $(call add_define,PLATFORM_TEST_NV_COUNTERS)) |
Tamas Ban | dc15bf4 | 2024-02-22 11:35:28 +0100 | [diff] [blame] | 21 | else ifeq (${PLATFORM_TEST},rse-rotpk) |
| 22 | include drivers/arm/rse/rse_comms.mk |
laurenw-arm | 15aac38 | 2023-07-17 12:32:46 -0500 | [diff] [blame] | 23 | |
| 24 | # Test code. |
| 25 | BL31_SOURCES += plat/arm/board/tc/rotpk_test.c |
| 26 | |
| 27 | # Code under testing. |
Tamas Ban | dc15bf4 | 2024-02-22 11:35:28 +0100 | [diff] [blame] | 28 | BL31_SOURCES += lib/psa/rse_platform.c \ |
| 29 | ${RSE_COMMS_SOURCES} |
laurenw-arm | 15aac38 | 2023-07-17 12:32:46 -0500 | [diff] [blame] | 30 | |
| 31 | PLAT_INCLUDES += -Iinclude/lib/psa |
| 32 | |
| 33 | $(eval $(call add_define,PLATFORM_TEST_ROTPK)) |
| 34 | else ifeq (${PLATFORM_TEST},tfm-testsuite) |
Tamas Ban | dc15bf4 | 2024-02-22 11:35:28 +0100 | [diff] [blame] | 35 | include drivers/arm/rse/rse_comms.mk |
Mate Toth-Pal | 14ba4af | 2022-10-21 14:24:49 +0200 | [diff] [blame] | 36 | |
| 37 | # The variables need to be set to compile the platform test: |
| 38 | ifeq (${TF_M_TESTS_PATH},) |
Tamas Ban | dc15bf4 | 2024-02-22 11:35:28 +0100 | [diff] [blame] | 39 | # Example: ../rse/tf-m-tests |
Mate Toth-Pal | 14ba4af | 2022-10-21 14:24:49 +0200 | [diff] [blame] | 40 | $(error Error: TF_M_TESTS_PATH not set) |
| 41 | endif |
| 42 | ifeq (${TF_M_EXTRAS_PATH},) |
Tamas Ban | dc15bf4 | 2024-02-22 11:35:28 +0100 | [diff] [blame] | 43 | # Example: ../rse/tf-m-extras |
Mate Toth-Pal | 14ba4af | 2022-10-21 14:24:49 +0200 | [diff] [blame] | 44 | $(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 Vincze | 5813125 | 2023-12-22 14:34:22 +0100 | [diff] [blame] | 58 | LIBMBEDTLS_SRCS += $(addprefix ${MBEDTLS_DIR}/library/, \ |
Mate Toth-Pal | 14ba4af | 2022-10-21 14:24:49 +0200 | [diff] [blame] | 59 | entropy.c \ |
| 60 | entropy_poll.c \ |
| 61 | hmac_drbg.c \ |
| 62 | psa_crypto.c \ |
| 63 | psa_crypto_client.c \ |
Jimmy Brisson | 640d991 | 2024-04-10 10:20:13 -0500 | [diff] [blame] | 64 | psa_crypto_driver_wrappers_no_static.c \ |
Mate Toth-Pal | 14ba4af | 2022-10-21 14:24:49 +0200 | [diff] [blame] | 65 | psa_crypto_hash.c \ |
| 66 | psa_crypto_rsa.c \ |
| 67 | psa_crypto_ecp.c \ |
| 68 | psa_crypto_slot_management.c \ |
Jimmy Brisson | 640d991 | 2024-04-10 10:20:13 -0500 | [diff] [blame] | 69 | psa_util.c \ |
Mate Toth-Pal | 14ba4af | 2022-10-21 14:24:49 +0200 | [diff] [blame] | 70 | ) |
| 71 | |
Tamas Ban | dc15bf4 | 2024-02-22 11:35:28 +0100 | [diff] [blame] | 72 | BL31_SOURCES += ${RSE_COMMS_SOURCES} \ |
David Vincze | 5813125 | 2023-12-22 14:34:22 +0100 | [diff] [blame] | 73 | plat/arm/common/arm_dyn_cfg.c \ |
Tamas Ban | dc15bf4 | 2024-02-22 11:35:28 +0100 | [diff] [blame] | 74 | ${TC_BASE}/rse_ap_tests.c \ |
| 75 | ${TC_BASE}/rse_ap_testsuites.c \ |
| 76 | ${TC_BASE}/rse_ap_test_stubs.c \ |
David Vincze | 5813125 | 2023-12-22 14:34:22 +0100 | [diff] [blame] | 77 | $(TF_M_TESTS_PATH)/tests_reg/test/framework/test_framework.c \ |
Mate Toth-Pal | 14ba4af | 2022-10-21 14:24:49 +0200 | [diff] [blame] | 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 \ |
David Vincze | 5813125 | 2023-12-22 14:34:22 +0100 | [diff] [blame] | 81 | drivers/auth/mbedtls/mbedtls_common.c \ |
| 82 | lib/psa/measured_boot.c \ |
Mate Toth-Pal | 14ba4af | 2022-10-21 14:24:49 +0200 | [diff] [blame] | 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 \ |
David Vincze | 5813125 | 2023-12-22 14:34:22 +0100 | [diff] [blame] | 87 | -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-Pal | 14ba4af | 2022-10-21 14:24:49 +0200 | [diff] [blame] | 97 | |
| 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 Ban | 15b79da | 2023-04-21 09:31:48 +0200 | [diff] [blame] | 110 | $(eval $(call add_define,PLATFORM_TEST_TFM_TESTSUITE)) |
laurenw-arm | 15aac38 | 2023-07-17 12:32:46 -0500 | [diff] [blame] | 111 | else |
| 112 | $(error "Unsupported PLATFORM_TEST value") |
Mate Toth-Pal | 14ba4af | 2022-10-21 14:24:49 +0200 | [diff] [blame] | 113 | endif |