blob: b50975c16936284ba8afef9f5fa0011a01fb7499 [file] [log] [blame]
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +02001#
Olivier Deprez2661ba52024-02-19 18:50:53 +01002# Copyright (c) 2018-2024, Arm Limited. All rights reserved.
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +02003#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6
Alexei Fedorov7fac1622020-06-19 14:25:43 +01007include branch_protection.mk
Olivier Deprezafcdb7c2019-11-29 14:21:48 +01008include lib/xlat_tables_v2/xlat_tables.mk
Antonio Nino Diaz43ef3932018-07-03 14:39:47 +01009
Arunachalam Ganapathy51be1fe2020-09-22 13:25:21 +010010# Include cactus platform make file
11CACTUS_PLAT_PATH := $(shell find spm/cactus/plat -wholename '*/${PLAT}')
12ifneq (${CACTUS_PLAT_PATH},)
13 include ${CACTUS_PLAT_PATH}/platform.mk
14endif
15
Daniel Boulbyf6c288e2022-07-25 14:07:57 +010016CACTUS_DTB := $(BUILD_PLAT)/cactus.dtb
17SECURE_PARTITIONS += cactus
Antonio Nino Diaz1451f612018-11-30 10:51:26 +000018
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020019CACTUS_INCLUDES := \
Olivier Deprezafcdb7c2019-11-29 14:21:48 +010020 -Itftf/framework/include \
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020021 -Iinclude \
22 -Iinclude/common \
23 -Iinclude/common/${ARCH} \
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020024 -Iinclude/lib \
Shruti Gupta38133fa2023-04-19 17:00:38 +010025 -Iinclude/lib/extensions \
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020026 -Iinclude/lib/${ARCH} \
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020027 -Iinclude/lib/utils \
28 -Iinclude/lib/xlat_tables \
Olivier Deprez458d5532020-06-09 17:56:20 +020029 -Iinclude/plat/common \
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020030 -Iinclude/runtime_services \
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020031 -Ispm/cactus \
Daniel Boulbyf3da5912022-04-01 12:31:52 +010032 -Ispm/common \
33 -Ispm/common/sp_tests
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020034
35CACTUS_SOURCES := \
36 $(addprefix spm/cactus/, \
37 aarch64/cactus_entrypoint.S \
Manish Pandeyd27b37d2021-03-02 14:41:58 +000038 aarch64/cactus_exceptions.S \
Manish Pandeyd27b37d2021-03-02 14:41:58 +000039 cactus_interrupt.c \
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020040 cactus_main.c \
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020041 ) \
42 $(addprefix spm/common/, \
Ruari Phippsddc661a2020-09-10 09:06:14 +010043 sp_debug.c \
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020044 sp_helpers.c \
Ruari Phippsddc661a2020-09-10 09:06:14 +010045 spm_helpers.c \
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020046 ) \
Daniel Boulbyf3da5912022-04-01 12:31:52 +010047 $(addprefix spm/common/sp_tests/, \
48 sp_test_ffa.c \
Olivier Deprez2661ba52024-02-19 18:50:53 +010049 sp_test_cpu.c \
Daniel Boulbyf3da5912022-04-01 12:31:52 +010050 ) \
J-Alves0e1e7ca2021-01-25 14:11:06 +000051 $(addprefix spm/cactus/cactus_tests/, \
J-Alveseeb25472021-03-11 09:54:21 +000052 cactus_message_loop.c \
Olivier Deprez6bb3a502023-10-12 16:08:02 +020053 cactus_test_simd.c \
J-Alves0e1e7ca2021-01-25 14:11:06 +000054 cactus_test_direct_messaging.c \
J-Alves58cc4da2024-04-05 14:17:35 +010055 cactus_test_indirect_message.c \
Manish Pandey9ee6a8d2021-03-03 09:53:33 +000056 cactus_test_interrupts.c \
J-Alves0e1e7ca2021-01-25 14:11:06 +000057 cactus_test_memory_sharing.c \
Madhukar Pappireddy172523b2020-12-31 19:25:33 -060058 cactus_tests_smmuv3.c \
J-Alvesb4e89a22021-03-09 10:04:39 +000059 cactus_test_notifications.c \
Madhukar Pappireddye9c18122024-09-10 16:28:48 -050060 cactus_test_timer.c \
J-Alves0e1e7ca2021-01-25 14:11:06 +000061 )
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020062
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020063# TODO: Remove dependency on TFTF files.
Daniel Boulbyce386b12022-03-29 18:36:36 +010064CACTUS_SOURCES += \
65 tftf/framework/debug.c \
66 tftf/framework/${ARCH}/asm_debug.S \
67 tftf/tests/runtime_services/secure_service/${ARCH}/ffa_arch_helpers.S \
68 tftf/tests/runtime_services/secure_service/ffa_helpers.c \
69 tftf/tests/runtime_services/secure_service/spm_common.c \
Madhukar Pappireddye9c18122024-09-10 16:28:48 -050070 tftf/framework/${ARCH}/exception_report.c \
71 lib/delay/delay.c
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020072
73CACTUS_SOURCES += drivers/arm/pl011/${ARCH}/pl011_console.S \
Madhukar Pappireddydd7db242021-08-05 14:14:15 -050074 drivers/arm/sp805/sp805.c \
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020075 lib/${ARCH}/cache_helpers.S \
76 lib/${ARCH}/misc_helpers.S \
Olivier Deprezafcdb7c2019-11-29 14:21:48 +010077 lib/smc/${ARCH}/asm_smc.S \
78 lib/smc/${ARCH}/smc.c \
79 lib/smc/${ARCH}/hvc.c \
Olivier Deprez20b9b172021-04-22 14:39:54 +020080 lib/exceptions/${ARCH}/sync.c \
Sandrine Bailleux750b7cc2018-11-08 14:10:18 +010081 lib/locks/${ARCH}/spinlock.S \
82 lib/utils/mp_printf.c \
Shruti Gupta38133fa2023-04-19 17:00:38 +010083 lib/extensions/fpu/fpu.c \
Olivier Deprezafcdb7c2019-11-29 14:21:48 +010084 ${XLAT_TABLES_LIB_SRCS}
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020085
86CACTUS_LINKERFILE := spm/cactus/cactus.ld.S
87
88CACTUS_DEFINES :=
89
Alexei Fedorov7fac1622020-06-19 14:25:43 +010090$(eval $(call add_define,CACTUS_DEFINES,ARM_ARCH_MAJOR))
91$(eval $(call add_define,CACTUS_DEFINES,ARM_ARCH_MINOR))
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020092$(eval $(call add_define,CACTUS_DEFINES,DEBUG))
Alexei Fedorov7fac1622020-06-19 14:25:43 +010093$(eval $(call add_define,CACTUS_DEFINES,ENABLE_ASSERTIONS))
94$(eval $(call add_define,CACTUS_DEFINES,ENABLE_BTI))
95$(eval $(call add_define,CACTUS_DEFINES,ENABLE_PAUTH))
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020096$(eval $(call add_define,CACTUS_DEFINES,LOG_LEVEL))
97$(eval $(call add_define,CACTUS_DEFINES,PLAT_${PLAT}))
J-Alves63cdaa72020-10-08 17:22:45 +010098$(eval $(call add_define,CACTUS_DEFINES,PLAT_XLAT_TABLES_DYNAMIC))
Madhukar Pappireddy6f7344b2024-07-05 16:21:26 -050099$(eval $(call add_define,CACTUS_DEFINES,SPMC_AT_EL3))
Deepika Bhavnanic249d5e2020-02-06 16:29:45 -0600100
Antonio Nino Diaz1451f612018-11-30 10:51:26 +0000101$(CACTUS_DTB) : $(BUILD_PLAT)/cactus $(BUILD_PLAT)/cactus/cactus.elf
Arunachalam Ganapathy51be1fe2020-09-22 13:25:21 +0100102$(CACTUS_DTB) : $(CACTUS_DTS)
103 @echo " DTBGEN $@"
Antonio Nino Diaz1451f612018-11-30 10:51:26 +0000104 ${Q}tools/generate_dtb/generate_dtb.sh \
Olivier Deprez6baf5b82021-05-14 19:04:40 +0200105 cactus ${CACTUS_DTS} $(BUILD_PLAT) $(CACTUS_DTB)
Antonio Nino Diaz1451f612018-11-30 10:51:26 +0000106 @echo
107 @echo "Built $@ successfully"
108 @echo
109
Daniel Boulbyf6c288e2022-07-25 14:07:57 +0100110cactus: $(CACTUS_DTB) SP_LAYOUT
Arunachalam Ganapathy51be1fe2020-09-22 13:25:21 +0100111
112# FDTS_CP copies flattened device tree sources
113# $(1) = output directory
114# $(2) = flattened device tree source file to copy
115define FDTS_CP
116 $(eval FDTS := $(addprefix $(1)/,$(notdir $(2))))
117FDTS_LIST += $(FDTS)
118$(FDTS): $(2) $(CACTUS_DTB)
119 @echo " CP $$<"
120 ${Q}cp $$< $$@
121endef
122
123ifdef FDTS_CP_LIST
124 $(eval files := $(filter %.dts,$(FDTS_CP_LIST)))
125 $(eval $(foreach file,$(files),$(call FDTS_CP,$(BUILD_PLAT),$(file))))
126cactus: $(FDTS_LIST)
127endif