xref: /rk3399_ARM-atf/Makefile (revision 274a69e7ca7769065efbc1b72fe16e1723269f54)
14f6ad66aSAchin Gupta#
2c9c56f6eSManish V Badarkhe# Copyright (c) 2013-2022, 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
1124c5d206SJayanth Dodderi ChidanandVERSION_MINOR			:= 7
12dddf4283Slaurenw-armVERSION				:= ${VERSION_MAJOR}.${VERSION_MINOR}
13aaa3e722SJuan Castillo
1488154678SJuan Castillo# Default goal is build all images
1588154678SJuan Castillo.DEFAULT_GOAL			:= all
1688154678SJuan Castillo
1772fc70edSDouglas Raillard# Avoid any implicit propagation of command line variable definitions to
1872fc70edSDouglas Raillard# sub-Makefiles, like CFLAGS that we reserved for the firmware images'
1972fc70edSDouglas Raillard# usage. Other command line options like "-s" are still propagated as usual.
2072fc70edSDouglas RaillardMAKEOVERRIDES =
2172fc70edSDouglas Raillard
22231c1470SEvan LloydMAKE_HELPERS_DIRECTORY := make_helpers/
23231c1470SEvan Lloydinclude ${MAKE_HELPERS_DIRECTORY}build_macros.mk
24e7f54dbdSEvan Lloydinclude ${MAKE_HELPERS_DIRECTORY}build_env.mk
2573c99d4eSJuan Castillo
2673c99d4eSJuan Castillo################################################################################
272fae4b1eSJeenu Viswambharan# Default values for build configurations, and their dependencies
2873c99d4eSJuan Castillo################################################################################
29e35c4045SJeenu Viswambharan
302fae4b1eSJeenu Viswambharaninclude ${MAKE_HELPERS_DIRECTORY}defaults.mk
31872be88aSdp-arm
32cc8b5632SAntonio Nino Diaz# Assertions enabled for DEBUG builds by default
33cc8b5632SAntonio Nino DiazENABLE_ASSERTIONS		:= ${DEBUG}
342fae4b1eSJeenu ViswambharanENABLE_PMF			:= ${ENABLE_RUNTIME_INSTRUMENTATION}
352fae4b1eSJeenu ViswambharanPLAT				:= ${DEFAULT_PLAT}
3673c99d4eSJuan Castillo
3773c99d4eSJuan Castillo################################################################################
3873c99d4eSJuan Castillo# Checkpatch script options
3973c99d4eSJuan Castillo################################################################################
4073c99d4eSJuan Castillo
41f607739cSSandrine BailleuxCHECKCODE_ARGS		:=	--no-patch
42f0b489c1SDan Handley# Do not check the coding style on imported library files or documentation files
434501843fSGilad Ben-YossefINC_ARM_DIRS_TO_CHECK	:=	$(sort $(filter-out                     \
444501843fSGilad Ben-Yossef					include/drivers/arm/cryptocell,	\
454501843fSGilad Ben-Yossef					$(wildcard include/drivers/arm/*)))
464501843fSGilad Ben-YossefINC_ARM_DIRS_TO_CHECK	+=	include/drivers/arm/cryptocell/*.h
474501843fSGilad Ben-YossefINC_DRV_DIRS_TO_CHECK	:=	$(sort $(filter-out			\
484501843fSGilad Ben-Yossef					include/drivers/arm,		\
494501843fSGilad Ben-Yossef					$(wildcard include/drivers/*)))
50f0b489c1SDan HandleyINC_LIB_DIRS_TO_CHECK	:=	$(sort $(filter-out			\
511a41e8c1SDan Handley					include/lib/libfdt		\
5261f72a34SRoberto Vargas					include/lib/libc,		\
53f0b489c1SDan Handley					$(wildcard include/lib/*)))
54f0b489c1SDan HandleyINC_DIRS_TO_CHECK	:=	$(sort $(filter-out			\
554501843fSGilad Ben-Yossef					include/lib			\
564501843fSGilad Ben-Yossef					include/drivers,		\
57f0b489c1SDan Handley					$(wildcard include/*)))
58f0b489c1SDan HandleyLIB_DIRS_TO_CHECK	:=	$(sort $(filter-out			\
59d801fbb0Sdp-arm					lib/compiler-rt			\
6055cdcf75SAntonio Nino Diaz					lib/libfdt%			\
6161f72a34SRoberto Vargas					lib/libc,			\
62f0b489c1SDan Handley					$(wildcard lib/*)))
63f0b489c1SDan HandleyROOT_DIRS_TO_CHECK	:=	$(sort $(filter-out			\
64f0b489c1SDan Handley					lib				\
65f0b489c1SDan Handley					include				\
66f0b489c1SDan Handley					docs				\
671ef35512SPaul Beesley					%.rst,				\
68f0b489c1SDan Handley					$(wildcard *)))
69f0b489c1SDan HandleyCHECK_PATHS		:=	${ROOT_DIRS_TO_CHECK}			\
70f0b489c1SDan Handley				${INC_DIRS_TO_CHECK}			\
71f0b489c1SDan Handley				${INC_LIB_DIRS_TO_CHECK}		\
724501843fSGilad Ben-Yossef				${LIB_DIRS_TO_CHECK}			\
734501843fSGilad Ben-Yossef				${INC_DRV_DIRS_TO_CHECK}		\
744501843fSGilad Ben-Yossef				${INC_ARM_DIRS_TO_CHECK}
7536eaaf37SIan Spray
7673c99d4eSJuan Castillo
7773c99d4eSJuan Castillo################################################################################
7873c99d4eSJuan Castillo# Process build options
7973c99d4eSJuan Castillo################################################################################
8073c99d4eSJuan Castillo
8173c99d4eSJuan Castillo# Verbose flag
82e35c4045SJeenu Viswambharanifeq (${V},0)
83b169f6a9SEvan Lloyd        Q:=@
84ee1ba6d4SAndre Przywara        ECHO:=@echo
8536eaaf37SIan Spray        CHECKCODE_ARGS	+=	--no-summary --terse
864f6ad66aSAchin Guptaelse
87b169f6a9SEvan Lloyd        Q:=
88b5a0f4bdSAntonio Nino Diaz        ECHO:=$(ECHO_QUIET)
894f6ad66aSAchin Guptaendif
90ee1ba6d4SAndre Przywara
91ee1ba6d4SAndre Przywaraifneq ($(findstring s,$(filter-out --%,$(MAKEFLAGS))),)
92ee1ba6d4SAndre Przywara        Q:=@
93b5a0f4bdSAntonio Nino Diaz        ECHO:=$(ECHO_QUIET)
94ee1ba6d4SAndre Przywaraendif
95ee1ba6d4SAndre Przywara
96ee1ba6d4SAndre Przywaraexport Q ECHO
972f2cef46SJeenu Viswambharan
9873c99d4eSJuan Castillo# The cert_create tool cannot generate certificates individually, so we use the
9973c99d4eSJuan Castillo# target 'certificates' to create them all
10073c99d4eSJuan Castilloifneq (${GENERATE_COT},0)
10173c99d4eSJuan Castillo        FIP_DEPS += certificates
1020191262dSYatharth Kochar        FWU_FIP_DEPS += fwu_certificates
10373c99d4eSJuan Castilloendif
10473c99d4eSJuan Castillo
1059fc59639SAlexei Fedorov# Process BRANCH_PROTECTION value and set
1069fc59639SAlexei Fedorov# Pointer Authentication and Branch Target Identification flags
1079fc59639SAlexei Fedorovifeq (${BRANCH_PROTECTION},0)
1089fc59639SAlexei Fedorov	# Default value turns off all types of branch protection
1099fc59639SAlexei Fedorov	BP_OPTION := none
1109fc59639SAlexei Fedorovelse ifneq (${ARCH},aarch64)
1119fc59639SAlexei Fedorov        $(error BRANCH_PROTECTION requires AArch64)
1129fc59639SAlexei Fedorovelse ifeq (${BRANCH_PROTECTION},1)
1139fc59639SAlexei Fedorov	# Enables all types of branch protection features
1149fc59639SAlexei Fedorov	BP_OPTION := standard
1159fc59639SAlexei Fedorov	ENABLE_BTI := 1
1169fc59639SAlexei Fedorov	ENABLE_PAUTH := 1
1179fc59639SAlexei Fedorovelse ifeq (${BRANCH_PROTECTION},2)
1189fc59639SAlexei Fedorov	# Return address signing to its standard level
1199fc59639SAlexei Fedorov	BP_OPTION := pac-ret
1209fc59639SAlexei Fedorov	ENABLE_PAUTH := 1
1219fc59639SAlexei Fedorovelse ifeq (${BRANCH_PROTECTION},3)
1229fc59639SAlexei Fedorov	# Extend the signing to include leaf functions
1239fc59639SAlexei Fedorov	BP_OPTION := pac-ret+leaf
1249fc59639SAlexei Fedorov	ENABLE_PAUTH := 1
1253768fecfSAlexei Fedorovelse ifeq (${BRANCH_PROTECTION},4)
1263768fecfSAlexei Fedorov	# Turn on branch target identification mechanism
1273768fecfSAlexei Fedorov	BP_OPTION := bti
1283768fecfSAlexei Fedorov	ENABLE_BTI := 1
1299fc59639SAlexei Fedorovelse
1309fc59639SAlexei Fedorov        $(error Unknown BRANCH_PROTECTION value ${BRANCH_PROTECTION})
1319fc59639SAlexei Fedorovendif
13273c99d4eSJuan Castillo
1335b18de09SZelalem Aweke# FEAT_RME
1345b18de09SZelalem Awekeifeq (${ENABLE_RME},1)
1355b18de09SZelalem Aweke# RME doesn't support PIE
1365b18de09SZelalem Awekeifneq (${ENABLE_PIE},0)
1375b18de09SZelalem Aweke        $(error ENABLE_RME does not support PIE)
1385b18de09SZelalem Awekeendif
139744ad974Sjohpow01# RME doesn't support BRBE
140744ad974Sjohpow01ifneq (${ENABLE_BRBE_FOR_NS},0)
141744ad974Sjohpow01        $(error ENABLE_RME does not support BRBE.)
142744ad974Sjohpow01endif
1435b18de09SZelalem Aweke# RME requires AARCH64
1445b18de09SZelalem Awekeifneq (${ARCH},aarch64)
1455b18de09SZelalem Aweke        $(error ENABLE_RME requires AArch64)
1465b18de09SZelalem Awekeendif
1475b18de09SZelalem Aweke# RME requires el2 context to be saved for now.
1485b18de09SZelalem AwekeCTX_INCLUDE_EL2_REGS := 1
1495b18de09SZelalem AwekeCTX_INCLUDE_AARCH32_REGS := 0
1505b18de09SZelalem AwekeARM_ARCH_MAJOR := 8
1515b18de09SZelalem AwekeARM_ARCH_MINOR := 6
1525b18de09SZelalem Awekeendif
1535b18de09SZelalem Aweke
154c97cba4eSSoby Mathew# USE_SPINLOCK_CAS requires AArch64 build
155c97cba4eSSoby Mathewifeq (${USE_SPINLOCK_CAS},1)
156c97cba4eSSoby Mathewifneq (${ARCH},aarch64)
157c97cba4eSSoby Mathew        $(error USE_SPINLOCK_CAS requires AArch64)
158c97cba4eSSoby Mathewendif
159c97cba4eSSoby Mathewendif
160c97cba4eSSoby Mathew
1610ca3913dSOlivier Deprez# USE_DEBUGFS experimental feature recommended only in debug builds
1620ca3913dSOlivier Deprezifeq (${USE_DEBUGFS},1)
1630ca3913dSOlivier Deprezifeq (${DEBUG},1)
1640ca3913dSOlivier Deprez        $(warning DEBUGFS experimental feature is enabled.)
1650ca3913dSOlivier Deprezelse
1660ca3913dSOlivier Deprez        $(warning DEBUGFS experimental, recommended in DEBUG builds ONLY)
1670ca3913dSOlivier Deprezendif
1680ca3913dSOlivier Deprezendif
1690ca3913dSOlivier Deprez
170c6ba9b45SSumit Gargifneq (${DECRYPTION_SUPPORT},none)
171c6ba9b45SSumit GargENC_ARGS += -f ${FW_ENC_STATUS}
172c6ba9b45SSumit GargENC_ARGS += -k ${ENC_KEY}
173c6ba9b45SSumit GargENC_ARGS += -n ${ENC_NONCE}
174c6ba9b45SSumit GargFIP_DEPS += enctool
175c6ba9b45SSumit GargFWU_FIP_DEPS += enctool
176c6ba9b45SSumit Gargendif
177c6ba9b45SSumit Garg
17873c99d4eSJuan Castillo################################################################################
17973c99d4eSJuan Castillo# Toolchain
18073c99d4eSJuan Castillo################################################################################
18173c99d4eSJuan Castillo
18272610c41Sdp-armHOSTCC			:=	gcc
18372610c41Sdp-armexport HOSTCC
18472610c41Sdp-arm
18573c99d4eSJuan CastilloCC			:=	${CROSS_COMPILE}gcc
18673c99d4eSJuan CastilloCPP			:=	${CROSS_COMPILE}cpp
18773c99d4eSJuan CastilloAS			:=	${CROSS_COMPILE}gcc
18873c99d4eSJuan CastilloAR			:=	${CROSS_COMPILE}ar
1892adee763SRoberto VargasLINKER			:=	${CROSS_COMPILE}ld
19073c99d4eSJuan CastilloOC			:=	${CROSS_COMPILE}objcopy
19173c99d4eSJuan CastilloOD			:=	${CROSS_COMPILE}objdump
19273c99d4eSJuan CastilloNM			:=	${CROSS_COMPILE}nm
19373c99d4eSJuan CastilloPP			:=	${CROSS_COMPILE}gcc -E
19438c14d88SSoby MathewDTC			:=	dtc
19573c99d4eSJuan Castillo
196b25a577fSJulius Werner# Use ${LD}.bfd instead if it exists (as absolute path or together with $PATH).
197b25a577fSJulius Wernerifneq ($(strip $(wildcard ${LD}.bfd) \
1982adee763SRoberto Vargas	$(foreach dir,$(subst :, ,${PATH}),$(wildcard ${dir}/${LINKER}.bfd))),)
1992adee763SRoberto VargasLINKER			:=	${LINKER}.bfd
200b25a577fSJulius Wernerendif
201b25a577fSJulius Werner
20226e63c44SEtienne Carriereifeq (${ARM_ARCH_MAJOR},7)
20326e63c44SEtienne Carrieretarget32-directive	= 	-target arm-none-eabi
20426e63c44SEtienne Carriere# Will set march32-directive from platform configuration
20526e63c44SEtienne Carriereelse
20626e63c44SEtienne Carrieretarget32-directive	= 	-target armv8a-none-eabi
207fa6f774bSAlexei Fedorov
208f1821790SAlexei Fedorov# Set the compiler's target architecture profile based on
209f1821790SAlexei Fedorov# ARM_ARCH_MAJOR ARM_ARCH_MINOR options
210fa6f774bSAlexei Fedorovifeq (${ARM_ARCH_MINOR},0)
211f1821790SAlexei Fedorovmarch32-directive	= 	-march=armv${ARM_ARCH_MAJOR}-a
212f1821790SAlexei Fedorovmarch64-directive	= 	-march=armv${ARM_ARCH_MAJOR}-a
213fa6f774bSAlexei Fedorovelse
214f1821790SAlexei Fedorovmarch32-directive	= 	-march=armv${ARM_ARCH_MAJOR}.${ARM_ARCH_MINOR}-a
215f1821790SAlexei Fedorovmarch64-directive	= 	-march=armv${ARM_ARCH_MAJOR}.${ARM_ARCH_MINOR}-a
216fa6f774bSAlexei Fedorovendif
21726e63c44SEtienne Carriereendif
21826e63c44SEtienne Carriere
2197ff088d1SManish V Badarkhe# Memory tagging is supported in architecture Armv8.5-A AArch64 and onwards
2207ff088d1SManish V Badarkheifeq ($(ARCH), aarch64)
2214a565bd8SSami Mujawar# Check if revision is greater than or equal to 8.5
2224a565bd8SSami Mujawarifeq "8.5" "$(word 1, $(sort 8.5 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))"
2237ff088d1SManish V Badarkhemem_tag_arch_support	= 	yes
2247ff088d1SManish V Badarkheendif
2257ff088d1SManish V Badarkheendif
2267ff088d1SManish V Badarkhe
227f1821790SAlexei Fedorov# Get architecture feature modifiers
228f1821790SAlexei Fedorovarch-features		=	${ARM_ARCH_FEATURE}
229f1821790SAlexei Fedorov
230f1821790SAlexei Fedorov# Enable required options for memory stack tagging.
231f1821790SAlexei Fedorov# Currently, these options are enabled only for clang and armclang compiler.
2327ff088d1SManish V Badarkheifeq (${SUPPORT_STACK_MEMTAG},yes)
2337ff088d1SManish V Badarkheifdef mem_tag_arch_support
234f1821790SAlexei Fedorov# Check for armclang and clang compilers
2357ff088d1SManish V Badarkheifneq ( ,$(filter $(notdir $(CC)),armclang clang))
236f1821790SAlexei Fedorov# Add "memtag" architecture feature modifier if not specified
237f1821790SAlexei Fedorovifeq ( ,$(findstring memtag,$(arch-features)))
238f1821790SAlexei Fedorovarch-features       	:=       $(arch-features)+memtag
239f1821790SAlexei Fedorovendif	# memtag
2407ff088d1SManish V Badarkheifeq ($(notdir $(CC)),armclang)
2417ff088d1SManish V BadarkheTF_CFLAGS		+=	-mmemtag-stack
2427ff088d1SManish V Badarkheelse ifeq ($(notdir $(CC)),clang)
2437ff088d1SManish V BadarkheTF_CFLAGS		+=	-fsanitize=memtag
244f1821790SAlexei Fedorovendif	# armclang
245f1821790SAlexei Fedorovendif	# armclang clang
2467ff088d1SManish V Badarkheelse
2477ff088d1SManish V Badarkhe$(error "Error: stack memory tagging is not supported for architecture \
2487ff088d1SManish V Badarkhe	${ARCH},armv${ARM_ARCH_MAJOR}.${ARM_ARCH_MINOR}-a")
249f1821790SAlexei Fedorovendif	# mem_tag_arch_support
250f1821790SAlexei Fedorovendif	# SUPPORT_STACK_MEMTAG
251f1821790SAlexei Fedorov
252f1821790SAlexei Fedorov# Set the compiler's architecture feature modifiers
253f1821790SAlexei Fedorovifneq ($(arch-features), none)
254f1821790SAlexei Fedorov# Strip "none+" from arch-features
255f1821790SAlexei Fedorovarch-features		:=	$(subst none+,,$(arch-features))
256f1821790SAlexei Fedorovifeq ($(ARCH), aarch32)
257f1821790SAlexei Fedorovmarch32-directive	:=	$(march32-directive)+$(arch-features)
258f1821790SAlexei Fedorovelse
259f1821790SAlexei Fedorovmarch64-directive	:=	$(march64-directive)+$(arch-features)
2607ff088d1SManish V Badarkheendif
261f1821790SAlexei Fedorov# Print features
262f1821790SAlexei Fedorov$(info Arm Architecture Features specified: $(subst +, ,$(arch-features)))
263f1821790SAlexei Fedorovendif	# arch-features
2647ff088d1SManish V Badarkhe
26512cd65e0STomas Pilar# Determine if FEAT_RNG is supported
26612cd65e0STomas PilarENABLE_FEAT_RNG		=	$(if $(findstring rng,${arch-features}),1,0)
26712cd65e0STomas Pilar
2684e04478aSChris Kay# Determine if FEAT_SB is supported
2694e04478aSChris KayENABLE_FEAT_SB		=	$(if $(findstring sb,${arch-features}),1,0)
2704e04478aSChris Kay
271c8a992fdSoriginifneq ($(findstring clang,$(notdir $(CC))),)
272fd18a8fcSVarun Wadekar	ifneq ($(findstring armclang,$(notdir $(CC))),)
273c8a992fdSorigin		TF_CFLAGS_aarch32	:=	-target arm-arm-none-eabi $(march32-directive)
274c8a992fdSorigin		TF_CFLAGS_aarch64	:=	-target aarch64-arm-none-eabi $(march64-directive)
275c8a992fdSorigin		LD			:=	$(LINKER)
276c8a992fdSorigin	else
277c8a992fdSorigin		TF_CFLAGS_aarch32	:=	$(target32-directive) $(march32-directive)
278c8a992fdSorigin		TF_CFLAGS_aarch64	:=	-target aarch64-elf $(march64-directive)
279c8a992fdSorigin		LD			:=	$(shell $(CC) --print-prog-name ld.lld)
280c8a992fdSorigin
281c8a992fdSorigin		AR			:=	$(shell $(CC) --print-prog-name llvm-ar)
282c8a992fdSorigin		OD			:=	$(shell $(CC) --print-prog-name llvm-objdump)
283c8a992fdSorigin		OC			:=	$(shell $(CC) --print-prog-name llvm-objcopy)
284641f16e7SAmbroise Vincent	endif
285c8a992fdSorigin
286c8a992fdSorigin	CPP		:=	$(CC) -E $(TF_CFLAGS_$(ARCH))
287c8a992fdSorigin	PP		:=	$(CC) -E $(TF_CFLAGS_$(ARCH))
288c8a992fdSorigin	AS		:=	$(CC) -c -x assembler-with-cpp $(TF_CFLAGS_$(ARCH))
289edbce9aaSzelalem-awekeelse ifneq ($(findstring gcc,$(notdir $(CC))),)
290edbce9aaSzelalem-awekeTF_CFLAGS_aarch32	=	$(march32-directive)
291edbce9aaSzelalem-awekeTF_CFLAGS_aarch64	=	$(march64-directive)
292edbce9aaSzelalem-awekeifeq ($(ENABLE_LTO),1)
293edbce9aaSzelalem-aweke	# Enable LTO only for aarch64
294edbce9aaSzelalem-aweke	ifeq (${ARCH},aarch64)
295edbce9aaSzelalem-aweke		LTO_CFLAGS	=	-flto
296edbce9aaSzelalem-aweke		# Use gcc as a wrapper for the ld, recommended for LTO
297edbce9aaSzelalem-aweke		LINKER		:=	${CROSS_COMPILE}gcc
298edbce9aaSzelalem-aweke	endif
299edbce9aaSzelalem-awekeendif
300edbce9aaSzelalem-awekeLD			=	$(LINKER)
301d5461857Sdp-armelse
30226e63c44SEtienne CarriereTF_CFLAGS_aarch32	=	$(march32-directive)
303fa6f774bSAlexei FedorovTF_CFLAGS_aarch64	=	$(march64-directive)
3042adee763SRoberto VargasLD			=	$(LINKER)
305d5461857Sdp-armendif
306d5461857Sdp-arm
30732b209bfSAhmad Fatoum# Process Debug flag
30832b209bfSAhmad Fatoum$(eval $(call add_define,DEBUG))
30932b209bfSAhmad Fatoumifneq (${DEBUG}, 0)
31032b209bfSAhmad Fatoum        BUILD_TYPE	:=	debug
3114466cf82SDaniel Boulby        TF_CFLAGS	+=	-g -gdwarf-4
3124466cf82SDaniel Boulby        ASFLAGS		+=	-g -Wa,-gdwarf-4
31332b209bfSAhmad Fatoum
31432b209bfSAhmad Fatoum        # Use LOG_LEVEL_INFO by default for debug builds
31532b209bfSAhmad Fatoum        LOG_LEVEL	:=	40
31632b209bfSAhmad Fatoumelse
31732b209bfSAhmad Fatoum        BUILD_TYPE	:=	release
31832b209bfSAhmad Fatoum        # Use LOG_LEVEL_NOTICE by default for release builds
31932b209bfSAhmad Fatoum        LOG_LEVEL	:=	20
32032b209bfSAhmad Fatoumendif
32132b209bfSAhmad Fatoum
322f1de4c8fSPeiyuan Song# Default build string (git branch and commit)
323f1de4c8fSPeiyuan Songifeq (${BUILD_STRING},)
324f1de4c8fSPeiyuan Song        BUILD_STRING  :=  $(shell git describe --always --dirty --tags 2> /dev/null)
325f1de4c8fSPeiyuan Songendif
326dddf4283Slaurenw-armVERSION_STRING    :=  v${VERSION}(${BUILD_TYPE}):${BUILD_STRING}
327f1de4c8fSPeiyuan Song
3288fd9d4d5SAntonio Nino Diazifeq (${AARCH32_INSTRUCTION_SET},A32)
3298fd9d4d5SAntonio Nino DiazTF_CFLAGS_aarch32	+=	-marm
3308fd9d4d5SAntonio Nino Diazelse ifeq (${AARCH32_INSTRUCTION_SET},T32)
3318fd9d4d5SAntonio Nino DiazTF_CFLAGS_aarch32	+=	-mthumb
3328fd9d4d5SAntonio Nino Diazelse
3338fd9d4d5SAntonio Nino Diaz$(error Error: Unknown AArch32 instruction set ${AARCH32_INSTRUCTION_SET})
3348fd9d4d5SAntonio Nino Diazendif
3358fd9d4d5SAntonio Nino Diaz
336a9c4dde3SSandrine BailleuxTF_CFLAGS_aarch32	+=	-mno-unaligned-access
337d5461857Sdp-armTF_CFLAGS_aarch64	+=	-mgeneral-regs-only -mstrict-align
3389d29c227SSoby Mathew
3399fc59639SAlexei Fedorovifneq (${BP_OPTION},none)
3409fc59639SAlexei FedorovTF_CFLAGS_aarch64	+=	-mbranch-protection=${BP_OPTION}
3419fc59639SAlexei Fedorovendif
3429fc59639SAlexei Fedorov
34326e63c44SEtienne CarriereASFLAGS_aarch32		=	$(march32-directive)
344fa6f774bSAlexei FedorovASFLAGS_aarch64		=	$(march64-directive)
345b86048c4SAntonio Nino Diaz
3469ab81b5eSJustin Chadwell# General warnings
3479ab81b5eSJustin ChadwellWARNINGS		:=	-Wall -Wmissing-include-dirs -Wunused	\
348b7f6525dSJustin Chadwell				-Wdisabled-optimization -Wvla -Wshadow	\
349ca661a00SMadhukar Pappireddy				-Wno-unused-parameter -Wredundant-decls
3509ab81b5eSJustin Chadwell
3519ab81b5eSJustin Chadwell# Additional warnings
3529ab81b5eSJustin Chadwell# Level 1
353e7c645b5SYann GautierWARNING1 := -Wextra
354e7c645b5SYann GautierWARNING1 += -Wmissing-format-attribute
355e7c645b5SYann GautierWARNING1 += -Wmissing-prototypes
356e7c645b5SYann GautierWARNING1 += -Wold-style-definition
357e7c645b5SYann Gautier
358b7f6525dSJustin Chadwell# Level 2
359e7c645b5SYann GautierWARNING2 := -Waggregate-return
360e7c645b5SYann GautierWARNING2 += -Wcast-align
361e7c645b5SYann GautierWARNING2 += -Wnested-externs
362e7c645b5SYann Gautier
363e7c645b5SYann GautierWARNING3 := -Wbad-function-cast
364e7c645b5SYann GautierWARNING3 += -Wcast-qual
365e7c645b5SYann GautierWARNING3 += -Wconversion
366e7c645b5SYann GautierWARNING3 += -Wpacked
367e7c645b5SYann GautierWARNING3 += -Wpointer-arith
368e7c645b5SYann GautierWARNING3 += -Wswitch-default
369e7c645b5SYann Gautier
370e7c645b5SYann Gautierifeq (${W},1)
3719ab81b5eSJustin ChadwellWARNINGS += $(WARNING1)
372e7c645b5SYann Gautierelse ifeq (${W},2)
3739ab81b5eSJustin ChadwellWARNINGS += $(WARNING1) $(WARNING2)
374e7c645b5SYann Gautierelse ifeq (${W},3)
3759ab81b5eSJustin ChadwellWARNINGS += $(WARNING1) $(WARNING2) $(WARNING3)
376e7c645b5SYann Gautierendif
377e7c645b5SYann Gautier
3789ab81b5eSJustin Chadwell# Compiler specific warnings
37900296576SAmbroise Vincentifeq ($(findstring clang,$(notdir $(CC))),)
38093c690ebSJustin Chadwell# not using clang
381d7b4cd41SJustin ChadwellWARNINGS	+=		-Wunused-but-set-variable -Wmaybe-uninitialized	\
382d7b4cd41SJustin Chadwell				-Wpacked-bitfield-compat -Wshift-overflow=2 \
383d7b4cd41SJustin Chadwell				-Wlogical-op
38493c690ebSJustin Chadwellelse
38593c690ebSJustin Chadwell# using clang
386d7b4cd41SJustin ChadwellWARNINGS	+=		-Wshift-overflow -Wshift-sign-overflow \
387d7b4cd41SJustin Chadwell				-Wlogical-op-parentheses
38800296576SAmbroise Vincentendif
38900296576SAmbroise Vincent
3906336b07aSYann Gautierifneq (${E},0)
3916336b07aSYann GautierERRORS := -Werror
3926336b07aSYann Gautierendif
3936336b07aSYann Gautier
394ea7a57a3SRoberto VargasCPPFLAGS		=	${DEFINES} ${INCLUDES} ${MBEDTLS_INC} -nostdinc	\
3959ab81b5eSJustin Chadwell				$(ERRORS) $(WARNINGS)
39659de5096SMasahiro YamadaASFLAGS			+=	$(CPPFLAGS) $(ASFLAGS_$(ARCH))			\
397d5dfdeb6SJulius Werner				-ffreestanding -Wa,--fatal-warnings
39859de5096SMasahiro YamadaTF_CFLAGS		+=	$(CPPFLAGS) $(TF_CFLAGS_$(ARCH))		\
399ebd6efaeSSamuel Holland				-ffunction-sections -fdata-sections		\
400ebd6efaeSSamuel Holland				-ffreestanding -fno-builtin -fno-common		\
401ebd6efaeSSamuel Holland				-Os -std=gnu99
40273c99d4eSJuan Castillo
403bebcf27fSMark Brown$(eval $(call add_define,SVE_VECTOR_LEN))
404bebcf27fSMark Brown
4051f461979SJustin Chadwellifeq (${SANITIZE_UB},on)
4061f461979SJustin ChadwellTF_CFLAGS		+=	-fsanitize=undefined -fno-sanitize-recover
4071f461979SJustin Chadwellendif
4081f461979SJustin Chadwellifeq (${SANITIZE_UB},trap)
4091f461979SJustin ChadwellTF_CFLAGS		+=	-fsanitize=undefined -fno-sanitize-recover	\
4101f461979SJustin Chadwell				-fsanitize-undefined-trap-on-error
4111f461979SJustin Chadwellendif
4121f461979SJustin Chadwell
413f7ec31dbSdavid cunadoGCC_V_OUTPUT		:=	$(shell $(CC) -v 2>&1)
414f7ec31dbSdavid cunado
415641f16e7SAmbroise Vincent# LD = armlink
416c2ad38ceSVarun Wadekarifneq ($(findstring armlink,$(notdir $(LD))),)
417c2ad38ceSVarun WadekarTF_LDFLAGS		+=	--diag_error=warning --lto_level=O1
418c2ad38ceSVarun WadekarTF_LDFLAGS		+=	--remove --info=unused,unusedsymbols
419edbce9aaSzelalem-awekeTF_LDFLAGS		+=	$(TF_LDFLAGS_$(ARCH))
420641f16e7SAmbroise Vincent
421641f16e7SAmbroise Vincent# LD = gcc (used when GCC LTO is enabled)
422edbce9aaSzelalem-awekeelse ifneq ($(findstring gcc,$(notdir $(LD))),)
423edbce9aaSzelalem-aweke# Pass ld options with Wl or Xlinker switches
424edbce9aaSzelalem-awekeTF_LDFLAGS		+=	-Wl,--fatal-warnings -O1
425edbce9aaSzelalem-awekeTF_LDFLAGS		+=	-Wl,--gc-sections
426edbce9aaSzelalem-awekeifeq ($(ENABLE_LTO),1)
427edbce9aaSzelalem-aweke	ifeq (${ARCH},aarch64)
428edbce9aaSzelalem-aweke		TF_LDFLAGS	+=	-flto -fuse-linker-plugin
429edbce9aaSzelalem-aweke	endif
430edbce9aaSzelalem-awekeendif
431edbce9aaSzelalem-aweke# GCC automatically adds fix-cortex-a53-843419 flag when used to link
432edbce9aaSzelalem-aweke# which breaks some builds, so disable if errata fix is not explicitly enabled
433edbce9aaSzelalem-awekeifneq (${ERRATA_A53_843419},1)
434edbce9aaSzelalem-aweke	TF_LDFLAGS	+= 	-mno-fix-cortex-a53-843419
435edbce9aaSzelalem-awekeendif
436edbce9aaSzelalem-awekeTF_LDFLAGS		+= 	-nostdlib
437edbce9aaSzelalem-awekeTF_LDFLAGS		+=	$(subst --,-Xlinker --,$(TF_LDFLAGS_$(ARCH)))
438641f16e7SAmbroise Vincent
439641f16e7SAmbroise Vincent# LD = gcc-ld (ld) or llvm-ld (ld.lld) or other
440c2ad38ceSVarun Wadekarelse
441c2b8806fSDouglas RaillardTF_LDFLAGS		+=	--fatal-warnings -O1
442c2b8806fSDouglas RaillardTF_LDFLAGS		+=	--gc-sections
443641f16e7SAmbroise Vincent# ld.lld doesn't recognize the errata flags,
444641f16e7SAmbroise Vincent# therefore don't add those in that case
445641f16e7SAmbroise Vincentifeq ($(findstring ld.lld,$(notdir $(LD))),)
446c2b8806fSDouglas RaillardTF_LDFLAGS		+=	$(TF_LDFLAGS_$(ARCH))
447edbce9aaSzelalem-awekeendif
448641f16e7SAmbroise Vincentendif
44973c99d4eSJuan Castillo
45003b397a8SNishanth MenonDTC_FLAGS		+=	-I dts -O dtb
451a6de824fSLouis MayencourtDTC_CPPFLAGS		+=	-P -nostdinc -Iinclude -Ifdts -undef \
452a6de824fSLouis Mayencourt				-x assembler-with-cpp $(DEFINES)
45303b397a8SNishanth Menon
45473c99d4eSJuan Castillo################################################################################
45573c99d4eSJuan Castillo# Common sources and include directories
45673c99d4eSJuan Castillo################################################################################
4576a0da736SJayanth Dodderi Chidanandinclude ${MAKE_HELPERS_DIRECTORY}arch_features.mk
458d801fbb0Sdp-arminclude lib/compiler-rt/compiler-rt.mk
45973c99d4eSJuan Castillo
46073c99d4eSJuan CastilloBL_COMMON_SOURCES	+=	common/bl_common.c			\
4617f56e9a3SSoby Mathew				common/tf_log.c				\
4629d29c227SSoby Mathew				common/${ARCH}/debug.S			\
46391b48c9fSJulius Werner				drivers/console/multi_console.c		\
4649d29c227SSoby Mathew				lib/${ARCH}/cache_helpers.S		\
4659d29c227SSoby Mathew				lib/${ARCH}/misc_helpers.S		\
466566034fcSSoby Mathew				plat/common/plat_bl_common.c		\
4677f56e9a3SSoby Mathew				plat/common/plat_log_common.c		\
46875311203Sdp-arm				plat/common/${ARCH}/plat_common.c	\
4699d29c227SSoby Mathew				plat/common/${ARCH}/platform_helpers.S	\
47061f72a34SRoberto Vargas				${COMPILER_RT_SRCS}
471d7a6b0f8SRyan Harkin
4728422a840SAntonio Nino Diazifeq ($(notdir $(CC)),armclang)
4738422a840SAntonio Nino DiazBL_COMMON_SOURCES	+=	lib/${ARCH}/armclang_printf.S
4748422a840SAntonio Nino Diazendif
4758422a840SAntonio Nino Diaz
4761f461979SJustin Chadwellifeq (${SANITIZE_UB},on)
4771f461979SJustin ChadwellBL_COMMON_SOURCES	+=	plat/common/ubsan.c
4781f461979SJustin Chadwellendif
4791f461979SJustin Chadwell
48001d237cbSYann GautierINCLUDES		+=	-Iinclude				\
481f5478dedSAntonio Nino Diaz				-Iinclude/arch/${ARCH}			\
48209d40e0eSAntonio Nino Diaz				-Iinclude/lib/cpus/${ARCH}		\
48309d40e0eSAntonio Nino Diaz				-Iinclude/lib/el3_runtime/${ARCH}	\
48409d40e0eSAntonio Nino Diaz				${PLAT_INCLUDES}			\
48509d40e0eSAntonio Nino Diaz				${SPD_INCLUDES}
48609d40e0eSAntonio Nino Diaz
4879c6d1c50SAntonio Nino Diazinclude common/backtrace/backtrace.mk
4889c6d1c50SAntonio Nino Diaz
48973c99d4eSJuan Castillo################################################################################
49073c99d4eSJuan Castillo# Generic definitions
49173c99d4eSJuan Castillo################################################################################
49273c99d4eSJuan Castillo
493231c1470SEvan Lloydinclude ${MAKE_HELPERS_DIRECTORY}plat_helpers.mk
494231c1470SEvan Lloyd
49529214e95SGrant Likelyifeq (${BUILD_BASE},)
49673c99d4eSJuan Castillo     BUILD_BASE		:=	./build
49729214e95SGrant Likelyendif
49829214e95SGrant LikelyBUILD_PLAT		:=	$(abspath ${BUILD_BASE})/${PLAT}/${BUILD_TYPE}
49973c99d4eSJuan Castillo
500231c1470SEvan LloydSPDS			:=	$(sort $(filter-out none, $(patsubst services/spd/%,%,$(wildcard services/spd/*))))
50173c99d4eSJuan Castillo
50273c99d4eSJuan Castillo# Platforms providing their own TBB makefile may override this value
50373c99d4eSJuan CastilloINCLUDE_TBBR_MK		:=	1
50473c99d4eSJuan Castillo
50573c99d4eSJuan Castillo
50673c99d4eSJuan Castillo################################################################################
50773c99d4eSJuan Castillo# Include SPD Makefile if one has been specified
50873c99d4eSJuan Castillo################################################################################
50973c99d4eSJuan Castillo
51073c99d4eSJuan Castilloifneq (${SPD},none)
5119d29c227SSoby Mathew    ifeq (${ARCH},aarch32)
5129d29c227SSoby Mathew        $(error "Error: SPD is incompatible with AArch32.")
5139d29c227SSoby Mathew    endif
51428f39f02SMax Shvetsov
5154c117f6cSSandrine Bailleux    ifdef EL3_PAYLOAD_BASE
5164c117f6cSSandrine Bailleux        $(warning "SPD and EL3_PAYLOAD_BASE are incompatible build options.")
5174c117f6cSSandrine Bailleux        $(warning "The SPD and its BL32 companion will be present but ignored.")
5184c117f6cSSandrine Bailleux    endif
51928f39f02SMax Shvetsov
520c3fb00d9SAchin Gupta    ifeq (${SPD},spmd)
521c3fb00d9SAchin Gupta        # SPMD is located in std_svc directory
522c3fb00d9SAchin Gupta        SPD_DIR := std_svc
52328f39f02SMax Shvetsov
524033039f8SMax Shvetsov        ifeq ($(SPMD_SPM_AT_SEL2),1)
52528f39f02SMax Shvetsov            ifeq ($(CTX_INCLUDE_EL2_REGS),0)
526033039f8SMax Shvetsov                $(error SPMD with SPM at S-EL2 requires CTX_INCLUDE_EL2_REGS option)
527033039f8SMax Shvetsov            endif
5281d63ae4dSMarc Bonnici	    ifeq ($(SPMC_AT_EL3),1)
5291d63ae4dSMarc Bonnici                $(error SPM cannot be enabled in both S-EL2 and EL3.)
5301d63ae4dSMarc Bonnici            endif
53128f39f02SMax Shvetsov        endif
532db1ef41aSOlivier Deprez
533db1ef41aSOlivier Deprez        ifeq ($(findstring optee_sp,$(ARM_SPMC_MANIFEST_DTS)),optee_sp)
534db1ef41aSOlivier Deprez            DTC_CPPFLAGS	+=	-DOPTEE_SP_FW_CONFIG
535db1ef41aSOlivier Deprez        endif
536ca932481SDavidson K
537ca932481SDavidson K        ifeq ($(TS_SP_FW_CONFIG),1)
538ca932481SDavidson K            DTC_CPPFLAGS	+=	-DTS_SP_FW_CONFIG
539ca932481SDavidson K        endif
54033993a37SBalint Dobszay
54133993a37SBalint Dobszay        ifneq ($(ARM_BL2_SP_LIST_DTS),)
54233993a37SBalint Dobszay            DTC_CPPFLAGS += -DARM_BL2_SP_LIST_DTS=$(ARM_BL2_SP_LIST_DTS)
54333993a37SBalint Dobszay        endif
54446789a7cSBalint Dobszay
54546789a7cSBalint Dobszay        ifneq ($(SP_LAYOUT_FILE),)
54646789a7cSBalint Dobszay            BL2_ENABLE_SP_LOAD := 1
54746789a7cSBalint Dobszay        endif
548c3fb00d9SAchin Gupta    else
549c3fb00d9SAchin Gupta        # All other SPDs in spd directory
550c3fb00d9SAchin Gupta        SPD_DIR := spd
551c3fb00d9SAchin Gupta    endif
552c3fb00d9SAchin Gupta
55373c99d4eSJuan Castillo    # We expect to locate an spd.mk under the specified SPD directory
554c3fb00d9SAchin Gupta    SPD_MAKE	:=	$(wildcard services/${SPD_DIR}/${SPD}/${SPD}.mk)
555c3fb00d9SAchin Gupta
55673c99d4eSJuan Castillo    ifeq (${SPD_MAKE},)
557c3fb00d9SAchin Gupta        $(error Error: No services/${SPD_DIR}/${SPD}/${SPD}.mk located)
55873c99d4eSJuan Castillo    endif
55973c99d4eSJuan Castillo    $(info Including ${SPD_MAKE})
56073c99d4eSJuan Castillo    include ${SPD_MAKE}
56173c99d4eSJuan Castillo
56270d1fc53SJuan Castillo    # If there's BL32 companion for the chosen SPD, we expect that the SPD's
56370d1fc53SJuan Castillo    # Makefile would set NEED_BL32 to "yes". In this case, the build system
56470d1fc53SJuan Castillo    # supports two mutually exclusive options:
56570d1fc53SJuan Castillo    # * BL32 is built from source: then BL32_SOURCES must contain the list
56670d1fc53SJuan Castillo    #   of source files to build BL32
56770d1fc53SJuan Castillo    # * BL32 is a prebuilt binary: then BL32 must point to the image file
56870d1fc53SJuan Castillo    #   that will be included in the FIP
56970d1fc53SJuan Castillo    # If both BL32_SOURCES and BL32 are defined, the binary takes precedence
57070d1fc53SJuan Castillo    # over the sources.
571e35c4045SJeenu Viswambharanendif
572e35c4045SJeenu Viswambharan
57351faada7SDouglas Raillard################################################################################
5745b18de09SZelalem Aweke# Include rmmd Makefile if RME is enabled
5755b18de09SZelalem Aweke################################################################################
5765b18de09SZelalem Aweke
5775b18de09SZelalem Awekeifneq (${ENABLE_RME},0)
5785b18de09SZelalem Awekeifneq (${ARCH},aarch64)
5795b18de09SZelalem Aweke	$(error ENABLE_RME requires AArch64)
5805b18de09SZelalem Awekeendif
5811d63ae4dSMarc Bonniciifeq ($(SPMC_AT_EL3),1)
5821d63ae4dSMarc Bonnici	$(error SPMC_AT_EL3 and ENABLE_RME cannot both be enabled.)
5831d63ae4dSMarc Bonniciendif
5845b18de09SZelalem Awekeinclude services/std_svc/rmmd/rmmd.mk
5855b18de09SZelalem Aweke$(warning "RME is an experimental feature")
5865b18de09SZelalem Awekeendif
5875b18de09SZelalem Aweke
5885b18de09SZelalem Aweke################################################################################
58973c99d4eSJuan Castillo# Include the platform specific Makefile after the SPD Makefile (the platform
59073c99d4eSJuan Castillo# makefile may use all previous definitions in this file)
59173c99d4eSJuan Castillo################################################################################
5922da8d8bfSJeenu Viswambharan
59373c99d4eSJuan Castilloinclude ${PLAT_MAKEFILE_FULL}
5940f21c547SJuan Castillo
5958012cc5cSMasahiro Yamada$(eval $(call MAKE_PREREQ_DIR,${BUILD_PLAT}))
5968012cc5cSMasahiro Yamada
59726e63c44SEtienne Carriereifeq (${ARM_ARCH_MAJOR},7)
59826e63c44SEtienne Carriereinclude make_helpers/armv7-a-cpus.mk
59926e63c44SEtienne Carriereendif
60026e63c44SEtienne Carriere
6013bd17c0fSSoby MathewPIE_FOUND		:=	$(findstring --enable-default-pie,${GCC_V_OUTPUT})
6023bd17c0fSSoby Mathewifneq ($(PIE_FOUND),)
6033bd17c0fSSoby Mathew	TF_CFLAGS	+=	-fno-PIE
6047b592418SSamuel Hollandifneq ($(findstring gcc,$(notdir $(LD))),)
6057b592418SSamuel Holland	TF_LDFLAGS	+=	-no-pie
6067b592418SSamuel Hollandendif
6073bd17c0fSSoby Mathewendif
608320920c1SMasahiro Yamada
609320920c1SMasahiro Yamadaifneq ($(findstring gcc,$(notdir $(LD))),)
610320920c1SMasahiro Yamada	PIE_LDFLAGS	+=	-Wl,-pie -Wl,--no-dynamic-linker
611320920c1SMasahiro Yamadaelse
612320920c1SMasahiro Yamada	PIE_LDFLAGS	+=	-pie --no-dynamic-linker
613320920c1SMasahiro Yamadaendif
614320920c1SMasahiro Yamada
615320920c1SMasahiro Yamadaifeq ($(ENABLE_PIE),1)
61669af7fcfSMasahiro Yamadaifeq ($(BL2_AT_EL3),1)
61769af7fcfSMasahiro Yamadaifneq ($(BL2_IN_XIP_MEM),1)
61869af7fcfSMasahiro Yamada	BL2_CFLAGS	+=	-fpie
61969af7fcfSMasahiro Yamada	BL2_LDFLAGS	+=	$(PIE_LDFLAGS)
62069af7fcfSMasahiro Yamadaendif
62169af7fcfSMasahiro Yamadaendif
622320920c1SMasahiro Yamada	BL31_CFLAGS	+=	-fpie
623320920c1SMasahiro Yamada	BL31_LDFLAGS	+=	$(PIE_LDFLAGS)
624d974301dSMasahiro Yamada	BL32_CFLAGS	+=	-fpie
625d974301dSMasahiro Yamada	BL32_LDFLAGS	+=	$(PIE_LDFLAGS)
626d974301dSMasahiro Yamadaendif
6273bd17c0fSSoby Mathew
628d5e97a1dSMasahiro Yamadaifeq (${ARCH},aarch64)
6299cefb4b1SMasahiro YamadaBL1_CPPFLAGS += -DIMAGE_AT_EL3
630d5e97a1dSMasahiro Yamadaifeq ($(BL2_AT_EL3),1)
6319cefb4b1SMasahiro YamadaBL2_CPPFLAGS += -DIMAGE_AT_EL3
632d5e97a1dSMasahiro Yamadaelse
6339cefb4b1SMasahiro YamadaBL2_CPPFLAGS += -DIMAGE_AT_EL1
634d5e97a1dSMasahiro Yamadaendif
6359cefb4b1SMasahiro YamadaBL2U_CPPFLAGS += -DIMAGE_AT_EL1
6369cefb4b1SMasahiro YamadaBL31_CPPFLAGS += -DIMAGE_AT_EL3
6379cefb4b1SMasahiro YamadaBL32_CPPFLAGS += -DIMAGE_AT_EL1
638d5e97a1dSMasahiro Yamadaendif
639d5e97a1dSMasahiro Yamada
64054035fc4SSandrine Bailleux# Include the CPU specific operations makefile, which provides default
64154035fc4SSandrine Bailleux# values for all CPU errata workarounds and CPU specific optimisations.
64254035fc4SSandrine Bailleux# This can be overridden by the platform.
64373c99d4eSJuan Castilloinclude lib/cpus/cpu-ops.mk
6444f6ad66aSAchin Gupta
645a4409008Sdp-armifeq (${ARCH},aarch32)
646a4409008Sdp-armNEED_BL32 := yes
647a4409008Sdp-arm
648a4409008Sdp-arm################################################################################
649a4409008Sdp-arm# Build `AARCH32_SP` as BL32 image for AArch32
650a4409008Sdp-arm################################################################################
651a4409008Sdp-armifneq (${AARCH32_SP},none)
652a4409008Sdp-arm# We expect to locate an sp.mk under the specified AARCH32_SP directory
653a4409008Sdp-armAARCH32_SP_MAKE	:=	$(wildcard bl32/${AARCH32_SP}/${AARCH32_SP}.mk)
654a4409008Sdp-arm
655a4409008Sdp-armifeq (${AARCH32_SP_MAKE},)
656a4409008Sdp-arm  $(error Error: No bl32/${AARCH32_SP}/${AARCH32_SP}.mk located)
657a4409008Sdp-armendif
658a4409008Sdp-arm
659a4409008Sdp-arm$(info Including ${AARCH32_SP_MAKE})
660a4409008Sdp-arminclude ${AARCH32_SP_MAKE}
661a4409008Sdp-armendif
662a4409008Sdp-arm
663a4409008Sdp-armendif
6644f6ad66aSAchin Gupta
66573c99d4eSJuan Castillo################################################################################
66677f1f7a1SVarun Wadekar# Include libc if not overridden
66777f1f7a1SVarun Wadekar################################################################################
66877f1f7a1SVarun Wadekarifeq (${OVERRIDE_LIBC},0)
66977f1f7a1SVarun Wadekarinclude lib/libc/libc.mk
67077f1f7a1SVarun Wadekarendif
67177f1f7a1SVarun Wadekar
67277f1f7a1SVarun Wadekar################################################################################
673cf2c8a33SAntonio Nino Diaz# Check incompatible options
674cf2c8a33SAntonio Nino Diaz################################################################################
675cf2c8a33SAntonio Nino Diaz
676cf2c8a33SAntonio Nino Diazifdef EL3_PAYLOAD_BASE
67768450a6dSAntonio Nino Diaz        ifdef PRELOADED_BL33_BASE
67868450a6dSAntonio Nino Diaz                $(warning "PRELOADED_BL33_BASE and EL3_PAYLOAD_BASE are \
67968450a6dSAntonio Nino Diaz                incompatible build options. EL3_PAYLOAD_BASE has priority.")
680cf2c8a33SAntonio Nino Diaz        endif
68176580f3dSQixiang Xu        ifneq (${GENERATE_COT},0)
68276580f3dSQixiang Xu                $(error "GENERATE_COT and EL3_PAYLOAD_BASE are incompatible build options.")
68376580f3dSQixiang Xu        endif
68476580f3dSQixiang Xu        ifneq (${TRUSTED_BOARD_BOOT},0)
68576580f3dSQixiang Xu                $(error "TRUSTED_BOARD_BOOT and EL3_PAYLOAD_BASE are incompatible build options.")
68676580f3dSQixiang Xu        endif
687cf2c8a33SAntonio Nino Diazendif
688cf2c8a33SAntonio Nino Diaz
689cf2c8a33SAntonio Nino Diazifeq (${NEED_BL33},yes)
690cf2c8a33SAntonio Nino Diaz        ifdef EL3_PAYLOAD_BASE
691cf2c8a33SAntonio Nino Diaz                $(warning "BL33 image is not needed when option \
692cf2c8a33SAntonio Nino Diaz                BL33_PAYLOAD_BASE is used and won't be added to the FIP file.")
693cf2c8a33SAntonio Nino Diaz        endif
69468450a6dSAntonio Nino Diaz        ifdef PRELOADED_BL33_BASE
69568450a6dSAntonio Nino Diaz                $(warning "BL33 image is not needed when option \
69668450a6dSAntonio Nino Diaz                PRELOADED_BL33_BASE is used and won't be added to the FIP \
69768450a6dSAntonio Nino Diaz                file.")
698cf2c8a33SAntonio Nino Diaz        endif
699cf2c8a33SAntonio Nino Diazendif
700cf2c8a33SAntonio Nino Diaz
701d4593e47SJeenu Viswambharan# When building for systems with hardware-assisted coherency, there's no need to
702d4593e47SJeenu Viswambharan# use USE_COHERENT_MEM. Require that USE_COHERENT_MEM must be set to 0 too.
703d4593e47SJeenu Viswambharanifeq ($(HW_ASSISTED_COHERENCY)-$(USE_COHERENT_MEM),1-1)
704d4593e47SJeenu Viswambharan$(error USE_COHERENT_MEM cannot be enabled with HW_ASSISTED_COHERENCY)
705d4593e47SJeenu Viswambharanendif
7061a0a3f06SYatharth Kochar
7077d173fc5SJiafei Pan#For now, BL2_IN_XIP_MEM is only supported when BL2_AT_EL3 is 1.
7087d173fc5SJiafei Panifeq ($(BL2_AT_EL3)-$(BL2_IN_XIP_MEM),0-1)
7097d173fc5SJiafei Pan$(error "BL2_IN_XIP_MEM is only supported when BL2_AT_EL3 is enabled")
7107d173fc5SJiafei Panendif
7117d173fc5SJiafei Pan
71214c6016aSJeenu Viswambharan# For RAS_EXTENSION, require that EAs are handled in EL3 first
71314c6016aSJeenu Viswambharanifeq ($(RAS_EXTENSION),1)
71414c6016aSJeenu Viswambharan    ifneq ($(HANDLE_EA_EL3_FIRST),1)
71514c6016aSJeenu Viswambharan        $(error For RAS_EXTENSION, HANDLE_EA_EL3_FIRST must also be 1)
71614c6016aSJeenu Viswambharan    endif
71714c6016aSJeenu Viswambharanendif
71814c6016aSJeenu Viswambharan
7191a7c1cfeSJeenu Viswambharan# When FAULT_INJECTION_SUPPORT is used, require that RAS_EXTENSION is enabled
7201a7c1cfeSJeenu Viswambharanifeq ($(FAULT_INJECTION_SUPPORT),1)
7211a7c1cfeSJeenu Viswambharan    ifneq ($(RAS_EXTENSION),1)
7221a7c1cfeSJeenu Viswambharan        $(error For FAULT_INJECTION_SUPPORT, RAS_EXTENSION must also be 1)
7231a7c1cfeSJeenu Viswambharan    endif
7241a7c1cfeSJeenu Viswambharanendif
7251a7c1cfeSJeenu Viswambharan
726ed51b51fSRoberto Vargas# DYN_DISABLE_AUTH can be set only when TRUSTED_BOARD_BOOT=1
727209a60ccSSoby Mathewifeq ($(DYN_DISABLE_AUTH), 1)
728209a60ccSSoby Mathew    ifeq (${TRUSTED_BOARD_BOOT}, 0)
729209a60ccSSoby Mathew        $(error "TRUSTED_BOARD_BOOT must be enabled for DYN_DISABLE_AUTH to be set.")
730209a60ccSSoby Mathew    endif
731209a60ccSSoby Mathewendif
732209a60ccSSoby Mathew
733c9c56f6eSManish V Badarkheifneq ($(filter 1,${MEASURED_BOOT} ${TRUSTED_BOARD_BOOT}),)
734c9c56f6eSManish V Badarkhe    CRYPTO_SUPPORT := 1
735c9c56f6eSManish V Badarkheelse
736c9c56f6eSManish V Badarkhe    CRYPTO_SUPPORT := 0
737c9c56f6eSManish V Badarkheendif
738c9c56f6eSManish V Badarkhe
739cbf9e84aSBalint Dobszay# SDEI_IN_FCONF is only supported when SDEI_SUPPORT is enabled.
740cbf9e84aSBalint Dobszayifeq ($(SDEI_SUPPORT)-$(SDEI_IN_FCONF),0-1)
741700e7685SManish Pandey$(error "SDEI_IN_FCONF is only supported when SDEI_SUPPORT is enabled")
74284ef9cd8SManish V Badarkheendif
74384ef9cd8SManish V Badarkhe
744b86048c4SAntonio Nino Diaz# If pointer authentication is used in the firmware, make sure that all the
7459fc59639SAlexei Fedorov# registers associated to it are also saved and restored.
7469fc59639SAlexei Fedorov# Not doing it would leak the value of the keys used by EL3 to EL1 and S-EL1.
747b86048c4SAntonio Nino Diazifeq ($(ENABLE_PAUTH),1)
7489fc59639SAlexei Fedorov    ifeq ($(CTX_INCLUDE_PAUTH_REGS),0)
7499fc59639SAlexei Fedorov        $(error Pointer Authentication requires CTX_INCLUDE_PAUTH_REGS=1)
75006715f85SAlexei Fedorov    endif
7519fc59639SAlexei Fedorovendif
7529fc59639SAlexei Fedorov
75306715f85SAlexei Fedorovifeq ($(CTX_INCLUDE_PAUTH_REGS),1)
7549fc59639SAlexei Fedorov    ifneq (${ARCH},aarch64)
7559fc59639SAlexei Fedorov        $(error CTX_INCLUDE_PAUTH_REGS requires AArch64)
756b86048c4SAntonio Nino Diaz    endif
757b86048c4SAntonio Nino Diazendif
7589fc59639SAlexei Fedorov
7599dd94382SJustin Chadwellifeq ($(CTX_INCLUDE_MTE_REGS),1)
7609dd94382SJustin Chadwell    ifneq (${ARCH},aarch64)
7619dd94382SJustin Chadwell        $(error CTX_INCLUDE_MTE_REGS requires AArch64)
7629dd94382SJustin Chadwell    endif
7639dd94382SJustin Chadwellendif
7649dd94382SJustin Chadwell
765396b339dSManish V Badarkheifeq ($(PSA_FWU_SUPPORT),1)
766396b339dSManish V Badarkhe    $(info PSA_FWU_SUPPORT is an experimental feature)
767396b339dSManish V Badarkheendif
768396b339dSManish V Badarkhe
7696a0da736SJayanth Dodderi Chidanandifeq ($(FEATURE_DETECTION),1)
7706a0da736SJayanth Dodderi Chidanand    $(info FEATURE_DETECTION is an experimental feature)
7716a0da736SJayanth Dodderi Chidanandendif
7726a0da736SJayanth Dodderi Chidanand
77360e8f3cfSPetre-Ionut Tudorifeq (${ARM_XLAT_TABLES_LIB_V1}, 1)
77460e8f3cfSPetre-Ionut Tudor    ifeq (${ALLOW_RO_XLAT_TABLES}, 1)
77560e8f3cfSPetre-Ionut Tudor        $(error "ALLOW_RO_XLAT_TABLES requires translation tables library v2")
77660e8f3cfSPetre-Ionut Tudor    endif
77760e8f3cfSPetre-Ionut Tudorendif
77860e8f3cfSPetre-Ionut Tudor
7797cda17bbSSumit Gargifneq (${DECRYPTION_SUPPORT},none)
7807cda17bbSSumit Garg    ifeq (${TRUSTED_BOARD_BOOT}, 0)
7817cda17bbSSumit Garg        $(error TRUSTED_BOARD_BOOT must be enabled for DECRYPTION_SUPPORT to be set)
7827cda17bbSSumit Garg    endif
7837cda17bbSSumit Gargendif
7847cda17bbSSumit Garg
785744ad974Sjohpow01# Ensure that no Aarch64-only features are enabled in Aarch32 build
786dc78e62dSjohpow01ifeq (${ARCH},aarch32)
787744ad974Sjohpow01
788744ad974Sjohpow01    # SME/SVE only supported on AArch64
789dc78e62dSjohpow01    ifeq (${ENABLE_SME_FOR_NS},1)
790dc78e62dSjohpow01        $(error "ENABLE_SME_FOR_NS cannot be used with ARCH=aarch32")
791dc78e62dSjohpow01    endif
792dc78e62dSjohpow01    ifeq (${ENABLE_SVE_FOR_NS},1)
793dc78e62dSjohpow01        # Warning instead of error due to CI dependency on this
79424ab2c0aSYann Gautier        $(error "ENABLE_SVE_FOR_NS cannot be used with ARCH=aarch32")
795dc78e62dSjohpow01    endif
796744ad974Sjohpow01
797ff86e0b4SJuan Pablo Conde    # BRBE is not supported in AArch32
798744ad974Sjohpow01    ifeq (${ENABLE_BRBE_FOR_NS},1)
799744ad974Sjohpow01        $(error "ENABLE_BRBE_FOR_NS cannot be used with ARCH=aarch32")
800744ad974Sjohpow01    endif
801744ad974Sjohpow01
802ff86e0b4SJuan Pablo Conde    # FEAT_RNG_TRAP is not supported in AArch32
803ff86e0b4SJuan Pablo Conde    ifeq (${ENABLE_FEAT_RNG_TRAP},1)
804ff86e0b4SJuan Pablo Conde        $(error "ENABLE_FEAT_RNG_TRAP cannot be used with ARCH=aarch32")
805ff86e0b4SJuan Pablo Conde    endif
806dc78e62dSjohpow01endif
807dc78e62dSjohpow01
808dc78e62dSjohpow01# Ensure ENABLE_RME is not used with SME
809dc78e62dSjohpow01ifeq (${ENABLE_RME},1)
810dc78e62dSjohpow01    ifeq (${ENABLE_SME_FOR_NS},1)
811dc78e62dSjohpow01        $(error "ENABLE_SME_FOR_NS cannot be used with ENABLE_RME")
812dc78e62dSjohpow01    endif
813dc78e62dSjohpow01endif
814dc78e62dSjohpow01
815dc78e62dSjohpow01# Secure SME/SVE requires the non-secure component as well
816dc78e62dSjohpow01ifeq (${ENABLE_SME_FOR_SWD},1)
817dc78e62dSjohpow01    ifeq (${ENABLE_SME_FOR_NS},0)
818dc78e62dSjohpow01        $(error "ENABLE_SME_FOR_SWD requires ENABLE_SME_FOR_NS")
819dc78e62dSjohpow01    endif
820dc78e62dSjohpow01endif
821dc78e62dSjohpow01ifeq (${ENABLE_SVE_FOR_SWD},1)
822dc78e62dSjohpow01    ifeq (${ENABLE_SVE_FOR_NS},0)
823dc78e62dSjohpow01        $(error "ENABLE_SVE_FOR_SWD requires ENABLE_SVE_FOR_NS")
824dc78e62dSjohpow01    endif
825dc78e62dSjohpow01endif
826dc78e62dSjohpow01
827dc78e62dSjohpow01# SVE and SME cannot be used with CTX_INCLUDE_FPREGS since secure manager does
828dc78e62dSjohpow01# its own context management including FPU registers.
829dc78e62dSjohpow01ifeq (${CTX_INCLUDE_FPREGS},1)
830dc78e62dSjohpow01    ifeq (${ENABLE_SME_FOR_NS},1)
831dc78e62dSjohpow01        $(error "ENABLE_SME_FOR_NS cannot be used with CTX_INCLUDE_FPREGS")
832dc78e62dSjohpow01    endif
833dc78e62dSjohpow01    ifeq (${ENABLE_SVE_FOR_NS},1)
834dc78e62dSjohpow01        # Warning instead of error due to CI dependency on this
835dc78e62dSjohpow01        $(warning "ENABLE_SVE_FOR_NS cannot be used with CTX_INCLUDE_FPREGS")
836dc78e62dSjohpow01        $(warning "Forced ENABLE_SVE_FOR_NS=0")
837dc78e62dSjohpow01        override ENABLE_SVE_FOR_NS	:= 0
838dc78e62dSjohpow01    endif
839dc78e62dSjohpow01endif
840dc78e62dSjohpow01
84100e28874SManish V Badarkheifeq ($(DRTM_SUPPORT),1)
84200e28874SManish V Badarkhe    $(info DRTM_SUPPORT is an experimental feature)
84300e28874SManish V Badarkheendif
84400e28874SManish V Badarkhe
845*274a69e7SChris Kayifeq (${ENABLE_RME},1)
846*274a69e7SChris Kay    ifneq (${SEPARATE_CODE_AND_RODATA},1)
847*274a69e7SChris Kay        $(error `ENABLE_RME=1` requires `SEPARATE_CODE_AND_RODATA=1`)
848*274a69e7SChris Kay    endif
849*274a69e7SChris Kayendif
850*274a69e7SChris Kay
851cf2c8a33SAntonio Nino Diaz################################################################################
85273c99d4eSJuan Castillo# Process platform overrideable behaviour
85373c99d4eSJuan Castillo################################################################################
8544f6ad66aSAchin Gupta
8555f24ce96SManish Pandeyifdef BL1_SOURCES
8565f24ce96SManish PandeyNEED_BL1 := yes
8575f24ce96SManish Pandeyendif
8585f24ce96SManish Pandey
8595f24ce96SManish Pandeyifdef BL2_SOURCES
8605f24ce96SManish Pandey	NEED_BL2 := yes
8615f24ce96SManish Pandey
862bd97f83aSJohn Tsichritzis	# Using BL2 implies that a BL33 image also needs to be supplied for the FIP and
863bd97f83aSJohn Tsichritzis	# Certificate generation tools. This flag can be overridden by the platform.
864cf2c8a33SAntonio Nino Diaz	ifdef EL3_PAYLOAD_BASE
865cf2c8a33SAntonio Nino Diaz                # If booting an EL3 payload there is no need for a BL33 image
866cf2c8a33SAntonio Nino Diaz                # in the FIP file.
8674c117f6cSSandrine Bailleux                NEED_BL33		:=	no
868cf2c8a33SAntonio Nino Diaz        else
86968450a6dSAntonio Nino Diaz                ifdef PRELOADED_BL33_BASE
870cf2c8a33SAntonio Nino Diaz                        # If booting a BL33 preloaded image there is no need of
871cf2c8a33SAntonio Nino Diaz                        # another one in the FIP file.
872cf2c8a33SAntonio Nino Diaz                        NEED_BL33		:=	no
873cf2c8a33SAntonio Nino Diaz                else
874cf2c8a33SAntonio Nino Diaz                        NEED_BL33		?=	yes
875cf2c8a33SAntonio Nino Diaz                endif
8764c117f6cSSandrine Bailleux        endif
87773c99d4eSJuan Castilloendif
8786f971622SJuan Castillo
8795f24ce96SManish Pandeyifdef BL2U_SOURCES
8805f24ce96SManish PandeyNEED_BL2U := yes
8815f24ce96SManish Pandeyendif
8825f24ce96SManish Pandey
8834d045d0eSMasahiro Yamada# If SCP_BL2 is given, we always want FIP to include it.
8844d045d0eSMasahiro Yamadaifdef SCP_BL2
8854d045d0eSMasahiro Yamada        NEED_SCP_BL2		:=	yes
8864d045d0eSMasahiro Yamadaendif
8874d045d0eSMasahiro Yamada
8885744e874SSoby Mathew# For AArch32, BL31 is not currently supported.
8895744e874SSoby Mathewifneq (${ARCH},aarch32)
8905744e874SSoby Mathew    ifdef BL31_SOURCES
8915744e874SSoby Mathew        # When booting an EL3 payload, there is no need to compile the BL31 image nor
8925744e874SSoby Mathew        # put it in the FIP.
8935744e874SSoby Mathew        ifndef EL3_PAYLOAD_BASE
8945744e874SSoby Mathew            NEED_BL31 := yes
8955744e874SSoby Mathew        endif
8965744e874SSoby Mathew    endif
8975744e874SSoby Mathewendif
8985744e874SSoby Mathew
89973c99d4eSJuan Castillo# Process TBB related flags
9006f971622SJuan Castilloifneq (${GENERATE_COT},0)
90173c99d4eSJuan Castillo        # Common cert_create options
9026f971622SJuan Castillo        ifneq (${CREATE_KEYS},0)
9036f971622SJuan Castillo                $(eval CRT_ARGS += -n)
9040191262dSYatharth Kochar                $(eval FWU_CRT_ARGS += -n)
905fd34e7baSJuan Castillo                ifneq (${SAVE_KEYS},0)
906fd34e7baSJuan Castillo                        $(eval CRT_ARGS += -k)
9070191262dSYatharth Kochar                        $(eval FWU_CRT_ARGS += -k)
908fd34e7baSJuan Castillo                endif
9096f971622SJuan Castillo        endif
91073c99d4eSJuan Castillo        # Include TBBR makefile (unless the platform indicates otherwise)
91173c99d4eSJuan Castillo        ifeq (${INCLUDE_TBBR_MK},1)
91273c99d4eSJuan Castillo                include make_helpers/tbbr/tbbr_tools.mk
91373c99d4eSJuan Castillo        endif
9146f971622SJuan Castilloendif
9156f971622SJuan Castillo
9161c75d5dfSMasahiro Yamadaifneq (${FIP_ALIGN},0)
9171c75d5dfSMasahiro YamadaFIP_ARGS += --align ${FIP_ALIGN}
9181c75d5dfSMasahiro Yamadaendif
9191c75d5dfSMasahiro Yamada
9205f24ce96SManish Pandeyifdef FDT_SOURCES
9215f24ce96SManish PandeyNEED_FDT := yes
9225f24ce96SManish Pandeyendif
9235f24ce96SManish Pandey
92473c99d4eSJuan Castillo################################################################################
92546e5e035SMichalis Pappas# Include libraries' Makefile that are used in all BL
92646e5e035SMichalis Pappas################################################################################
92746e5e035SMichalis Pappas
92846e5e035SMichalis Pappasinclude lib/stack_protector/stack_protector.mk
92946e5e035SMichalis Pappas
93046e5e035SMichalis Pappas################################################################################
931819281eeSdp-arm# Auxiliary tools (fiptool, cert_create, etc)
93273c99d4eSJuan Castillo################################################################################
93373c99d4eSJuan Castillo
93473c99d4eSJuan Castillo# Variables for use with Certificate Generation Tool
93573c99d4eSJuan CastilloCRTTOOLPATH		?=	tools/cert_create
93642a45b51SEvan LloydCRTTOOL			?=	${CRTTOOLPATH}/cert_create${BIN_EXT}
93773c99d4eSJuan Castillo
93890aa901fSSumit Garg# Variables for use with Firmware Encryption Tool
93990aa901fSSumit GargENCTOOLPATH		?=	tools/encrypt_fw
94090aa901fSSumit GargENCTOOL			?=	${ENCTOOLPATH}/encrypt_fw${BIN_EXT}
94190aa901fSSumit Garg
94273c99d4eSJuan Castillo# Variables for use with Firmware Image Package
943819281eeSdp-armFIPTOOLPATH		?=	tools/fiptool
944819281eeSdp-armFIPTOOL			?=	${FIPTOOLPATH}/fiptool${BIN_EXT}
94573c99d4eSJuan Castillo
94626010da1SAntonio Nino Diaz# Variables for use with sptool
94726010da1SAntonio Nino DiazSPTOOLPATH		?=	tools/sptool
948822c7279SJ-AlvesSPTOOL			?=	${SPTOOLPATH}/sptool.py
949ce2b1ec6SManish PandeySP_MK_GEN		?=	${SPTOOLPATH}/sp_mk_generator.py
95026010da1SAntonio Nino Diaz
9515accce5bSRoberto Vargas# Variables for use with ROMLIB
9525accce5bSRoberto VargasROMLIBPATH		?=	lib/romlib
9535accce5bSRoberto Vargas
954cfe83910SLouis Mayencourt# Variable for use with Python
955cfe83910SLouis MayencourtPYTHON			?=	python3
956cfe83910SLouis Mayencourt
957cfe83910SLouis Mayencourt# Variables for use with PRINT_MEMORY_MAP
958cfe83910SLouis MayencourtPRINT_MEMORY_MAP_PATH		?=	tools/memory
959cfe83910SLouis MayencourtPRINT_MEMORY_MAP		?=	${PRINT_MEMORY_MAP_PATH}/print_memory_map.py
960cfe83910SLouis Mayencourt
9616de32378SMadhukar Pappireddy# Variables for use with documentation build using Sphinx tool
9626de32378SMadhukar PappireddyDOCS_PATH		?=	docs
9636de32378SMadhukar Pappireddy
9641f1c0206SAbdul Halim, Muhammad Hadi Asyrafi# Defination of SIMICS flag
9651f1c0206SAbdul Halim, Muhammad Hadi AsyrafiSIMICS_BUILD	?=	0
9661f1c0206SAbdul Halim, Muhammad Hadi Asyrafi
9678a86052dSSoby Mathew################################################################################
9688a86052dSSoby Mathew# Include BL specific makefiles
9698a86052dSSoby Mathew################################################################################
9705f24ce96SManish Pandey
9715f24ce96SManish Pandeyifeq (${NEED_BL1},yes)
9728a86052dSSoby Mathewinclude bl1/bl1.mk
9738a86052dSSoby Mathewendif
9748a86052dSSoby Mathew
9755f24ce96SManish Pandeyifeq (${NEED_BL2},yes)
9768a86052dSSoby Mathewinclude bl2/bl2.mk
9778a86052dSSoby Mathewendif
9788a86052dSSoby Mathew
9795f24ce96SManish Pandeyifeq (${NEED_BL2U},yes)
9808a86052dSSoby Mathewinclude bl2u/bl2u.mk
9818a86052dSSoby Mathewendif
9828a86052dSSoby Mathew
9835744e874SSoby Mathewifeq (${NEED_BL31},yes)
9848a86052dSSoby Mathewinclude bl31/bl31.mk
9858a86052dSSoby Mathewendif
98603b397a8SNishanth Menon
98773c99d4eSJuan Castillo################################################################################
98873c99d4eSJuan Castillo# Build options checks
98973c99d4eSJuan Castillo################################################################################
99073c99d4eSJuan Castillo
991327131c4SLeonardo Sandoval$(eval $(call assert_booleans,\
992327131c4SLeonardo Sandoval    $(sort \
993327131c4SLeonardo Sandoval        ALLOW_RO_XLAT_TABLES \
99446789a7cSBalint Dobszay        BL2_ENABLE_SP_LOAD \
995327131c4SLeonardo Sandoval        COLD_BOOT_SINGLE_CPU \
996327131c4SLeonardo Sandoval        CREATE_KEYS \
997327131c4SLeonardo Sandoval        CTX_INCLUDE_AARCH32_REGS \
998327131c4SLeonardo Sandoval        CTX_INCLUDE_FPREGS \
999327131c4SLeonardo Sandoval        CTX_INCLUDE_EL2_REGS \
1000327131c4SLeonardo Sandoval        DEBUG \
10010063dd17SJavier Almansa Sobrino        DISABLE_MTPMU \
1002327131c4SLeonardo Sandoval        DYN_DISABLE_AUTH \
1003327131c4SLeonardo Sandoval        EL3_EXCEPTION_HANDLING \
1004327131c4SLeonardo Sandoval        ENABLE_AMU \
10051fd685a7SChris Kay        ENABLE_AMU_AUXILIARY_COUNTERS \
1006742ca230SChris Kay        ENABLE_AMU_FCONF \
1007873d4241Sjohpow01        AMU_RESTRICT_COUNTERS \
1008327131c4SLeonardo Sandoval        ENABLE_ASSERTIONS \
1009327131c4SLeonardo Sandoval        ENABLE_PIE \
1010327131c4SLeonardo Sandoval        ENABLE_PMF \
1011327131c4SLeonardo Sandoval        ENABLE_PSCI_STAT \
1012327131c4SLeonardo Sandoval        ENABLE_RUNTIME_INSTRUMENTATION \
1013dc78e62dSjohpow01        ENABLE_SME_FOR_NS \
1014dc78e62dSjohpow01        ENABLE_SME_FOR_SWD \
1015327131c4SLeonardo Sandoval        ENABLE_SPE_FOR_LOWER_ELS \
1016327131c4SLeonardo Sandoval        ENABLE_SVE_FOR_NS \
10170c5e7d1cSMax Shvetsov        ENABLE_SVE_FOR_SWD \
1018327131c4SLeonardo Sandoval        ERROR_DEPRECATED \
1019327131c4SLeonardo Sandoval        FAULT_INJECTION_SUPPORT \
1020327131c4SLeonardo Sandoval        GENERATE_COT \
1021327131c4SLeonardo Sandoval        GICV2_G0_FOR_EL3 \
1022327131c4SLeonardo Sandoval        HANDLE_EA_EL3_FIRST \
1023327131c4SLeonardo Sandoval        HW_ASSISTED_COHERENCY \
1024327131c4SLeonardo Sandoval        INVERTED_MEMMAP \
1025327131c4SLeonardo Sandoval        MEASURED_BOOT \
102600e28874SManish V Badarkhe        DRTM_SUPPORT \
1027327131c4SLeonardo Sandoval        NS_TIMER_SWITCH \
1028327131c4SLeonardo Sandoval        OVERRIDE_LIBC \
1029327131c4SLeonardo Sandoval        PL011_GENERIC_UART \
10300ce2072dSTamas Ban        PLAT_RSS_NOT_SUPPORTED \
1031327131c4SLeonardo Sandoval        PROGRAMMABLE_RESET_ADDRESS \
1032327131c4SLeonardo Sandoval        PSCI_EXTENDED_STATE_ID \
1033327131c4SLeonardo Sandoval        RESET_TO_BL31 \
103425844ff7SJorge Ramirez-Ortiz        RESET_TO_BL31_WITH_PARAMS \
1035327131c4SLeonardo Sandoval        SAVE_KEYS \
1036327131c4SLeonardo Sandoval        SEPARATE_CODE_AND_RODATA \
103796a8ed14SJiafei Pan        SEPARATE_BL2_NOLOAD_REGION \
1038327131c4SLeonardo Sandoval        SEPARATE_NOBITS_REGION \
1039327131c4SLeonardo Sandoval        SPIN_ON_BL1_EXIT \
1040327131c4SLeonardo Sandoval        SPM_MM \
10411d63ae4dSMarc Bonnici        SPMC_AT_EL3 \
1042327131c4SLeonardo Sandoval        SPMD_SPM_AT_SEL2 \
1043327131c4SLeonardo Sandoval        TRUSTED_BOARD_BOOT \
1044c9c56f6eSManish V Badarkhe        CRYPTO_SUPPORT \
1045327131c4SLeonardo Sandoval        USE_COHERENT_MEM \
1046327131c4SLeonardo Sandoval        USE_DEBUGFS \
1047327131c4SLeonardo Sandoval        ARM_IO_IN_DTB \
1048327131c4SLeonardo Sandoval        SDEI_IN_FCONF \
1049327131c4SLeonardo Sandoval        SEC_INT_DESC_IN_FCONF \
1050327131c4SLeonardo Sandoval        USE_ROMLIB \
1051327131c4SLeonardo Sandoval        USE_TBBR_DEFS \
1052327131c4SLeonardo Sandoval        WARMBOOT_ENABLE_DCACHE_EARLY \
1053327131c4SLeonardo Sandoval        BL2_AT_EL3 \
1054327131c4SLeonardo Sandoval        BL2_IN_XIP_MEM \
1055327131c4SLeonardo Sandoval        BL2_INV_DCACHE \
1056327131c4SLeonardo Sandoval        USE_SPINLOCK_CAS \
1057327131c4SLeonardo Sandoval        ENCRYPT_BL31 \
1058327131c4SLeonardo Sandoval        ENCRYPT_BL32 \
1059327131c4SLeonardo Sandoval        ERRATA_SPECULATIVE_AT \
106000e8f79cSManish Pandey        RAS_TRAP_NS_ERR_REC_ACCESS \
1061327131c4SLeonardo Sandoval        COT_DESC_IN_DTB \
1062327131c4SLeonardo Sandoval        USE_SP804_TIMER \
1063396b339dSManish V Badarkhe        PSA_FWU_SUPPORT \
1064d4582d30SManish V Badarkhe        ENABLE_SYS_REG_TRACE_FOR_NS \
106568120783SChris Kay        ENABLE_MPMM \
106668120783SChris Kay        ENABLE_MPMM_FCONF \
10671f1c0206SAbdul Halim, Muhammad Hadi Asyrafi        SIMICS_BUILD \
10686a0da736SJayanth Dodderi Chidanand        FEATURE_DETECTION \
1069327131c4SLeonardo Sandoval)))
107073c99d4eSJuan Castillo
1071327131c4SLeonardo Sandoval$(eval $(call assert_numerics,\
1072327131c4SLeonardo Sandoval    $(sort \
1073327131c4SLeonardo Sandoval        ARM_ARCH_MAJOR \
1074327131c4SLeonardo Sandoval        ARM_ARCH_MINOR \
1075327131c4SLeonardo Sandoval        BRANCH_PROTECTION \
10766a0da736SJayanth Dodderi Chidanand        CTX_INCLUDE_PAUTH_REGS \
10776a0da736SJayanth Dodderi Chidanand        CTX_INCLUDE_MTE_REGS \
10786a0da736SJayanth Dodderi Chidanand        CTX_INCLUDE_NEVE_REGS \
10791298f2f1SJayanth Dodderi Chidanand        ENABLE_BRBE_FOR_NS \
108047c681b7SJayanth Dodderi Chidanand        ENABLE_TRBE_FOR_NS \
10816a0da736SJayanth Dodderi Chidanand        ENABLE_BTI \
10826a0da736SJayanth Dodderi Chidanand        ENABLE_PAUTH \
10836a0da736SJayanth Dodderi Chidanand        ENABLE_FEAT_AMUv1 \
10846a0da736SJayanth Dodderi Chidanand        ENABLE_FEAT_AMUv1p1 \
10856a0da736SJayanth Dodderi Chidanand        ENABLE_FEAT_CSV2_2 \
10866a0da736SJayanth Dodderi Chidanand        ENABLE_FEAT_DIT \
10876a0da736SJayanth Dodderi Chidanand        ENABLE_FEAT_ECV \
10886a0da736SJayanth Dodderi Chidanand        ENABLE_FEAT_FGT \
10896a0da736SJayanth Dodderi Chidanand        ENABLE_FEAT_HCX \
10906a0da736SJayanth Dodderi Chidanand        ENABLE_FEAT_PAN \
10916a0da736SJayanth Dodderi Chidanand        ENABLE_FEAT_RNG \
1092ff86e0b4SJuan Pablo Conde        ENABLE_FEAT_RNG_TRAP \
10936a0da736SJayanth Dodderi Chidanand        ENABLE_FEAT_SB \
10946a0da736SJayanth Dodderi Chidanand        ENABLE_FEAT_SEL2 \
10956a0da736SJayanth Dodderi Chidanand        ENABLE_FEAT_VHE \
10966a0da736SJayanth Dodderi Chidanand        ENABLE_MPAM_FOR_LOWER_ELS \
10976a0da736SJayanth Dodderi Chidanand        ENABLE_RME \
10986a0da736SJayanth Dodderi Chidanand        ENABLE_TRF_FOR_NS \
1099327131c4SLeonardo Sandoval        FW_ENC_STATUS \
11005357f83dSManish V Badarkhe        NR_OF_FW_BANKS \
11015357f83dSManish V Badarkhe        NR_OF_IMAGES_IN_FW_BANK \
11026a0da736SJayanth Dodderi Chidanand        RAS_EXTENSION \
1103781d07a4SJayanth Dodderi Chidanand        TWED_DELAY \
1104781d07a4SJayanth Dodderi Chidanand        ENABLE_FEAT_TWED \
1105bebcf27fSMark Brown        SVE_VECTOR_LEN \
1106327131c4SLeonardo Sandoval)))
1107c877b414SJeenu Viswambharan
1108aacff749SJustin Chadwellifdef KEY_SIZE
1109aacff749SJustin Chadwell        $(eval $(call assert_numeric,KEY_SIZE))
1110aacff749SJustin Chadwellendif
1111aacff749SJustin Chadwell
11121f461979SJustin Chadwellifeq ($(filter $(SANITIZE_UB), on off trap),)
11131f461979SJustin Chadwell        $(error "Invalid value for SANITIZE_UB: can be one of on, off, trap")
11141f461979SJustin Chadwellendif
11151f461979SJustin Chadwell
111673c99d4eSJuan Castillo################################################################################
111773c99d4eSJuan Castillo# Add definitions to the cpp preprocessor based on the current build options.
111873c99d4eSJuan Castillo# This is done after including the platform specific makefile to allow the
111973c99d4eSJuan Castillo# platform to overwrite the default options
112073c99d4eSJuan Castillo################################################################################
112173c99d4eSJuan Castillo
1122327131c4SLeonardo Sandoval$(eval $(call add_defines,\
1123327131c4SLeonardo Sandoval    $(sort \
1124327131c4SLeonardo Sandoval        ALLOW_RO_XLAT_TABLES \
1125327131c4SLeonardo Sandoval        ARM_ARCH_MAJOR \
1126327131c4SLeonardo Sandoval        ARM_ARCH_MINOR \
112746789a7cSBalint Dobszay        BL2_ENABLE_SP_LOAD \
1128327131c4SLeonardo Sandoval        COLD_BOOT_SINGLE_CPU \
1129327131c4SLeonardo Sandoval        CTX_INCLUDE_AARCH32_REGS \
1130327131c4SLeonardo Sandoval        CTX_INCLUDE_FPREGS \
1131327131c4SLeonardo Sandoval        CTX_INCLUDE_PAUTH_REGS \
1132327131c4SLeonardo Sandoval        EL3_EXCEPTION_HANDLING \
1133327131c4SLeonardo Sandoval        CTX_INCLUDE_MTE_REGS \
1134327131c4SLeonardo Sandoval        CTX_INCLUDE_EL2_REGS \
1135062f8aafSArunachalam Ganapathy        CTX_INCLUDE_NEVE_REGS \
1136327131c4SLeonardo Sandoval        DECRYPTION_SUPPORT_${DECRYPTION_SUPPORT} \
11370063dd17SJavier Almansa Sobrino        DISABLE_MTPMU \
1138327131c4SLeonardo Sandoval        ENABLE_AMU \
11391fd685a7SChris Kay        ENABLE_AMU_AUXILIARY_COUNTERS \
1140742ca230SChris Kay        ENABLE_AMU_FCONF \
1141873d4241Sjohpow01        AMU_RESTRICT_COUNTERS \
1142327131c4SLeonardo Sandoval        ENABLE_ASSERTIONS \
1143327131c4SLeonardo Sandoval        ENABLE_BTI \
1144327131c4SLeonardo Sandoval        ENABLE_MPAM_FOR_LOWER_ELS \
1145327131c4SLeonardo Sandoval        ENABLE_PAUTH \
1146327131c4SLeonardo Sandoval        ENABLE_PIE \
1147327131c4SLeonardo Sandoval        ENABLE_PMF \
1148327131c4SLeonardo Sandoval        ENABLE_PSCI_STAT \
11495b18de09SZelalem Aweke        ENABLE_RME \
1150327131c4SLeonardo Sandoval        ENABLE_RUNTIME_INSTRUMENTATION \
1151dc78e62dSjohpow01        ENABLE_SME_FOR_NS \
1152dc78e62dSjohpow01        ENABLE_SME_FOR_SWD \
1153327131c4SLeonardo Sandoval        ENABLE_SPE_FOR_LOWER_ELS \
1154327131c4SLeonardo Sandoval        ENABLE_SVE_FOR_NS \
11550c5e7d1cSMax Shvetsov        ENABLE_SVE_FOR_SWD \
1156327131c4SLeonardo Sandoval        ENCRYPT_BL31 \
1157327131c4SLeonardo Sandoval        ENCRYPT_BL32 \
1158327131c4SLeonardo Sandoval        ERROR_DEPRECATED \
1159327131c4SLeonardo Sandoval        FAULT_INJECTION_SUPPORT \
1160327131c4SLeonardo Sandoval        GICV2_G0_FOR_EL3 \
1161327131c4SLeonardo Sandoval        HANDLE_EA_EL3_FIRST \
1162327131c4SLeonardo Sandoval        HW_ASSISTED_COHERENCY \
1163327131c4SLeonardo Sandoval        LOG_LEVEL \
1164327131c4SLeonardo Sandoval        MEASURED_BOOT \
116500e28874SManish V Badarkhe        DRTM_SUPPORT \
1166327131c4SLeonardo Sandoval        NS_TIMER_SWITCH \
1167327131c4SLeonardo Sandoval        PL011_GENERIC_UART \
1168327131c4SLeonardo Sandoval        PLAT_${PLAT} \
11690ce2072dSTamas Ban        PLAT_RSS_NOT_SUPPORTED \
1170327131c4SLeonardo Sandoval        PROGRAMMABLE_RESET_ADDRESS \
1171327131c4SLeonardo Sandoval        PSCI_EXTENDED_STATE_ID \
1172327131c4SLeonardo Sandoval        RAS_EXTENSION \
1173327131c4SLeonardo Sandoval        RESET_TO_BL31 \
117425844ff7SJorge Ramirez-Ortiz        RESET_TO_BL31_WITH_PARAMS \
1175327131c4SLeonardo Sandoval        SEPARATE_CODE_AND_RODATA \
117696a8ed14SJiafei Pan        SEPARATE_BL2_NOLOAD_REGION \
1177327131c4SLeonardo Sandoval        SEPARATE_NOBITS_REGION \
1178327131c4SLeonardo Sandoval        RECLAIM_INIT_CODE \
1179327131c4SLeonardo Sandoval        SPD_${SPD} \
1180327131c4SLeonardo Sandoval        SPIN_ON_BL1_EXIT \
1181327131c4SLeonardo Sandoval        SPM_MM \
11821d63ae4dSMarc Bonnici        SPMC_AT_EL3 \
1183327131c4SLeonardo Sandoval        SPMD_SPM_AT_SEL2 \
1184327131c4SLeonardo Sandoval        TRUSTED_BOARD_BOOT \
1185c9c56f6eSManish V Badarkhe        CRYPTO_SUPPORT \
11867dfb9911SJimmy Brisson        TRNG_SUPPORT \
1187327131c4SLeonardo Sandoval        USE_COHERENT_MEM \
1188327131c4SLeonardo Sandoval        USE_DEBUGFS \
1189327131c4SLeonardo Sandoval        ARM_IO_IN_DTB \
1190327131c4SLeonardo Sandoval        SDEI_IN_FCONF \
1191327131c4SLeonardo Sandoval        SEC_INT_DESC_IN_FCONF \
1192327131c4SLeonardo Sandoval        USE_ROMLIB \
1193327131c4SLeonardo Sandoval        USE_TBBR_DEFS \
1194327131c4SLeonardo Sandoval        WARMBOOT_ENABLE_DCACHE_EARLY \
1195327131c4SLeonardo Sandoval        BL2_AT_EL3 \
1196327131c4SLeonardo Sandoval        BL2_IN_XIP_MEM \
1197327131c4SLeonardo Sandoval        BL2_INV_DCACHE \
1198327131c4SLeonardo Sandoval        USE_SPINLOCK_CAS \
1199327131c4SLeonardo Sandoval        ERRATA_SPECULATIVE_AT \
120000e8f79cSManish Pandey        RAS_TRAP_NS_ERR_REC_ACCESS \
1201327131c4SLeonardo Sandoval        COT_DESC_IN_DTB \
1202327131c4SLeonardo Sandoval        USE_SP804_TIMER \
120312cd65e0STomas Pilar        ENABLE_FEAT_RNG \
1204ff86e0b4SJuan Pablo Conde        ENABLE_FEAT_RNG_TRAP \
12054e04478aSChris Kay        ENABLE_FEAT_SB \
12067d33ffe4SDaniel Boulby        ENABLE_FEAT_DIT \
12075357f83dSManish V Badarkhe        NR_OF_FW_BANKS \
12085357f83dSManish V Badarkhe        NR_OF_IMAGES_IN_FW_BANK \
1209396b339dSManish V Badarkhe        PSA_FWU_SUPPORT \
1210744ad974Sjohpow01        ENABLE_BRBE_FOR_NS \
1211813524eaSManish V Badarkhe        ENABLE_TRBE_FOR_NS \
1212d4582d30SManish V Badarkhe        ENABLE_SYS_REG_TRACE_FOR_NS \
12138fcd3d96SManish V Badarkhe        ENABLE_TRF_FOR_NS \
1214cb4ec47bSjohpow01        ENABLE_FEAT_HCX \
121568120783SChris Kay        ENABLE_MPMM \
121668120783SChris Kay        ENABLE_MPMM_FCONF \
1217f74cb0beSJayanth Dodderi Chidanand        ENABLE_FEAT_FGT \
1218f74cb0beSJayanth Dodderi Chidanand        ENABLE_FEAT_AMUv1 \
1219f74cb0beSJayanth Dodderi Chidanand        ENABLE_FEAT_ECV \
12201f1c0206SAbdul Halim, Muhammad Hadi Asyrafi        SIMICS_BUILD \
12216a0da736SJayanth Dodderi Chidanand        ENABLE_FEAT_AMUv1p1 \
12226a0da736SJayanth Dodderi Chidanand        ENABLE_FEAT_SEL2 \
12236a0da736SJayanth Dodderi Chidanand        ENABLE_FEAT_VHE \
12246a0da736SJayanth Dodderi Chidanand        ENABLE_FEAT_CSV2_2 \
12256a0da736SJayanth Dodderi Chidanand        ENABLE_FEAT_PAN \
12266a0da736SJayanth Dodderi Chidanand        FEATURE_DETECTION \
1227781d07a4SJayanth Dodderi Chidanand        TWED_DELAY \
1228781d07a4SJayanth Dodderi Chidanand        ENABLE_FEAT_TWED \
1229327131c4SLeonardo Sandoval)))
12302fae4b1eSJeenu Viswambharan
12311f461979SJustin Chadwellifeq (${SANITIZE_UB},trap)
12321f461979SJustin Chadwell        $(eval $(call add_define,MONITOR_TRAPS))
12331f461979SJustin Chadwellendif
12341f461979SJustin Chadwell
12354c117f6cSSandrine Bailleux# Define the EL3_PAYLOAD_BASE flag only if it is provided.
12364c117f6cSSandrine Bailleuxifdef EL3_PAYLOAD_BASE
12374c117f6cSSandrine Bailleux        $(eval $(call add_define,EL3_PAYLOAD_BASE))
1238cf2c8a33SAntonio Nino Diazelse
123968450a6dSAntonio Nino Diaz        # Define the PRELOADED_BL33_BASE flag only if it is provided and
124068450a6dSAntonio Nino Diaz        # EL3_PAYLOAD_BASE is not defined, as it has priority.
124168450a6dSAntonio Nino Diaz        ifdef PRELOADED_BL33_BASE
124268450a6dSAntonio Nino Diaz                $(eval $(call add_define,PRELOADED_BL33_BASE))
12434c117f6cSSandrine Bailleux        endif
1244cf2c8a33SAntonio Nino Diazendif
124573c99d4eSJuan Castillo
1246209a60ccSSoby Mathew# Define the DYN_DISABLE_AUTH flag only if set.
1247209a60ccSSoby Mathewifeq (${DYN_DISABLE_AUTH},1)
1248209a60ccSSoby Mathew$(eval $(call add_define,DYN_DISABLE_AUTH))
1249209a60ccSSoby Mathewendif
1250209a60ccSSoby Mathew
1251c2ad38ceSVarun Wadekarifneq ($(findstring armlink,$(notdir $(LD))),)
1252c2ad38ceSVarun Wadekar$(eval $(call add_define,USE_ARM_LINK))
1253c2ad38ceSVarun Wadekarendif
1254c2ad38ceSVarun Wadekar
1255ce2b1ec6SManish Pandey# Generate and include sp_gen.mk if SPD is spmd and SP_LAYOUT_FILE is defined
1256ce2b1ec6SManish Pandeyifeq (${SPD},spmd)
1257c33ff198SOlivier Deprezifdef SP_LAYOUT_FILE
1258ce2b1ec6SManish Pandey        -include $(BUILD_PLAT)/sp_gen.mk
1259ce2b1ec6SManish Pandey        FIP_DEPS += sp
126007c44475SManish Pandey        CRT_DEPS += sp
1261ce2b1ec6SManish Pandey        NEED_SP_PKG := yes
1262ce2b1ec6SManish Pandeyelse
1263c33ff198SOlivier Deprez        ifeq (${SPMD_SPM_AT_SEL2},1)
1264c33ff198SOlivier Deprez            $(error "SPMD with SPM at S-EL2 require SP_LAYOUT_FILE")
1265c33ff198SOlivier Deprez        endif
1266ce2b1ec6SManish Pandeyendif
1267ce2b1ec6SManish Pandeyendif
1268ce2b1ec6SManish Pandey
126973c99d4eSJuan Castillo################################################################################
127073c99d4eSJuan Castillo# Build targets
127173c99d4eSJuan Castillo################################################################################
127273c99d4eSJuan Castillo
127390aa901fSSumit Garg.PHONY:	all msg_start clean realclean distclean cscope locate-checkpatch checkcodebase checkpatch fiptool sptool fip sp fwu_fip certtool dtbs memmap doc enctool
127473c99d4eSJuan Castillo.SUFFIXES:
127573c99d4eSJuan Castillo
127673c99d4eSJuan Castilloall: msg_start
127773c99d4eSJuan Castillo
127873c99d4eSJuan Castillomsg_start:
127973c99d4eSJuan Castillo	@echo "Building ${PLAT}"
128073c99d4eSJuan Castillo
12817a24cba5SSoby Mathewifeq (${ERROR_DEPRECATED},0)
1282d5dfdeb6SJulius Werner# Check if deprecated declarations and cpp warnings should be treated as error or not.
1283c2ad38ceSVarun Wadekarifneq ($(findstring clang,$(notdir $(CC))),)
1284c2ad38ceSVarun Wadekar    CPPFLAGS		+= 	-Wno-error=deprecated-declarations
1285c2ad38ceSVarun Wadekarelse
1286bc1a03c7SDan Handley    CPPFLAGS		+= 	-Wno-error=deprecated-declarations -Wno-error=cpp
12877a24cba5SSoby Mathewendif
1288d5dfdeb6SJulius Wernerendif # !ERROR_DEPRECATED
12897a24cba5SSoby Mathew
12905accce5bSRoberto Vargas$(eval $(call MAKE_LIB_DIRS))
129161f72a34SRoberto Vargas$(eval $(call MAKE_LIB,c))
12925fee0287SRoberto Vargas
129373c99d4eSJuan Castillo# Expand build macros for the different images
129473c99d4eSJuan Castilloifeq (${NEED_BL1},yes)
1295b34635a0SChris KayBL1_SOURCES := $(sort ${BL1_SOURCES})
1296b34635a0SChris Kay
1297434d0491SZelalem Aweke$(eval $(call MAKE_BL,bl1))
129873c99d4eSJuan Castilloendif
129973c99d4eSJuan Castillo
130073c99d4eSJuan Castilloifeq (${NEED_BL2},yes)
1301c9b31ae8SRoberto Vargasifeq (${BL2_AT_EL3}, 0)
1302c9b31ae8SRoberto VargasFIP_BL2_ARGS := tb-fw
1303c9b31ae8SRoberto Vargasendif
1304c9b31ae8SRoberto Vargas
1305eb1acfb6SChris KayBL2_SOURCES := $(sort ${BL2_SOURCES})
1306eb1acfb6SChris Kay
130733950dd8SMasahiro Yamada$(if ${BL2}, $(eval $(call TOOL_ADD_IMG,bl2,--${FIP_BL2_ARGS})),\
1308434d0491SZelalem Aweke	$(eval $(call MAKE_BL,bl2,${FIP_BL2_ARGS})))
130973c99d4eSJuan Castilloendif
131073c99d4eSJuan Castillo
13114d045d0eSMasahiro Yamadaifeq (${NEED_SCP_BL2},yes)
131233950dd8SMasahiro Yamada$(eval $(call TOOL_ADD_IMG,scp_bl2,--scp-fw))
13134d045d0eSMasahiro Yamadaendif
13144d045d0eSMasahiro Yamada
131573c99d4eSJuan Castilloifeq (${NEED_BL31},yes)
131673c99d4eSJuan CastilloBL31_SOURCES += ${SPD_SOURCES}
131726d1e0c3SMadhukar Pappireddy# Sort BL31 source files to remove duplicates
131826d1e0c3SMadhukar PappireddyBL31_SOURCES := $(sort ${BL31_SOURCES})
1319c6ba9b45SSumit Gargifneq (${DECRYPTION_SUPPORT},none)
1320c6ba9b45SSumit Garg$(if ${BL31}, $(eval $(call TOOL_ADD_IMG,bl31,--soc-fw,,$(ENCRYPT_BL31))),\
1321434d0491SZelalem Aweke	$(eval $(call MAKE_BL,bl31,soc-fw,,$(ENCRYPT_BL31))))
1322c6ba9b45SSumit Gargelse
132333950dd8SMasahiro Yamada$(if ${BL31}, $(eval $(call TOOL_ADD_IMG,bl31,--soc-fw)),\
1324434d0491SZelalem Aweke	$(eval $(call MAKE_BL,bl31,soc-fw)))
132573c99d4eSJuan Castilloendif
1326c6ba9b45SSumit Gargendif
132773c99d4eSJuan Castillo
132870d1fc53SJuan Castillo# If a BL32 image is needed but neither BL32 nor BL32_SOURCES is defined, the
1329c939d13aSMasahiro Yamada# build system will call TOOL_ADD_IMG to print a warning message and abort the
133070d1fc53SJuan Castillo# process. Note that the dependency on BL32 applies to the FIP only.
133173c99d4eSJuan Castilloifeq (${NEED_BL32},yes)
133226d1e0c3SMadhukar Pappireddy# Sort BL32 source files to remove duplicates
133326d1e0c3SMadhukar PappireddyBL32_SOURCES := $(sort ${BL32_SOURCES})
13349cd15239SMasahiro YamadaBUILD_BL32 := $(if $(BL32),,$(if $(BL32_SOURCES),1))
13359cd15239SMasahiro Yamada
1336c6ba9b45SSumit Gargifneq (${DECRYPTION_SUPPORT},none)
1337434d0491SZelalem Aweke$(if ${BUILD_BL32}, $(eval $(call MAKE_BL,bl32,tos-fw,,$(ENCRYPT_BL32))),\
1338c6ba9b45SSumit Garg	$(eval $(call TOOL_ADD_IMG,bl32,--tos-fw,,$(ENCRYPT_BL32))))
1339c6ba9b45SSumit Gargelse
1340434d0491SZelalem Aweke$(if ${BUILD_BL32}, $(eval $(call MAKE_BL,bl32,tos-fw)),\
134133950dd8SMasahiro Yamada	$(eval $(call TOOL_ADD_IMG,bl32,--tos-fw)))
134273c99d4eSJuan Castilloendif
1343c6ba9b45SSumit Gargendif
134473c99d4eSJuan Castillo
13455b18de09SZelalem Aweke# If RMM image is needed but RMM is not defined, Test Realm Payload (TRP)
13465b18de09SZelalem Aweke# needs to be built from RMM_SOURCES.
13475b18de09SZelalem Awekeifeq (${NEED_RMM},yes)
13485b18de09SZelalem Aweke# Sort RMM source files to remove duplicates
13495b18de09SZelalem AwekeRMM_SOURCES := $(sort ${RMM_SOURCES})
13505b18de09SZelalem AwekeBUILD_RMM := $(if $(RMM),,$(if $(RMM_SOURCES),1))
13515b18de09SZelalem Aweke
13525b18de09SZelalem Aweke$(if ${BUILD_RMM}, $(eval $(call MAKE_BL,rmm,rmm-fw)),\
13535b18de09SZelalem Aweke         $(eval $(call TOOL_ADD_IMG,rmm,--rmm-fw)))
13545b18de09SZelalem Awekeendif
13555b18de09SZelalem Aweke
135673c99d4eSJuan Castillo# Add the BL33 image if required by the platform
135773c99d4eSJuan Castilloifeq (${NEED_BL33},yes)
135833950dd8SMasahiro Yamada$(eval $(call TOOL_ADD_IMG,bl33,--nt-fw))
1359db6071c9SJuan Castilloendif
1360db6071c9SJuan Castillo
13619003fa0bSYatharth Kocharifeq (${NEED_BL2U},yes)
136233950dd8SMasahiro Yamada$(if ${BL2U}, $(eval $(call TOOL_ADD_IMG,bl2u,--ap-fwu-cfg,FWU_)),\
1363434d0491SZelalem Aweke	$(eval $(call MAKE_BL,bl2u,ap-fwu-cfg,FWU_)))
13649003fa0bSYatharth Kocharendif
13659003fa0bSYatharth Kochar
136603b397a8SNishanth Menon# Expand build macros for the different images
136703b397a8SNishanth Menonifeq (${NEED_FDT},yes)
136803b397a8SNishanth Menon    $(eval $(call MAKE_DTBS,$(BUILD_PLAT)/fdts,$(FDT_SOURCES)))
136903b397a8SNishanth Menonendif
137003b397a8SNishanth Menon
1371ce2b1ec6SManish Pandey# Add Secure Partition packages
1372ce2b1ec6SManish Pandeyifeq (${NEED_SP_PKG},yes)
1373ce2b1ec6SManish Pandey$(BUILD_PLAT)/sp_gen.mk: ${SP_MK_GEN} ${SP_LAYOUT_FILE} | ${BUILD_PLAT}
13741e7528ecSRuari Phipps	${Q}${PYTHON} "$<" "$@" $(filter-out $<,$^) $(BUILD_PLAT) ${COT}
1375822c7279SJ-Alvessp: $(DTBS) $(BUILD_PLAT)/sp_gen.mk $(SP_PKGS)
1376ce2b1ec6SManish Pandey	@${ECHO_BLANK_LINE}
1377ce2b1ec6SManish Pandey	@echo "Built SP Images successfully"
1378ce2b1ec6SManish Pandey	@${ECHO_BLANK_LINE}
1379ce2b1ec6SManish Pandeyendif
1380ce2b1ec6SManish Pandey
138136eaaf37SIan Spraylocate-checkpatch:
138236eaaf37SIan Sprayifndef CHECKPATCH
138366079b04SEtienne Carriere	$(error "Please set CHECKPATCH to point to the Linux checkpatch.pl file, eg: CHECKPATCH=../linux/scripts/checkpatch.pl")
138436eaaf37SIan Sprayelse
138536eaaf37SIan Sprayifeq (,$(wildcard ${CHECKPATCH}))
138666079b04SEtienne Carriere	$(error "The file CHECKPATCH points to cannot be found, use eg: CHECKPATCH=../linux/scripts/checkpatch.pl")
138736eaaf37SIan Sprayendif
138836eaaf37SIan Sprayendif
138936eaaf37SIan Spray
13904f6ad66aSAchin Guptaclean:
13914f6ad66aSAchin Gupta	@echo "  CLEAN"
1392f1477d4aSEvan Lloyd	$(call SHELL_REMOVE_DIR,${BUILD_PLAT})
139388a1cf1eSSami Mujawarifdef UNIX_MK
13942f2cef46SJeenu Viswambharan	${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean
139588a1cf1eSSami Mujawarelse
139688a1cf1eSSami Mujawar# Clear the MAKEFLAGS as we do not want
139788a1cf1eSSami Mujawar# to pass the gnumake flags to nmake.
139888a1cf1eSSami Mujawar	${Q}set MAKEFLAGS= && ${MSVC_NMAKE} /nologo /f ${FIPTOOLPATH}/Makefile.msvc FIPTOOLPATH=$(subst /,\,$(FIPTOOLPATH)) FIPTOOL=$(subst /,\,$(FIPTOOL)) clean
139988a1cf1eSSami Mujawarendif
14006f971622SJuan Castillo	${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} clean
140190aa901fSSumit Garg	${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${ENCTOOLPATH} clean
14025accce5bSRoberto Vargas	${Q}${MAKE} --no-print-directory -C ${ROMLIBPATH} clean
14034f6ad66aSAchin Gupta
1404eaaeece2SJames Morrisseyrealclean distclean:
1405eaaeece2SJames Morrissey	@echo "  REALCLEAN"
1406f1477d4aSEvan Lloyd	$(call SHELL_REMOVE_DIR,${BUILD_BASE})
1407f1477d4aSEvan Lloyd	$(call SHELL_DELETE_ALL, ${CURDIR}/cscope.*)
140888a1cf1eSSami Mujawarifdef UNIX_MK
14092f2cef46SJeenu Viswambharan	${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean
141088a1cf1eSSami Mujawarelse
141188a1cf1eSSami Mujawar# Clear the MAKEFLAGS as we do not want
141288a1cf1eSSami Mujawar# to pass the gnumake flags to nmake.
141388a1cf1eSSami Mujawar	${Q}set MAKEFLAGS= && ${MSVC_NMAKE} /nologo /f ${FIPTOOLPATH}/Makefile.msvc FIPTOOLPATH=$(subst /,\,$(FIPTOOLPATH)) FIPTOOL=$(subst /,\,$(FIPTOOL)) realclean
141488a1cf1eSSami Mujawarendif
1415e15591aaSNicolas Boulenguez	${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} realclean
141690aa901fSSumit Garg	${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${ENCTOOLPATH} realclean
14175accce5bSRoberto Vargas	${Q}${MAKE} --no-print-directory -C ${ROMLIBPATH} clean
14184f6ad66aSAchin Gupta
141936eaaf37SIan Spraycheckcodebase:		locate-checkpatch
142036eaaf37SIan Spray	@echo "  CHECKING STYLE"
142136eaaf37SIan Spray	@if test -d .git ; then						\
14221ef35512SPaul Beesley		git ls-files | grep -E -v 'libfdt|libc|docs|\.rst' |	\
14231a41e8c1SDan Handley		while read GIT_FILE ;					\
14241a41e8c1SDan Handley		do ${CHECKPATCH} ${CHECKCODE_ARGS} -f $$GIT_FILE ;	\
14251a41e8c1SDan Handley		done ;							\
142636eaaf37SIan Spray	else								\
14271a41e8c1SDan Handley		 find . -type f -not -iwholename "*.git*"		\
14281a41e8c1SDan Handley		 -not -iwholename "*build*"				\
14291a41e8c1SDan Handley		 -not -iwholename "*libfdt*"				\
143061f72a34SRoberto Vargas		 -not -iwholename "*libc*"				\
14311a41e8c1SDan Handley		 -not -iwholename "*docs*"				\
14321ef35512SPaul Beesley		 -not -iwholename "*.rst"				\
14331a41e8c1SDan Handley		 -exec ${CHECKPATCH} ${CHECKCODE_ARGS} -f {} \; ;	\
143436eaaf37SIan Spray	fi
143536eaaf37SIan Spray
143636eaaf37SIan Spraycheckpatch:		locate-checkpatch
143736eaaf37SIan Spray	@echo "  CHECKING STYLE"
143802a76d5fSYann Gautier	@if test -n "${CHECKPATCH_OPTS}"; then				\
143902a76d5fSYann Gautier		echo "    with ${CHECKPATCH_OPTS} option(s)";		\
144002a76d5fSYann Gautier	fi
144151d28937SAntonio Nino Diaz	${Q}COMMON_COMMIT=$$(git merge-base HEAD ${BASE_COMMIT});	\
144277a0a7f1SYann Gautier	for commit in `git rev-list --no-merges $$COMMON_COMMIT..HEAD`;	\
144377a0a7f1SYann Gautier	do								\
144451d28937SAntonio Nino Diaz		printf "\n[*] Checking style of '$$commit'\n\n";	\
144551d28937SAntonio Nino Diaz		git log --format=email "$$commit~..$$commit"		\
144602a76d5fSYann Gautier			-- ${CHECK_PATHS} |				\
144702a76d5fSYann Gautier			${CHECKPATCH} ${CHECKPATCH_OPTS} - || true;	\
144851d28937SAntonio Nino Diaz		git diff --format=email "$$commit~..$$commit"		\
144902a76d5fSYann Gautier			-- ${CHECK_PATHS} |				\
145002a76d5fSYann Gautier			${CHECKPATCH}  ${CHECKPATCH_OPTS} - || true;	\
145151d28937SAntonio Nino Diaz	done
145236eaaf37SIan Spray
145373c99d4eSJuan Castillocerttool: ${CRTTOOL}
145473c99d4eSJuan Castillo
1455a9812206SPali Rohár${CRTTOOL}: FORCE
1456fafd3ec9SManish V Badarkhe	${Q}${MAKE} PLAT=${PLAT} USE_TBBR_DEFS=${USE_TBBR_DEFS} COT=${COT} OPENSSL_DIR=${OPENSSL_DIR} CRTTOOL=${CRTTOOL} --no-print-directory -C ${CRTTOOLPATH}
1457f1477d4aSEvan Lloyd	@${ECHO_BLANK_LINE}
14586f971622SJuan Castillo	@echo "Built $@ successfully"
1459f1477d4aSEvan Lloyd	@${ECHO_BLANK_LINE}
14606f971622SJuan Castillo
14616f971622SJuan Castilloifneq (${GENERATE_COT},0)
146273c99d4eSJuan Castillocertificates: ${CRT_DEPS} ${CRTTOOL}
14636f971622SJuan Castillo	${Q}${CRTTOOL} ${CRT_ARGS}
1464f1477d4aSEvan Lloyd	@${ECHO_BLANK_LINE}
14656f971622SJuan Castillo	@echo "Built $@ successfully"
14666f971622SJuan Castillo	@echo "Certificates can be found in ${BUILD_PLAT}"
1467f1477d4aSEvan Lloyd	@${ECHO_BLANK_LINE}
146873c99d4eSJuan Castilloendif
146927713fb4SSoby Mathew
147073c99d4eSJuan Castillo${BUILD_PLAT}/${FIP_NAME}: ${FIP_DEPS} ${FIPTOOL}
14714727fd13SPali Rohár	$(eval ${CHECK_FIP_CMD})
1472819281eeSdp-arm	${Q}${FIPTOOL} create ${FIP_ARGS} $@
1473819281eeSdp-arm	${Q}${FIPTOOL} info $@
1474f1477d4aSEvan Lloyd	@${ECHO_BLANK_LINE}
14752f2cef46SJeenu Viswambharan	@echo "Built $@ successfully"
1476f1477d4aSEvan Lloyd	@${ECHO_BLANK_LINE}
1477f58ad36fSHarry Liebel
14780191262dSYatharth Kocharifneq (${GENERATE_COT},0)
14790191262dSYatharth Kocharfwu_certificates: ${FWU_CRT_DEPS} ${CRTTOOL}
14800191262dSYatharth Kochar	${Q}${CRTTOOL} ${FWU_CRT_ARGS}
1481052ab529SEvan Lloyd	@${ECHO_BLANK_LINE}
14820191262dSYatharth Kochar	@echo "Built $@ successfully"
14830191262dSYatharth Kochar	@echo "FWU certificates can be found in ${BUILD_PLAT}"
1484052ab529SEvan Lloyd	@${ECHO_BLANK_LINE}
14850191262dSYatharth Kocharendif
14860191262dSYatharth Kochar
14870191262dSYatharth Kochar${BUILD_PLAT}/${FWU_FIP_NAME}: ${FWU_FIP_DEPS} ${FIPTOOL}
14884727fd13SPali Rohár	$(eval ${CHECK_FWU_FIP_CMD})
1489819281eeSdp-arm	${Q}${FIPTOOL} create ${FWU_FIP_ARGS} $@
1490819281eeSdp-arm	${Q}${FIPTOOL} info $@
1491052ab529SEvan Lloyd	@${ECHO_BLANK_LINE}
14920191262dSYatharth Kochar	@echo "Built $@ successfully"
1493052ab529SEvan Lloyd	@${ECHO_BLANK_LINE}
14940191262dSYatharth Kochar
149573c99d4eSJuan Castillofiptool: ${FIPTOOL}
149673c99d4eSJuan Castillofip: ${BUILD_PLAT}/${FIP_NAME}
14970191262dSYatharth Kocharfwu_fip: ${BUILD_PLAT}/${FWU_FIP_NAME}
149873c99d4eSJuan Castillo
1499a9812206SPali Rohár${FIPTOOL}: FORCE
150088a1cf1eSSami Mujawarifdef UNIX_MK
15010a956f81SRoss Burton	${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" FIPTOOL=${FIPTOOL} OPENSSL_DIR=${OPENSSL_DIR} --no-print-directory -C ${FIPTOOLPATH}
150288a1cf1eSSami Mujawarelse
150388a1cf1eSSami Mujawar# Clear the MAKEFLAGS as we do not want
150488a1cf1eSSami Mujawar# to pass the gnumake flags to nmake.
150588a1cf1eSSami Mujawar	${Q}set MAKEFLAGS= && ${MSVC_NMAKE} /nologo /f ${FIPTOOLPATH}/Makefile.msvc FIPTOOLPATH=$(subst /,\,$(FIPTOOLPATH)) FIPTOOL=$(subst /,\,$(FIPTOOL))
150688a1cf1eSSami Mujawarendif
1507f58ad36fSHarry Liebel
1508a9812206SPali Rohárromlib.bin: libraries FORCE
1509bbb24f61SJohn Tsichritzis	${Q}${MAKE} PLAT_DIR=${PLAT_DIR} BUILD_PLAT=${BUILD_PLAT} ENABLE_BTI=${ENABLE_BTI} ARM_ARCH_MINOR=${ARM_ARCH_MINOR} INCLUDES='${INCLUDES}' DEFINES='${DEFINES}' --no-print-directory -C ${ROMLIBPATH} all
15105accce5bSRoberto Vargas
1511cfe83910SLouis Mayencourt# Call print_memory_map tool
1512cfe83910SLouis Mayencourtmemmap: all
1513b890b36dSLouis Mayencourt	${Q}${PYTHON} ${PRINT_MEMORY_MAP} ${BUILD_PLAT} ${INVERTED_MEMMAP}
1514cfe83910SLouis Mayencourt
15156de32378SMadhukar Pappireddydoc:
15166de32378SMadhukar Pappireddy	@echo "  BUILD DOCUMENTATION"
15176de32378SMadhukar Pappireddy	${Q}${MAKE} --no-print-directory -C ${DOCS_PATH} html
15186de32378SMadhukar Pappireddy
151990aa901fSSumit Gargenctool: ${ENCTOOL}
152090aa901fSSumit Garg
1521a9812206SPali Rohár${ENCTOOL}: FORCE
1522fafd3ec9SManish V Badarkhe	${Q}${MAKE} PLAT=${PLAT} BUILD_INFO=0 OPENSSL_DIR=${OPENSSL_DIR} ENCTOOL=${ENCTOOL} --no-print-directory -C ${ENCTOOLPATH}
152390aa901fSSumit Garg	@${ECHO_BLANK_LINE}
152490aa901fSSumit Garg	@echo "Built $@ successfully"
152590aa901fSSumit Garg	@${ECHO_BLANK_LINE}
152690aa901fSSumit Garg
152735fab8c9SJoakim Bechcscope:
152835fab8c9SJoakim Bech	@echo "  CSCOPE"
152935fab8c9SJoakim Bech	${Q}find ${CURDIR} -name "*.[chsS]" > cscope.files
153035fab8c9SJoakim Bech	${Q}cscope -b -q -k
153135fab8c9SJoakim Bech
153272ee3314SRyan Harkinhelp:
15337c23126cSJohn Tsichritzis	@echo "usage: ${MAKE} [PLAT=<platform>] [OPTIONS] [TARGET]"
153472ee3314SRyan Harkin	@echo ""
153572ee3314SRyan Harkin	@echo "PLAT is used to specify which platform you wish to build."
153608c7ed0fSSandrine Bailleux	@echo "If no platform is specified, PLAT defaults to: ${DEFAULT_PLAT}"
153772ee3314SRyan Harkin	@echo ""
15387c23126cSJohn Tsichritzis	@echo "platform = ${PLATFORM_LIST}"
15397c23126cSJohn Tsichritzis	@echo ""
15401b578596SSandrine Bailleux	@echo "Please refer to the User Guide for a list of all supported options."
15411b578596SSandrine Bailleux	@echo "Note that the build system doesn't track dependencies for build "
15421b578596SSandrine Bailleux	@echo "options. Therefore, if any of the build options are changed "
15431b578596SSandrine Bailleux	@echo "from a previous build, a clean build must be performed."
15441b578596SSandrine Bailleux	@echo ""
154572ee3314SRyan Harkin	@echo "Supported Targets:"
15461b578596SSandrine Bailleux	@echo "  all            Build all individual bootloader binaries"
154736eaaf37SIan Spray	@echo "  bl1            Build the BL1 binary"
15488aa559c0SJeenu Viswambharan	@echo "  bl2            Build the BL2 binary"
15499003fa0bSYatharth Kochar	@echo "  bl2u           Build the BL2U binary"
1550d178637dSJuan Castillo	@echo "  bl31           Build the BL31 binary"
15519d29c227SSoby Mathew	@echo "  bl32           Build the BL32 binary. If ARCH=aarch32, then "
15529d29c227SSoby Mathew	@echo "                 this builds secure payload specified by AARCH32_SP"
155373c99d4eSJuan Castillo	@echo "  certificates   Build the certificates (requires 'GENERATE_COT=1')"
15541b578596SSandrine Bailleux	@echo "  fip            Build the Firmware Image Package (FIP)"
15550191262dSYatharth Kochar	@echo "  fwu_fip        Build the FWU Firmware Image Package (FIP)"
155636eaaf37SIan Spray	@echo "  checkcodebase  Check the coding style of the entire source tree"
155736eaaf37SIan Spray	@echo "  checkpatch     Check the coding style on changes in the current"
155836eaaf37SIan Spray	@echo "                 branch against BASE_COMMIT (default origin/master)"
155972ee3314SRyan Harkin	@echo "  clean          Clean the build for the selected platform"
156035fab8c9SJoakim Bech	@echo "  cscope         Generate cscope index"
156172ee3314SRyan Harkin	@echo "  distclean      Remove all build artifacts for all platforms"
15626f971622SJuan Castillo	@echo "  certtool       Build the Certificate generation tool"
156390aa901fSSumit Garg	@echo "  enctool        Build the Firmware encryption tool"
1564f58ad36fSHarry Liebel	@echo "  fiptool        Build the Firmware Image Package (FIP) creation tool"
1565ce2b1ec6SManish Pandey	@echo "  sp             Build the Secure Partition Packages"
156626010da1SAntonio Nino Diaz	@echo "  sptool         Build the Secure Partition Package creation tool"
156738c14d88SSoby Mathew	@echo "  dtbs           Build the Device Tree Blobs (if required for the platform)"
1568cfe83910SLouis Mayencourt	@echo "  memmap         Print the memory map of the built binaries"
15696de32378SMadhukar Pappireddy	@echo "  doc            Build html based documentation using Sphinx tool"
157072ee3314SRyan Harkin	@echo ""
15711b578596SSandrine Bailleux	@echo "Note: most build targets require PLAT to be set to a specific platform."
157272ee3314SRyan Harkin	@echo ""
157372ee3314SRyan Harkin	@echo "example: build all targets for the FVP platform:"
157472ee3314SRyan Harkin	@echo "  CROSS_COMPILE=aarch64-none-elf- make PLAT=fvp all"
1575a9812206SPali Rohár
1576a9812206SPali Rohár.PHONY: FORCE
1577a9812206SPali RohárFORCE:;
1578