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 | d27b37d | 2021-03-02 14:41:58 +0000 | [diff] [blame] | 35 | aarch64/cactus_exceptions.S \ |
Manish Pandey | d27b37d | 2021-03-02 14:41:58 +0000 | [diff] [blame] | 36 | cactus_interrupt.c \ |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 37 | cactus_main.c \ |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 38 | ) \ |
| 39 | $(addprefix spm/common/, \ |
| 40 | aarch64/sp_arch_helpers.S \ |
Ruari Phipps | ddc661a | 2020-09-10 09:06:14 +0100 | [diff] [blame] | 41 | sp_debug.c \ |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 42 | sp_helpers.c \ |
Ruari Phipps | ddc661a | 2020-09-10 09:06:14 +0100 | [diff] [blame] | 43 | spm_helpers.c \ |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 44 | ) \ |
J-Alves | 0e1e7ca | 2021-01-25 14:11:06 +0000 | [diff] [blame] | 45 | $(addprefix spm/cactus/cactus_tests/, \ |
J-Alves | eeb2547 | 2021-03-11 09:54:21 +0000 | [diff] [blame] | 46 | cactus_message_loop.c \ |
J-Alves | 0e1e7ca | 2021-01-25 14:11:06 +0000 | [diff] [blame] | 47 | cactus_test_cpu_features.c \ |
| 48 | cactus_test_direct_messaging.c \ |
J-Alves | ecd3074 | 2021-02-19 18:31:06 +0000 | [diff] [blame] | 49 | cactus_test_ffa.c \ |
Manish Pandey | 9ee6a8d | 2021-03-03 09:53:33 +0000 | [diff] [blame] | 50 | cactus_test_interrupts.c \ |
J-Alves | 0e1e7ca | 2021-01-25 14:11:06 +0000 | [diff] [blame] | 51 | cactus_test_memory_sharing.c \ |
Madhukar Pappireddy | 172523b | 2020-12-31 19:25:33 -0600 | [diff] [blame] | 52 | cactus_tests_smmuv3.c \ |
J-Alves | b4e89a2 | 2021-03-09 10:04:39 +0000 | [diff] [blame] | 53 | cactus_test_notifications.c \ |
J-Alves | 0e1e7ca | 2021-01-25 14:11:06 +0000 | [diff] [blame] | 54 | ) |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 55 | |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 56 | # TODO: Remove dependency on TFTF files. |
| 57 | CACTUS_SOURCES += \ |
| 58 | tftf/framework/debug.c \ |
J-Alves | 5aecd98 | 2020-06-11 10:25:33 +0100 | [diff] [blame] | 59 | tftf/framework/${ARCH}/asm_debug.S \ |
Olivier Deprez | 458d553 | 2020-06-09 17:56:20 +0200 | [diff] [blame] | 60 | tftf/tests/runtime_services/secure_service/ffa_helpers.c \ |
Max Shvetsov | 103e056 | 2021-02-04 16:58:31 +0000 | [diff] [blame] | 61 | tftf/tests/runtime_services/secure_service/spm_common.c \ |
Olivier Deprez | 458d553 | 2020-06-09 17:56:20 +0200 | [diff] [blame] | 62 | tftf/framework/${ARCH}/exception_report.c |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 63 | |
| 64 | CACTUS_SOURCES += drivers/arm/pl011/${ARCH}/pl011_console.S \ |
Madhukar Pappireddy | dd7db24 | 2021-08-05 14:14:15 -0500 | [diff] [blame] | 65 | drivers/arm/sp805/sp805.c \ |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 66 | lib/${ARCH}/cache_helpers.S \ |
| 67 | lib/${ARCH}/misc_helpers.S \ |
Olivier Deprez | afcdb7c | 2019-11-29 14:21:48 +0100 | [diff] [blame] | 68 | lib/smc/${ARCH}/asm_smc.S \ |
| 69 | lib/smc/${ARCH}/smc.c \ |
| 70 | lib/smc/${ARCH}/hvc.c \ |
Olivier Deprez | 20b9b17 | 2021-04-22 14:39:54 +0200 | [diff] [blame^] | 71 | lib/exceptions/${ARCH}/sync.c \ |
Sandrine Bailleux | 750b7cc | 2018-11-08 14:10:18 +0100 | [diff] [blame] | 72 | lib/locks/${ARCH}/spinlock.S \ |
| 73 | lib/utils/mp_printf.c \ |
Olivier Deprez | afcdb7c | 2019-11-29 14:21:48 +0100 | [diff] [blame] | 74 | ${XLAT_TABLES_LIB_SRCS} |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 75 | |
| 76 | CACTUS_LINKERFILE := spm/cactus/cactus.ld.S |
| 77 | |
| 78 | CACTUS_DEFINES := |
| 79 | |
Alexei Fedorov | 7fac162 | 2020-06-19 14:25:43 +0100 | [diff] [blame] | 80 | $(eval $(call add_define,CACTUS_DEFINES,ARM_ARCH_MAJOR)) |
| 81 | $(eval $(call add_define,CACTUS_DEFINES,ARM_ARCH_MINOR)) |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 82 | $(eval $(call add_define,CACTUS_DEFINES,DEBUG)) |
Alexei Fedorov | 7fac162 | 2020-06-19 14:25:43 +0100 | [diff] [blame] | 83 | $(eval $(call add_define,CACTUS_DEFINES,ENABLE_ASSERTIONS)) |
| 84 | $(eval $(call add_define,CACTUS_DEFINES,ENABLE_BTI)) |
| 85 | $(eval $(call add_define,CACTUS_DEFINES,ENABLE_PAUTH)) |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 86 | $(eval $(call add_define,CACTUS_DEFINES,LOG_LEVEL)) |
| 87 | $(eval $(call add_define,CACTUS_DEFINES,PLAT_${PLAT})) |
J-Alves | 63cdaa7 | 2020-10-08 17:22:45 +0100 | [diff] [blame] | 88 | $(eval $(call add_define,CACTUS_DEFINES,PLAT_XLAT_TABLES_DYNAMIC)) |
Deepika Bhavnani | c249d5e | 2020-02-06 16:29:45 -0600 | [diff] [blame] | 89 | |
Antonio Nino Diaz | 1451f61 | 2018-11-30 10:51:26 +0000 | [diff] [blame] | 90 | $(CACTUS_DTB) : $(BUILD_PLAT)/cactus $(BUILD_PLAT)/cactus/cactus.elf |
Arunachalam Ganapathy | 51be1fe | 2020-09-22 13:25:21 +0100 | [diff] [blame] | 91 | $(CACTUS_DTB) : $(CACTUS_DTS) |
| 92 | @echo " DTBGEN $@" |
Antonio Nino Diaz | 1451f61 | 2018-11-30 10:51:26 +0000 | [diff] [blame] | 93 | ${Q}tools/generate_dtb/generate_dtb.sh \ |
Arunachalam Ganapathy | 51be1fe | 2020-09-22 13:25:21 +0100 | [diff] [blame] | 94 | cactus ${CACTUS_DTS} $(BUILD_PLAT) |
Manish Pandey | 270ee15 | 2020-03-16 22:25:40 +0000 | [diff] [blame] | 95 | ${Q}tools/generate_json/generate_json.sh \ |
Arunachalam Ganapathy | 51be1fe | 2020-09-22 13:25:21 +0100 | [diff] [blame] | 96 | cactus $(BUILD_PLAT) |
Antonio Nino Diaz | 1451f61 | 2018-11-30 10:51:26 +0000 | [diff] [blame] | 97 | @echo |
| 98 | @echo "Built $@ successfully" |
| 99 | @echo |
| 100 | |
Bence Szépkúti | 537b358 | 2019-11-29 18:23:56 +0100 | [diff] [blame] | 101 | cactus: $(CACTUS_DTB) |
Arunachalam Ganapathy | 51be1fe | 2020-09-22 13:25:21 +0100 | [diff] [blame] | 102 | |
| 103 | # FDTS_CP copies flattened device tree sources |
| 104 | # $(1) = output directory |
| 105 | # $(2) = flattened device tree source file to copy |
| 106 | define FDTS_CP |
| 107 | $(eval FDTS := $(addprefix $(1)/,$(notdir $(2)))) |
| 108 | FDTS_LIST += $(FDTS) |
| 109 | $(FDTS): $(2) $(CACTUS_DTB) |
| 110 | @echo " CP $$<" |
| 111 | ${Q}cp $$< $$@ |
| 112 | endef |
| 113 | |
| 114 | ifdef FDTS_CP_LIST |
| 115 | $(eval files := $(filter %.dts,$(FDTS_CP_LIST))) |
| 116 | $(eval $(foreach file,$(files),$(call FDTS_CP,$(BUILD_PLAT),$(file)))) |
| 117 | cactus: $(FDTS_LIST) |
| 118 | endif |