blob: 31ac990c9f973b38e5ea043d7971718e7b41fbc4 [file] [log] [blame]
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +02001#
Max Shvetsov103e0562021-02-04 16:58:31 +00002# Copyright (c) 2018-2021, 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
Antonio Nino Diaz1451f612018-11-30 10:51:26 +000016CACTUS_DTB := $(BUILD_PLAT)/cactus.dtb
17
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020018CACTUS_INCLUDES := \
Olivier Deprezafcdb7c2019-11-29 14:21:48 +010019 -Itftf/framework/include \
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020020 -Iinclude \
21 -Iinclude/common \
22 -Iinclude/common/${ARCH} \
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020023 -Iinclude/lib \
24 -Iinclude/lib/${ARCH} \
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020025 -Iinclude/lib/utils \
26 -Iinclude/lib/xlat_tables \
Olivier Deprez458d5532020-06-09 17:56:20 +020027 -Iinclude/plat/common \
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020028 -Iinclude/runtime_services \
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020029 -Ispm/cactus \
Olivier Deprez458d5532020-06-09 17:56:20 +020030 -Ispm/common
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020031
32CACTUS_SOURCES := \
33 $(addprefix spm/cactus/, \
34 aarch64/cactus_entrypoint.S \
Manish Pandey29495372020-04-09 15:19:26 +010035 cactus_debug.c \
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020036 cactus_main.c \
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020037 ) \
38 $(addprefix spm/common/, \
39 aarch64/sp_arch_helpers.S \
40 sp_helpers.c \
41 ) \
J-Alves0e1e7ca2021-01-25 14:11:06 +000042 $(addprefix spm/cactus/cactus_tests/, \
43 cactus_test_cpu_features.c \
J-Alves92f15be2021-02-19 14:49:51 +000044 cactus_test_cmds.c \
J-Alves0e1e7ca2021-01-25 14:11:06 +000045 cactus_test_direct_messaging.c \
J-Alvesecd30742021-02-19 18:31:06 +000046 cactus_test_ffa.c \
J-Alves0e1e7ca2021-01-25 14:11:06 +000047 cactus_test_memory_sharing.c \
48 )
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020049
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020050# TODO: Remove dependency on TFTF files.
51CACTUS_SOURCES += \
52 tftf/framework/debug.c \
J-Alves5aecd982020-06-11 10:25:33 +010053 tftf/framework/${ARCH}/asm_debug.S \
Olivier Deprez458d5532020-06-09 17:56:20 +020054 tftf/tests/runtime_services/secure_service/ffa_helpers.c \
Max Shvetsov103e0562021-02-04 16:58:31 +000055 tftf/tests/runtime_services/secure_service/spm_common.c \
Olivier Deprez458d5532020-06-09 17:56:20 +020056 tftf/framework/${ARCH}/exceptions.S \
57 tftf/framework/${ARCH}/exception_report.c
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020058
59CACTUS_SOURCES += drivers/arm/pl011/${ARCH}/pl011_console.S \
60 lib/${ARCH}/cache_helpers.S \
61 lib/${ARCH}/misc_helpers.S \
Olivier Deprezafcdb7c2019-11-29 14:21:48 +010062 lib/smc/${ARCH}/asm_smc.S \
63 lib/smc/${ARCH}/smc.c \
64 lib/smc/${ARCH}/hvc.c \
Sandrine Bailleux750b7cc2018-11-08 14:10:18 +010065 lib/locks/${ARCH}/spinlock.S \
66 lib/utils/mp_printf.c \
Olivier Deprezafcdb7c2019-11-29 14:21:48 +010067 ${XLAT_TABLES_LIB_SRCS}
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020068
69CACTUS_LINKERFILE := spm/cactus/cactus.ld.S
70
71CACTUS_DEFINES :=
72
Alexei Fedorov7fac1622020-06-19 14:25:43 +010073$(eval $(call add_define,CACTUS_DEFINES,ARM_ARCH_MAJOR))
74$(eval $(call add_define,CACTUS_DEFINES,ARM_ARCH_MINOR))
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020075$(eval $(call add_define,CACTUS_DEFINES,DEBUG))
Alexei Fedorov7fac1622020-06-19 14:25:43 +010076$(eval $(call add_define,CACTUS_DEFINES,ENABLE_ASSERTIONS))
77$(eval $(call add_define,CACTUS_DEFINES,ENABLE_BTI))
78$(eval $(call add_define,CACTUS_DEFINES,ENABLE_PAUTH))
Alexei Fedorov7cc25872020-06-02 16:35:36 +010079$(eval $(call add_define,CACTUS_DEFINES,FVP_CLUSTER_COUNT))
80$(eval $(call add_define,CACTUS_DEFINES,FVP_MAX_CPUS_PER_CLUSTER))
Alexei Fedorov0f305472019-10-29 14:06:54 +000081$(eval $(call add_define,CACTUS_DEFINES,FVP_MAX_PE_PER_CPU))
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020082$(eval $(call add_define,CACTUS_DEFINES,LOG_LEVEL))
83$(eval $(call add_define,CACTUS_DEFINES,PLAT_${PLAT}))
J-Alves63cdaa72020-10-08 17:22:45 +010084$(eval $(call add_define,CACTUS_DEFINES,PLAT_XLAT_TABLES_DYNAMIC))
Deepika Bhavnanic249d5e2020-02-06 16:29:45 -060085
Antonio Nino Diaz1451f612018-11-30 10:51:26 +000086$(CACTUS_DTB) : $(BUILD_PLAT)/cactus $(BUILD_PLAT)/cactus/cactus.elf
Arunachalam Ganapathy51be1fe2020-09-22 13:25:21 +010087$(CACTUS_DTB) : $(CACTUS_DTS)
88 @echo " DTBGEN $@"
Antonio Nino Diaz1451f612018-11-30 10:51:26 +000089 ${Q}tools/generate_dtb/generate_dtb.sh \
Arunachalam Ganapathy51be1fe2020-09-22 13:25:21 +010090 cactus ${CACTUS_DTS} $(BUILD_PLAT)
Manish Pandey270ee152020-03-16 22:25:40 +000091 ${Q}tools/generate_json/generate_json.sh \
Arunachalam Ganapathy51be1fe2020-09-22 13:25:21 +010092 cactus $(BUILD_PLAT)
Antonio Nino Diaz1451f612018-11-30 10:51:26 +000093 @echo
94 @echo "Built $@ successfully"
95 @echo
96
Bence Szépkúti537b3582019-11-29 18:23:56 +010097cactus: $(CACTUS_DTB)
Arunachalam Ganapathy51be1fe2020-09-22 13:25:21 +010098
99# FDTS_CP copies flattened device tree sources
100# $(1) = output directory
101# $(2) = flattened device tree source file to copy
102define FDTS_CP
103 $(eval FDTS := $(addprefix $(1)/,$(notdir $(2))))
104FDTS_LIST += $(FDTS)
105$(FDTS): $(2) $(CACTUS_DTB)
106 @echo " CP $$<"
107 ${Q}cp $$< $$@
108endef
109
110ifdef FDTS_CP_LIST
111 $(eval files := $(filter %.dts,$(FDTS_CP_LIST)))
112 $(eval $(foreach file,$(files),$(call FDTS_CP,$(BUILD_PLAT),$(file))))
113cactus: $(FDTS_LIST)
114endif