Antonio Nino Diaz | 0b1ab40 | 2018-12-05 15:38:39 +0000 | [diff] [blame] | 1 | # |
Ruari Phipps | 9f1952c | 2020-08-24 11:32:32 +0100 | [diff] [blame] | 2 | # Copyright (c) 2018-2021, 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 | |
| 16 | IVY_DTB := build/${PLAT}/debug/ivy.dtb |
Antonio Nino Diaz | 1451f61 | 2018-11-30 10:51:26 +0000 | [diff] [blame] | 17 | |
Antonio Nino Diaz | 0b1ab40 | 2018-12-05 15:38:39 +0000 | [diff] [blame] | 18 | IVY_INCLUDES := \ |
Ruari Phipps | 9f1952c | 2020-08-24 11:32:32 +0100 | [diff] [blame] | 19 | -Itftf/framework/include \ |
Antonio Nino Diaz | 0b1ab40 | 2018-12-05 15:38:39 +0000 | [diff] [blame] | 20 | -Iinclude \ |
| 21 | -Iinclude/common \ |
| 22 | -Iinclude/common/${ARCH} \ |
Antonio Nino Diaz | 0b1ab40 | 2018-12-05 15:38:39 +0000 | [diff] [blame] | 23 | -Iinclude/lib \ |
| 24 | -Iinclude/lib/${ARCH} \ |
Antonio Nino Diaz | 0b1ab40 | 2018-12-05 15:38:39 +0000 | [diff] [blame] | 25 | -Iinclude/lib/utils \ |
| 26 | -Iinclude/lib/xlat_tables \ |
| 27 | -Iinclude/runtime_services \ |
| 28 | -Iinclude/runtime_services/secure_el0_payloads \ |
Ruari Phipps | 1925b2a | 2020-09-10 14:05:55 +0100 | [diff] [blame] | 29 | -Ispm/ivy/app \ |
| 30 | -Ispm/ivy/shim \ |
Ruari Phipps | 9f1952c | 2020-08-24 11:32:32 +0100 | [diff] [blame] | 31 | -Ispm/common |
Antonio Nino Diaz | 0b1ab40 | 2018-12-05 15:38:39 +0000 | [diff] [blame] | 32 | |
| 33 | IVY_SOURCES := \ |
Ruari Phipps | 1925b2a | 2020-09-10 14:05:55 +0100 | [diff] [blame] | 34 | $(addprefix spm/ivy/app/, \ |
Antonio Nino Diaz | 0b1ab40 | 2018-12-05 15:38:39 +0000 | [diff] [blame] | 35 | aarch64/ivy_entrypoint.S \ |
| 36 | ivy_main.c \ |
| 37 | ) \ |
Ruari Phipps | 1925b2a | 2020-09-10 14:05:55 +0100 | [diff] [blame] | 38 | $(addprefix spm/ivy/shim/, \ |
| 39 | aarch64/spm_shim_entrypoint.S \ |
| 40 | aarch64/spm_shim_exceptions.S \ |
| 41 | shim_main.c \ |
| 42 | ) \ |
Antonio Nino Diaz | 0b1ab40 | 2018-12-05 15:38:39 +0000 | [diff] [blame] | 43 | $(addprefix spm/common/, \ |
| 44 | aarch64/sp_arch_helpers.S \ |
Ruari Phipps | ddc661a | 2020-09-10 09:06:14 +0100 | [diff] [blame] | 45 | sp_debug.c \ |
Antonio Nino Diaz | 0b1ab40 | 2018-12-05 15:38:39 +0000 | [diff] [blame] | 46 | sp_helpers.c \ |
Ruari Phipps | ddc661a | 2020-09-10 09:06:14 +0100 | [diff] [blame] | 47 | spm_helpers.c \ |
Antonio Nino Diaz | 0b1ab40 | 2018-12-05 15:38:39 +0000 | [diff] [blame] | 48 | ) \ |
| 49 | |
Antonio Nino Diaz | 0b1ab40 | 2018-12-05 15:38:39 +0000 | [diff] [blame] | 50 | # TODO: Remove dependency on TFTF files. |
| 51 | IVY_SOURCES += \ |
| 52 | tftf/framework/debug.c \ |
Ruari Phipps | 9f1952c | 2020-08-24 11:32:32 +0100 | [diff] [blame] | 53 | tftf/framework/${ARCH}/asm_debug.S \ |
| 54 | tftf/tests/runtime_services/secure_service/ffa_helpers.c |
Antonio Nino Diaz | 0b1ab40 | 2018-12-05 15:38:39 +0000 | [diff] [blame] | 55 | |
| 56 | IVY_SOURCES += drivers/arm/pl011/${ARCH}/pl011_console.S \ |
| 57 | lib/${ARCH}/cache_helpers.S \ |
| 58 | lib/${ARCH}/misc_helpers.S \ |
Ruari Phipps | ddc661a | 2020-09-10 09:06:14 +0100 | [diff] [blame] | 59 | lib/smc/${ARCH}/asm_smc.S \ |
| 60 | lib/smc/${ARCH}/smc.c \ |
| 61 | lib/smc/${ARCH}/hvc.c \ |
Sandrine Bailleux | 750b7cc | 2018-11-08 14:10:18 +0100 | [diff] [blame] | 62 | lib/locks/${ARCH}/spinlock.S \ |
| 63 | lib/utils/mp_printf.c \ |
Ruari Phipps | 9f1952c | 2020-08-24 11:32:32 +0100 | [diff] [blame] | 64 | ${XLAT_TABLES_LIB_SRCS} |
Antonio Nino Diaz | 0b1ab40 | 2018-12-05 15:38:39 +0000 | [diff] [blame] | 65 | |
| 66 | IVY_LINKERFILE := spm/ivy/ivy.ld.S |
| 67 | |
| 68 | IVY_DEFINES := |
| 69 | |
Alexei Fedorov | 7fac162 | 2020-06-19 14:25:43 +0100 | [diff] [blame] | 70 | $(eval $(call add_define,IVY_DEFINES,ARM_ARCH_MAJOR)) |
| 71 | $(eval $(call add_define,IVY_DEFINES,ARM_ARCH_MINOR)) |
Antonio Nino Diaz | 0b1ab40 | 2018-12-05 15:38:39 +0000 | [diff] [blame] | 72 | $(eval $(call add_define,IVY_DEFINES,DEBUG)) |
| 73 | $(eval $(call add_define,IVY_DEFINES,ENABLE_ASSERTIONS)) |
Alexei Fedorov | 7fac162 | 2020-06-19 14:25:43 +0100 | [diff] [blame] | 74 | $(eval $(call add_define,IVY_DEFINES,ENABLE_BTI)) |
| 75 | $(eval $(call add_define,IVY_DEFINES,ENABLE_PAUTH)) |
Antonio Nino Diaz | 0b1ab40 | 2018-12-05 15:38:39 +0000 | [diff] [blame] | 76 | $(eval $(call add_define,IVY_DEFINES,LOG_LEVEL)) |
| 77 | $(eval $(call add_define,IVY_DEFINES,PLAT_${PLAT})) |
Antonio Nino Diaz | 0b1ab40 | 2018-12-05 15:38:39 +0000 | [diff] [blame] | 78 | |
Antonio Nino Diaz | 1451f61 | 2018-11-30 10:51:26 +0000 | [diff] [blame] | 79 | $(IVY_DTB) : $(BUILD_PLAT)/ivy $(BUILD_PLAT)/ivy/ivy.elf |
Olivier Deprez | 2765ebf | 2020-12-16 15:46:14 +0100 | [diff] [blame] | 80 | $(IVY_DTB) : $(IVY_DTS) |
| 81 | @echo " DTBGEN $@" |
Antonio Nino Diaz | 1451f61 | 2018-11-30 10:51:26 +0000 | [diff] [blame] | 82 | ${Q}tools/generate_dtb/generate_dtb.sh \ |
Olivier Deprez | 2765ebf | 2020-12-16 15:46:14 +0100 | [diff] [blame] | 83 | ivy ${IVY_DTS} $(BUILD_PLAT) |
| 84 | ${Q}tools/generate_json/generate_json.sh \ |
| 85 | ivy $(BUILD_PLAT) |
Antonio Nino Diaz | 1451f61 | 2018-11-30 10:51:26 +0000 | [diff] [blame] | 86 | @echo |
| 87 | @echo "Built $@ successfully" |
| 88 | @echo |
| 89 | |
Bence Szépkúti | 537b358 | 2019-11-29 18:23:56 +0100 | [diff] [blame] | 90 | ivy: $(IVY_DTB) |
Olivier Deprez | 2765ebf | 2020-12-16 15:46:14 +0100 | [diff] [blame] | 91 | |
| 92 | # FDTS_CP copies flattened device tree sources |
| 93 | # $(1) = output directory |
| 94 | # $(2) = flattened device tree source file to copy |
| 95 | define FDTS_CP |
| 96 | $(eval FDTS := $(addprefix $(1)/,$(notdir $(2)))) |
| 97 | FDTS_LIST += $(FDTS) |
| 98 | $(FDTS): $(2) $(IVY_DTB) |
| 99 | @echo " CP $$<" |
| 100 | ${Q}cp $$< $$@ |
| 101 | endef |
| 102 | |
| 103 | ifdef FDTS_CP_LIST |
| 104 | $(eval files := $(filter %.dts,$(FDTS_CP_LIST))) |
| 105 | $(eval $(foreach file,$(files),$(call FDTS_CP,$(BUILD_PLAT),$(file)))) |
| 106 | ivy: $(FDTS_LIST) |
| 107 | endif |