Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 1 | # |
Max Shvetsov | 103e056 | 2021-02-04 16:58:31 +0000 | [diff] [blame] | 2 | # Copyright (c) 2018-2021, Arm Limited. All rights reserved. |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | |
Alexei Fedorov | 7fac162 | 2020-06-19 14:25:43 +0100 | [diff] [blame] | 7 | include branch_protection.mk |
Olivier Deprez | afcdb7c | 2019-11-29 14:21:48 +0100 | [diff] [blame] | 8 | include lib/xlat_tables_v2/xlat_tables.mk |
Antonio Nino Diaz | 43ef393 | 2018-07-03 14:39:47 +0100 | [diff] [blame] | 9 | |
Arunachalam Ganapathy | 51be1fe | 2020-09-22 13:25:21 +0100 | [diff] [blame] | 10 | # Include cactus platform make file |
| 11 | CACTUS_PLAT_PATH := $(shell find spm/cactus/plat -wholename '*/${PLAT}') |
| 12 | ifneq (${CACTUS_PLAT_PATH},) |
| 13 | include ${CACTUS_PLAT_PATH}/platform.mk |
| 14 | endif |
| 15 | |
Antonio Nino Diaz | 1451f61 | 2018-11-30 10:51:26 +0000 | [diff] [blame] | 16 | CACTUS_DTB := $(BUILD_PLAT)/cactus.dtb |
| 17 | |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 18 | CACTUS_INCLUDES := \ |
Olivier Deprez | afcdb7c | 2019-11-29 14:21:48 +0100 | [diff] [blame] | 19 | -Itftf/framework/include \ |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 20 | -Iinclude \ |
| 21 | -Iinclude/common \ |
| 22 | -Iinclude/common/${ARCH} \ |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 23 | -Iinclude/lib \ |
| 24 | -Iinclude/lib/${ARCH} \ |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 25 | -Iinclude/lib/utils \ |
| 26 | -Iinclude/lib/xlat_tables \ |
Olivier Deprez | 458d553 | 2020-06-09 17:56:20 +0200 | [diff] [blame] | 27 | -Iinclude/plat/common \ |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 28 | -Iinclude/runtime_services \ |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 29 | -Ispm/cactus \ |
Olivier Deprez | 458d553 | 2020-06-09 17:56:20 +0200 | [diff] [blame] | 30 | -Ispm/common |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 31 | |
| 32 | CACTUS_SOURCES := \ |
| 33 | $(addprefix spm/cactus/, \ |
| 34 | aarch64/cactus_entrypoint.S \ |
Manish Pandey | 2949537 | 2020-04-09 15:19:26 +0100 | [diff] [blame] | 35 | cactus_debug.c \ |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 36 | cactus_main.c \ |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 37 | ) \ |
| 38 | $(addprefix spm/common/, \ |
| 39 | aarch64/sp_arch_helpers.S \ |
| 40 | sp_helpers.c \ |
| 41 | ) \ |
J-Alves | 0e1e7ca | 2021-01-25 14:11:06 +0000 | [diff] [blame] | 42 | $(addprefix spm/cactus/cactus_tests/, \ |
| 43 | cactus_test_cpu_features.c \ |
J-Alves | 92f15be | 2021-02-19 14:49:51 +0000 | [diff] [blame] | 44 | cactus_test_cmds.c \ |
J-Alves | 0e1e7ca | 2021-01-25 14:11:06 +0000 | [diff] [blame] | 45 | cactus_test_direct_messaging.c \ |
J-Alves | ecd3074 | 2021-02-19 18:31:06 +0000 | [diff] [blame] | 46 | cactus_test_ffa.c \ |
J-Alves | 0e1e7ca | 2021-01-25 14:11:06 +0000 | [diff] [blame] | 47 | cactus_test_memory_sharing.c \ |
| 48 | ) |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 49 | |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 50 | # TODO: Remove dependency on TFTF files. |
| 51 | CACTUS_SOURCES += \ |
| 52 | tftf/framework/debug.c \ |
J-Alves | 5aecd98 | 2020-06-11 10:25:33 +0100 | [diff] [blame] | 53 | tftf/framework/${ARCH}/asm_debug.S \ |
Olivier Deprez | 458d553 | 2020-06-09 17:56:20 +0200 | [diff] [blame] | 54 | tftf/tests/runtime_services/secure_service/ffa_helpers.c \ |
Max Shvetsov | 103e056 | 2021-02-04 16:58:31 +0000 | [diff] [blame] | 55 | tftf/tests/runtime_services/secure_service/spm_common.c \ |
Olivier Deprez | 458d553 | 2020-06-09 17:56:20 +0200 | [diff] [blame] | 56 | tftf/framework/${ARCH}/exceptions.S \ |
| 57 | tftf/framework/${ARCH}/exception_report.c |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 58 | |
| 59 | CACTUS_SOURCES += drivers/arm/pl011/${ARCH}/pl011_console.S \ |
| 60 | lib/${ARCH}/cache_helpers.S \ |
| 61 | lib/${ARCH}/misc_helpers.S \ |
Olivier Deprez | afcdb7c | 2019-11-29 14:21:48 +0100 | [diff] [blame] | 62 | lib/smc/${ARCH}/asm_smc.S \ |
| 63 | lib/smc/${ARCH}/smc.c \ |
| 64 | lib/smc/${ARCH}/hvc.c \ |
Sandrine Bailleux | 750b7cc | 2018-11-08 14:10:18 +0100 | [diff] [blame] | 65 | lib/locks/${ARCH}/spinlock.S \ |
| 66 | lib/utils/mp_printf.c \ |
Olivier Deprez | afcdb7c | 2019-11-29 14:21:48 +0100 | [diff] [blame] | 67 | ${XLAT_TABLES_LIB_SRCS} |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 68 | |
| 69 | CACTUS_LINKERFILE := spm/cactus/cactus.ld.S |
| 70 | |
| 71 | CACTUS_DEFINES := |
| 72 | |
Alexei Fedorov | 7fac162 | 2020-06-19 14:25:43 +0100 | [diff] [blame] | 73 | $(eval $(call add_define,CACTUS_DEFINES,ARM_ARCH_MAJOR)) |
| 74 | $(eval $(call add_define,CACTUS_DEFINES,ARM_ARCH_MINOR)) |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 75 | $(eval $(call add_define,CACTUS_DEFINES,DEBUG)) |
Alexei Fedorov | 7fac162 | 2020-06-19 14:25:43 +0100 | [diff] [blame] | 76 | $(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 Fedorov | 7cc2587 | 2020-06-02 16:35:36 +0100 | [diff] [blame] | 79 | $(eval $(call add_define,CACTUS_DEFINES,FVP_CLUSTER_COUNT)) |
| 80 | $(eval $(call add_define,CACTUS_DEFINES,FVP_MAX_CPUS_PER_CLUSTER)) |
Alexei Fedorov | 0f30547 | 2019-10-29 14:06:54 +0000 | [diff] [blame] | 81 | $(eval $(call add_define,CACTUS_DEFINES,FVP_MAX_PE_PER_CPU)) |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 82 | $(eval $(call add_define,CACTUS_DEFINES,LOG_LEVEL)) |
| 83 | $(eval $(call add_define,CACTUS_DEFINES,PLAT_${PLAT})) |
J-Alves | 63cdaa7 | 2020-10-08 17:22:45 +0100 | [diff] [blame] | 84 | $(eval $(call add_define,CACTUS_DEFINES,PLAT_XLAT_TABLES_DYNAMIC)) |
Deepika Bhavnani | c249d5e | 2020-02-06 16:29:45 -0600 | [diff] [blame] | 85 | |
Antonio Nino Diaz | 1451f61 | 2018-11-30 10:51:26 +0000 | [diff] [blame] | 86 | $(CACTUS_DTB) : $(BUILD_PLAT)/cactus $(BUILD_PLAT)/cactus/cactus.elf |
Arunachalam Ganapathy | 51be1fe | 2020-09-22 13:25:21 +0100 | [diff] [blame] | 87 | $(CACTUS_DTB) : $(CACTUS_DTS) |
| 88 | @echo " DTBGEN $@" |
Antonio Nino Diaz | 1451f61 | 2018-11-30 10:51:26 +0000 | [diff] [blame] | 89 | ${Q}tools/generate_dtb/generate_dtb.sh \ |
Arunachalam Ganapathy | 51be1fe | 2020-09-22 13:25:21 +0100 | [diff] [blame] | 90 | cactus ${CACTUS_DTS} $(BUILD_PLAT) |
Manish Pandey | 270ee15 | 2020-03-16 22:25:40 +0000 | [diff] [blame] | 91 | ${Q}tools/generate_json/generate_json.sh \ |
Arunachalam Ganapathy | 51be1fe | 2020-09-22 13:25:21 +0100 | [diff] [blame] | 92 | cactus $(BUILD_PLAT) |
Antonio Nino Diaz | 1451f61 | 2018-11-30 10:51:26 +0000 | [diff] [blame] | 93 | @echo |
| 94 | @echo "Built $@ successfully" |
| 95 | @echo |
| 96 | |
Bence Szépkúti | 537b358 | 2019-11-29 18:23:56 +0100 | [diff] [blame] | 97 | cactus: $(CACTUS_DTB) |
Arunachalam Ganapathy | 51be1fe | 2020-09-22 13:25:21 +0100 | [diff] [blame] | 98 | |
| 99 | # FDTS_CP copies flattened device tree sources |
| 100 | # $(1) = output directory |
| 101 | # $(2) = flattened device tree source file to copy |
| 102 | define FDTS_CP |
| 103 | $(eval FDTS := $(addprefix $(1)/,$(notdir $(2)))) |
| 104 | FDTS_LIST += $(FDTS) |
| 105 | $(FDTS): $(2) $(CACTUS_DTB) |
| 106 | @echo " CP $$<" |
| 107 | ${Q}cp $$< $$@ |
| 108 | endef |
| 109 | |
| 110 | ifdef FDTS_CP_LIST |
| 111 | $(eval files := $(filter %.dts,$(FDTS_CP_LIST))) |
| 112 | $(eval $(foreach file,$(files),$(call FDTS_CP,$(BUILD_PLAT),$(file)))) |
| 113 | cactus: $(FDTS_LIST) |
| 114 | endif |