platform_test.mk 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. # Copyright (c) 2022-2024, Arm Limited. All rights reserved.
  2. #
  3. # SPDX-License-Identifier: BSD-3-Clause
  4. #
  5. $(eval $(call add_define,PLATFORM_TESTS))
  6. ifeq (${PLATFORM_TEST},rse-nv-counters)
  7. include drivers/arm/rse/rse_comms.mk
  8. # Test code.
  9. BL31_SOURCES += plat/arm/board/tc/nv_counter_test.c
  10. # Code under testing.
  11. BL31_SOURCES += lib/psa/rse_platform.c \
  12. ${RSE_COMMS_SOURCES}
  13. PLAT_INCLUDES += -Iinclude/lib/psa
  14. $(eval $(call add_define,PLATFORM_TEST_NV_COUNTERS))
  15. else ifeq (${PLATFORM_TEST},rse-rotpk)
  16. include drivers/arm/rse/rse_comms.mk
  17. # Test code.
  18. BL31_SOURCES += plat/arm/board/tc/rotpk_test.c
  19. # Code under testing.
  20. BL31_SOURCES += lib/psa/rse_platform.c \
  21. ${RSE_COMMS_SOURCES}
  22. PLAT_INCLUDES += -Iinclude/lib/psa
  23. $(eval $(call add_define,PLATFORM_TEST_ROTPK))
  24. else ifeq (${PLATFORM_TEST},tfm-testsuite)
  25. include drivers/arm/rse/rse_comms.mk
  26. include drivers/measured_boot/rse/qcbor.mk
  27. # The variables need to be set to compile the platform test:
  28. ifeq (${TF_M_TESTS_PATH},)
  29. # Example: ../rse/tf-m-tests
  30. $(error Error: TF_M_TESTS_PATH not set)
  31. endif
  32. ifeq (${TF_M_EXTRAS_PATH},)
  33. # Example: ../rse/tf-m-extras
  34. $(error Error: TF_M_EXTRAS_PATH not set)
  35. endif
  36. ifeq (${MEASUREMENT_VALUE_SIZE},)
  37. MEASUREMENT_VALUE_SIZE := 32
  38. endif
  39. ifeq (${MEASURED_BOOT_HASH_ALG},)
  40. MEASURED_BOOT_HASH_ALG := "PSA_ALG_SHA_256"
  41. endif
  42. DELEGATED_ATTEST_TESTS_PATH = $(TF_M_EXTRAS_PATH)/partitions/delegated_attestation/test
  43. MEASURED_BOOT_TESTS_PATH = $(TF_M_EXTRAS_PATH)/partitions/measured_boot/test
  44. MBEDTLS_CONFIG_FILE = "<plat_tc_mbedtls_config.h>"
  45. LIBMBEDTLS_SRCS += $(addprefix ${MBEDTLS_DIR}/library/, \
  46. entropy.c \
  47. entropy_poll.c \
  48. hmac_drbg.c \
  49. psa_crypto.c \
  50. psa_crypto_client.c \
  51. psa_crypto_driver_wrappers_no_static.c \
  52. psa_crypto_hash.c \
  53. psa_crypto_rsa.c \
  54. psa_crypto_ecp.c \
  55. psa_crypto_slot_management.c \
  56. psa_util.c \
  57. )
  58. BL31_SOURCES += ${RSE_COMMS_SOURCES} \
  59. plat/arm/common/arm_dyn_cfg.c \
  60. ${TC_BASE}/rse_ap_tests.c \
  61. ${TC_BASE}/rse_ap_testsuites.c \
  62. ${TC_BASE}/rse_ap_test_stubs.c \
  63. $(TF_M_TESTS_PATH)/tests_reg/test/framework/test_framework.c \
  64. $(MEASURED_BOOT_TESTS_PATH)/measured_boot_common.c \
  65. $(MEASURED_BOOT_TESTS_PATH)/measured_boot_tests_common.c \
  66. $(DELEGATED_ATTEST_TESTS_PATH)/delegated_attest_test.c \
  67. drivers/auth/mbedtls/mbedtls_common.c \
  68. lib/psa/measured_boot.c \
  69. lib/psa/delegated_attestation.c \
  70. ${QCBOR_SOURCES}
  71. PLAT_INCLUDES += -I$(TF_M_EXTRAS_PATH)/partitions/measured_boot/interface/include \
  72. -I$(TF_M_EXTRAS_PATH)/partitions/delegated_attestation/interface/include \
  73. -I$(TF_M_TESTS_PATH)/tests_reg/test/framework \
  74. -I$(TF_M_TESTS_PATH)/tests_reg/test/secure_fw/suites/extra \
  75. -I$(TF_M_TESTS_PATH)/lib/log \
  76. -I$(MEASURED_BOOT_TESTS_PATH)/non_secure \
  77. -I$(DELEGATED_ATTEST_TESTS_PATH) \
  78. -I$(DELEGATED_ATTEST_TESTS_PATH)/non_secure \
  79. -Iplat/arm/board/tc \
  80. -Iinclude/drivers/auth/mbedtls \
  81. -Iinclude/drivers/arm \
  82. -Iinclude/lib/psa \
  83. -I${QCBOR_INCLUDES}
  84. # Some of the PSA functions are declared in multiple header files, that
  85. # triggers this warning.
  86. TF_CFLAGS += -Wno-error=redundant-decls
  87. # TODO: Created patch for warning in tf-m-tests
  88. TF_CFLAGS += -Wno-error=return-type
  89. # Define macros that are used by the code coming from the tf-m-extras repo.
  90. $(eval $(call add_define,MEASUREMENT_VALUE_SIZE))
  91. $(eval $(call add_define,MEASURED_BOOT_HASH_ALG))
  92. $(eval $(call add_define,DELEG_ATTEST_DUMP_TOKEN_AND_KEY))
  93. $(eval $(call add_define,PLATFORM_TEST_TFM_TESTSUITE))
  94. else
  95. $(error "Unsupported PLATFORM_TEST value")
  96. endif