xref: /rk3399_ARM-atf/Makefile (revision 0fe374ef046f70b6e990024922034d14d418b109)
14f6ad66aSAchin Gupta#
2c3273703SChris Kay# Copyright (c) 2013-2025, Arm Limited and Contributors. All rights reserved.
34f6ad66aSAchin Gupta#
482cb2c1aSdp-arm# SPDX-License-Identifier: BSD-3-Clause
54f6ad66aSAchin Gupta#
64f6ad66aSAchin Gupta
7e35c4045SJeenu Viswambharan#
8aaa3e722SJuan Castillo# Trusted Firmware Version
9aaa3e722SJuan Castillo#
101a0f1121SSoby MathewVERSION_MAJOR			:= 2
1107a6a654SGovindraj RajaVERSION_MINOR			:= 12
12c25d1ccfSYann Gautier# VERSION_PATCH is only used for LTS releases
13c25d1ccfSYann GautierVERSION_PATCH			:= 0
14055ebecaSYann GautierVERSION				:= ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}
15aaa3e722SJuan Castillo
1688154678SJuan Castillo# Default goal is build all images
1788154678SJuan Castillo.DEFAULT_GOAL			:= all
1888154678SJuan Castillo
1972fc70edSDouglas Raillard# Avoid any implicit propagation of command line variable definitions to
2072fc70edSDouglas Raillard# sub-Makefiles, like CFLAGS that we reserved for the firmware images'
2172fc70edSDouglas Raillard# usage. Other command line options like "-s" are still propagated as usual.
2272fc70edSDouglas RaillardMAKEOVERRIDES =
2372fc70edSDouglas Raillard
24231c1470SEvan LloydMAKE_HELPERS_DIRECTORY := make_helpers/
25231c1470SEvan Lloydinclude ${MAKE_HELPERS_DIRECTORY}build_macros.mk
26f4dd18c2SChris Kayinclude ${MAKE_HELPERS_DIRECTORY}build-rules.mk
277c4e1eeaSChris Kayinclude ${MAKE_HELPERS_DIRECTORY}common.mk
2873c99d4eSJuan Castillo
2973c99d4eSJuan Castillo################################################################################
302fae4b1eSJeenu Viswambharan# Default values for build configurations, and their dependencies
3173c99d4eSJuan Castillo################################################################################
32e35c4045SJeenu Viswambharan
332fae4b1eSJeenu Viswambharaninclude ${MAKE_HELPERS_DIRECTORY}defaults.mk
341b2fb6adSAndrey Skvortsovinclude ${MAKE_HELPERS_DIRECTORY}plat_helpers.mk
351b2fb6adSAndrey Skvortsov
361b2fb6adSAndrey Skvortsov# To be able to set platform specific defaults
371b2fb6adSAndrey Skvortsovifneq ($(PLAT_DEFAULTS_MAKEFILE_FULL),)
381b2fb6adSAndrey Skvortsovinclude ${PLAT_DEFAULTS_MAKEFILE_FULL}
391b2fb6adSAndrey Skvortsovendif
40872be88aSdp-arm
41cc277de8SChris Kay################################################################################
42cc277de8SChris Kay# Configure the toolchains used to build TF-A and its tools
43cc277de8SChris Kay################################################################################
44cc277de8SChris Kay
45cc277de8SChris Kayinclude ${MAKE_HELPERS_DIRECTORY}toolchain.mk
46cc277de8SChris Kay
47cc8b5632SAntonio Nino Diaz# Assertions enabled for DEBUG builds by default
48cc8b5632SAntonio Nino DiazENABLE_ASSERTIONS		:= ${DEBUG}
492fae4b1eSJeenu ViswambharanENABLE_PMF			:= ${ENABLE_RUNTIME_INSTRUMENTATION}
5073c99d4eSJuan Castillo
5173c99d4eSJuan Castillo################################################################################
5273c99d4eSJuan Castillo# Checkpatch script options
5373c99d4eSJuan Castillo################################################################################
5473c99d4eSJuan Castillo
55f607739cSSandrine BailleuxCHECKCODE_ARGS		:=	--no-patch
56f0b489c1SDan Handley# Do not check the coding style on imported library files or documentation files
574501843fSGilad Ben-YossefINC_DRV_DIRS_TO_CHECK	:=	$(sort $(filter-out			\
584501843fSGilad Ben-Yossef					include/drivers/arm,		\
594501843fSGilad Ben-Yossef					$(wildcard include/drivers/*)))
60f0b489c1SDan HandleyINC_LIB_DIRS_TO_CHECK	:=	$(sort $(filter-out			\
611a41e8c1SDan Handley					include/lib/libfdt		\
6261f72a34SRoberto Vargas					include/lib/libc,		\
63f0b489c1SDan Handley					$(wildcard include/lib/*)))
64f0b489c1SDan HandleyINC_DIRS_TO_CHECK	:=	$(sort $(filter-out			\
654501843fSGilad Ben-Yossef					include/lib			\
664501843fSGilad Ben-Yossef					include/drivers,		\
67f0b489c1SDan Handley					$(wildcard include/*)))
68f0b489c1SDan HandleyLIB_DIRS_TO_CHECK	:=	$(sort $(filter-out			\
69d801fbb0Sdp-arm					lib/compiler-rt			\
7055cdcf75SAntonio Nino Diaz					lib/libfdt%			\
7161f72a34SRoberto Vargas					lib/libc,			\
72a194255dSDaniel Boulby					lib/zlib			\
73f0b489c1SDan Handley					$(wildcard lib/*)))
74f0b489c1SDan HandleyROOT_DIRS_TO_CHECK	:=	$(sort $(filter-out			\
75f0b489c1SDan Handley					lib				\
76f0b489c1SDan Handley					include				\
77f0b489c1SDan Handley					docs				\
781ef35512SPaul Beesley					%.rst,				\
79f0b489c1SDan Handley					$(wildcard *)))
80f0b489c1SDan HandleyCHECK_PATHS		:=	${ROOT_DIRS_TO_CHECK}			\
81f0b489c1SDan Handley				${INC_DIRS_TO_CHECK}			\
82f0b489c1SDan Handley				${INC_LIB_DIRS_TO_CHECK}		\
834501843fSGilad Ben-Yossef				${LIB_DIRS_TO_CHECK}			\
844501843fSGilad Ben-Yossef				${INC_DRV_DIRS_TO_CHECK}		\
854501843fSGilad Ben-Yossef				${INC_ARM_DIRS_TO_CHECK}
8636eaaf37SIan Spray
8773c99d4eSJuan Castillo################################################################################
8873c99d4eSJuan Castillo# Process build options
8973c99d4eSJuan Castillo################################################################################
9073c99d4eSJuan Castillo
917c4e1eeaSChris Kayifeq ($(verbose),)
9236eaaf37SIan Spray	CHECKCODE_ARGS	+=	--no-summary --terse
934f6ad66aSAchin Guptaendif
94ee1ba6d4SAndre Przywara
9573c99d4eSJuan Castillo################################################################################
96c5e1da83SJayanth Dodderi Chidanand# Auxiliary tools (fiptool, cert_create, etc)
97c5e1da83SJayanth Dodderi Chidanand################################################################################
98c5e1da83SJayanth Dodderi Chidanand
99c5e1da83SJayanth Dodderi Chidanand# Variables for use with Certificate Generation Tool
100c5e1da83SJayanth Dodderi ChidanandCRTTOOLPATH		?=	tools/cert_create
101c3273703SChris KayCRTTOOL			?=	${CRTTOOLPATH}/cert_create$(.exe)
102c5e1da83SJayanth Dodderi Chidanand
103c5e1da83SJayanth Dodderi Chidanand# Variables for use with Firmware Encryption Tool
104c5e1da83SJayanth Dodderi ChidanandENCTOOLPATH		?=	tools/encrypt_fw
105c3273703SChris KayENCTOOL			?=	${ENCTOOLPATH}/encrypt_fw$(.exe)
106c5e1da83SJayanth Dodderi Chidanand
107c5e1da83SJayanth Dodderi Chidanand# Variables for use with Firmware Image Package
108c5e1da83SJayanth Dodderi ChidanandFIPTOOLPATH		?=	tools/fiptool
109c3273703SChris KayFIPTOOL			?=	${FIPTOOLPATH}/fiptool$(.exe)
110c5e1da83SJayanth Dodderi Chidanand
111c5e1da83SJayanth Dodderi Chidanand# Variables for use with sptool
112c5e1da83SJayanth Dodderi ChidanandSPTOOLPATH		?=	tools/sptool
113c5e1da83SJayanth Dodderi ChidanandSPTOOL			?=	${SPTOOLPATH}/sptool.py
114c5e1da83SJayanth Dodderi ChidanandSP_MK_GEN		?=	${SPTOOLPATH}/sp_mk_generator.py
11520629b31SKarl MeakinSP_DTS_LIST_FRAGMENT	?=	${BUILD_PLAT}/sp_list_fragment.dts
116c5e1da83SJayanth Dodderi Chidanand
117*0fe374efSJ-Alves# Variables for use with sptool
118*0fe374efSJ-AlvesTLCTOOL 		?=	poetry run tlc
119*0fe374efSJ-Alves
120c5e1da83SJayanth Dodderi Chidanand# Variables for use with ROMLIB
121c5e1da83SJayanth Dodderi ChidanandROMLIBPATH		?=	lib/romlib
122c5e1da83SJayanth Dodderi Chidanand
123c5e1da83SJayanth Dodderi Chidanand# Variable for use with Python
124c5e1da83SJayanth Dodderi ChidanandPYTHON			?=	python3
125c5e1da83SJayanth Dodderi Chidanand
126c5e1da83SJayanth Dodderi Chidanand# Variables for use with documentation build using Sphinx tool
127c5e1da83SJayanth Dodderi ChidanandDOCS_PATH		?=	docs
128c5e1da83SJayanth Dodderi Chidanand
129c5e1da83SJayanth Dodderi Chidanand################################################################################
130c5e1da83SJayanth Dodderi Chidanand# Compiler Configuration based on ARCH_MAJOR and ARCH_MINOR flags
131c5e1da83SJayanth Dodderi Chidanand################################################################################
13226e63c44SEtienne Carriereifeq (${ARM_ARCH_MAJOR},7)
13326e63c44SEtienne Carriere	target32-directive	= 	-target arm-none-eabi
134d4089fb8SGovindraj Raja# Will set march-directive from platform configuration
13526e63c44SEtienne Carriereelse
13626e63c44SEtienne Carriere	target32-directive	= 	-target armv8a-none-eabi
137c5e1da83SJayanth Dodderi Chidanandendif #(ARM_ARCH_MAJOR)
138c5e1da83SJayanth Dodderi Chidanand
139c5e1da83SJayanth Dodderi Chidanand################################################################################
140c5e1da83SJayanth Dodderi Chidanand# Get Architecture Feature Modifiers
141c5e1da83SJayanth Dodderi Chidanand################################################################################
142c5e1da83SJayanth Dodderi Chidanandarch-features		=	${ARM_ARCH_FEATURE}
143c5e1da83SJayanth Dodderi Chidanand
1448620bd0bSChris Kayifneq ($(filter %-clang,$($(ARCH)-cc-id)),)
1458620bd0bSChris Kay	ifeq ($($(ARCH)-cc-id),arm-clang)
1467794d6c8SGovindraj Raja		TF_CFLAGS_aarch32	:=	-target arm-arm-none-eabi
1477794d6c8SGovindraj Raja		TF_CFLAGS_aarch64	:=	-target aarch64-arm-none-eabi
148c8a992fdSorigin	else
1497794d6c8SGovindraj Raja		TF_CFLAGS_aarch32	=	$(target32-directive)
1507794d6c8SGovindraj Raja		TF_CFLAGS_aarch64	:=	-target aarch64-elf
151641f16e7SAmbroise Vincent	endif
152c8a992fdSorigin
1538620bd0bSChris Kayelse ifeq ($($(ARCH)-cc-id),gnu-gcc)
154edbce9aaSzelalem-aweke	# Enable LTO only for aarch64
155edbce9aaSzelalem-aweke	ifeq (${ARCH},aarch64)
156fa402f38SChris Kay		LTO_CFLAGS	=	$(if $(filter-out 0,$(ENABLE_LTO)),-flto)
157edbce9aaSzelalem-aweke	endif
158c5e1da83SJayanth Dodderi Chidanandendif #(clang)
159d5461857Sdp-arm
16032b209bfSAhmad Fatoum# Process Debug flag
16132b209bfSAhmad Fatoum$(eval $(call add_define,DEBUG))
16232b209bfSAhmad Fatoumifneq (${DEBUG}, 0)
16332b209bfSAhmad Fatoum	BUILD_TYPE	:=	debug
1644466cf82SDaniel Boulby	TF_CFLAGS	+=	-g -gdwarf-4
1654466cf82SDaniel Boulby	ASFLAGS		+=	-g -Wa,-gdwarf-4
16632b209bfSAhmad Fatoum
16732b209bfSAhmad Fatoum	# Use LOG_LEVEL_INFO by default for debug builds
16832b209bfSAhmad Fatoum	LOG_LEVEL	:=	40
16932b209bfSAhmad Fatoumelse
17032b209bfSAhmad Fatoum	BUILD_TYPE	:=	release
17132b209bfSAhmad Fatoum	# Use LOG_LEVEL_NOTICE by default for release builds
17232b209bfSAhmad Fatoum	LOG_LEVEL	:=	20
173c5e1da83SJayanth Dodderi Chidanandendif #(Debug)
17432b209bfSAhmad Fatoum
175f1de4c8fSPeiyuan Song# Default build string (git branch and commit)
176f1de4c8fSPeiyuan Songifeq (${BUILD_STRING},)
177f1de4c8fSPeiyuan Song	BUILD_STRING  :=  $(shell git describe --always --dirty --tags 2> /dev/null)
178f1de4c8fSPeiyuan Songendif
179dddf4283Slaurenw-armVERSION_STRING    :=  v${VERSION}(${BUILD_TYPE}):${BUILD_STRING}
180f1de4c8fSPeiyuan Song
1818fd9d4d5SAntonio Nino Diazifeq (${AARCH32_INSTRUCTION_SET},A32)
1828fd9d4d5SAntonio Nino Diaz	TF_CFLAGS_aarch32	+=	-marm
1838fd9d4d5SAntonio Nino Diazelse ifeq (${AARCH32_INSTRUCTION_SET},T32)
1848fd9d4d5SAntonio Nino Diaz	TF_CFLAGS_aarch32	+=	-mthumb
1858fd9d4d5SAntonio Nino Diazelse
1868fd9d4d5SAntonio Nino Diaz        $(error Error: Unknown AArch32 instruction set ${AARCH32_INSTRUCTION_SET})
187c5e1da83SJayanth Dodderi Chidanandendif #(AARCH32_INSTRUCTION_SET)
1888fd9d4d5SAntonio Nino Diaz
189a9c4dde3SSandrine BailleuxTF_CFLAGS_aarch32	+=	-mno-unaligned-access
190d5461857Sdp-armTF_CFLAGS_aarch64	+=	-mgeneral-regs-only -mstrict-align
1919d29c227SSoby Mathew
192c5e1da83SJayanth Dodderi Chidanand##############################################################################
193c5e1da83SJayanth Dodderi Chidanand# WARNINGS Configuration
194c5e1da83SJayanth Dodderi Chidanand###############################################################################
1959ab81b5eSJustin Chadwell# General warnings
1969ab81b5eSJustin ChadwellWARNINGS		:=	-Wall -Wmissing-include-dirs -Wunused	\
197b7f6525dSJustin Chadwell				-Wdisabled-optimization -Wvla -Wshadow	\
198d75a9ecdSBoyan Karatotev				-Wredundant-decls
199d75a9ecdSBoyan Karatotev# stricter warnings
200d75a9ecdSBoyan KaratotevWARNINGS		+=	-Wextra -Wno-trigraphs
201d75a9ecdSBoyan Karatotev# too verbose for generic build
202d75a9ecdSBoyan KaratotevWARNINGS		+=	-Wno-missing-field-initializers \
203d75a9ecdSBoyan Karatotev				-Wno-type-limits -Wno-sign-compare \
204d75a9ecdSBoyan Karatotev# on clang this flag gets reset if -Wextra is set after it. No difference on gcc
205d75a9ecdSBoyan KaratotevWARNINGS		+=	-Wno-unused-parameter
2069ab81b5eSJustin Chadwell
2079ab81b5eSJustin Chadwell# Additional warnings
208d75a9ecdSBoyan Karatotev# Level 1 - infrequent warnings we should have none of
209d75a9ecdSBoyan Karatotev# full -Wextra
210d75a9ecdSBoyan KaratotevWARNING1 += -Wsign-compare
211d75a9ecdSBoyan KaratotevWARNING1 += -Wtype-limits
212d75a9ecdSBoyan KaratotevWARNING1 += -Wmissing-field-initializers
213e7c645b5SYann Gautier
214d75a9ecdSBoyan Karatotev# Level 2 - problematic warnings that we want
215d75a9ecdSBoyan Karatotev# zlib, compiler-rt, coreboot, and mbdedtls blow up with these
216d75a9ecdSBoyan Karatotev# TODO: disable just for them and move into default build
217d75a9ecdSBoyan KaratotevWARNING2 += -Wold-style-definition
218d75a9ecdSBoyan KaratotevWARNING2 += -Wmissing-prototypes
219d75a9ecdSBoyan KaratotevWARNING2 += -Wmissing-format-attribute
220d75a9ecdSBoyan Karatotev# TF-A aims to comply with this eventually. Effort too large at present
221d75a9ecdSBoyan KaratotevWARNING2 += -Wundef
222d141e638SBoyan Karatotev# currently very involved and many platforms set this off
223d141e638SBoyan KaratotevWARNING2 += -Wunused-const-variable=2
224e7c645b5SYann Gautier
225d75a9ecdSBoyan Karatotev# Level 3 - very pedantic, frequently ignored
226e7c645b5SYann GautierWARNING3 := -Wbad-function-cast
227d75a9ecdSBoyan KaratotevWARNING3 += -Waggregate-return
228d75a9ecdSBoyan KaratotevWARNING3 += -Wnested-externs
229d75a9ecdSBoyan KaratotevWARNING3 += -Wcast-align
230e7c645b5SYann GautierWARNING3 += -Wcast-qual
231e7c645b5SYann GautierWARNING3 += -Wconversion
232e7c645b5SYann GautierWARNING3 += -Wpacked
233e7c645b5SYann GautierWARNING3 += -Wpointer-arith
234e7c645b5SYann GautierWARNING3 += -Wswitch-default
235e7c645b5SYann Gautier
236d75a9ecdSBoyan Karatotev# Setting W is quite verbose and most warnings will be pre-existing issues
237d75a9ecdSBoyan Karatotev# outside of the contributor's control. Don't fail the build on them so warnings
238d75a9ecdSBoyan Karatotev# can be seen and hopefully addressed
239d75a9ecdSBoyan Karatotevifdef W
240d75a9ecdSBoyan Karatotev	ifneq (${W},0)
241d75a9ecdSBoyan Karatotev		E	 ?= 0
242d75a9ecdSBoyan Karatotev	endif
243d75a9ecdSBoyan Karatotevendif
244d75a9ecdSBoyan Karatotev
245e7c645b5SYann Gautierifeq (${W},1)
2469ab81b5eSJustin Chadwell	WARNINGS += $(WARNING1)
247e7c645b5SYann Gautierelse ifeq (${W},2)
2489ab81b5eSJustin Chadwell	WARNINGS += $(WARNING1) $(WARNING2)
249e7c645b5SYann Gautierelse ifeq (${W},3)
2509ab81b5eSJustin Chadwell	WARNINGS += $(WARNING1) $(WARNING2) $(WARNING3)
251c5e1da83SJayanth Dodderi Chidanandendif #(W)
252e7c645b5SYann Gautier
2539ab81b5eSJustin Chadwell# Compiler specific warnings
2548620bd0bSChris Kayifeq ($(filter %-clang,$($(ARCH)-cc-id)),)
25593c690ebSJustin Chadwell# not using clang
256d7b4cd41SJustin ChadwellWARNINGS	+=		-Wunused-but-set-variable -Wmaybe-uninitialized	\
257d7b4cd41SJustin Chadwell				-Wpacked-bitfield-compat -Wshift-overflow=2 \
258d7b4cd41SJustin Chadwell				-Wlogical-op
259dea23e24SGovindraj Raja
260dea23e24SGovindraj Raja# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105523
261316f5c97SBoyan KaratotevTF_CFLAGS_MIN_PAGE_SIZE	:=	$(call cc_option, --param=min-pagesize=0)
262316f5c97SBoyan KaratotevTF_CFLAGS		+=	$(TF_CFLAGS_MIN_PAGE_SIZE)
263dea23e24SGovindraj Raja
264538516f5SBipin Raviifeq ($(HARDEN_SLS), 1)
265316f5c97SBoyan Karatotev        TF_CFLAGS_MHARDEN_SLS	:=      $(call cc_option, -mharden-sls=all)
266316f5c97SBoyan Karatotev        TF_CFLAGS_aarch64	+=      $(TF_CFLAGS_MHARDEN_SLS)
267538516f5SBipin Raviendif
268538516f5SBipin Ravi
26993c690ebSJustin Chadwellelse
27093c690ebSJustin Chadwell# using clang
271d7b4cd41SJustin ChadwellWARNINGS	+=		-Wshift-overflow -Wshift-sign-overflow \
272d7b4cd41SJustin Chadwell				-Wlogical-op-parentheses
273c5e1da83SJayanth Dodderi Chidanandendif #(Clang Warning)
27400296576SAmbroise Vincent
2756336b07aSYann Gautierifneq (${E},0)
2766336b07aSYann Gautier	ERRORS := -Werror
277c5e1da83SJayanth Dodderi Chidanandendif #(E)
2786336b07aSYann Gautier
279c5e1da83SJayanth Dodderi Chidanand################################################################################
280c5e1da83SJayanth Dodderi Chidanand# Compiler and Linker Directives
281c5e1da83SJayanth Dodderi Chidanand################################################################################
282ea7a57a3SRoberto VargasCPPFLAGS		=	${DEFINES} ${INCLUDES} ${MBEDTLS_INC} -nostdinc	\
2839ab81b5eSJustin Chadwell				$(ERRORS) $(WARNINGS)
284d4089fb8SGovindraj RajaASFLAGS			+=	$(CPPFLAGS)                 			\
285d5dfdeb6SJulius Werner				-ffreestanding -Wa,--fatal-warnings
28659de5096SMasahiro YamadaTF_CFLAGS		+=	$(CPPFLAGS) $(TF_CFLAGS_$(ARCH))		\
287ebd6efaeSSamuel Holland				-ffunction-sections -fdata-sections		\
288ee0c5b8cSBoyan Karatotev				-ffreestanding -fno-common			\
289ebd6efaeSSamuel Holland				-Os -std=gnu99
29073c99d4eSJuan Castillo
2911f461979SJustin Chadwellifeq (${SANITIZE_UB},on)
2921f461979SJustin Chadwell	TF_CFLAGS	+=	-fsanitize=undefined -fno-sanitize-recover
293c5e1da83SJayanth Dodderi Chidanandendif #(${SANITIZE_UB},on)
294c5e1da83SJayanth Dodderi Chidanand
2951f461979SJustin Chadwellifeq (${SANITIZE_UB},trap)
2961f461979SJustin Chadwell	TF_CFLAGS	+=	-fsanitize=undefined -fno-sanitize-recover	\
2971f461979SJustin Chadwell				-fsanitize-undefined-trap-on-error
298c5e1da83SJayanth Dodderi Chidanandendif #(${SANITIZE_UB},trap)
2991f461979SJustin Chadwell
300291e7182SChris KayGCC_V_OUTPUT		:=	$(if $($(ARCH)-cc),$(shell $($(ARCH)-cc) -v 2>&1))
301f7ec31dbSdavid cunado
3021f49db5fSMarco FelschTF_LDFLAGS		+=	-z noexecstack
3031f49db5fSMarco Felsch
304641f16e7SAmbroise Vincent# LD = armlink
3058620bd0bSChris Kayifeq ($($(ARCH)-ld-id),arm-link)
306c2ad38ceSVarun Wadekar	TF_LDFLAGS		+=	--diag_error=warning --lto_level=O1
307c2ad38ceSVarun Wadekar	TF_LDFLAGS		+=	--remove --info=unused,unusedsymbols
308edbce9aaSzelalem-aweke	TF_LDFLAGS		+=	$(TF_LDFLAGS_$(ARCH))
309641f16e7SAmbroise Vincent
310641f16e7SAmbroise Vincent# LD = gcc (used when GCC LTO is enabled)
3118620bd0bSChris Kayelse ifeq ($($(ARCH)-ld-id),gnu-gcc)
312edbce9aaSzelalem-aweke	# Pass ld options with Wl or Xlinker switches
31386e489c1SChris Kay	TF_LDFLAGS		+=	$(call ld_option,-Xlinker --no-warn-rwx-segments)
314edbce9aaSzelalem-aweke	TF_LDFLAGS		+=	-Wl,--fatal-warnings -O1
315edbce9aaSzelalem-aweke	TF_LDFLAGS		+=	-Wl,--gc-sections
316ac98b82aSChris Kay
317ac98b82aSChris Kay	TF_LDFLAGS		+=	-Wl,-z,common-page-size=4096 #Configure page size constants
318ac98b82aSChris Kay	TF_LDFLAGS		+=	-Wl,-z,max-page-size=4096
319304ad94bSAndrey Skvortsov	TF_LDFLAGS		+=	-Wl,--build-id=none
320ac98b82aSChris Kay
321edbce9aaSzelalem-aweke	ifeq ($(ENABLE_LTO),1)
322edbce9aaSzelalem-aweke		ifeq (${ARCH},aarch64)
323edbce9aaSzelalem-aweke			TF_LDFLAGS	+=	-flto -fuse-linker-plugin
32431f80efeSAndrey Skvortsov			TF_LDFLAGS      +=	-flto-partition=one
325edbce9aaSzelalem-aweke		endif
326c5e1da83SJayanth Dodderi Chidanand	endif #(ENABLE_LTO)
327c5e1da83SJayanth Dodderi Chidanand
328edbce9aaSzelalem-aweke# GCC automatically adds fix-cortex-a53-843419 flag when used to link
329edbce9aaSzelalem-aweke# which breaks some builds, so disable if errata fix is not explicitly enabled
330cfe6767fSYann Gautier	ifeq (${ARCH},aarch64)
331edbce9aaSzelalem-aweke		ifneq (${ERRATA_A53_843419},1)
332edbce9aaSzelalem-aweke			TF_LDFLAGS	+= 	-mno-fix-cortex-a53-843419
333edbce9aaSzelalem-aweke		endif
334cfe6767fSYann Gautier	endif
335edbce9aaSzelalem-aweke	TF_LDFLAGS		+= 	-nostdlib
336edbce9aaSzelalem-aweke	TF_LDFLAGS		+=	$(subst --,-Xlinker --,$(TF_LDFLAGS_$(ARCH)))
337641f16e7SAmbroise Vincent
338641f16e7SAmbroise Vincent# LD = gcc-ld (ld) or llvm-ld (ld.lld) or other
339c2ad38ceSVarun Wadekarelse
3401f49db5fSMarco Felsch# With ld.bfd version 2.39 and newer new warnings are added. Skip those since we
3411f49db5fSMarco Felsch# are not loaded by a elf loader.
3421f49db5fSMarco Felsch	TF_LDFLAGS		+=	$(call ld_option, --no-warn-rwx-segments)
343ebac6922SYabin Cui	TF_LDFLAGS		+=	-O1
344c2b8806fSDouglas Raillard	TF_LDFLAGS		+=	--gc-sections
345ac98b82aSChris Kay
346ac98b82aSChris Kay	TF_LDFLAGS		+=	-z common-page-size=4096 # Configure page size constants
347ac98b82aSChris Kay	TF_LDFLAGS		+=	-z max-page-size=4096
348304ad94bSAndrey Skvortsov	TF_LDFLAGS		+=	--build-id=none
349ac98b82aSChris Kay
350641f16e7SAmbroise Vincent# ld.lld doesn't recognize the errata flags,
351ebac6922SYabin Cui# therefore don't add those in that case.
352ebac6922SYabin Cui# ld.lld reports section type mismatch warnings,
353ebac6922SYabin Cui# therefore don't add --fatal-warnings to it.
3548620bd0bSChris Kay	ifneq ($($(ARCH)-ld-id),llvm-lld)
355ebac6922SYabin Cui		TF_LDFLAGS	+=	$(TF_LDFLAGS_$(ARCH)) --fatal-warnings
356edbce9aaSzelalem-aweke	endif
357c5e1da83SJayanth Dodderi Chidanand
358c5e1da83SJayanth Dodderi Chidanandendif #(LD = armlink)
35973c99d4eSJuan Castillo
36073c99d4eSJuan Castillo################################################################################
361f5211420SGovindraj Raja# Setup ARCH_MAJOR/MINOR before parsing arch_features.
362f5211420SGovindraj Raja################################################################################
363f5211420SGovindraj Rajaifeq (${ENABLE_RME},1)
3647d5fc98fSAlexeiFedorov	ARM_ARCH_MAJOR := 9
3657d5fc98fSAlexeiFedorov	ARM_ARCH_MINOR := 2
366f5211420SGovindraj Rajaendif
367f5211420SGovindraj Raja
368f5211420SGovindraj Raja################################################################################
36973c99d4eSJuan Castillo# Common sources and include directories
37073c99d4eSJuan Castillo################################################################################
371d801fbb0Sdp-arminclude lib/compiler-rt/compiler-rt.mk
37273c99d4eSJuan Castillo
373758ccb80SChris Kay# Allow overriding the timestamp, for example for reproducible builds, or to
374758ccb80SChris Kay# synchronize timestamps across multiple projects.
375758ccb80SChris Kay# This must be set to a C string (including quotes where applicable).
376758ccb80SChris KayBUILD_MESSAGE_TIMESTAMP ?= __TIME__", "__DATE__
377758ccb80SChris Kay
378758ccb80SChris KayDEFINES += -DBUILD_MESSAGE_TIMESTAMP='$(BUILD_MESSAGE_TIMESTAMP)'
379758ccb80SChris KayDEFINES += -DBUILD_MESSAGE_VERSION_STRING='"$(VERSION_STRING)"'
380758ccb80SChris KayDEFINES += -DBUILD_MESSAGE_VERSION='"$(VERSION)"'
381758ccb80SChris Kay
38273c99d4eSJuan CastilloBL_COMMON_SOURCES	+=	common/bl_common.c			\
3837f56e9a3SSoby Mathew				common/tf_log.c				\
3849d29c227SSoby Mathew				common/${ARCH}/debug.S			\
38591b48c9fSJulius Werner				drivers/console/multi_console.c		\
3869d29c227SSoby Mathew				lib/${ARCH}/cache_helpers.S		\
3879d29c227SSoby Mathew				lib/${ARCH}/misc_helpers.S		\
388c73686a1SBoyan Karatotev				lib/extensions/pmuv3/${ARCH}/pmuv3.c	\
389566034fcSSoby Mathew				plat/common/plat_bl_common.c		\
3907f56e9a3SSoby Mathew				plat/common/plat_log_common.c		\
39175311203Sdp-arm				plat/common/${ARCH}/plat_common.c	\
3929d29c227SSoby Mathew				plat/common/${ARCH}/platform_helpers.S	\
39361f72a34SRoberto Vargas				${COMPILER_RT_SRCS}
394d7a6b0f8SRyan Harkin
3958620bd0bSChris Kayifeq ($($(ARCH)-cc-id),arm-clang)
3968422a840SAntonio Nino Diaz	BL_COMMON_SOURCES	+=	lib/${ARCH}/armclang_printf.S
3978422a840SAntonio Nino Diazendif
3988422a840SAntonio Nino Diaz
3991f461979SJustin Chadwellifeq (${SANITIZE_UB},on)
4001f461979SJustin Chadwell	BL_COMMON_SOURCES	+=	plat/common/ubsan.c
4011f461979SJustin Chadwellendif
4021f461979SJustin Chadwell
40301d237cbSYann GautierINCLUDES		+=	-Iinclude				\
404f5478dedSAntonio Nino Diaz				-Iinclude/arch/${ARCH}			\
40509d40e0eSAntonio Nino Diaz				-Iinclude/lib/cpus/${ARCH}		\
40609d40e0eSAntonio Nino Diaz				-Iinclude/lib/el3_runtime/${ARCH}	\
40709d40e0eSAntonio Nino Diaz				${PLAT_INCLUDES}			\
40809d40e0eSAntonio Nino Diaz				${SPD_INCLUDES}
40909d40e0eSAntonio Nino Diaz
410e03dcc8fSNishant SharmaDTC_FLAGS		+=	-I dts -O dtb
411e03dcc8fSNishant SharmaDTC_CPPFLAGS		+=	-P -nostdinc $(INCLUDES) -Ifdts -undef \
412e03dcc8fSNishant Sharma				-x assembler-with-cpp $(DEFINES)
413e03dcc8fSNishant Sharma
4149c6d1c50SAntonio Nino Diazinclude common/backtrace/backtrace.mk
4159c6d1c50SAntonio Nino Diaz
41673c99d4eSJuan Castillo################################################################################
4173547270fSGovindraj Raja# Generic definitions
4183547270fSGovindraj Raja################################################################################
4193547270fSGovindraj Raja
4203547270fSGovindraj Rajaifeq (${BUILD_BASE},)
4213547270fSGovindraj Raja     BUILD_BASE		:=	./build
4223547270fSGovindraj Rajaendif
4233547270fSGovindraj RajaBUILD_PLAT		:=	$(abspath ${BUILD_BASE})/${PLAT}/${BUILD_TYPE}
4243547270fSGovindraj Raja
4253547270fSGovindraj RajaSPDS			:=	$(sort $(filter-out none, $(patsubst services/spd/%,%,$(wildcard services/spd/*))))
4263547270fSGovindraj Raja
4273547270fSGovindraj Raja# Platforms providing their own TBB makefile may override this value
4283547270fSGovindraj RajaINCLUDE_TBBR_MK		:=	1
4293547270fSGovindraj Raja
4303547270fSGovindraj Raja################################################################################
4313547270fSGovindraj Raja# Include SPD Makefile if one has been specified
4323547270fSGovindraj Raja################################################################################
4333547270fSGovindraj Raja
4343547270fSGovindraj Rajaifneq (${SPD},none)
4353547270fSGovindraj Raja	ifeq (${ARCH},aarch32)
4363547270fSGovindraj Raja                $(error "Error: SPD is incompatible with AArch32.")
4373547270fSGovindraj Raja	endif
4383547270fSGovindraj Raja
4393547270fSGovindraj Raja	ifdef EL3_PAYLOAD_BASE
4403547270fSGovindraj Raja                $(warning "SPD and EL3_PAYLOAD_BASE are incompatible build options.")
4413547270fSGovindraj Raja                $(warning "The SPD and its BL32 companion will be present but \
4423547270fSGovindraj Raja                ignored.")
4433547270fSGovindraj Raja	endif
4443547270fSGovindraj Raja
4453547270fSGovindraj Raja	ifeq (${SPD},spmd)
4463547270fSGovindraj Raja	# SPMD is located in std_svc directory
4473547270fSGovindraj Raja		SPD_DIR := std_svc
4483547270fSGovindraj Raja
4493547270fSGovindraj Raja		ifeq ($(SPMD_SPM_AT_SEL2),1)
4503547270fSGovindraj Raja			CTX_INCLUDE_EL2_REGS := 1
4513547270fSGovindraj Raja			ifeq ($(SPMC_AT_EL3),1)
4523547270fSGovindraj Raja                                $(error SPM cannot be enabled in both S-EL2 and EL3.)
4533547270fSGovindraj Raja			endif
45459bdcc58SMadhukar Pappireddy			ifeq ($(CTX_INCLUDE_SVE_REGS),1)
45559bdcc58SMadhukar Pappireddy                                $(error SVE context management not needed with Hafnium SPMC.)
45659bdcc58SMadhukar Pappireddy			endif
4573547270fSGovindraj Raja		endif
4583547270fSGovindraj Raja
4593547270fSGovindraj Raja		ifeq ($(findstring optee_sp,$(ARM_SPMC_MANIFEST_DTS)),optee_sp)
4603547270fSGovindraj Raja			DTC_CPPFLAGS	+=	-DOPTEE_SP_FW_CONFIG
4613547270fSGovindraj Raja		endif
4623547270fSGovindraj Raja
4630686a01bSArunachalam Ganapathy		ifeq ($(findstring trusty_sp,$(ARM_SPMC_MANIFEST_DTS)),trusty_sp)
4640686a01bSArunachalam Ganapathy			DTC_CPPFLAGS	+=	-DTRUSTY_SP_FW_CONFIG
4650686a01bSArunachalam Ganapathy		endif
4660686a01bSArunachalam Ganapathy
4673547270fSGovindraj Raja		ifeq ($(TS_SP_FW_CONFIG),1)
4683547270fSGovindraj Raja			DTC_CPPFLAGS	+=	-DTS_SP_FW_CONFIG
4693547270fSGovindraj Raja		endif
4703547270fSGovindraj Raja
4713547270fSGovindraj Raja		ifneq ($(ARM_BL2_SP_LIST_DTS),)
4723547270fSGovindraj Raja		DTC_CPPFLAGS += -DARM_BL2_SP_LIST_DTS=$(ARM_BL2_SP_LIST_DTS)
4733547270fSGovindraj Raja		endif
4743547270fSGovindraj Raja
4753547270fSGovindraj Raja		ifneq ($(SP_LAYOUT_FILE),)
4763547270fSGovindraj Raja		BL2_ENABLE_SP_LOAD := 1
4773547270fSGovindraj Raja		endif
478c189adbdSGovindraj Raja
479c189adbdSGovindraj Raja		ifeq ($(SPMC_AT_EL3_SEL0_SP),1)
480c189adbdSGovindraj Raja			ifneq ($(SPMC_AT_EL3),1)
481c189adbdSGovindraj Raja			$(error SEL0 SP cannot be enabled without SPMC at EL3)
482c189adbdSGovindraj Raja			endif
483c189adbdSGovindraj Raja		endif
4843547270fSGovindraj Raja	else
4853547270fSGovindraj Raja		# All other SPDs in spd directory
4863547270fSGovindraj Raja		SPD_DIR := spd
4873547270fSGovindraj Raja	endif #(SPD)
4883547270fSGovindraj Raja
4893547270fSGovindraj Raja	# We expect to locate an spd.mk under the specified SPD directory
4903547270fSGovindraj Raja	SPD_MAKE	:=	$(wildcard services/${SPD_DIR}/${SPD}/${SPD}.mk)
4913547270fSGovindraj Raja
4923547270fSGovindraj Raja	ifeq (${SPD_MAKE},)
4933547270fSGovindraj Raja                $(error Error: No services/${SPD_DIR}/${SPD}/${SPD}.mk located)
4943547270fSGovindraj Raja	endif
4953547270fSGovindraj Raja        $(info Including ${SPD_MAKE})
4963547270fSGovindraj Raja        include ${SPD_MAKE}
4973547270fSGovindraj Raja
4983547270fSGovindraj Raja	# If there's BL32 companion for the chosen SPD, we expect that the SPD's
4993547270fSGovindraj Raja	# Makefile would set NEED_BL32 to "yes". In this case, the build system
5003547270fSGovindraj Raja	# supports two mutually exclusive options:
5013547270fSGovindraj Raja	# * BL32 is built from source: then BL32_SOURCES must contain the list
5023547270fSGovindraj Raja	#   of source files to build BL32
5033547270fSGovindraj Raja	# * BL32 is a prebuilt binary: then BL32 must point to the image file
5043547270fSGovindraj Raja	#   that will be included in the FIP
5053547270fSGovindraj Raja	# If both BL32_SOURCES and BL32 are defined, the binary takes precedence
5063547270fSGovindraj Raja	# over the sources.
5073547270fSGovindraj Rajaendif #(SPD=none)
5083547270fSGovindraj Raja
5093547270fSGovindraj Rajaifeq (${ENABLE_SPMD_LP}, 1)
5103547270fSGovindraj Rajaifneq (${SPD},spmd)
5113547270fSGovindraj Raja        $(error Error: ENABLE_SPMD_LP requires SPD=spmd.)
5123547270fSGovindraj Rajaendif
5133547270fSGovindraj Rajaifeq ($(SPMC_AT_EL3),1)
5143547270fSGovindraj Raja        $(error SPMC at EL3 not supported when enabling SPMD Logical partitions.)
5153547270fSGovindraj Rajaendif
5163547270fSGovindraj Rajaendif
5173547270fSGovindraj Raja
5183547270fSGovindraj Raja################################################################################
519696ed168SOlivier Deprez# Include the platform specific Makefile after the SPD Makefile (the platform
520696ed168SOlivier Deprez# makefile may use all previous definitions in this file)
521696ed168SOlivier Deprez################################################################################
522696ed168SOlivier Deprezinclude ${PLAT_MAKEFILE_FULL}
523696ed168SOlivier Deprez
524696ed168SOlivier Deprez################################################################################
525f5211420SGovindraj Raja# Process BRANCH_PROTECTION value and set
526f5211420SGovindraj Raja# Pointer Authentication and Branch Target Identification flags
527f5211420SGovindraj Raja################################################################################
528f5211420SGovindraj Rajaifeq (${BRANCH_PROTECTION},0)
529f5211420SGovindraj Raja	# Default value turns off all types of branch protection
530f5211420SGovindraj Raja	BP_OPTION := none
531f5211420SGovindraj Rajaelse ifneq (${ARCH},aarch64)
532f5211420SGovindraj Raja        $(error BRANCH_PROTECTION requires AArch64)
533f5211420SGovindraj Rajaelse ifeq (${BRANCH_PROTECTION},1)
534f5211420SGovindraj Raja	# Enables all types of branch protection features
535f5211420SGovindraj Raja	BP_OPTION := standard
536f5211420SGovindraj Raja	ENABLE_BTI := 1
537f5211420SGovindraj Raja	ENABLE_PAUTH := 1
538f5211420SGovindraj Rajaelse ifeq (${BRANCH_PROTECTION},2)
539f5211420SGovindraj Raja	# Return address signing to its standard level
540f5211420SGovindraj Raja	BP_OPTION := pac-ret
541f5211420SGovindraj Raja	ENABLE_PAUTH := 1
542f5211420SGovindraj Rajaelse ifeq (${BRANCH_PROTECTION},3)
543f5211420SGovindraj Raja	# Extend the signing to include leaf functions
544f5211420SGovindraj Raja	BP_OPTION := pac-ret+leaf
545f5211420SGovindraj Raja	ENABLE_PAUTH := 1
546f5211420SGovindraj Rajaelse ifeq (${BRANCH_PROTECTION},4)
547f5211420SGovindraj Raja	# Turn on branch target identification mechanism
548f5211420SGovindraj Raja	BP_OPTION := bti
549f5211420SGovindraj Raja	ENABLE_BTI := 1
550f5211420SGovindraj Rajaelse
551f5211420SGovindraj Raja        $(error Unknown BRANCH_PROTECTION value ${BRANCH_PROTECTION})
552f5211420SGovindraj Rajaendif #(BRANCH_PROTECTION)
553f5211420SGovindraj Raja
554f5211420SGovindraj Rajaifeq ($(ENABLE_PAUTH),1)
555f5211420SGovindraj Raja	CTX_INCLUDE_PAUTH_REGS := 1
556f5211420SGovindraj Rajaendif
557f5211420SGovindraj Rajaifneq (${BP_OPTION},none)
558f5211420SGovindraj Raja	TF_CFLAGS_aarch64	+=	-mbranch-protection=${BP_OPTION}
559f5211420SGovindraj Rajaendif #(BP_OPTION)
560f5211420SGovindraj Raja
561f5211420SGovindraj Raja# Pointer Authentication sources
562f5211420SGovindraj Rajaifeq (${ENABLE_PAUTH}, 1)
563f5211420SGovindraj Raja# arm/common/aarch64/arm_pauth.c contains a sample platform hook to complete the
564f5211420SGovindraj Raja# Pauth support. As it's not secure, it must be reimplemented for real platforms
565f5211420SGovindraj Raja	BL_COMMON_SOURCES	+=	lib/extensions/pauth/pauth_helpers.S
566f5211420SGovindraj Rajaendif
567f5211420SGovindraj Raja
5683547270fSGovindraj Raja################################################################################
5693547270fSGovindraj Raja# Setup arch_features based on ARM_ARCH_MAJOR, ARM_ARCH_MINOR provided from
5703547270fSGovindraj Raja# platform.
5713547270fSGovindraj Raja################################################################################
5723547270fSGovindraj Rajainclude ${MAKE_HELPERS_DIRECTORY}arch_features.mk
5733547270fSGovindraj Raja
574f5211420SGovindraj Raja####################################################
575f5211420SGovindraj Raja# Enable required options for Memory Stack Tagging.
576f5211420SGovindraj Raja####################################################
577f5211420SGovindraj Raja
578f5211420SGovindraj Raja# Currently, these options are enabled only for clang and armclang compiler.
579f5211420SGovindraj Rajaifeq (${SUPPORT_STACK_MEMTAG},yes)
580f5211420SGovindraj Raja    ifdef mem_tag_arch_support
581f5211420SGovindraj Raja        # Check for armclang and clang compilers
5828620bd0bSChris Kay        ifneq ($(filter %-clang,$($(ARCH)-cc-id)),)
583f5211420SGovindraj Raja        # Add "memtag" architecture feature modifier if not specified
584f5211420SGovindraj Raja            ifeq ( ,$(findstring memtag,$(arch-features)))
585f5211420SGovindraj Raja                arch-features	:=	$(arch-features)+memtag
586f5211420SGovindraj Raja            endif	# memtag
5878620bd0bSChris Kay            ifeq ($($(ARCH)-cc-id),arm-clang)
588f5211420SGovindraj Raja                TF_CFLAGS	+=	-mmemtag-stack
5898620bd0bSChris Kay            else ifeq ($($(ARCH)-cc-id),llvm-clang)
590f5211420SGovindraj Raja                TF_CFLAGS	+=	-fsanitize=memtag
591f5211420SGovindraj Raja            endif	# armclang
592f5211420SGovindraj Raja        endif
593f5211420SGovindraj Raja    else
594f5211420SGovindraj Raja        $(error "Error: stack memory tagging is not supported for  \
595f5211420SGovindraj Raja        architecture ${ARCH},armv${ARM_ARCH_MAJOR}.${ARM_ARCH_MINOR}-a")
596f5211420SGovindraj Raja	endif #(mem_tag_arch_support)
597f5211420SGovindraj Rajaendif #(SUPPORT_STACK_MEMTAG)
598f5211420SGovindraj Raja
599f5211420SGovindraj Raja################################################################################
600f5211420SGovindraj Raja# RME dependent flags configuration, Enable optional features for RME.
601f5211420SGovindraj Raja################################################################################
602f5211420SGovindraj Raja# FEAT_RME
603f5211420SGovindraj Rajaifeq (${ENABLE_RME},1)
604f5211420SGovindraj Raja	# RME requires AARCH64
605f5211420SGovindraj Raja	ifneq (${ARCH},aarch64)
606f5211420SGovindraj Raja                $(error ENABLE_RME requires AArch64)
607f5211420SGovindraj Raja	endif
608f5211420SGovindraj Raja
609f5211420SGovindraj Raja	# RME requires el2 context to be saved for now.
610f5211420SGovindraj Raja	CTX_INCLUDE_EL2_REGS := 1
611f5211420SGovindraj Raja	CTX_INCLUDE_AARCH32_REGS := 0
612f5211420SGovindraj Raja	CTX_INCLUDE_PAUTH_REGS := 1
613f5211420SGovindraj Raja
614f5211420SGovindraj Raja	# RME enables CSV2_2 extension by default.
615f5211420SGovindraj Raja	ENABLE_FEAT_CSV2_2 = 1
616f5211420SGovindraj Rajaendif #(FEAT_RME)
617f5211420SGovindraj Raja
618f5211420SGovindraj Raja################################################################################
6195b18de09SZelalem Aweke# Include rmmd Makefile if RME is enabled
6205b18de09SZelalem Aweke################################################################################
6215b18de09SZelalem Awekeifneq (${ENABLE_RME},0)
6225b18de09SZelalem Aweke	ifneq (${ARCH},aarch64)
6235b18de09SZelalem Aweke                $(error ENABLE_RME requires AArch64)
6245b18de09SZelalem Aweke	endif
6251d63ae4dSMarc Bonnici	ifeq ($(SPMC_AT_EL3),1)
6261d63ae4dSMarc Bonnici                $(error SPMC_AT_EL3 and ENABLE_RME cannot both be enabled.)
6271d63ae4dSMarc Bonnici	endif
628c5e1da83SJayanth Dodderi Chidanand
6294fba2e1fSBoyan Karatotev	ifneq (${SPD}, none)
6304fba2e1fSBoyan Karatotev		ifneq (${SPD}, spmd)
6314fba2e1fSBoyan Karatotev                        $(error ENABLE_RME is incompatible with SPD=${SPD}. Use SPD=spmd)
6324fba2e1fSBoyan Karatotev		endif
6334fba2e1fSBoyan Karatotev	endif
6345b18de09SZelalem Awekeinclude services/std_svc/rmmd/rmmd.mk
6355b18de09SZelalem Aweke$(warning "RME is an experimental feature")
6365b18de09SZelalem Awekeendif
6375b18de09SZelalem Aweke
6383547270fSGovindraj Rajaifeq (${CTX_INCLUDE_EL2_REGS}, 1)
6393547270fSGovindraj Raja	ifeq (${SPD},none)
6403547270fSGovindraj Raja		ifeq (${ENABLE_RME},0)
6413547270fSGovindraj Raja                        $(error CTX_INCLUDE_EL2_REGS is available only when SPD \
6423547270fSGovindraj Raja                        or RME is enabled)
6433547270fSGovindraj Raja		endif
6443547270fSGovindraj Raja	endif
6453547270fSGovindraj Rajaendif
6460f21c547SJuan Castillo
6477794d6c8SGovindraj Raja################################################################################
64830655136SGovindraj Raja# Make 128-Bit sysreg read/writes availabe when FEAT_D128 is enabled.
64930655136SGovindraj Raja################################################################################
65030655136SGovindraj Rajaifneq (${ENABLE_FEAT_D128}, 0)
65130655136SGovindraj Raja        BL_COMMON_SOURCES       +=      lib/extensions/sysreg128/sysreg128.S
65230655136SGovindraj Rajaendif
65330655136SGovindraj Raja
65430655136SGovindraj Raja################################################################################
6557794d6c8SGovindraj Raja# Platform specific Makefile might provide us ARCH_MAJOR/MINOR use that to come
6567794d6c8SGovindraj Raja# up with appropriate march values for compiler.
6577794d6c8SGovindraj Raja################################################################################
6587794d6c8SGovindraj Rajainclude ${MAKE_HELPERS_DIRECTORY}march.mk
6597794d6c8SGovindraj Raja
6607794d6c8SGovindraj RajaTF_CFLAGS   +=	$(march-directive)
6617275ac2aSGovindraj RajaASFLAGS		+=	$(march-directive)
6627794d6c8SGovindraj Raja
66342d4d3baSArvind Ram Prakash# This internal flag is common option which is set to 1 for scenarios
66442d4d3baSArvind Ram Prakash# when the BL2 is running in EL3 level. This occurs in two scenarios -
66542d4d3baSArvind Ram Prakash# 4 world system running BL2 at EL3 and two world system without BL1 running
66642d4d3baSArvind Ram Prakash# BL2 in EL3
66742d4d3baSArvind Ram Prakash
66842d4d3baSArvind Ram Prakashifeq (${RESET_TO_BL2},1)
66942d4d3baSArvind Ram Prakash	BL2_RUNS_AT_EL3	:=	1
67042d4d3baSArvind Ram Prakash	ifeq (${ENABLE_RME},1)
671c5e1da83SJayanth Dodderi Chidanand                $(error RESET_TO_BL2=1 and ENABLE_RME=1 configuration is not \
672c5e1da83SJayanth Dodderi Chidanand                supported at the moment.)
67342d4d3baSArvind Ram Prakash	endif
67442d4d3baSArvind Ram Prakashelse ifeq (${ENABLE_RME},1)
67542d4d3baSArvind Ram Prakash	BL2_RUNS_AT_EL3	:=	1
67642d4d3baSArvind Ram Prakashelse
67742d4d3baSArvind Ram Prakash	BL2_RUNS_AT_EL3	:=	0
67842d4d3baSArvind Ram Prakashendif
67942d4d3baSArvind Ram Prakash
680f87e54f7SManish Pandey# This internal flag is set to 1 when Firmware First handling of External aborts
681f87e54f7SManish Pandey# is required by lowe ELs. Currently only NS requires this support.
682f87e54f7SManish Pandeyifeq ($(HANDLE_EA_EL3_FIRST_NS),1)
683f87e54f7SManish Pandey	FFH_SUPPORT := 1
684f87e54f7SManish Pandeyelse
685f87e54f7SManish Pandey	FFH_SUPPORT := 0
686f87e54f7SManish Pandeyendif
687f87e54f7SManish Pandey
68826e63c44SEtienne Carriereifeq (${ARM_ARCH_MAJOR},7)
68926e63c44SEtienne Carriereinclude make_helpers/armv7-a-cpus.mk
69026e63c44SEtienne Carriereendif
69126e63c44SEtienne Carriere
6923bd17c0fSSoby MathewPIE_FOUND		:=	$(findstring --enable-default-pie,${GCC_V_OUTPUT})
6933bd17c0fSSoby Mathewifneq ($(PIE_FOUND),)
6943bd17c0fSSoby Mathew	TF_CFLAGS	+=	-fno-PIE
6958620bd0bSChris Kayifeq ($($(ARCH)-ld-id),gnu-gcc)
6967b592418SSamuel Holland	TF_LDFLAGS	+=	-no-pie
6977b592418SSamuel Hollandendif
698c5e1da83SJayanth Dodderi Chidanandendif #(PIE_FOUND)
699320920c1SMasahiro Yamada
7008620bd0bSChris Kayifeq ($($(ARCH)-ld-id),gnu-gcc)
701320920c1SMasahiro Yamada	PIE_LDFLAGS	+=	-Wl,-pie -Wl,--no-dynamic-linker
702320920c1SMasahiro Yamadaelse
703320920c1SMasahiro Yamada	PIE_LDFLAGS	+=	-pie --no-dynamic-linker
704320920c1SMasahiro Yamadaendif
705320920c1SMasahiro Yamada
706320920c1SMasahiro Yamadaifeq ($(ENABLE_PIE),1)
70742d4d3baSArvind Ram Prakash	ifeq ($(RESET_TO_BL2),1)
70869af7fcfSMasahiro Yamada		ifneq ($(BL2_IN_XIP_MEM),1)
709966660ecSChris Kay			BL2_CPPFLAGS	+=	-fpie
71069af7fcfSMasahiro Yamada			BL2_CFLAGS	+=	-fpie
71169af7fcfSMasahiro Yamada			BL2_LDFLAGS	+=	$(PIE_LDFLAGS)
712c5e1da83SJayanth Dodderi Chidanand		endif #(BL2_IN_XIP_MEM)
713c5e1da83SJayanth Dodderi Chidanand	endif #(RESET_TO_BL2)
714966660ecSChris Kay	BL31_CPPFLAGS	+=	-fpie
715320920c1SMasahiro Yamada	BL31_CFLAGS 	+=	-fpie
716320920c1SMasahiro Yamada	BL31_LDFLAGS	+=	$(PIE_LDFLAGS)
717966660ecSChris Kay
718966660ecSChris Kay	BL32_CPPFLAGS	+=	-fpie
719d974301dSMasahiro Yamada	BL32_CFLAGS	+=	-fpie
720d974301dSMasahiro Yamada	BL32_LDFLAGS	+=	$(PIE_LDFLAGS)
721c5e1da83SJayanth Dodderi Chidanandendif #(ENABLE_PIE)
7223bd17c0fSSoby Mathew
723007433d8SBoyan KaratotevBL1_CPPFLAGS  += -DREPORT_ERRATA=${DEBUG}
724007433d8SBoyan KaratotevBL31_CPPFLAGS += -DREPORT_ERRATA=${DEBUG}
725007433d8SBoyan KaratotevBL32_CPPFLAGS += -DREPORT_ERRATA=${DEBUG}
726007433d8SBoyan Karatotev
7279cefb4b1SMasahiro YamadaBL1_CPPFLAGS += -DIMAGE_AT_EL3
72842d4d3baSArvind Ram Prakashifeq ($(RESET_TO_BL2),1)
7299cefb4b1SMasahiro Yamada	BL2_CPPFLAGS += -DIMAGE_AT_EL3
730d5e97a1dSMasahiro Yamadaelse
7319cefb4b1SMasahiro Yamada	BL2_CPPFLAGS += -DIMAGE_AT_EL1
732c5e1da83SJayanth Dodderi Chidanandendif #(RESET_TO_BL2)
733007433d8SBoyan Karatotev
734007433d8SBoyan Karatotevifeq (${ARCH},aarch64)
7359cefb4b1SMasahiro Yamada	BL2U_CPPFLAGS += -DIMAGE_AT_EL1
7369cefb4b1SMasahiro Yamada	BL31_CPPFLAGS += -DIMAGE_AT_EL3
7379cefb4b1SMasahiro Yamada	BL32_CPPFLAGS += -DIMAGE_AT_EL1
738007433d8SBoyan Karatotevelse
739007433d8SBoyan Karatotev	BL32_CPPFLAGS += -DIMAGE_AT_EL3
740d5e97a1dSMasahiro Yamadaendif
741d5e97a1dSMasahiro Yamada
74254035fc4SSandrine Bailleux# Include the CPU specific operations makefile, which provides default
74354035fc4SSandrine Bailleux# values for all CPU errata workarounds and CPU specific optimisations.
74454035fc4SSandrine Bailleux# This can be overridden by the platform.
74573c99d4eSJuan Castilloinclude lib/cpus/cpu-ops.mk
7464f6ad66aSAchin Gupta
747a4409008Sdp-arm################################################################################
748a4409008Sdp-arm# Build `AARCH32_SP` as BL32 image for AArch32
749a4409008Sdp-arm################################################################################
750c5e1da83SJayanth Dodderi Chidanandifeq (${ARCH},aarch32)
751c5e1da83SJayanth Dodderi Chidanand        NEED_BL32 := yes
752c5e1da83SJayanth Dodderi Chidanand
753a4409008Sdp-arm        ifneq (${AARCH32_SP},none)
754a4409008Sdp-arm        # We expect to locate an sp.mk under the specified AARCH32_SP directory
755a4409008Sdp-arm		AARCH32_SP_MAKE	:=	$(wildcard bl32/${AARCH32_SP}/${AARCH32_SP}.mk)
756a4409008Sdp-arm
757a4409008Sdp-arm                ifeq (${AARCH32_SP_MAKE},)
758a4409008Sdp-arm                        $(error Error: No bl32/${AARCH32_SP}/${AARCH32_SP}.mk located)
759a4409008Sdp-arm                endif
760a4409008Sdp-arm                $(info Including ${AARCH32_SP_MAKE})
761a4409008Sdp-arm                include ${AARCH32_SP_MAKE}
762a4409008Sdp-arm        endif
763c5e1da83SJayanth Dodderi Chidanandendif #(ARCH=aarch32)
7644f6ad66aSAchin Gupta
76573c99d4eSJuan Castillo################################################################################
76677f1f7a1SVarun Wadekar# Include libc if not overridden
76777f1f7a1SVarun Wadekar################################################################################
76877f1f7a1SVarun Wadekarifeq (${OVERRIDE_LIBC},0)
76977f1f7a1SVarun Wadekarinclude lib/libc/libc.mk
77077f1f7a1SVarun Wadekarendif
77177f1f7a1SVarun Wadekar
77277f1f7a1SVarun Wadekar################################################################################
773c5e1da83SJayanth Dodderi Chidanand# Check incompatible options and dependencies
774cf2c8a33SAntonio Nino Diaz################################################################################
775cf2c8a33SAntonio Nino Diaz
776c5e1da83SJayanth Dodderi Chidanand# USE_DEBUGFS experimental feature recommended only in debug builds
777c5e1da83SJayanth Dodderi Chidanandifeq (${USE_DEBUGFS},1)
778c5e1da83SJayanth Dodderi Chidanand        ifeq (${DEBUG},1)
779c5e1da83SJayanth Dodderi Chidanand                $(warning DEBUGFS experimental feature is enabled.)
780c5e1da83SJayanth Dodderi Chidanand        else
781c5e1da83SJayanth Dodderi Chidanand                $(warning DEBUGFS experimental, recommended in DEBUG builds ONLY)
782c5e1da83SJayanth Dodderi Chidanand        endif
783c5e1da83SJayanth Dodderi Chidanandendif #(USE_DEBUGFS)
784c5e1da83SJayanth Dodderi Chidanand
785c5e1da83SJayanth Dodderi Chidanand# USE_SPINLOCK_CAS requires AArch64 build
786c5e1da83SJayanth Dodderi Chidanandifeq (${USE_SPINLOCK_CAS},1)
787c5e1da83SJayanth Dodderi Chidanand        ifneq (${ARCH},aarch64)
788c5e1da83SJayanth Dodderi Chidanand               $(error USE_SPINLOCK_CAS requires AArch64)
789c5e1da83SJayanth Dodderi Chidanand        endif
790c5e1da83SJayanth Dodderi Chidanandendif #(USE_SPINLOCK_CAS)
791c5e1da83SJayanth Dodderi Chidanand
792c5e1da83SJayanth Dodderi Chidanand# The cert_create tool cannot generate certificates individually, so we use the
793c5e1da83SJayanth Dodderi Chidanand# target 'certificates' to create them all
794c5e1da83SJayanth Dodderi Chidanandifneq (${GENERATE_COT},0)
795c5e1da83SJayanth Dodderi Chidanand        FIP_DEPS += certificates
796c5e1da83SJayanth Dodderi Chidanand        FWU_FIP_DEPS += fwu_certificates
797c5e1da83SJayanth Dodderi Chidanandendif
798c5e1da83SJayanth Dodderi Chidanand
799c5e1da83SJayanth Dodderi Chidanandifneq (${DECRYPTION_SUPPORT},none)
800c5e1da83SJayanth Dodderi Chidanand	ENC_ARGS += -f ${FW_ENC_STATUS}
801c5e1da83SJayanth Dodderi Chidanand	ENC_ARGS += -k ${ENC_KEY}
802c5e1da83SJayanth Dodderi Chidanand	ENC_ARGS += -n ${ENC_NONCE}
803c5e1da83SJayanth Dodderi Chidanand	FIP_DEPS += enctool
804c5e1da83SJayanth Dodderi Chidanand	FWU_FIP_DEPS += enctool
805c5e1da83SJayanth Dodderi Chidanandendif #(DECRYPTION_SUPPORT)
806c5e1da83SJayanth Dodderi Chidanand
807cf2c8a33SAntonio Nino Diazifdef EL3_PAYLOAD_BASE
80868450a6dSAntonio Nino Diaz	ifdef PRELOADED_BL33_BASE
80968450a6dSAntonio Nino Diaz                $(warning "PRELOADED_BL33_BASE and EL3_PAYLOAD_BASE are \
81068450a6dSAntonio Nino Diaz		incompatible build options. EL3_PAYLOAD_BASE has priority.")
811cf2c8a33SAntonio Nino Diaz	endif
81276580f3dSQixiang Xu	ifneq (${GENERATE_COT},0)
813c5e1da83SJayanth Dodderi Chidanand                $(error "GENERATE_COT and EL3_PAYLOAD_BASE are incompatible \
814c5e1da83SJayanth Dodderi Chidanand                build options.")
81576580f3dSQixiang Xu	endif
81676580f3dSQixiang Xu	ifneq (${TRUSTED_BOARD_BOOT},0)
817c5e1da83SJayanth Dodderi Chidanand                $(error "TRUSTED_BOARD_BOOT and EL3_PAYLOAD_BASE are \
818c5e1da83SJayanth Dodderi Chidanand                incompatible \ build options.")
81976580f3dSQixiang Xu	endif
820c5e1da83SJayanth Dodderi Chidanandendif #(EL3_PAYLOAD_BASE)
821cf2c8a33SAntonio Nino Diaz
822cf2c8a33SAntonio Nino Diazifeq (${NEED_BL33},yes)
823cf2c8a33SAntonio Nino Diaz	ifdef EL3_PAYLOAD_BASE
824cf2c8a33SAntonio Nino Diaz                $(warning "BL33 image is not needed when option \
825cf2c8a33SAntonio Nino Diaz                BL33_PAYLOAD_BASE is used and won't be added to the FIP file.")
826cf2c8a33SAntonio Nino Diaz	endif
82768450a6dSAntonio Nino Diaz	ifdef PRELOADED_BL33_BASE
82868450a6dSAntonio Nino Diaz                $(warning "BL33 image is not needed when option \
829c5e1da83SJayanth Dodderi Chidanand                PRELOADED_BL33_BASE is used and won't be added to the FIP file.")
830cf2c8a33SAntonio Nino Diaz	endif
831c5e1da83SJayanth Dodderi Chidanandendif #(NEED_BL33)
832cf2c8a33SAntonio Nino Diaz
833d4593e47SJeenu Viswambharan# When building for systems with hardware-assisted coherency, there's no need to
834d4593e47SJeenu Viswambharan# use USE_COHERENT_MEM. Require that USE_COHERENT_MEM must be set to 0 too.
835d4593e47SJeenu Viswambharanifeq ($(HW_ASSISTED_COHERENCY)-$(USE_COHERENT_MEM),1-1)
836d4593e47SJeenu Viswambharan        $(error USE_COHERENT_MEM cannot be enabled with HW_ASSISTED_COHERENCY)
837d4593e47SJeenu Viswambharanendif
8381a0a3f06SYatharth Kochar
83942d4d3baSArvind Ram Prakash#For now, BL2_IN_XIP_MEM is only supported when RESET_TO_BL2 is 1.
84042d4d3baSArvind Ram Prakashifeq ($(RESET_TO_BL2)-$(BL2_IN_XIP_MEM),0-1)
84142d4d3baSArvind Ram Prakash        $(error "BL2_IN_XIP_MEM is only supported when RESET_TO_BL2 is enabled")
8427d173fc5SJiafei Panendif
8437d173fc5SJiafei Pan
8449202d519SManish Pandey# RAS_EXTENSION is deprecated, provide alternate build options
84514c6016aSJeenu Viswambharanifeq ($(RAS_EXTENSION),1)
846c5e1da83SJayanth Dodderi Chidanand        $(error "RAS_EXTENSION is now deprecated, please use ENABLE_FEAT_RAS \
847f87e54f7SManish Pandey        and HANDLE_EA_EL3_FIRST_NS instead")
8489202d519SManish Pandeyendif
849c5e1da83SJayanth Dodderi Chidanand
850c5e1da83SJayanth Dodderi Chidanand
8519202d519SManish Pandey# When FAULT_INJECTION_SUPPORT is used, require that FEAT_RAS is enabled
8521a7c1cfeSJeenu Viswambharanifeq ($(FAULT_INJECTION_SUPPORT),1)
8536503ff29SAndre Przywara	ifeq ($(ENABLE_FEAT_RAS),0)
8546503ff29SAndre Przywara                $(error For FAULT_INJECTION_SUPPORT, ENABLE_FEAT_RAS must not be 0)
8551a7c1cfeSJeenu Viswambharan	endif
856c5e1da83SJayanth Dodderi Chidanandendif #(FAULT_INJECTION_SUPPORT)
8571a7c1cfeSJeenu Viswambharan
858ed51b51fSRoberto Vargas# DYN_DISABLE_AUTH can be set only when TRUSTED_BOARD_BOOT=1
859209a60ccSSoby Mathewifeq ($(DYN_DISABLE_AUTH), 1)
860209a60ccSSoby Mathew	ifeq (${TRUSTED_BOARD_BOOT}, 0)
861c5e1da83SJayanth Dodderi Chidanand                $(error "TRUSTED_BOARD_BOOT must be enabled for DYN_DISABLE_AUTH \
862c5e1da83SJayanth Dodderi Chidanand                to be set.")
863209a60ccSSoby Mathew	endif
864c5e1da83SJayanth Dodderi Chidanandendif #(DYN_DISABLE_AUTH)
865209a60ccSSoby Mathew
8662bf4f27fSManish V Badarkheifeq ($(MEASURED_BOOT)-$(TRUSTED_BOARD_BOOT),1-1)
8672bf4f27fSManish V Badarkhe# Support authentication verification and hash calculation
8682bf4f27fSManish V Badarkhe	CRYPTO_SUPPORT := 3
8692bf4f27fSManish V Badarkheelse ifeq ($(DRTM_SUPPORT)-$(TRUSTED_BOARD_BOOT),1-1)
8702bf4f27fSManish V Badarkhe# Support authentication verification and hash calculation
8712bf4f27fSManish V Badarkhe	CRYPTO_SUPPORT := 3
8722bf4f27fSManish V Badarkheelse ifneq ($(filter 1,${MEASURED_BOOT} ${DRTM_SUPPORT}),)
8732bf4f27fSManish V Badarkhe# Support hash calculation only
8742bf4f27fSManish V Badarkhe	CRYPTO_SUPPORT := 2
8752bf4f27fSManish V Badarkheelse ifeq (${TRUSTED_BOARD_BOOT},1)
8762bf4f27fSManish V Badarkhe# Support authentication verification only
877c9c56f6eSManish V Badarkhe	CRYPTO_SUPPORT := 1
878c9c56f6eSManish V Badarkheelse
879c9c56f6eSManish V Badarkhe	CRYPTO_SUPPORT := 0
880c5e1da83SJayanth Dodderi Chidanandendif #($(MEASURED_BOOT)-$(TRUSTED_BOARD_BOOT))
881c9c56f6eSManish V Badarkhe
882e4a070e3SManish V Badarkheifneq ($(filter 1 2 3,$(CRYPTO_SUPPORT)),)
883e4a070e3SManish V BadarkheCRYPTO_LIB := $(BUILD_PLAT)/lib/libmbedtls.a
884e4a070e3SManish V Badarkheendif
885e4a070e3SManish V Badarkhe
886cbf9e84aSBalint Dobszay# SDEI_IN_FCONF is only supported when SDEI_SUPPORT is enabled.
887cbf9e84aSBalint Dobszayifeq ($(SDEI_SUPPORT)-$(SDEI_IN_FCONF),0-1)
888700e7685SManish Pandey        $(error "SDEI_IN_FCONF is only supported when SDEI_SUPPORT is enabled")
88984ef9cd8SManish V Badarkheendif
89084ef9cd8SManish V Badarkhe
891b86048c4SAntonio Nino Diaz# If pointer authentication is used in the firmware, make sure that all the
8929fc59639SAlexei Fedorov# registers associated to it are also saved and restored.
8939fc59639SAlexei Fedorov# Not doing it would leak the value of the keys used by EL3 to EL1 and S-EL1.
894b86048c4SAntonio Nino Diazifeq ($(ENABLE_PAUTH),1)
8959fc59639SAlexei Fedorov	ifeq ($(CTX_INCLUDE_PAUTH_REGS),0)
8969fc59639SAlexei Fedorov                $(error Pointer Authentication requires CTX_INCLUDE_PAUTH_REGS=1)
89706715f85SAlexei Fedorov	endif
898c5e1da83SJayanth Dodderi Chidanandendif #(ENABLE_PAUTH)
8999fc59639SAlexei Fedorov
90006715f85SAlexei Fedorovifeq ($(CTX_INCLUDE_PAUTH_REGS),1)
9019fc59639SAlexei Fedorov	ifneq (${ARCH},aarch64)
9029fc59639SAlexei Fedorov                $(error CTX_INCLUDE_PAUTH_REGS requires AArch64)
903b86048c4SAntonio Nino Diaz	endif
904c5e1da83SJayanth Dodderi Chidanandendif #(CTX_INCLUDE_PAUTH_REGS)
9059fc59639SAlexei Fedorov
9066a0da736SJayanth Dodderi Chidanandifeq ($(FEATURE_DETECTION),1)
9076a0da736SJayanth Dodderi Chidanand        $(info FEATURE_DETECTION is an experimental feature)
908c5e1da83SJayanth Dodderi Chidanandendif #(FEATURE_DETECTION)
9096a0da736SJayanth Dodderi Chidanand
91003d3c0d7SJayanth Dodderi Chidanandifneq ($(ENABLE_SME2_FOR_NS), 0)
91103d3c0d7SJayanth Dodderi Chidanand	ifeq (${ENABLE_SME_FOR_NS}, 0)
912c5e1da83SJayanth Dodderi Chidanand                $(warning "ENABLE_SME2_FOR_NS requires ENABLE_SME_FOR_NS also \
913c5e1da83SJayanth Dodderi Chidanand                to be set")
91403d3c0d7SJayanth Dodderi Chidanand                $(warning "Forced ENABLE_SME_FOR_NS=1")
91503d3c0d7SJayanth Dodderi Chidanand		override ENABLE_SME_FOR_NS	:= 1
91603d3c0d7SJayanth Dodderi Chidanand	endif
917c5e1da83SJayanth Dodderi Chidanandendif #(ENABLE_SME2_FOR_NS)
91845007acdSJayanth Dodderi Chidanand
91960e8f3cfSPetre-Ionut Tudorifeq (${ARM_XLAT_TABLES_LIB_V1}, 1)
92060e8f3cfSPetre-Ionut Tudor	ifeq (${ALLOW_RO_XLAT_TABLES}, 1)
921c5e1da83SJayanth Dodderi Chidanand                $(error "ALLOW_RO_XLAT_TABLES requires translation tables \
922c5e1da83SJayanth Dodderi Chidanand                library v2")
92360e8f3cfSPetre-Ionut Tudor	endif
924c5e1da83SJayanth Dodderi Chidanandendif #(ARM_XLAT_TABLES_LIB_V1)
92560e8f3cfSPetre-Ionut Tudor
9267cda17bbSSumit Gargifneq (${DECRYPTION_SUPPORT},none)
9277cda17bbSSumit Garg	ifeq (${TRUSTED_BOARD_BOOT}, 0)
928c5e1da83SJayanth Dodderi Chidanand                $(error TRUSTED_BOARD_BOOT must be enabled for DECRYPTION_SUPPORT \
929c5e1da83SJayanth Dodderi Chidanand                to be set)
9307cda17bbSSumit Garg	endif
931c5e1da83SJayanth Dodderi Chidanandendif #(DECRYPTION_SUPPORT)
9327cda17bbSSumit Garg
933744ad974Sjohpow01# Ensure that no Aarch64-only features are enabled in Aarch32 build
934dc78e62dSjohpow01ifeq (${ARCH},aarch32)
935744ad974Sjohpow01
936744ad974Sjohpow01	# SME/SVE only supported on AArch64
93745007acdSJayanth Dodderi Chidanand	ifneq (${ENABLE_SME_FOR_NS},0)
938dc78e62dSjohpow01                $(error "ENABLE_SME_FOR_NS cannot be used with ARCH=aarch32")
939dc78e62dSjohpow01	endif
94003d3c0d7SJayanth Dodderi Chidanand
941dc78e62dSjohpow01	ifeq (${ENABLE_SVE_FOR_NS},1)
942dc78e62dSjohpow01		# Warning instead of error due to CI dependency on this
94324ab2c0aSYann Gautier                $(error "ENABLE_SVE_FOR_NS cannot be used with ARCH=aarch32")
944dc78e62dSjohpow01	endif
945744ad974Sjohpow01
946ff86e0b4SJuan Pablo Conde	# BRBE is not supported in AArch32
947744ad974Sjohpow01	ifeq (${ENABLE_BRBE_FOR_NS},1)
948744ad974Sjohpow01                $(error "ENABLE_BRBE_FOR_NS cannot be used with ARCH=aarch32")
949744ad974Sjohpow01	endif
950744ad974Sjohpow01
951ff86e0b4SJuan Pablo Conde	# FEAT_RNG_TRAP is not supported in AArch32
952ff86e0b4SJuan Pablo Conde	ifeq (${ENABLE_FEAT_RNG_TRAP},1)
953ff86e0b4SJuan Pablo Conde                $(error "ENABLE_FEAT_RNG_TRAP cannot be used with ARCH=aarch32")
954ff86e0b4SJuan Pablo Conde	endif
955a57e18e4SArvind Ram Prakash
956a57e18e4SArvind Ram Prakash	ifneq (${ENABLE_FEAT_FPMR},0)
957a57e18e4SArvind Ram Prakash                $(error "ENABLE_FEAT_FPMR cannot be used with ARCH=aarch32")
958a57e18e4SArvind Ram Prakash	endif
9598db17052SBoyan Karatotev
9608db17052SBoyan Karatotev	ifeq (${ARCH_FEATURE_AVAILABILITY},1)
9618db17052SBoyan Karatotev                $(error "ARCH_FEATURE_AVAILABILITY cannot be used with ARCH=aarch32")
9628db17052SBoyan Karatotev	endif
9636b8df7b9SArvind Ram Prakash	# FEAT_MOPS is only supported on AArch64
9646b8df7b9SArvind Ram Prakash	ifneq (${ENABLE_FEAT_MOPS},0)
9656b8df7b9SArvind Ram Prakash		$(error "ENABLE_FEAT_MOPS cannot be used with ARCH=aarch32")
9666b8df7b9SArvind Ram Prakash	endif
967c5e1da83SJayanth Dodderi Chidanandendif #(ARCH=aarch32)
968dc78e62dSjohpow01
969a57e18e4SArvind Ram Prakashifneq (${ENABLE_FEAT_FPMR},0)
970a57e18e4SArvind Ram Prakash	ifeq (${ENABLE_FEAT_FGT},0)
971a57e18e4SArvind Ram Prakash                $(error "ENABLE_FEAT_FPMR requires ENABLE_FEAT_FGT")
972a57e18e4SArvind Ram Prakash	endif
973a57e18e4SArvind Ram Prakash	ifeq (${ENABLE_FEAT_HCX},0)
974a57e18e4SArvind Ram Prakash                $(error "ENABLE_FEAT_FPMR requires ENABLE_FEAT_HCX")
975a57e18e4SArvind Ram Prakash	endif
976a57e18e4SArvind Ram Prakashendif #(ENABLE_FEAT_FPMR)
977a57e18e4SArvind Ram Prakash
9780d122947SBoyan Karatotevifneq (${ENABLE_SME_FOR_NS},0)
9790d122947SBoyan Karatotev	ifeq (${ENABLE_SVE_FOR_NS},0)
9800d122947SBoyan Karatotev                $(error "ENABLE_SME_FOR_NS requires ENABLE_SVE_FOR_NS")
9810d122947SBoyan Karatotev	endif
982c5e1da83SJayanth Dodderi Chidanandendif #(ENABLE_SME_FOR_NS)
9830d122947SBoyan Karatotev
984dc78e62dSjohpow01# Secure SME/SVE requires the non-secure component as well
985dc78e62dSjohpow01ifeq (${ENABLE_SME_FOR_SWD},1)
986dc78e62dSjohpow01	ifeq (${ENABLE_SME_FOR_NS},0)
987dc78e62dSjohpow01                $(error "ENABLE_SME_FOR_SWD requires ENABLE_SME_FOR_NS")
988dc78e62dSjohpow01	endif
9890d122947SBoyan Karatotev	ifeq (${ENABLE_SVE_FOR_SWD},0)
9900d122947SBoyan Karatotev                $(error "ENABLE_SME_FOR_SWD requires ENABLE_SVE_FOR_SWD")
9910d122947SBoyan Karatotev	endif
992c5e1da83SJayanth Dodderi Chidanandendif #(ENABLE_SME_FOR_SWD)
993c5e1da83SJayanth Dodderi Chidanand
9943524d074SMadhukar Pappireddy# Enabling SVE for SWD requires enabling SVE for NWD due to ENABLE_FEAT
9953524d074SMadhukar Pappireddy# mechanism.
996dc78e62dSjohpow01ifeq (${ENABLE_SVE_FOR_SWD},1)
997dc78e62dSjohpow01    ifeq (${ENABLE_SVE_FOR_NS},0)
998dc78e62dSjohpow01        $(error "ENABLE_SVE_FOR_SWD requires ENABLE_SVE_FOR_NS")
999dc78e62dSjohpow01    endif
10003524d074SMadhukar Pappireddyendif
1001dc78e62dSjohpow01
10023524d074SMadhukar Pappireddy# Enabling SVE for both the worlds typically requires the context
10033524d074SMadhukar Pappireddy# management of SVE registers. The only exception being SPMC at S-EL2.
10043524d074SMadhukar Pappireddyifeq (${ENABLE_SVE_FOR_SWD}, 1)
10053524d074SMadhukar Pappireddy    ifneq (${ENABLE_SVE_FOR_NS}, 0)
10063524d074SMadhukar Pappireddy        ifeq (${CTX_INCLUDE_SVE_REGS}-$(SPMD_SPM_AT_SEL2),0-0)
10073524d074SMadhukar Pappireddy            $(warning "ENABLE_SVE_FOR_SWD and ENABLE_SVE_FOR_NS together require CTX_INCLUDE_SVE_REGS")
10083524d074SMadhukar Pappireddy        endif
10093524d074SMadhukar Pappireddy    endif
10103524d074SMadhukar Pappireddyendif
10113524d074SMadhukar Pappireddy
10123524d074SMadhukar Pappireddy# Enabling SVE in either world while enabling CTX_INCLUDE_FPREGS requires
10133524d074SMadhukar Pappireddy# CTX_INCLUDE_SVE_REGS to be enabled due to architectural dependency between FP
10143524d074SMadhukar Pappireddy# and SVE registers.
10153524d074SMadhukar Pappireddyifeq (${CTX_INCLUDE_FPREGS}, 1)
10163524d074SMadhukar Pappireddy    ifneq (${ENABLE_SVE_FOR_NS},0)
10173524d074SMadhukar Pappireddy        ifeq (${CTX_INCLUDE_SVE_REGS},0)
10183524d074SMadhukar Pappireddy	    # Warning instead of error due to CI dependency on this
10193524d074SMadhukar Pappireddy            $(warning "CTX_INCLUDE_FPREGS and ENABLE_SVE_FOR_NS together require CTX_INCLUDE_SVE_REGS")
10203524d074SMadhukar Pappireddy            $(warning "Forced ENABLE_SVE_FOR_NS=0")
10213524d074SMadhukar Pappireddy	    override ENABLE_SVE_FOR_NS	:= 0
10223524d074SMadhukar Pappireddy        endif
10233524d074SMadhukar Pappireddy    endif
10243524d074SMadhukar Pappireddyendif #(CTX_INCLUDE_FPREGS)
10253524d074SMadhukar Pappireddy
10263524d074SMadhukar Pappireddy# SVE context management is only required if secure world has access to SVE/FP
10273524d074SMadhukar Pappireddy# functionality.
10283524d074SMadhukar Pappireddyifeq (${CTX_INCLUDE_SVE_REGS},1)
10293524d074SMadhukar Pappireddy    ifeq (${ENABLE_SVE_FOR_SWD},0)
10303524d074SMadhukar Pappireddy        $(error "CTX_INCLUDE_SVE_REGS requires ENABLE_SVE_FOR_SWD to also be enabled")
10313524d074SMadhukar Pappireddy    endif
10323524d074SMadhukar Pappireddyendif
10333524d074SMadhukar Pappireddy
10343524d074SMadhukar Pappireddy# SME cannot be used with CTX_INCLUDE_FPREGS since SPM does its own context
10353524d074SMadhukar Pappireddy# management including FPU registers.
1036dc78e62dSjohpow01ifeq (${CTX_INCLUDE_FPREGS},1)
103745007acdSJayanth Dodderi Chidanand    ifneq (${ENABLE_SME_FOR_NS},0)
1038dc78e62dSjohpow01        $(error "ENABLE_SME_FOR_NS cannot be used with CTX_INCLUDE_FPREGS")
1039dc78e62dSjohpow01    endif
1040c5e1da83SJayanth Dodderi Chidanandendif #(CTX_INCLUDE_FPREGS)
1041dc78e62dSjohpow01
104200e28874SManish V Badarkheifeq ($(DRTM_SUPPORT),1)
104300e28874SManish V Badarkhe        $(info DRTM_SUPPORT is an experimental feature)
104400e28874SManish V Badarkheendif
104500e28874SManish V Badarkhe
10468953568aSLevi Yunifeq (${HOB_LIST},1)
10478953568aSLevi Yun        $(warning HOB_LIST is an experimental feature)
10488953568aSLevi Yunendif
10498953568aSLevi Yun
10503ba2c151SRaymond Maoifeq (${TRANSFER_LIST},1)
10513ba2c151SRaymond Mao        $(info TRANSFER_LIST is an experimental feature)
10523ba2c151SRaymond Maoendif
10533ba2c151SRaymond Mao
1054274a69e7SChris Kayifeq (${ENABLE_RME},1)
1055274a69e7SChris Kay	ifneq (${SEPARATE_CODE_AND_RODATA},1)
1056274a69e7SChris Kay                $(error `ENABLE_RME=1` requires `SEPARATE_CODE_AND_RODATA=1`)
1057274a69e7SChris Kay	endif
1058274a69e7SChris Kayendif
1059274a69e7SChris Kay
10605782b890SManish V Badarkheifeq ($(PSA_CRYPTO),1)
10615782b890SManish V Badarkhe        $(info PSA_CRYPTO is an experimental feature)
10625782b890SManish V Badarkheendif
10635782b890SManish V Badarkhe
106482222db8SManish V Badarkheifeq ($(DICE_PROTECTION_ENVIRONMENT),1)
106582222db8SManish V Badarkhe        $(info DICE_PROTECTION_ENVIRONMENT is an experimental feature)
106682222db8SManish V Badarkheendif
106782222db8SManish V Badarkhe
1068cf2c8a33SAntonio Nino Diaz################################################################################
106973c99d4eSJuan Castillo# Process platform overrideable behaviour
107073c99d4eSJuan Castillo################################################################################
10714f6ad66aSAchin Gupta
10725f24ce96SManish Pandeyifdef BL1_SOURCES
10735f24ce96SManish Pandey	NEED_BL1 := yes
1074c5e1da83SJayanth Dodderi Chidanandendif #(BL1_SOURCES)
10755f24ce96SManish Pandey
10765f24ce96SManish Pandeyifdef BL2_SOURCES
10775f24ce96SManish Pandey	NEED_BL2 := yes
10785f24ce96SManish Pandey
1079bd97f83aSJohn Tsichritzis	# Using BL2 implies that a BL33 image also needs to be supplied for the FIP and
1080bd97f83aSJohn Tsichritzis	# Certificate generation tools. This flag can be overridden by the platform.
1081cf2c8a33SAntonio Nino Diaz	ifdef EL3_PAYLOAD_BASE
1082cf2c8a33SAntonio Nino Diaz		# If booting an EL3 payload there is no need for a BL33 image
1083cf2c8a33SAntonio Nino Diaz		# in the FIP file.
10844c117f6cSSandrine Bailleux		NEED_BL33		:=	no
1085cf2c8a33SAntonio Nino Diaz	else
108668450a6dSAntonio Nino Diaz		ifdef PRELOADED_BL33_BASE
1087cf2c8a33SAntonio Nino Diaz			# If booting a BL33 preloaded image there is no need of
1088cf2c8a33SAntonio Nino Diaz			# another one in the FIP file.
1089cf2c8a33SAntonio Nino Diaz			NEED_BL33		:=	no
1090cf2c8a33SAntonio Nino Diaz		else
1091cf2c8a33SAntonio Nino Diaz			NEED_BL33		?=	yes
1092cf2c8a33SAntonio Nino Diaz		endif
10934c117f6cSSandrine Bailleux	endif
1094c5e1da83SJayanth Dodderi Chidanandendif #(BL2_SOURCES)
10956f971622SJuan Castillo
10965f24ce96SManish Pandeyifdef BL2U_SOURCES
10975f24ce96SManish Pandey	NEED_BL2U := yes
1098c5e1da83SJayanth Dodderi Chidanandendif #(BL2U_SOURCES)
10995f24ce96SManish Pandey
11004d045d0eSMasahiro Yamada# If SCP_BL2 is given, we always want FIP to include it.
11014d045d0eSMasahiro Yamadaifdef SCP_BL2
11024d045d0eSMasahiro Yamada	NEED_SCP_BL2		:=	yes
1103c5e1da83SJayanth Dodderi Chidanandendif #(SCP_BL2)
11044d045d0eSMasahiro Yamada
11055744e874SSoby Mathew# For AArch32, BL31 is not currently supported.
11065744e874SSoby Mathewifneq (${ARCH},aarch32)
11075744e874SSoby Mathew	ifdef BL31_SOURCES
1108c5e1da83SJayanth Dodderi Chidanand	# When booting an EL3 payload, there is no need to compile the BL31
1109c5e1da83SJayanth Dodderi Chidanand	# image nor put it in the FIP.
11105744e874SSoby Mathew		ifndef EL3_PAYLOAD_BASE
11115744e874SSoby Mathew			NEED_BL31 := yes
11125744e874SSoby Mathew		endif
11135744e874SSoby Mathew	endif
1114c5e1da83SJayanth Dodderi Chidanandendif #(ARCH=aarch64)
11155744e874SSoby Mathew
111673c99d4eSJuan Castillo# Process TBB related flags
11176f971622SJuan Castilloifneq (${GENERATE_COT},0)
111873c99d4eSJuan Castillo	# Common cert_create options
11196f971622SJuan Castillo	ifneq (${CREATE_KEYS},0)
11206f971622SJuan Castillo                $(eval CRT_ARGS += -n)
11210191262dSYatharth Kochar                $(eval FWU_CRT_ARGS += -n)
1122fd34e7baSJuan Castillo		ifneq (${SAVE_KEYS},0)
1123fd34e7baSJuan Castillo                        $(eval CRT_ARGS += -k)
11240191262dSYatharth Kochar                        $(eval FWU_CRT_ARGS += -k)
1125fd34e7baSJuan Castillo		endif
11266f971622SJuan Castillo	endif
112773c99d4eSJuan Castillo	# Include TBBR makefile (unless the platform indicates otherwise)
112873c99d4eSJuan Castillo	ifeq (${INCLUDE_TBBR_MK},1)
112973c99d4eSJuan Castillo                include make_helpers/tbbr/tbbr_tools.mk
113073c99d4eSJuan Castillo	endif
1131c5e1da83SJayanth Dodderi Chidanandendif #(GENERATE_COT)
11326f971622SJuan Castillo
11331c75d5dfSMasahiro Yamadaifneq (${FIP_ALIGN},0)
11341c75d5dfSMasahiro Yamada	FIP_ARGS += --align ${FIP_ALIGN}
1135c5e1da83SJayanth Dodderi Chidanandendif #(FIP_ALIGN)
11361c75d5dfSMasahiro Yamada
11375f24ce96SManish Pandeyifdef FDT_SOURCES
11385f24ce96SManish Pandey	NEED_FDT := yes
1139c5e1da83SJayanth Dodderi Chidanandendif #(FDT_SOURCES)
11405f24ce96SManish Pandey
114173c99d4eSJuan Castillo################################################################################
114246e5e035SMichalis Pappas# Include libraries' Makefile that are used in all BL
114346e5e035SMichalis Pappas################################################################################
114446e5e035SMichalis Pappas
114546e5e035SMichalis Pappasinclude lib/stack_protector/stack_protector.mk
114646e5e035SMichalis Pappas
114746e5e035SMichalis Pappas################################################################################
11488a86052dSSoby Mathew# Include BL specific makefiles
11498a86052dSSoby Mathew################################################################################
11505f24ce96SManish Pandey
11515f24ce96SManish Pandeyifeq (${NEED_BL1},yes)
11528a86052dSSoby Mathewinclude bl1/bl1.mk
11538a86052dSSoby Mathewendif
11548a86052dSSoby Mathew
11555f24ce96SManish Pandeyifeq (${NEED_BL2},yes)
11568a86052dSSoby Mathewinclude bl2/bl2.mk
11578a86052dSSoby Mathewendif
11588a86052dSSoby Mathew
11595f24ce96SManish Pandeyifeq (${NEED_BL2U},yes)
11608a86052dSSoby Mathewinclude bl2u/bl2u.mk
11618a86052dSSoby Mathewendif
11628a86052dSSoby Mathew
11635744e874SSoby Mathewifeq (${NEED_BL31},yes)
11648a86052dSSoby Mathewinclude bl31/bl31.mk
11658a86052dSSoby Mathewendif
116603b397a8SNishanth Menon
116773c99d4eSJuan Castillo################################################################################
116873c99d4eSJuan Castillo# Build options checks
116973c99d4eSJuan Castillo################################################################################
117073c99d4eSJuan Castillo
1171c5e1da83SJayanth Dodderi Chidanand# Boolean_Flags
1172327131c4SLeonardo Sandoval$(eval $(call assert_booleans,\
1173327131c4SLeonardo Sandoval    $(sort \
1174327131c4SLeonardo Sandoval	ALLOW_RO_XLAT_TABLES \
117546789a7cSBalint Dobszay	BL2_ENABLE_SP_LOAD \
1176327131c4SLeonardo Sandoval	COLD_BOOT_SINGLE_CPU \
1177327131c4SLeonardo Sandoval	CREATE_KEYS \
1178327131c4SLeonardo Sandoval	CTX_INCLUDE_AARCH32_REGS \
1179327131c4SLeonardo Sandoval	CTX_INCLUDE_FPREGS \
118042422622SMadhukar Pappireddy	CTX_INCLUDE_SVE_REGS \
1181327131c4SLeonardo Sandoval	CTX_INCLUDE_EL2_REGS \
11829acff28aSArvind Ram Prakash	CTX_INCLUDE_MPAM_REGS \
1183327131c4SLeonardo Sandoval	DEBUG \
1184327131c4SLeonardo Sandoval	DYN_DISABLE_AUTH \
1185327131c4SLeonardo Sandoval	EL3_EXCEPTION_HANDLING \
11861fd685a7SChris Kay	ENABLE_AMU_AUXILIARY_COUNTERS \
1187742ca230SChris Kay	ENABLE_AMU_FCONF \
1188873d4241Sjohpow01	AMU_RESTRICT_COUNTERS \
1189327131c4SLeonardo Sandoval	ENABLE_ASSERTIONS \
1190327131c4SLeonardo Sandoval	ENABLE_PIE \
1191327131c4SLeonardo Sandoval	ENABLE_PMF \
1192327131c4SLeonardo Sandoval	ENABLE_PSCI_STAT \
1193327131c4SLeonardo Sandoval	ENABLE_RUNTIME_INSTRUMENTATION \
1194dc78e62dSjohpow01	ENABLE_SME_FOR_SWD \
11950c5e7d1cSMax Shvetsov	ENABLE_SVE_FOR_SWD \
1196970a4a8dSManish Pandey	ENABLE_FEAT_RAS	\
1197f87e54f7SManish Pandey	FFH_SUPPORT	\
1198327131c4SLeonardo Sandoval	ERROR_DEPRECATED \
1199327131c4SLeonardo Sandoval	FAULT_INJECTION_SUPPORT \
1200327131c4SLeonardo Sandoval	GENERATE_COT \
1201327131c4SLeonardo Sandoval	GICV2_G0_FOR_EL3 \
120246cc41d5SManish Pandey	HANDLE_EA_EL3_FIRST_NS \
1203538516f5SBipin Ravi	HARDEN_SLS \
1204327131c4SLeonardo Sandoval	HW_ASSISTED_COHERENCY \
1205327131c4SLeonardo Sandoval	MEASURED_BOOT \
1206e7f1181fSTamas Ban	DICE_PROTECTION_ENVIRONMENT \
12076a88ec8bSRaghu Krishnamurthy	RMMD_ENABLE_EL3_TOKEN_SIGN \
120800e28874SManish V Badarkhe	DRTM_SUPPORT \
1209327131c4SLeonardo Sandoval	NS_TIMER_SWITCH \
1210327131c4SLeonardo Sandoval	OVERRIDE_LIBC \
1211327131c4SLeonardo Sandoval	PL011_GENERIC_UART \
1212327131c4SLeonardo Sandoval	PROGRAMMABLE_RESET_ADDRESS \
1213327131c4SLeonardo Sandoval	PSCI_EXTENDED_STATE_ID \
121464b4710bSWing Li	PSCI_OS_INIT_MODE \
12158db17052SBoyan Karatotev	ARCH_FEATURE_AVAILABILITY \
1216327131c4SLeonardo Sandoval	RESET_TO_BL31 \
1217327131c4SLeonardo Sandoval	SAVE_KEYS \
1218327131c4SLeonardo Sandoval	SEPARATE_CODE_AND_RODATA \
121996a8ed14SJiafei Pan	SEPARATE_BL2_NOLOAD_REGION \
1220327131c4SLeonardo Sandoval	SEPARATE_NOBITS_REGION \
122186acbbe2SYe Li	SEPARATE_RWDATA_REGION \
1222308ebfa1SMadhukar Pappireddy	SEPARATE_SIMD_SECTION \
1223327131c4SLeonardo Sandoval	SPIN_ON_BL1_EXIT \
1224327131c4SLeonardo Sandoval	SPM_MM \
12251d63ae4dSMarc Bonnici	SPMC_AT_EL3 \
1226801cd3c8SNishant Sharma	SPMC_AT_EL3_SEL0_SP \
1227327131c4SLeonardo Sandoval	SPMD_SPM_AT_SEL2 \
1228890b5088SRaghu Krishnamurthy	ENABLE_SPMD_LP \
12293ba2c151SRaymond Mao	TRANSFER_LIST \
1230327131c4SLeonardo Sandoval	TRUSTED_BOARD_BOOT \
1231327131c4SLeonardo Sandoval	USE_COHERENT_MEM \
1232327131c4SLeonardo Sandoval	USE_DEBUGFS \
1233327131c4SLeonardo Sandoval	ARM_IO_IN_DTB \
1234327131c4SLeonardo Sandoval	SDEI_IN_FCONF \
1235327131c4SLeonardo Sandoval	SEC_INT_DESC_IN_FCONF \
1236327131c4SLeonardo Sandoval	USE_ROMLIB \
1237327131c4SLeonardo Sandoval	USE_TBBR_DEFS \
1238327131c4SLeonardo Sandoval	WARMBOOT_ENABLE_DCACHE_EARLY \
123942d4d3baSArvind Ram Prakash	RESET_TO_BL2 \
1240327131c4SLeonardo Sandoval	BL2_IN_XIP_MEM \
1241327131c4SLeonardo Sandoval	BL2_INV_DCACHE \
1242327131c4SLeonardo Sandoval	USE_SPINLOCK_CAS \
1243327131c4SLeonardo Sandoval	ENCRYPT_BL31 \
1244327131c4SLeonardo Sandoval	ENCRYPT_BL32 \
1245327131c4SLeonardo Sandoval	ERRATA_SPECULATIVE_AT \
124600e8f79cSManish Pandey	RAS_TRAP_NS_ERR_REC_ACCESS \
1247327131c4SLeonardo Sandoval	COT_DESC_IN_DTB \
1248327131c4SLeonardo Sandoval	USE_SP804_TIMER \
1249396b339dSManish V Badarkhe	PSA_FWU_SUPPORT \
125011d05a77SSughosh Ganu	PSA_FWU_METADATA_FW_STORE_DESC \
125168120783SChris Kay	ENABLE_MPMM \
125268120783SChris Kay	ENABLE_MPMM_FCONF \
12536a0da736SJayanth Dodderi Chidanand	FEATURE_DETECTION \
12540b22e591SJayanth Dodderi Chidanand	TRNG_SUPPORT \
1255ffea3844SSona Mathew	ERRATA_ABI_SUPPORT \
1256ef63f5beSSona Mathew	ERRATA_NON_ARM_INTERCONNECT \
125704c7303bSOkash Khawaja	CONDITIONAL_CMO \
12585782b890SManish V Badarkhe	PSA_CRYPTO	\
125985bebe18SSandrine Bailleux	ENABLE_CONSOLE_GETC \
1260183329a5SArvind Ram Prakash	INIT_UNUSED_NS_EL2	\
1261bfef8b90SJuan Pablo Conde	PLATFORM_REPORT_CTX_MEM_USE \
1262ae770fedSYann Gautier	EARLY_CONSOLE \
1263f99a69c3SArvind Ram Prakash	PRESERVE_DSU_PMU_REGS \
12648953568aSLevi Yun	HOB_LIST \
1265327131c4SLeonardo Sandoval)))
126673c99d4eSJuan Castillo
1267c5e1da83SJayanth Dodderi Chidanand# Numeric_Flags
1268327131c4SLeonardo Sandoval$(eval $(call assert_numerics,\
1269327131c4SLeonardo Sandoval    $(sort \
1270327131c4SLeonardo Sandoval	ARM_ARCH_MAJOR \
1271327131c4SLeonardo Sandoval	ARM_ARCH_MINOR \
1272327131c4SLeonardo Sandoval	BRANCH_PROTECTION \
12736a0da736SJayanth Dodderi Chidanand	CTX_INCLUDE_PAUTH_REGS \
12746a0da736SJayanth Dodderi Chidanand	CTX_INCLUDE_NEVE_REGS \
12752bf4f27fSManish V Badarkhe	CRYPTO_SUPPORT \
127683a4dae1SBoyan Karatotev	DISABLE_MTPMU \
12771298f2f1SJayanth Dodderi Chidanand	ENABLE_BRBE_FOR_NS \
127847c681b7SJayanth Dodderi Chidanand	ENABLE_TRBE_FOR_NS \
12796a0da736SJayanth Dodderi Chidanand	ENABLE_BTI \
12806a0da736SJayanth Dodderi Chidanand	ENABLE_PAUTH \
1281d23acc9eSAndre Przywara	ENABLE_FEAT_AMU \
12826a0da736SJayanth Dodderi Chidanand	ENABLE_FEAT_AMUv1p1 \
12836a0da736SJayanth Dodderi Chidanand	ENABLE_FEAT_CSV2_2 \
128430019d86SSona Mathew	ENABLE_FEAT_CSV2_3 \
128583271d5aSArvind Ram Prakash	ENABLE_FEAT_DEBUGV8P9 \
12866a0da736SJayanth Dodderi Chidanand	ENABLE_FEAT_DIT \
12876a0da736SJayanth Dodderi Chidanand	ENABLE_FEAT_ECV \
12886a0da736SJayanth Dodderi Chidanand	ENABLE_FEAT_FGT \
128933e6aaacSArvind Ram Prakash	ENABLE_FEAT_FGT2 \
1290a57e18e4SArvind Ram Prakash	ENABLE_FEAT_FPMR \
12916a0da736SJayanth Dodderi Chidanand	ENABLE_FEAT_HCX \
129219d52a83SAndre Przywara	ENABLE_FEAT_LS64_ACCDATA \
12936b8df7b9SArvind Ram Prakash	ENABLE_FEAT_MOPS \
12948e397889SGovindraj Raja	ENABLE_FEAT_MTE2 \
12956a0da736SJayanth Dodderi Chidanand	ENABLE_FEAT_PAN \
12966a0da736SJayanth Dodderi Chidanand	ENABLE_FEAT_RNG \
1297ff86e0b4SJuan Pablo Conde	ENABLE_FEAT_RNG_TRAP \
12986a0da736SJayanth Dodderi Chidanand	ENABLE_FEAT_SEL2 \
1299d3331603SMark Brown	ENABLE_FEAT_TCR2 \
13006d0433f0SJayanth Dodderi Chidanand	ENABLE_FEAT_THE \
13010e4daed2SGovindraj Raja	ENABLE_FEAT_SB \
1302062b6c6bSMark Brown	ENABLE_FEAT_S2PIE \
1303062b6c6bSMark Brown	ENABLE_FEAT_S1PIE \
1304062b6c6bSMark Brown	ENABLE_FEAT_S2POE \
1305062b6c6bSMark Brown	ENABLE_FEAT_S1POE \
13064ec4e545SJayanth Dodderi Chidanand	ENABLE_FEAT_SCTLR2 \
130730655136SGovindraj Raja	ENABLE_FEAT_D128 \
1308688ab57bSMark Brown	ENABLE_FEAT_GCS \
13096a0da736SJayanth Dodderi Chidanand	ENABLE_FEAT_VHE \
1310edebefbcSArvind Ram Prakash	ENABLE_FEAT_MPAM \
13116a0da736SJayanth Dodderi Chidanand	ENABLE_RME \
13126437a09aSAndre Przywara	ENABLE_SPE_FOR_NS \
1313603a0c6fSAndre Przywara	ENABLE_SYS_REG_TRACE_FOR_NS \
131445007acdSJayanth Dodderi Chidanand	ENABLE_SME_FOR_NS \
131503d3c0d7SJayanth Dodderi Chidanand	ENABLE_SME2_FOR_NS \
13162b0bc4e0SJayanth Dodderi Chidanand	ENABLE_SVE_FOR_NS \
13176a0da736SJayanth Dodderi Chidanand	ENABLE_TRF_FOR_NS \
1318327131c4SLeonardo Sandoval	FW_ENC_STATUS \
13195357f83dSManish V Badarkhe	NR_OF_FW_BANKS \
13205357f83dSManish V Badarkhe	NR_OF_IMAGES_IN_FW_BANK \
1321781d07a4SJayanth Dodderi Chidanand	TWED_DELAY \
1322781d07a4SJayanth Dodderi Chidanand	ENABLE_FEAT_TWED \
1323bebcf27fSMark Brown	SVE_VECTOR_LEN \
13240ed3be6fSVarun Wadekar	IMPDEF_SYSREG_TRAP \
1325327131c4SLeonardo Sandoval)))
1326c877b414SJeenu Viswambharan
1327aacff749SJustin Chadwellifdef KEY_SIZE
1328aacff749SJustin Chadwell        $(eval $(call assert_numeric,KEY_SIZE))
1329aacff749SJustin Chadwellendif
1330aacff749SJustin Chadwell
13311f461979SJustin Chadwellifeq ($(filter $(SANITIZE_UB), on off trap),)
13321f461979SJustin Chadwell        $(error "Invalid value for SANITIZE_UB: can be one of on, off, trap")
13331f461979SJustin Chadwellendif
13341f461979SJustin Chadwell
133573c99d4eSJuan Castillo################################################################################
133673c99d4eSJuan Castillo# Add definitions to the cpp preprocessor based on the current build options.
133773c99d4eSJuan Castillo# This is done after including the platform specific makefile to allow the
133873c99d4eSJuan Castillo# platform to overwrite the default options
133973c99d4eSJuan Castillo################################################################################
134073c99d4eSJuan Castillo
1341327131c4SLeonardo Sandoval$(eval $(call add_defines,\
1342327131c4SLeonardo Sandoval    $(sort \
1343327131c4SLeonardo Sandoval	ALLOW_RO_XLAT_TABLES \
1344327131c4SLeonardo Sandoval	ARM_ARCH_MAJOR \
1345327131c4SLeonardo Sandoval	ARM_ARCH_MINOR \
134646789a7cSBalint Dobszay	BL2_ENABLE_SP_LOAD \
1347327131c4SLeonardo Sandoval	COLD_BOOT_SINGLE_CPU \
1348327131c4SLeonardo Sandoval	CTX_INCLUDE_AARCH32_REGS \
1349327131c4SLeonardo Sandoval	CTX_INCLUDE_FPREGS \
135042422622SMadhukar Pappireddy	CTX_INCLUDE_SVE_REGS \
1351327131c4SLeonardo Sandoval	CTX_INCLUDE_PAUTH_REGS \
13529acff28aSArvind Ram Prakash	CTX_INCLUDE_MPAM_REGS \
1353327131c4SLeonardo Sandoval	EL3_EXCEPTION_HANDLING \
1354327131c4SLeonardo Sandoval	CTX_INCLUDE_EL2_REGS \
1355062f8aafSArunachalam Ganapathy	CTX_INCLUDE_NEVE_REGS \
1356327131c4SLeonardo Sandoval	DECRYPTION_SUPPORT_${DECRYPTION_SUPPORT} \
13570063dd17SJavier Almansa Sobrino	DISABLE_MTPMU \
1358d23acc9eSAndre Przywara	ENABLE_FEAT_AMU \
13591fd685a7SChris Kay	ENABLE_AMU_AUXILIARY_COUNTERS \
1360742ca230SChris Kay	ENABLE_AMU_FCONF \
1361873d4241Sjohpow01	AMU_RESTRICT_COUNTERS \
1362327131c4SLeonardo Sandoval	ENABLE_ASSERTIONS \
1363327131c4SLeonardo Sandoval	ENABLE_BTI \
136483271d5aSArvind Ram Prakash	ENABLE_FEAT_DEBUGV8P9 \
1365edebefbcSArvind Ram Prakash	ENABLE_FEAT_MPAM \
1366327131c4SLeonardo Sandoval	ENABLE_PAUTH \
1367327131c4SLeonardo Sandoval	ENABLE_PIE \
1368327131c4SLeonardo Sandoval	ENABLE_PMF \
1369327131c4SLeonardo Sandoval	ENABLE_PSCI_STAT \
13705b18de09SZelalem Aweke	ENABLE_RME \
13716a88ec8bSRaghu Krishnamurthy	RMMD_ENABLE_EL3_TOKEN_SIGN \
1372327131c4SLeonardo Sandoval	ENABLE_RUNTIME_INSTRUMENTATION \
1373dc78e62dSjohpow01	ENABLE_SME_FOR_NS \
137403d3c0d7SJayanth Dodderi Chidanand	ENABLE_SME2_FOR_NS \
1375dc78e62dSjohpow01	ENABLE_SME_FOR_SWD \
137690118bb5SAndre Przywara	ENABLE_SPE_FOR_NS \
1377327131c4SLeonardo Sandoval	ENABLE_SVE_FOR_NS \
13780c5e7d1cSMax Shvetsov	ENABLE_SVE_FOR_SWD \
1379970a4a8dSManish Pandey	ENABLE_FEAT_RAS \
1380f87e54f7SManish Pandey	FFH_SUPPORT \
1381327131c4SLeonardo Sandoval	ENCRYPT_BL31 \
1382327131c4SLeonardo Sandoval	ENCRYPT_BL32 \
1383327131c4SLeonardo Sandoval	ERROR_DEPRECATED \
1384327131c4SLeonardo Sandoval	FAULT_INJECTION_SUPPORT \
1385327131c4SLeonardo Sandoval	GICV2_G0_FOR_EL3 \
138646cc41d5SManish Pandey	HANDLE_EA_EL3_FIRST_NS \
1387327131c4SLeonardo Sandoval	HW_ASSISTED_COHERENCY \
1388327131c4SLeonardo Sandoval	LOG_LEVEL \
1389327131c4SLeonardo Sandoval	MEASURED_BOOT \
1390e7f1181fSTamas Ban	DICE_PROTECTION_ENVIRONMENT \
139100e28874SManish V Badarkhe	DRTM_SUPPORT \
1392327131c4SLeonardo Sandoval	NS_TIMER_SWITCH \
1393327131c4SLeonardo Sandoval	PL011_GENERIC_UART \
1394327131c4SLeonardo Sandoval	PLAT_${PLAT} \
1395327131c4SLeonardo Sandoval	PROGRAMMABLE_RESET_ADDRESS \
1396327131c4SLeonardo Sandoval	PSCI_EXTENDED_STATE_ID \
139764b4710bSWing Li	PSCI_OS_INIT_MODE \
13988db17052SBoyan Karatotev	ARCH_FEATURE_AVAILABILITY \
1399327131c4SLeonardo Sandoval	RESET_TO_BL31 \
1400d766084fSAlexeiFedorov	RME_GPT_BITLOCK_BLOCK \
1401ec0088bbSAlexeiFedorov	RME_GPT_MAX_BLOCK \
1402327131c4SLeonardo Sandoval	SEPARATE_CODE_AND_RODATA \
140396a8ed14SJiafei Pan	SEPARATE_BL2_NOLOAD_REGION \
1404327131c4SLeonardo Sandoval	SEPARATE_NOBITS_REGION \
140586acbbe2SYe Li	SEPARATE_RWDATA_REGION \
1406308ebfa1SMadhukar Pappireddy	SEPARATE_SIMD_SECTION \
1407327131c4SLeonardo Sandoval	RECLAIM_INIT_CODE \
1408327131c4SLeonardo Sandoval	SPD_${SPD} \
1409327131c4SLeonardo Sandoval	SPIN_ON_BL1_EXIT \
1410327131c4SLeonardo Sandoval	SPM_MM \
14111d63ae4dSMarc Bonnici	SPMC_AT_EL3 \
1412801cd3c8SNishant Sharma	SPMC_AT_EL3_SEL0_SP \
1413327131c4SLeonardo Sandoval	SPMD_SPM_AT_SEL2 \
14143ba2c151SRaymond Mao	TRANSFER_LIST \
1415327131c4SLeonardo Sandoval	TRUSTED_BOARD_BOOT \
1416c9c56f6eSManish V Badarkhe	CRYPTO_SUPPORT \
14177dfb9911SJimmy Brisson	TRNG_SUPPORT \
1418ffea3844SSona Mathew	ERRATA_ABI_SUPPORT \
1419ef63f5beSSona Mathew	ERRATA_NON_ARM_INTERCONNECT \
1420327131c4SLeonardo Sandoval	USE_COHERENT_MEM \
1421327131c4SLeonardo Sandoval	USE_DEBUGFS \
1422327131c4SLeonardo Sandoval	ARM_IO_IN_DTB \
1423327131c4SLeonardo Sandoval	SDEI_IN_FCONF \
1424327131c4SLeonardo Sandoval	SEC_INT_DESC_IN_FCONF \
1425327131c4SLeonardo Sandoval	USE_ROMLIB \
1426327131c4SLeonardo Sandoval	USE_TBBR_DEFS \
1427327131c4SLeonardo Sandoval	WARMBOOT_ENABLE_DCACHE_EARLY \
142842d4d3baSArvind Ram Prakash	RESET_TO_BL2 \
142942d4d3baSArvind Ram Prakash	BL2_RUNS_AT_EL3	\
1430327131c4SLeonardo Sandoval	BL2_IN_XIP_MEM \
1431327131c4SLeonardo Sandoval	BL2_INV_DCACHE \
1432327131c4SLeonardo Sandoval	USE_SPINLOCK_CAS \
1433327131c4SLeonardo Sandoval	ERRATA_SPECULATIVE_AT \
143400e8f79cSManish Pandey	RAS_TRAP_NS_ERR_REC_ACCESS \
1435327131c4SLeonardo Sandoval	COT_DESC_IN_DTB \
1436327131c4SLeonardo Sandoval	USE_SP804_TIMER \
143712cd65e0STomas Pilar	ENABLE_FEAT_RNG \
1438ff86e0b4SJuan Pablo Conde	ENABLE_FEAT_RNG_TRAP \
14394e04478aSChris Kay	ENABLE_FEAT_SB \
14407d33ffe4SDaniel Boulby	ENABLE_FEAT_DIT \
14415357f83dSManish V Badarkhe	NR_OF_FW_BANKS \
14425357f83dSManish V Badarkhe	NR_OF_IMAGES_IN_FW_BANK \
1443396b339dSManish V Badarkhe	PSA_FWU_SUPPORT \
144411d05a77SSughosh Ganu	PSA_FWU_METADATA_FW_STORE_DESC \
1445744ad974Sjohpow01	ENABLE_BRBE_FOR_NS \
1446813524eaSManish V Badarkhe	ENABLE_TRBE_FOR_NS \
1447d4582d30SManish V Badarkhe	ENABLE_SYS_REG_TRACE_FOR_NS \
14488fcd3d96SManish V Badarkhe	ENABLE_TRF_FOR_NS \
1449cb4ec47bSjohpow01	ENABLE_FEAT_HCX \
145068120783SChris Kay	ENABLE_MPMM \
145168120783SChris Kay	ENABLE_MPMM_FCONF \
1452f74cb0beSJayanth Dodderi Chidanand	ENABLE_FEAT_FGT \
145333e6aaacSArvind Ram Prakash	ENABLE_FEAT_FGT2 \
1454a57e18e4SArvind Ram Prakash	ENABLE_FEAT_FPMR \
1455f74cb0beSJayanth Dodderi Chidanand	ENABLE_FEAT_ECV \
14566a0da736SJayanth Dodderi Chidanand	ENABLE_FEAT_AMUv1p1 \
14576a0da736SJayanth Dodderi Chidanand	ENABLE_FEAT_SEL2 \
14586a0da736SJayanth Dodderi Chidanand	ENABLE_FEAT_VHE \
14596a0da736SJayanth Dodderi Chidanand	ENABLE_FEAT_CSV2_2 \
146030019d86SSona Mathew	ENABLE_FEAT_CSV2_3 \
146119d52a83SAndre Przywara	ENABLE_FEAT_LS64_ACCDATA \
14626a0da736SJayanth Dodderi Chidanand	ENABLE_FEAT_PAN \
1463d3331603SMark Brown	ENABLE_FEAT_TCR2 \
14646d0433f0SJayanth Dodderi Chidanand	ENABLE_FEAT_THE \
1465062b6c6bSMark Brown	ENABLE_FEAT_S2PIE \
1466062b6c6bSMark Brown	ENABLE_FEAT_S1PIE \
1467062b6c6bSMark Brown	ENABLE_FEAT_S2POE \
1468062b6c6bSMark Brown	ENABLE_FEAT_S1POE \
14694ec4e545SJayanth Dodderi Chidanand	ENABLE_FEAT_SCTLR2 \
147030655136SGovindraj Raja	ENABLE_FEAT_D128 \
1471688ab57bSMark Brown	ENABLE_FEAT_GCS \
14726b8df7b9SArvind Ram Prakash	ENABLE_FEAT_MOPS \
14738e397889SGovindraj Raja	ENABLE_FEAT_MTE2 \
14746a0da736SJayanth Dodderi Chidanand	FEATURE_DETECTION \
1475781d07a4SJayanth Dodderi Chidanand	TWED_DELAY \
1476781d07a4SJayanth Dodderi Chidanand	ENABLE_FEAT_TWED \
147704c7303bSOkash Khawaja	CONDITIONAL_CMO \
14780ed3be6fSVarun Wadekar	IMPDEF_SYSREG_TRAP \
1479a8cf6faeSJayanth Dodderi Chidanand	SVE_VECTOR_LEN \
1480890b5088SRaghu Krishnamurthy	ENABLE_SPMD_LP \
14815782b890SManish V Badarkhe	PSA_CRYPTO	\
148285bebe18SSandrine Bailleux	ENABLE_CONSOLE_GETC \
1483183329a5SArvind Ram Prakash	INIT_UNUSED_NS_EL2	\
1484bfef8b90SJuan Pablo Conde	PLATFORM_REPORT_CTX_MEM_USE \
1485ae770fedSYann Gautier	EARLY_CONSOLE \
1486f99a69c3SArvind Ram Prakash	PRESERVE_DSU_PMU_REGS \
14878953568aSLevi Yun	HOB_LIST \
1488327131c4SLeonardo Sandoval)))
14892fae4b1eSJeenu Viswambharan
1490bfef8b90SJuan Pablo Condeifeq (${PLATFORM_REPORT_CTX_MEM_USE}, 1)
1491bfef8b90SJuan Pablo Condeifeq (${DEBUG}, 0)
1492bfef8b90SJuan Pablo Conde        $(warning "PLATFORM_REPORT_CTX_MEM_USE can be applied when DEBUG=1 only")
1493bfef8b90SJuan Pablo Conde        override PLATFORM_REPORT_CTX_MEM_USE := 0
1494bfef8b90SJuan Pablo Condeendif
1495bfef8b90SJuan Pablo Condeendif
1496bfef8b90SJuan Pablo Conde
14971f461979SJustin Chadwellifeq (${SANITIZE_UB},trap)
14981f461979SJustin Chadwell        $(eval $(call add_define,MONITOR_TRAPS))
1499c5e1da83SJayanth Dodderi Chidanandendif #(SANITIZE_UB)
15001f461979SJustin Chadwell
15014c117f6cSSandrine Bailleux# Define the EL3_PAYLOAD_BASE flag only if it is provided.
15024c117f6cSSandrine Bailleuxifdef EL3_PAYLOAD_BASE
15034c117f6cSSandrine Bailleux        $(eval $(call add_define,EL3_PAYLOAD_BASE))
1504cf2c8a33SAntonio Nino Diazelse
150568450a6dSAntonio Nino Diaz# Define the PRELOADED_BL33_BASE flag only if it is provided and
150668450a6dSAntonio Nino Diaz# EL3_PAYLOAD_BASE is not defined, as it has priority.
150768450a6dSAntonio Nino Diaz	ifdef PRELOADED_BL33_BASE
150868450a6dSAntonio Nino Diaz                $(eval $(call add_define,PRELOADED_BL33_BASE))
15094c117f6cSSandrine Bailleux	endif
1510c5e1da83SJayanth Dodderi Chidanandendif #(EL3_PAYLOAD_BASE)
151173c99d4eSJuan Castillo
1512209a60ccSSoby Mathew# Define the DYN_DISABLE_AUTH flag only if set.
1513209a60ccSSoby Mathewifeq (${DYN_DISABLE_AUTH},1)
1514209a60ccSSoby Mathew        $(eval $(call add_define,DYN_DISABLE_AUTH))
1515209a60ccSSoby Mathewendif
1516209a60ccSSoby Mathew
15178620bd0bSChris Kayifeq ($($(ARCH)-ld-id),arm-link)
1518c2ad38ceSVarun Wadekar        $(eval $(call add_define,USE_ARM_LINK))
1519c2ad38ceSVarun Wadekarendif
1520c2ad38ceSVarun Wadekar
1521ce2b1ec6SManish Pandey# Generate and include sp_gen.mk if SPD is spmd and SP_LAYOUT_FILE is defined
1522ce2b1ec6SManish Pandeyifeq (${SPD},spmd)
1523c33ff198SOlivier Deprezifdef SP_LAYOUT_FILE
1524ce2b1ec6SManish Pandey	-include $(BUILD_PLAT)/sp_gen.mk
1525ce2b1ec6SManish Pandey	FIP_DEPS += sp
152607c44475SManish Pandey	CRT_DEPS += sp
1527ce2b1ec6SManish Pandey	NEED_SP_PKG := yes
1528ce2b1ec6SManish Pandeyelse
1529c33ff198SOlivier Deprez	ifeq (${SPMD_SPM_AT_SEL2},1)
1530c33ff198SOlivier Deprez                $(error "SPMD with SPM at S-EL2 require SP_LAYOUT_FILE")
1531c33ff198SOlivier Deprez	endif
1532c5e1da83SJayanth Dodderi Chidanandendif #(SP_LAYOUT_FILE)
1533c5e1da83SJayanth Dodderi Chidanandendif #(SPD)
1534ce2b1ec6SManish Pandey
153573c99d4eSJuan Castillo################################################################################
153673c99d4eSJuan Castillo# Build targets
153773c99d4eSJuan Castillo################################################################################
153873c99d4eSJuan Castillo
15392329e22bSHarrison Mutai.PHONY:	all msg_start clean realclean distclean cscope locate-checkpatch checkcodebase checkpatch fiptool sptool fip sp tl fwu_fip certtool dtbs memmap doc enctool
154073c99d4eSJuan Castillo
154173c99d4eSJuan Castilloall: msg_start
154273c99d4eSJuan Castillo
154373c99d4eSJuan Castillomsg_start:
15447c4e1eeaSChris Kay	$(s)echo "Building ${PLAT}"
154573c99d4eSJuan Castillo
15467a24cba5SSoby Mathewifeq (${ERROR_DEPRECATED},0)
1547d5dfdeb6SJulius Werner# Check if deprecated declarations and cpp warnings should be treated as error or not.
15488620bd0bSChris Kayifneq ($(filter %-clang,$($(ARCH)-cc-id)),)
1549c2ad38ceSVarun Wadekar    CPPFLAGS		+= 	-Wno-error=deprecated-declarations
1550c2ad38ceSVarun Wadekarelse
1551bc1a03c7SDan Handley    CPPFLAGS		+= 	-Wno-error=deprecated-declarations -Wno-error=cpp
15527a24cba5SSoby Mathewendif
1553c5e1da83SJayanth Dodderi Chidanandendif #(!ERROR_DEPRECATED)
15547a24cba5SSoby Mathew
155561f72a34SRoberto Vargas$(eval $(call MAKE_LIB,c))
15565fee0287SRoberto Vargas
155773c99d4eSJuan Castillo# Expand build macros for the different images
155873c99d4eSJuan Castilloifeq (${NEED_BL1},yes)
1559b34635a0SChris KayBL1_SOURCES := $(sort ${BL1_SOURCES})
1560434d0491SZelalem Aweke$(eval $(call MAKE_BL,bl1))
1561c5e1da83SJayanth Dodderi Chidanandendif #(NEED_BL1)
156273c99d4eSJuan Castillo
156373c99d4eSJuan Castilloifeq (${NEED_BL2},yes)
1564c5e1da83SJayanth Dodderi Chidanand
156542d4d3baSArvind Ram Prakashifeq (${RESET_TO_BL2}, 0)
1566c9b31ae8SRoberto VargasFIP_BL2_ARGS := tb-fw
1567c9b31ae8SRoberto Vargasendif
1568c9b31ae8SRoberto Vargas
1569eb1acfb6SChris KayBL2_SOURCES := $(sort ${BL2_SOURCES})
1570eb1acfb6SChris Kay
157133950dd8SMasahiro Yamada$(if ${BL2}, $(eval $(call TOOL_ADD_IMG,bl2,--${FIP_BL2_ARGS})),\
1572434d0491SZelalem Aweke	$(eval $(call MAKE_BL,bl2,${FIP_BL2_ARGS})))
1573c5e1da83SJayanth Dodderi Chidanand
1574c5e1da83SJayanth Dodderi Chidanandendif #(NEED_BL2)
157573c99d4eSJuan Castillo
15764d045d0eSMasahiro Yamadaifeq (${NEED_SCP_BL2},yes)
157733950dd8SMasahiro Yamada$(eval $(call TOOL_ADD_IMG,scp_bl2,--scp-fw))
1578c5e1da83SJayanth Dodderi Chidanandendif #(NEED_SCP_BL2)
15794d045d0eSMasahiro Yamada
158073c99d4eSJuan Castilloifeq (${NEED_BL31},yes)
158173c99d4eSJuan CastilloBL31_SOURCES += ${SPD_SOURCES}
158226d1e0c3SMadhukar Pappireddy# Sort BL31 source files to remove duplicates
158326d1e0c3SMadhukar PappireddyBL31_SOURCES := $(sort ${BL31_SOURCES})
1584c6ba9b45SSumit Gargifneq (${DECRYPTION_SUPPORT},none)
1585c6ba9b45SSumit Garg$(if ${BL31}, $(eval $(call TOOL_ADD_IMG,bl31,--soc-fw,,$(ENCRYPT_BL31))),\
1586434d0491SZelalem Aweke	$(eval $(call MAKE_BL,bl31,soc-fw,,$(ENCRYPT_BL31))))
1587c6ba9b45SSumit Gargelse
158833950dd8SMasahiro Yamada$(if ${BL31}, $(eval $(call TOOL_ADD_IMG,bl31,--soc-fw)),\
1589434d0491SZelalem Aweke	$(eval $(call MAKE_BL,bl31,soc-fw)))
1590c5e1da83SJayanth Dodderi Chidanandendif #(DECRYPTION_SUPPORT)
1591c5e1da83SJayanth Dodderi Chidanandendif #(NEED_BL31)
159273c99d4eSJuan Castillo
159370d1fc53SJuan Castillo# If a BL32 image is needed but neither BL32 nor BL32_SOURCES is defined, the
1594c939d13aSMasahiro Yamada# build system will call TOOL_ADD_IMG to print a warning message and abort the
159570d1fc53SJuan Castillo# process. Note that the dependency on BL32 applies to the FIP only.
159673c99d4eSJuan Castilloifeq (${NEED_BL32},yes)
159726d1e0c3SMadhukar Pappireddy# Sort BL32 source files to remove duplicates
159826d1e0c3SMadhukar PappireddyBL32_SOURCES := $(sort ${BL32_SOURCES})
15999cd15239SMasahiro YamadaBUILD_BL32 := $(if $(BL32),,$(if $(BL32_SOURCES),1))
16009cd15239SMasahiro Yamada
1601c6ba9b45SSumit Gargifneq (${DECRYPTION_SUPPORT},none)
1602434d0491SZelalem Aweke$(if ${BUILD_BL32}, $(eval $(call MAKE_BL,bl32,tos-fw,,$(ENCRYPT_BL32))),\
1603c6ba9b45SSumit Garg	$(eval $(call TOOL_ADD_IMG,bl32,--tos-fw,,$(ENCRYPT_BL32))))
1604c6ba9b45SSumit Gargelse
1605434d0491SZelalem Aweke$(if ${BUILD_BL32}, $(eval $(call MAKE_BL,bl32,tos-fw)),\
160633950dd8SMasahiro Yamada	$(eval $(call TOOL_ADD_IMG,bl32,--tos-fw)))
1607c5e1da83SJayanth Dodderi Chidanandendif #(DECRYPTION_SUPPORT)
1608c5e1da83SJayanth Dodderi Chidanandendif #(NEED_BL32)
160973c99d4eSJuan Castillo
16105b18de09SZelalem Aweke# If RMM image is needed but RMM is not defined, Test Realm Payload (TRP)
16115b18de09SZelalem Aweke# needs to be built from RMM_SOURCES.
16125b18de09SZelalem Awekeifeq (${NEED_RMM},yes)
16135b18de09SZelalem Aweke# Sort RMM source files to remove duplicates
16145b18de09SZelalem AwekeRMM_SOURCES := $(sort ${RMM_SOURCES})
16155b18de09SZelalem AwekeBUILD_RMM := $(if $(RMM),,$(if $(RMM_SOURCES),1))
16165b18de09SZelalem Aweke
16175b18de09SZelalem Aweke$(if ${BUILD_RMM}, $(eval $(call MAKE_BL,rmm,rmm-fw)),\
16185b18de09SZelalem Aweke	 $(eval $(call TOOL_ADD_IMG,rmm,--rmm-fw)))
1619c5e1da83SJayanth Dodderi Chidanandendif #(NEED_RMM)
16205b18de09SZelalem Aweke
162173c99d4eSJuan Castillo# Add the BL33 image if required by the platform
162273c99d4eSJuan Castilloifeq (${NEED_BL33},yes)
162333950dd8SMasahiro Yamada$(eval $(call TOOL_ADD_IMG,bl33,--nt-fw))
1624c5e1da83SJayanth Dodderi Chidanandendif #(NEED_BL33)
1625db6071c9SJuan Castillo
16269003fa0bSYatharth Kocharifeq (${NEED_BL2U},yes)
162733950dd8SMasahiro Yamada$(if ${BL2U}, $(eval $(call TOOL_ADD_IMG,bl2u,--ap-fwu-cfg,FWU_)),\
1628434d0491SZelalem Aweke	$(eval $(call MAKE_BL,bl2u,ap-fwu-cfg,FWU_)))
1629c5e1da83SJayanth Dodderi Chidanandendif #(NEED_BL2U)
16309003fa0bSYatharth Kochar
163103b397a8SNishanth Menon# Expand build macros for the different images
163203b397a8SNishanth Menonifeq (${NEED_FDT},yes)
163303b397a8SNishanth Menon    $(eval $(call MAKE_DTBS,$(BUILD_PLAT)/fdts,$(FDT_SOURCES)))
1634c5e1da83SJayanth Dodderi Chidanandendif #(NEED_FDT)
163503b397a8SNishanth Menon
1636ce2b1ec6SManish Pandey# Add Secure Partition packages
1637ce2b1ec6SManish Pandeyifeq (${NEED_SP_PKG},yes)
1638fd74ca0dSChris Kay$(BUILD_PLAT)/sp_gen.mk: ${SP_MK_GEN} ${SP_LAYOUT_FILE} | $$(@D)/
16397c4e1eeaSChris Kay	$(q)${PYTHON} "$<" "$@" $(filter-out $<,$^) $(BUILD_PLAT) ${COT} ${SP_DTS_LIST_FRAGMENT}
1640822c7279SJ-Alvessp: $(DTBS) $(BUILD_PLAT)/sp_gen.mk $(SP_PKGS)
16417c4e1eeaSChris Kay	$(s)echo
16427c4e1eeaSChris Kay	$(s)echo "Built SP Images successfully"
16437c4e1eeaSChris Kay	$(s)echo
1644c5e1da83SJayanth Dodderi Chidanandendif #(NEED_SP_PKG)
1645ce2b1ec6SManish Pandey
164636eaaf37SIan Spraylocate-checkpatch:
164736eaaf37SIan Sprayifndef CHECKPATCH
164866079b04SEtienne Carriere	$(error "Please set CHECKPATCH to point to the Linux checkpatch.pl file, eg: CHECKPATCH=../linux/scripts/checkpatch.pl")
164936eaaf37SIan Sprayelse
165036eaaf37SIan Sprayifeq (,$(wildcard ${CHECKPATCH}))
165166079b04SEtienne Carriere	$(error "The file CHECKPATCH points to cannot be found, use eg: CHECKPATCH=../linux/scripts/checkpatch.pl")
165236eaaf37SIan Sprayendif
1653c5e1da83SJayanth Dodderi Chidanandendif #(CHECKPATCH)
165436eaaf37SIan Spray
16554f6ad66aSAchin Guptaclean:
16567c4e1eeaSChris Kay	$(s)echo "  CLEAN"
1657c3273703SChris Kay	$(q)rm -rf $(BUILD_PLAT)
16587c4e1eeaSChris Kay	$(q)${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean
16597c4e1eeaSChris Kay	$(q)${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} clean
16607c4e1eeaSChris Kay	$(q)${MAKE} PLAT=${PLAT} --no-print-directory -C ${ENCTOOLPATH} clean
16617c4e1eeaSChris Kay	$(q)${MAKE} --no-print-directory -C ${ROMLIBPATH} clean
16624f6ad66aSAchin Gupta
1663eaaeece2SJames Morrisseyrealclean distclean:
16647c4e1eeaSChris Kay	$(s)echo "  REALCLEAN"
1665c3273703SChris Kay	$(q)rm -rf $(BUILD_BASE)
1666c3273703SChris Kay	$(q)rm -rf $(CURDIR)/cscope.*
16677c4e1eeaSChris Kay	$(q)${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean
16687c4e1eeaSChris Kay	$(q)${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} realclean
16697c4e1eeaSChris Kay	$(q)${MAKE} PLAT=${PLAT} --no-print-directory -C ${ENCTOOLPATH} realclean
16707c4e1eeaSChris Kay	$(q)${MAKE} --no-print-directory -C ${ROMLIBPATH} clean
16714f6ad66aSAchin Gupta
167236eaaf37SIan Spraycheckcodebase:		locate-checkpatch
16737c4e1eeaSChris Kay	$(s)echo "  CHECKING STYLE"
16747c4e1eeaSChris Kay	$(q)if test -d .git ; then						\
16751ef35512SPaul Beesley		git ls-files | grep -E -v 'libfdt|libc|docs|\.rst' |	\
16761a41e8c1SDan Handley		while read GIT_FILE ;					\
16771a41e8c1SDan Handley		do ${CHECKPATCH} ${CHECKCODE_ARGS} -f $$GIT_FILE ;	\
16781a41e8c1SDan Handley		done ;							\
167936eaaf37SIan Spray	else								\
16801a41e8c1SDan Handley		 find . -type f -not -iwholename "*.git*"		\
16811a41e8c1SDan Handley		 -not -iwholename "*build*"				\
16821a41e8c1SDan Handley		 -not -iwholename "*libfdt*"				\
168361f72a34SRoberto Vargas		 -not -iwholename "*libc*"				\
16841a41e8c1SDan Handley		 -not -iwholename "*docs*"				\
16851ef35512SPaul Beesley		 -not -iwholename "*.rst"				\
16861a41e8c1SDan Handley		 -exec ${CHECKPATCH} ${CHECKCODE_ARGS} -f {} \; ;	\
168736eaaf37SIan Spray	fi
168836eaaf37SIan Spray
168936eaaf37SIan Spraycheckpatch:		locate-checkpatch
16907c4e1eeaSChris Kay	$(s)echo "  CHECKING STYLE"
16917c4e1eeaSChris Kay	$(q)if test -n "${CHECKPATCH_OPTS}"; then				\
169202a76d5fSYann Gautier		echo "    with ${CHECKPATCH_OPTS} option(s)";		\
169302a76d5fSYann Gautier	fi
16947c4e1eeaSChris Kay	$(q)COMMON_COMMIT=$$(git merge-base HEAD ${BASE_COMMIT});	\
169577a0a7f1SYann Gautier	for commit in `git rev-list --no-merges $$COMMON_COMMIT..HEAD`;	\
169677a0a7f1SYann Gautier	do								\
169751d28937SAntonio Nino Diaz		printf "\n[*] Checking style of '$$commit'\n\n";	\
16981a721748SYann Gautier		( git log --format=email "$$commit~..$$commit"		\
16991a721748SYann Gautier			-- ${CHECK_PATHS} ;				\
170051d28937SAntonio Nino Diaz		  git diff --format=email "$$commit~..$$commit"		\
17011a721748SYann Gautier			-- ${CHECK_PATHS}; ) |				\
170202a76d5fSYann Gautier			${CHECKPATCH}  ${CHECKPATCH_OPTS} - || true;	\
170351d28937SAntonio Nino Diaz	done
170436eaaf37SIan Spray
170573c99d4eSJuan Castillocerttool: ${CRTTOOL}
170673c99d4eSJuan Castillo
1707a9812206SPali Rohár${CRTTOOL}: FORCE
17087c4e1eeaSChris Kay	$(q)${MAKE} PLAT=${PLAT} USE_TBBR_DEFS=${USE_TBBR_DEFS} COT=${COT} OPENSSL_DIR=${OPENSSL_DIR} CRTTOOL=${CRTTOOL} DEBUG=${DEBUG} --no-print-directory -C ${CRTTOOLPATH} all
17097c4e1eeaSChris Kay	$(s)echo
17107c4e1eeaSChris Kay	$(s)echo "Built $@ successfully"
17117c4e1eeaSChris Kay	$(s)echo
17126f971622SJuan Castillo
17136f971622SJuan Castilloifneq (${GENERATE_COT},0)
171473c99d4eSJuan Castillocertificates: ${CRT_DEPS} ${CRTTOOL}
17157c4e1eeaSChris Kay	$(q)${CRTTOOL} ${CRT_ARGS}
17167c4e1eeaSChris Kay	$(s)echo
17177c4e1eeaSChris Kay	$(s)echo "Built $@ successfully"
17187c4e1eeaSChris Kay	$(s)echo "Certificates can be found in ${BUILD_PLAT}"
17197c4e1eeaSChris Kay	$(s)echo
1720c5e1da83SJayanth Dodderi Chidanandendif #(GENERATE_COT)
172127713fb4SSoby Mathew
172273c99d4eSJuan Castillo${BUILD_PLAT}/${FIP_NAME}: ${FIP_DEPS} ${FIPTOOL}
17234727fd13SPali Rohár	$(eval ${CHECK_FIP_CMD})
17247c4e1eeaSChris Kay	$(q)${FIPTOOL} create ${FIP_ARGS} $@
17257c4e1eeaSChris Kay	$(q)${FIPTOOL} info $@
17267c4e1eeaSChris Kay	$(s)echo
17277c4e1eeaSChris Kay	$(s)echo "Built $@ successfully"
17287c4e1eeaSChris Kay	$(s)echo
1729f58ad36fSHarry Liebel
17300191262dSYatharth Kocharifneq (${GENERATE_COT},0)
17310191262dSYatharth Kocharfwu_certificates: ${FWU_CRT_DEPS} ${CRTTOOL}
17327c4e1eeaSChris Kay	$(q)${CRTTOOL} ${FWU_CRT_ARGS}
17337c4e1eeaSChris Kay	$(s)echo
17347c4e1eeaSChris Kay	$(s)echo "Built $@ successfully"
17357c4e1eeaSChris Kay	$(s)echo "FWU certificates can be found in ${BUILD_PLAT}"
17367c4e1eeaSChris Kay	$(s)echo
1737c5e1da83SJayanth Dodderi Chidanandendif #(GENERATE_COT)
17380191262dSYatharth Kochar
17390191262dSYatharth Kochar${BUILD_PLAT}/${FWU_FIP_NAME}: ${FWU_FIP_DEPS} ${FIPTOOL}
17404727fd13SPali Rohár	$(eval ${CHECK_FWU_FIP_CMD})
17417c4e1eeaSChris Kay	$(q)${FIPTOOL} create ${FWU_FIP_ARGS} $@
17427c4e1eeaSChris Kay	$(q)${FIPTOOL} info $@
17437c4e1eeaSChris Kay	$(s)echo
17447c4e1eeaSChris Kay	$(s)echo "Built $@ successfully"
17457c4e1eeaSChris Kay	$(s)echo
17460191262dSYatharth Kochar
174773c99d4eSJuan Castillofiptool: ${FIPTOOL}
174873c99d4eSJuan Castillofip: ${BUILD_PLAT}/${FIP_NAME}
17490191262dSYatharth Kocharfwu_fip: ${BUILD_PLAT}/${FWU_FIP_NAME}
175073c99d4eSJuan Castillo
1751a9812206SPali Rohár${FIPTOOL}: FORCE
175240469bf9SManish V Badarkhe	$(q)${MAKE} PLAT=${PLAT} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" FIPTOOL=${FIPTOOL} OPENSSL_DIR=${OPENSSL_DIR} DEBUG=${DEBUG} --no-print-directory -C ${FIPTOOLPATH} all
1753f58ad36fSHarry Liebel
1754e4a070e3SManish V Badarkhe$(BUILD_PLAT)/romlib/romlib.bin $(BUILD_PLAT)/lib/libwrappers.a $&: $(BUILD_PLAT)/lib/libfdt.a $(BUILD_PLAT)/lib/libc.a $(CRYPTO_LIB)
1755e4a070e3SManish V Badarkhe	$(q)${MAKE} PLAT_DIR=${PLAT_DIR} BUILD_PLAT=${BUILD_PLAT} ENABLE_BTI=${ENABLE_BTI} CRYPTO_SUPPORT=${CRYPTO_SUPPORT} ARM_ARCH_MINOR=${ARM_ARCH_MINOR} INCLUDES=$(call escape-shell,$(INCLUDES)) DEFINES=$(call escape-shell,$(DEFINES)) --no-print-directory -C ${ROMLIBPATH} all
17565accce5bSRoberto Vargas
1757cfe83910SLouis Mayencourtmemmap: all
17587c4e1eeaSChris Kay	$(q)PYTHONPATH=${CURDIR}/tools/memory \
1759af5b49e9SHarrison Mutai		${PYTHON} -m memory.memmap -sr ${BUILD_PLAT}
1760cfe83910SLouis Mayencourt
17612329e22bSHarrison Mutaitl: ${BUILD_PLAT}/tl.bin
17622329e22bSHarrison Mutai${BUILD_PLAT}/tl.bin: ${HW_CONFIG}
1763d2867397SChris Kay	$(if $(host-poetry),$(q)poetry -q install)
1764d2867397SChris Kay	$(q)$(if $(host-poetry),poetry run )tlc create --fdt $< -s ${FW_HANDOFF_SIZE} $@
17652329e22bSHarrison Mutai
17666de32378SMadhukar Pappireddydoc:
17677c4e1eeaSChris Kay	$(s)echo "  BUILD DOCUMENTATION"
17687c4e1eeaSChris Kay	$(q)${MAKE} --no-print-directory -C ${DOCS_PATH} html
17696de32378SMadhukar Pappireddy
177090aa901fSSumit Gargenctool: ${ENCTOOL}
177190aa901fSSumit Garg
1772a9812206SPali Rohár${ENCTOOL}: FORCE
17737c4e1eeaSChris Kay	$(q)${MAKE} PLAT=${PLAT} BUILD_INFO=0 OPENSSL_DIR=${OPENSSL_DIR} ENCTOOL=${ENCTOOL} DEBUG=${DEBUG} --no-print-directory -C ${ENCTOOLPATH} all
17747c4e1eeaSChris Kay	$(s)echo
17757c4e1eeaSChris Kay	$(s)echo "Built $@ successfully"
17767c4e1eeaSChris Kay	$(s)echo
177790aa901fSSumit Garg
177835fab8c9SJoakim Bechcscope:
17797c4e1eeaSChris Kay	$(s)echo "  CSCOPE"
17807c4e1eeaSChris Kay	$(q)find ${CURDIR} -name "*.[chsS]" > cscope.files
17817c4e1eeaSChris Kay	$(q)cscope -b -q -k
178235fab8c9SJoakim Bech
178372ee3314SRyan Harkinhelp:
17847c4e1eeaSChris Kay	$(s)echo "usage: ${MAKE} [PLAT=<platform>] [OPTIONS] [TARGET]"
17857c4e1eeaSChris Kay	$(s)echo ""
17867c4e1eeaSChris Kay	$(s)echo "PLAT is used to specify which platform you wish to build."
17877c4e1eeaSChris Kay	$(s)echo "If no platform is specified, PLAT defaults to: ${DEFAULT_PLAT}"
17887c4e1eeaSChris Kay	$(s)echo ""
17897c4e1eeaSChris Kay	$(s)echo "platform = ${PLATFORM_LIST}"
17907c4e1eeaSChris Kay	$(s)echo ""
17917c4e1eeaSChris Kay	$(s)echo "Please refer to the User Guide for a list of all supported options."
17927c4e1eeaSChris Kay	$(s)echo "Note that the build system doesn't track dependencies for build "
17937c4e1eeaSChris Kay	$(s)echo "options. Therefore, if any of the build options are changed "
17947c4e1eeaSChris Kay	$(s)echo "from a previous build, a clean build must be performed."
17957c4e1eeaSChris Kay	$(s)echo ""
17967c4e1eeaSChris Kay	$(s)echo "Supported Targets:"
17977c4e1eeaSChris Kay	$(s)echo "  all            Build all individual bootloader binaries"
17987c4e1eeaSChris Kay	$(s)echo "  bl1            Build the BL1 binary"
17997c4e1eeaSChris Kay	$(s)echo "  bl2            Build the BL2 binary"
18007c4e1eeaSChris Kay	$(s)echo "  bl2u           Build the BL2U binary"
18017c4e1eeaSChris Kay	$(s)echo "  bl31           Build the BL31 binary"
18027c4e1eeaSChris Kay	$(s)echo "  bl32           Build the BL32 binary. If ARCH=aarch32, then "
18037c4e1eeaSChris Kay	$(s)echo "                 this builds secure payload specified by AARCH32_SP"
18047c4e1eeaSChris Kay	$(s)echo "  certificates   Build the certificates (requires 'GENERATE_COT=1')"
18057c4e1eeaSChris Kay	$(s)echo "  fip            Build the Firmware Image Package (FIP)"
18067c4e1eeaSChris Kay	$(s)echo "  fwu_fip        Build the FWU Firmware Image Package (FIP)"
18077c4e1eeaSChris Kay	$(s)echo "  checkcodebase  Check the coding style of the entire source tree"
18087c4e1eeaSChris Kay	$(s)echo "  checkpatch     Check the coding style on changes in the current"
18097c4e1eeaSChris Kay	$(s)echo "                 branch against BASE_COMMIT (default origin/master)"
18107c4e1eeaSChris Kay	$(s)echo "  clean          Clean the build for the selected platform"
18117c4e1eeaSChris Kay	$(s)echo "  cscope         Generate cscope index"
18127c4e1eeaSChris Kay	$(s)echo "  distclean      Remove all build artifacts for all platforms"
18137c4e1eeaSChris Kay	$(s)echo "  certtool       Build the Certificate generation tool"
18147c4e1eeaSChris Kay	$(s)echo "  enctool        Build the Firmware encryption tool"
18157c4e1eeaSChris Kay	$(s)echo "  fiptool        Build the Firmware Image Package (FIP) creation tool"
18167c4e1eeaSChris Kay	$(s)echo "  sp             Build the Secure Partition Packages"
18177c4e1eeaSChris Kay	$(s)echo "  sptool         Build the Secure Partition Package creation tool"
18187c4e1eeaSChris Kay	$(s)echo "  dtbs           Build the Device Tree Blobs (if required for the platform)"
18197c4e1eeaSChris Kay	$(s)echo "  memmap         Print the memory map of the built binaries"
18207c4e1eeaSChris Kay	$(s)echo "  doc            Build html based documentation using Sphinx tool"
18217c4e1eeaSChris Kay	$(s)echo ""
18227c4e1eeaSChris Kay	$(s)echo "Note: most build targets require PLAT to be set to a specific platform."
18237c4e1eeaSChris Kay	$(s)echo ""
18247c4e1eeaSChris Kay	$(s)echo "example: build all targets for the FVP platform:"
18257c4e1eeaSChris Kay	$(s)echo "  CROSS_COMPILE=aarch64-none-elf- make PLAT=fvp all"
1826a9812206SPali Rohár
1827a9812206SPali Rohár.PHONY: FORCE
1828a9812206SPali RohárFORCE:;
1829