Antonio Nino Diaz | 0b1ab40 | 2018-12-05 15:38:39 +0000 | [diff] [blame] | 1 | # |
Olivier Deprez | 6baf5b8 | 2021-05-14 19:04:40 +0200 | [diff] [blame] | 2 | # Copyright (c) 2018-2022, Arm Limited. All rights reserved. |
Antonio Nino Diaz | 0b1ab40 | 2018-12-05 15:38:39 +0000 | [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 |
Ruari Phipps | 9f1952c | 2020-08-24 11:32:32 +0100 | [diff] [blame] | 8 | include lib/xlat_tables_v2/xlat_tables.mk |
Antonio Nino Diaz | 0b1ab40 | 2018-12-05 15:38:39 +0000 | [diff] [blame] | 9 | |
Olivier Deprez | 2765ebf | 2020-12-16 15:46:14 +0100 | [diff] [blame] | 10 | # Include ivy platform Makefile |
| 11 | IVY_PLAT_PATH := $(shell find spm/ivy/app/plat -wholename '*/${PLAT}') |
| 12 | ifneq (${IVY_PLAT_PATH},) |
| 13 | include ${IVY_PLAT_PATH}/platform.mk |
| 14 | endif |
| 15 | |
Olivier Deprez | 6baf5b8 | 2021-05-14 19:04:40 +0200 | [diff] [blame] | 16 | IVY_SHIM := 1 |
| 17 | |
| 18 | ifeq (${IVY_SHIM},1) |
Daniel Boulby | f6c288e | 2022-07-25 14:07:57 +0100 | [diff] [blame] | 19 | IVY_DTB := $(BUILD_PLAT)/ivy-sel1.dtb |
| 20 | SECURE_PARTITIONS += ivy_shim |
Olivier Deprez | 6baf5b8 | 2021-05-14 19:04:40 +0200 | [diff] [blame] | 21 | else |
Daniel Boulby | f6c288e | 2022-07-25 14:07:57 +0100 | [diff] [blame] | 22 | IVY_DTB := $(BUILD_PLAT)/ivy-sel0.dtb |
| 23 | SECURE_PARTITIONS += ivy |
Olivier Deprez | 6baf5b8 | 2021-05-14 19:04:40 +0200 | [diff] [blame] | 24 | endif |
Antonio Nino Diaz | 1451f61 | 2018-11-30 10:51:26 +0000 | [diff] [blame] | 25 | |
Antonio Nino Diaz | 0b1ab40 | 2018-12-05 15:38:39 +0000 | [diff] [blame] | 26 | IVY_INCLUDES := \ |
Ruari Phipps | 9f1952c | 2020-08-24 11:32:32 +0100 | [diff] [blame] | 27 | -Itftf/framework/include \ |
Antonio Nino Diaz | 0b1ab40 | 2018-12-05 15:38:39 +0000 | [diff] [blame] | 28 | -Iinclude \ |
| 29 | -Iinclude/common \ |
| 30 | -Iinclude/common/${ARCH} \ |
Antonio Nino Diaz | 0b1ab40 | 2018-12-05 15:38:39 +0000 | [diff] [blame] | 31 | -Iinclude/lib \ |
| 32 | -Iinclude/lib/${ARCH} \ |
Antonio Nino Diaz | 0b1ab40 | 2018-12-05 15:38:39 +0000 | [diff] [blame] | 33 | -Iinclude/lib/utils \ |
| 34 | -Iinclude/lib/xlat_tables \ |
Daniel Boulby | f3da591 | 2022-04-01 12:31:52 +0100 | [diff] [blame] | 35 | -Iinclude/plat/common \ |
Antonio Nino Diaz | 0b1ab40 | 2018-12-05 15:38:39 +0000 | [diff] [blame] | 36 | -Iinclude/runtime_services \ |
| 37 | -Iinclude/runtime_services/secure_el0_payloads \ |
Daniel Boulby | f3da591 | 2022-04-01 12:31:52 +0100 | [diff] [blame] | 38 | -Ispm/ivy/app \ |
Ruari Phipps | 1925b2a | 2020-09-10 14:05:55 +0100 | [diff] [blame] | 39 | -Ispm/ivy/shim \ |
Daniel Boulby | f3da591 | 2022-04-01 12:31:52 +0100 | [diff] [blame] | 40 | -Ispm/common \ |
| 41 | -Ispm/common/sp_tests/ |
Antonio Nino Diaz | 0b1ab40 | 2018-12-05 15:38:39 +0000 | [diff] [blame] | 42 | |
| 43 | IVY_SOURCES := \ |
Ruari Phipps | 1925b2a | 2020-09-10 14:05:55 +0100 | [diff] [blame] | 44 | $(addprefix spm/ivy/app/, \ |
Antonio Nino Diaz | 0b1ab40 | 2018-12-05 15:38:39 +0000 | [diff] [blame] | 45 | aarch64/ivy_entrypoint.S \ |
| 46 | ivy_main.c \ |
| 47 | ) \ |
| 48 | $(addprefix spm/common/, \ |
Ruari Phipps | ddc661a | 2020-09-10 09:06:14 +0100 | [diff] [blame] | 49 | sp_debug.c \ |
Antonio Nino Diaz | 0b1ab40 | 2018-12-05 15:38:39 +0000 | [diff] [blame] | 50 | sp_helpers.c \ |
Ruari Phipps | ddc661a | 2020-09-10 09:06:14 +0100 | [diff] [blame] | 51 | spm_helpers.c \ |
Antonio Nino Diaz | 0b1ab40 | 2018-12-05 15:38:39 +0000 | [diff] [blame] | 52 | ) \ |
Daniel Boulby | f3da591 | 2022-04-01 12:31:52 +0100 | [diff] [blame] | 53 | $(addprefix spm/common/sp_tests/, \ |
| 54 | sp_test_ffa.c \ |
| 55 | ) |
Antonio Nino Diaz | 0b1ab40 | 2018-12-05 15:38:39 +0000 | [diff] [blame] | 56 | |
Olivier Deprez | 6baf5b8 | 2021-05-14 19:04:40 +0200 | [diff] [blame] | 57 | ifeq ($(IVY_SHIM),1) |
| 58 | IVY_SOURCES += \ |
| 59 | $(addprefix spm/ivy/shim/, \ |
| 60 | aarch64/spm_shim_entrypoint.S \ |
| 61 | aarch64/spm_shim_exceptions.S \ |
| 62 | shim_main.c \ |
| 63 | ) |
| 64 | endif |
| 65 | |
Antonio Nino Diaz | 0b1ab40 | 2018-12-05 15:38:39 +0000 | [diff] [blame] | 66 | # TODO: Remove dependency on TFTF files. |
Daniel Boulby | f3da591 | 2022-04-01 12:31:52 +0100 | [diff] [blame] | 67 | IVY_SOURCES += \ |
| 68 | tftf/framework/debug.c \ |
| 69 | tftf/framework/${ARCH}/asm_debug.S \ |
Daniel Boulby | ce386b1 | 2022-03-29 18:36:36 +0100 | [diff] [blame] | 70 | tftf/tests/runtime_services/secure_service/${ARCH}/ffa_arch_helpers.S \ |
Daniel Boulby | f3da591 | 2022-04-01 12:31:52 +0100 | [diff] [blame] | 71 | tftf/tests/runtime_services/secure_service/ffa_helpers.c \ |
| 72 | tftf/tests/runtime_services/secure_service/spm_common.c |
Antonio Nino Diaz | 0b1ab40 | 2018-12-05 15:38:39 +0000 | [diff] [blame] | 73 | |
| 74 | IVY_SOURCES += drivers/arm/pl011/${ARCH}/pl011_console.S \ |
| 75 | lib/${ARCH}/cache_helpers.S \ |
| 76 | lib/${ARCH}/misc_helpers.S \ |
Ruari Phipps | ddc661a | 2020-09-10 09:06:14 +0100 | [diff] [blame] | 77 | lib/smc/${ARCH}/asm_smc.S \ |
| 78 | lib/smc/${ARCH}/smc.c \ |
| 79 | lib/smc/${ARCH}/hvc.c \ |
Sandrine Bailleux | 750b7cc | 2018-11-08 14:10:18 +0100 | [diff] [blame] | 80 | lib/locks/${ARCH}/spinlock.S \ |
| 81 | lib/utils/mp_printf.c \ |
Ruari Phipps | 9f1952c | 2020-08-24 11:32:32 +0100 | [diff] [blame] | 82 | ${XLAT_TABLES_LIB_SRCS} |
Antonio Nino Diaz | 0b1ab40 | 2018-12-05 15:38:39 +0000 | [diff] [blame] | 83 | |
| 84 | IVY_LINKERFILE := spm/ivy/ivy.ld.S |
| 85 | |
| 86 | IVY_DEFINES := |
| 87 | |
Alexei Fedorov | 7fac162 | 2020-06-19 14:25:43 +0100 | [diff] [blame] | 88 | $(eval $(call add_define,IVY_DEFINES,ARM_ARCH_MAJOR)) |
| 89 | $(eval $(call add_define,IVY_DEFINES,ARM_ARCH_MINOR)) |
Antonio Nino Diaz | 0b1ab40 | 2018-12-05 15:38:39 +0000 | [diff] [blame] | 90 | $(eval $(call add_define,IVY_DEFINES,DEBUG)) |
| 91 | $(eval $(call add_define,IVY_DEFINES,ENABLE_ASSERTIONS)) |
Alexei Fedorov | 7fac162 | 2020-06-19 14:25:43 +0100 | [diff] [blame] | 92 | $(eval $(call add_define,IVY_DEFINES,ENABLE_BTI)) |
| 93 | $(eval $(call add_define,IVY_DEFINES,ENABLE_PAUTH)) |
Antonio Nino Diaz | 0b1ab40 | 2018-12-05 15:38:39 +0000 | [diff] [blame] | 94 | $(eval $(call add_define,IVY_DEFINES,LOG_LEVEL)) |
| 95 | $(eval $(call add_define,IVY_DEFINES,PLAT_${PLAT})) |
Olivier Deprez | 6baf5b8 | 2021-05-14 19:04:40 +0200 | [diff] [blame] | 96 | $(eval $(call add_define,IVY_DEFINES,IVY_SHIM)) |
Antonio Nino Diaz | 0b1ab40 | 2018-12-05 15:38:39 +0000 | [diff] [blame] | 97 | |
Antonio Nino Diaz | 1451f61 | 2018-11-30 10:51:26 +0000 | [diff] [blame] | 98 | $(IVY_DTB) : $(BUILD_PLAT)/ivy $(BUILD_PLAT)/ivy/ivy.elf |
Olivier Deprez | 2765ebf | 2020-12-16 15:46:14 +0100 | [diff] [blame] | 99 | $(IVY_DTB) : $(IVY_DTS) |
| 100 | @echo " DTBGEN $@" |
Antonio Nino Diaz | 1451f61 | 2018-11-30 10:51:26 +0000 | [diff] [blame] | 101 | ${Q}tools/generate_dtb/generate_dtb.sh \ |
Olivier Deprez | 6baf5b8 | 2021-05-14 19:04:40 +0200 | [diff] [blame] | 102 | ivy ${IVY_DTS} $(BUILD_PLAT) $(IVY_DTB) |
Antonio Nino Diaz | 1451f61 | 2018-11-30 10:51:26 +0000 | [diff] [blame] | 103 | @echo |
| 104 | @echo "Built $@ successfully" |
| 105 | @echo |
| 106 | |
Daniel Boulby | f6c288e | 2022-07-25 14:07:57 +0100 | [diff] [blame] | 107 | ivy: $(IVY_DTB) SP_LAYOUT |
Olivier Deprez | 2765ebf | 2020-12-16 15:46:14 +0100 | [diff] [blame] | 108 | |
| 109 | # FDTS_CP copies flattened device tree sources |
| 110 | # $(1) = output directory |
| 111 | # $(2) = flattened device tree source file to copy |
| 112 | define FDTS_CP |
| 113 | $(eval FDTS := $(addprefix $(1)/,$(notdir $(2)))) |
| 114 | FDTS_LIST += $(FDTS) |
| 115 | $(FDTS): $(2) $(IVY_DTB) |
| 116 | @echo " CP $$<" |
| 117 | ${Q}cp $$< $$@ |
| 118 | endef |
| 119 | |
| 120 | ifdef FDTS_CP_LIST |
| 121 | $(eval files := $(filter %.dts,$(FDTS_CP_LIST))) |
| 122 | $(eval $(foreach file,$(files),$(call FDTS_CP,$(BUILD_PLAT),$(file)))) |
| 123 | ivy: $(FDTS_LIST) |
| 124 | endif |