xref: /rk3399_ARM-atf/Makefile (revision 7670ddb1fb5d4fa5e2e234375f7a4c0763f1c57a)
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
151*7670ddb1SAndre PrzywaraARM_ARCH_MINOR := 5
152*7670ddb1SAndre PrzywaraENABLE_FEAT_ECV = 1
153*7670ddb1SAndre PrzywaraENABLE_FEAT_FGT = 1
154*7670ddb1SAndre Przywara
1555b18de09SZelalem Awekeendif
1565b18de09SZelalem Aweke
157c97cba4eSSoby Mathew# USE_SPINLOCK_CAS requires AArch64 build
158c97cba4eSSoby Mathewifeq (${USE_SPINLOCK_CAS},1)
159c97cba4eSSoby Mathewifneq (${ARCH},aarch64)
160c97cba4eSSoby Mathew        $(error USE_SPINLOCK_CAS requires AArch64)
161c97cba4eSSoby Mathewendif
162c97cba4eSSoby Mathewendif
163c97cba4eSSoby Mathew
1640ca3913dSOlivier Deprez# USE_DEBUGFS experimental feature recommended only in debug builds
1650ca3913dSOlivier Deprezifeq (${USE_DEBUGFS},1)
1660ca3913dSOlivier Deprezifeq (${DEBUG},1)
1670ca3913dSOlivier Deprez        $(warning DEBUGFS experimental feature is enabled.)
1680ca3913dSOlivier Deprezelse
1690ca3913dSOlivier Deprez        $(warning DEBUGFS experimental, recommended in DEBUG builds ONLY)
1700ca3913dSOlivier Deprezendif
1710ca3913dSOlivier Deprezendif
1720ca3913dSOlivier Deprez
173c6ba9b45SSumit Gargifneq (${DECRYPTION_SUPPORT},none)
174c6ba9b45SSumit GargENC_ARGS += -f ${FW_ENC_STATUS}
175c6ba9b45SSumit GargENC_ARGS += -k ${ENC_KEY}
176c6ba9b45SSumit GargENC_ARGS += -n ${ENC_NONCE}
177c6ba9b45SSumit GargFIP_DEPS += enctool
178c6ba9b45SSumit GargFWU_FIP_DEPS += enctool
179c6ba9b45SSumit Gargendif
180c6ba9b45SSumit Garg
18173c99d4eSJuan Castillo################################################################################
18273c99d4eSJuan Castillo# Toolchain
18373c99d4eSJuan Castillo################################################################################
18473c99d4eSJuan Castillo
18572610c41Sdp-armHOSTCC			:=	gcc
18672610c41Sdp-armexport HOSTCC
18772610c41Sdp-arm
18873c99d4eSJuan CastilloCC			:=	${CROSS_COMPILE}gcc
18973c99d4eSJuan CastilloCPP			:=	${CROSS_COMPILE}cpp
19073c99d4eSJuan CastilloAS			:=	${CROSS_COMPILE}gcc
19173c99d4eSJuan CastilloAR			:=	${CROSS_COMPILE}ar
1922adee763SRoberto VargasLINKER			:=	${CROSS_COMPILE}ld
19373c99d4eSJuan CastilloOC			:=	${CROSS_COMPILE}objcopy
19473c99d4eSJuan CastilloOD			:=	${CROSS_COMPILE}objdump
19573c99d4eSJuan CastilloNM			:=	${CROSS_COMPILE}nm
19673c99d4eSJuan CastilloPP			:=	${CROSS_COMPILE}gcc -E
19738c14d88SSoby MathewDTC			:=	dtc
19873c99d4eSJuan Castillo
199b25a577fSJulius Werner# Use ${LD}.bfd instead if it exists (as absolute path or together with $PATH).
200b25a577fSJulius Wernerifneq ($(strip $(wildcard ${LD}.bfd) \
2012adee763SRoberto Vargas	$(foreach dir,$(subst :, ,${PATH}),$(wildcard ${dir}/${LINKER}.bfd))),)
2022adee763SRoberto VargasLINKER			:=	${LINKER}.bfd
203b25a577fSJulius Wernerendif
204b25a577fSJulius Werner
20526e63c44SEtienne Carriereifeq (${ARM_ARCH_MAJOR},7)
20626e63c44SEtienne Carrieretarget32-directive	= 	-target arm-none-eabi
20726e63c44SEtienne Carriere# Will set march32-directive from platform configuration
20826e63c44SEtienne Carriereelse
20926e63c44SEtienne Carrieretarget32-directive	= 	-target armv8a-none-eabi
210fa6f774bSAlexei Fedorov
211f1821790SAlexei Fedorov# Set the compiler's target architecture profile based on
212f1821790SAlexei Fedorov# ARM_ARCH_MAJOR ARM_ARCH_MINOR options
213fa6f774bSAlexei Fedorovifeq (${ARM_ARCH_MINOR},0)
214f1821790SAlexei Fedorovmarch32-directive	= 	-march=armv${ARM_ARCH_MAJOR}-a
215f1821790SAlexei Fedorovmarch64-directive	= 	-march=armv${ARM_ARCH_MAJOR}-a
216fa6f774bSAlexei Fedorovelse
217f1821790SAlexei Fedorovmarch32-directive	= 	-march=armv${ARM_ARCH_MAJOR}.${ARM_ARCH_MINOR}-a
218f1821790SAlexei Fedorovmarch64-directive	= 	-march=armv${ARM_ARCH_MAJOR}.${ARM_ARCH_MINOR}-a
219fa6f774bSAlexei Fedorovendif
22026e63c44SEtienne Carriereendif
22126e63c44SEtienne Carriere
2227ff088d1SManish V Badarkhe# Memory tagging is supported in architecture Armv8.5-A AArch64 and onwards
2237ff088d1SManish V Badarkheifeq ($(ARCH), aarch64)
2244a565bd8SSami Mujawar# Check if revision is greater than or equal to 8.5
2254a565bd8SSami Mujawarifeq "8.5" "$(word 1, $(sort 8.5 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))"
2267ff088d1SManish V Badarkhemem_tag_arch_support	= 	yes
2277ff088d1SManish V Badarkheendif
2287ff088d1SManish V Badarkheendif
2297ff088d1SManish V Badarkhe
230f1821790SAlexei Fedorov# Get architecture feature modifiers
231f1821790SAlexei Fedorovarch-features		=	${ARM_ARCH_FEATURE}
232f1821790SAlexei Fedorov
233f1821790SAlexei Fedorov# Enable required options for memory stack tagging.
234f1821790SAlexei Fedorov# Currently, these options are enabled only for clang and armclang compiler.
2357ff088d1SManish V Badarkheifeq (${SUPPORT_STACK_MEMTAG},yes)
2367ff088d1SManish V Badarkheifdef mem_tag_arch_support
237f1821790SAlexei Fedorov# Check for armclang and clang compilers
2387ff088d1SManish V Badarkheifneq ( ,$(filter $(notdir $(CC)),armclang clang))
239f1821790SAlexei Fedorov# Add "memtag" architecture feature modifier if not specified
240f1821790SAlexei Fedorovifeq ( ,$(findstring memtag,$(arch-features)))
241f1821790SAlexei Fedorovarch-features       	:=       $(arch-features)+memtag
242f1821790SAlexei Fedorovendif	# memtag
2437ff088d1SManish V Badarkheifeq ($(notdir $(CC)),armclang)
2447ff088d1SManish V BadarkheTF_CFLAGS		+=	-mmemtag-stack
2457ff088d1SManish V Badarkheelse ifeq ($(notdir $(CC)),clang)
2467ff088d1SManish V BadarkheTF_CFLAGS		+=	-fsanitize=memtag
247f1821790SAlexei Fedorovendif	# armclang
248f1821790SAlexei Fedorovendif	# armclang clang
2497ff088d1SManish V Badarkheelse
2507ff088d1SManish V Badarkhe$(error "Error: stack memory tagging is not supported for architecture \
2517ff088d1SManish V Badarkhe	${ARCH},armv${ARM_ARCH_MAJOR}.${ARM_ARCH_MINOR}-a")
252f1821790SAlexei Fedorovendif	# mem_tag_arch_support
253f1821790SAlexei Fedorovendif	# SUPPORT_STACK_MEMTAG
254f1821790SAlexei Fedorov
255f1821790SAlexei Fedorov# Set the compiler's architecture feature modifiers
256f1821790SAlexei Fedorovifneq ($(arch-features), none)
257f1821790SAlexei Fedorov# Strip "none+" from arch-features
258f1821790SAlexei Fedorovarch-features		:=	$(subst none+,,$(arch-features))
259f1821790SAlexei Fedorovifeq ($(ARCH), aarch32)
260f1821790SAlexei Fedorovmarch32-directive	:=	$(march32-directive)+$(arch-features)
261f1821790SAlexei Fedorovelse
262f1821790SAlexei Fedorovmarch64-directive	:=	$(march64-directive)+$(arch-features)
2637ff088d1SManish V Badarkheendif
264f1821790SAlexei Fedorov# Print features
265f1821790SAlexei Fedorov$(info Arm Architecture Features specified: $(subst +, ,$(arch-features)))
266f1821790SAlexei Fedorovendif	# arch-features
2677ff088d1SManish V Badarkhe
26812cd65e0STomas Pilar# Determine if FEAT_RNG is supported
26912cd65e0STomas PilarENABLE_FEAT_RNG		=	$(if $(findstring rng,${arch-features}),1,0)
27012cd65e0STomas Pilar
2714e04478aSChris Kay# Determine if FEAT_SB is supported
2724e04478aSChris KayENABLE_FEAT_SB		=	$(if $(findstring sb,${arch-features}),1,0)
2734e04478aSChris Kay
274c8a992fdSoriginifneq ($(findstring clang,$(notdir $(CC))),)
275fd18a8fcSVarun Wadekar	ifneq ($(findstring armclang,$(notdir $(CC))),)
276c8a992fdSorigin		TF_CFLAGS_aarch32	:=	-target arm-arm-none-eabi $(march32-directive)
277c8a992fdSorigin		TF_CFLAGS_aarch64	:=	-target aarch64-arm-none-eabi $(march64-directive)
278c8a992fdSorigin		LD			:=	$(LINKER)
279c8a992fdSorigin	else
280c8a992fdSorigin		TF_CFLAGS_aarch32	:=	$(target32-directive) $(march32-directive)
281c8a992fdSorigin		TF_CFLAGS_aarch64	:=	-target aarch64-elf $(march64-directive)
282c8a992fdSorigin		LD			:=	$(shell $(CC) --print-prog-name ld.lld)
283c8a992fdSorigin
284c8a992fdSorigin		AR			:=	$(shell $(CC) --print-prog-name llvm-ar)
285c8a992fdSorigin		OD			:=	$(shell $(CC) --print-prog-name llvm-objdump)
286c8a992fdSorigin		OC			:=	$(shell $(CC) --print-prog-name llvm-objcopy)
287641f16e7SAmbroise Vincent	endif
288c8a992fdSorigin
289c8a992fdSorigin	CPP		:=	$(CC) -E $(TF_CFLAGS_$(ARCH))
290c8a992fdSorigin	PP		:=	$(CC) -E $(TF_CFLAGS_$(ARCH))
291c8a992fdSorigin	AS		:=	$(CC) -c -x assembler-with-cpp $(TF_CFLAGS_$(ARCH))
292edbce9aaSzelalem-awekeelse ifneq ($(findstring gcc,$(notdir $(CC))),)
293edbce9aaSzelalem-awekeTF_CFLAGS_aarch32	=	$(march32-directive)
294edbce9aaSzelalem-awekeTF_CFLAGS_aarch64	=	$(march64-directive)
295edbce9aaSzelalem-awekeifeq ($(ENABLE_LTO),1)
296edbce9aaSzelalem-aweke	# Enable LTO only for aarch64
297edbce9aaSzelalem-aweke	ifeq (${ARCH},aarch64)
298edbce9aaSzelalem-aweke		LTO_CFLAGS	=	-flto
299edbce9aaSzelalem-aweke		# Use gcc as a wrapper for the ld, recommended for LTO
300edbce9aaSzelalem-aweke		LINKER		:=	${CROSS_COMPILE}gcc
301edbce9aaSzelalem-aweke	endif
302edbce9aaSzelalem-awekeendif
303edbce9aaSzelalem-awekeLD			=	$(LINKER)
304d5461857Sdp-armelse
30526e63c44SEtienne CarriereTF_CFLAGS_aarch32	=	$(march32-directive)
306fa6f774bSAlexei FedorovTF_CFLAGS_aarch64	=	$(march64-directive)
3072adee763SRoberto VargasLD			=	$(LINKER)
308d5461857Sdp-armendif
309d5461857Sdp-arm
31032b209bfSAhmad Fatoum# Process Debug flag
31132b209bfSAhmad Fatoum$(eval $(call add_define,DEBUG))
31232b209bfSAhmad Fatoumifneq (${DEBUG}, 0)
31332b209bfSAhmad Fatoum        BUILD_TYPE	:=	debug
3144466cf82SDaniel Boulby        TF_CFLAGS	+=	-g -gdwarf-4
3154466cf82SDaniel Boulby        ASFLAGS		+=	-g -Wa,-gdwarf-4
31632b209bfSAhmad Fatoum
31732b209bfSAhmad Fatoum        # Use LOG_LEVEL_INFO by default for debug builds
31832b209bfSAhmad Fatoum        LOG_LEVEL	:=	40
31932b209bfSAhmad Fatoumelse
32032b209bfSAhmad Fatoum        BUILD_TYPE	:=	release
32132b209bfSAhmad Fatoum        # Use LOG_LEVEL_NOTICE by default for release builds
32232b209bfSAhmad Fatoum        LOG_LEVEL	:=	20
32332b209bfSAhmad Fatoumendif
32432b209bfSAhmad Fatoum
325f1de4c8fSPeiyuan Song# Default build string (git branch and commit)
326f1de4c8fSPeiyuan Songifeq (${BUILD_STRING},)
327f1de4c8fSPeiyuan Song        BUILD_STRING  :=  $(shell git describe --always --dirty --tags 2> /dev/null)
328f1de4c8fSPeiyuan Songendif
329dddf4283Slaurenw-armVERSION_STRING    :=  v${VERSION}(${BUILD_TYPE}):${BUILD_STRING}
330f1de4c8fSPeiyuan Song
3318fd9d4d5SAntonio Nino Diazifeq (${AARCH32_INSTRUCTION_SET},A32)
3328fd9d4d5SAntonio Nino DiazTF_CFLAGS_aarch32	+=	-marm
3338fd9d4d5SAntonio Nino Diazelse ifeq (${AARCH32_INSTRUCTION_SET},T32)
3348fd9d4d5SAntonio Nino DiazTF_CFLAGS_aarch32	+=	-mthumb
3358fd9d4d5SAntonio Nino Diazelse
3368fd9d4d5SAntonio Nino Diaz$(error Error: Unknown AArch32 instruction set ${AARCH32_INSTRUCTION_SET})
3378fd9d4d5SAntonio Nino Diazendif
3388fd9d4d5SAntonio Nino Diaz
339a9c4dde3SSandrine BailleuxTF_CFLAGS_aarch32	+=	-mno-unaligned-access
340d5461857Sdp-armTF_CFLAGS_aarch64	+=	-mgeneral-regs-only -mstrict-align
3419d29c227SSoby Mathew
3429fc59639SAlexei Fedorovifneq (${BP_OPTION},none)
3439fc59639SAlexei FedorovTF_CFLAGS_aarch64	+=	-mbranch-protection=${BP_OPTION}
3449fc59639SAlexei Fedorovendif
3459fc59639SAlexei Fedorov
34626e63c44SEtienne CarriereASFLAGS_aarch32		=	$(march32-directive)
347fa6f774bSAlexei FedorovASFLAGS_aarch64		=	$(march64-directive)
348b86048c4SAntonio Nino Diaz
3499ab81b5eSJustin Chadwell# General warnings
3509ab81b5eSJustin ChadwellWARNINGS		:=	-Wall -Wmissing-include-dirs -Wunused	\
351b7f6525dSJustin Chadwell				-Wdisabled-optimization -Wvla -Wshadow	\
352ca661a00SMadhukar Pappireddy				-Wno-unused-parameter -Wredundant-decls
3539ab81b5eSJustin Chadwell
3549ab81b5eSJustin Chadwell# Additional warnings
3559ab81b5eSJustin Chadwell# Level 1
356e7c645b5SYann GautierWARNING1 := -Wextra
357e7c645b5SYann GautierWARNING1 += -Wmissing-format-attribute
358e7c645b5SYann GautierWARNING1 += -Wmissing-prototypes
359e7c645b5SYann GautierWARNING1 += -Wold-style-definition
360e7c645b5SYann Gautier
361b7f6525dSJustin Chadwell# Level 2
362e7c645b5SYann GautierWARNING2 := -Waggregate-return
363e7c645b5SYann GautierWARNING2 += -Wcast-align
364e7c645b5SYann GautierWARNING2 += -Wnested-externs
365e7c645b5SYann Gautier
366e7c645b5SYann GautierWARNING3 := -Wbad-function-cast
367e7c645b5SYann GautierWARNING3 += -Wcast-qual
368e7c645b5SYann GautierWARNING3 += -Wconversion
369e7c645b5SYann GautierWARNING3 += -Wpacked
370e7c645b5SYann GautierWARNING3 += -Wpointer-arith
371e7c645b5SYann GautierWARNING3 += -Wswitch-default
372e7c645b5SYann Gautier
373e7c645b5SYann Gautierifeq (${W},1)
3749ab81b5eSJustin ChadwellWARNINGS += $(WARNING1)
375e7c645b5SYann Gautierelse ifeq (${W},2)
3769ab81b5eSJustin ChadwellWARNINGS += $(WARNING1) $(WARNING2)
377e7c645b5SYann Gautierelse ifeq (${W},3)
3789ab81b5eSJustin ChadwellWARNINGS += $(WARNING1) $(WARNING2) $(WARNING3)
379e7c645b5SYann Gautierendif
380e7c645b5SYann Gautier
3819ab81b5eSJustin Chadwell# Compiler specific warnings
38200296576SAmbroise Vincentifeq ($(findstring clang,$(notdir $(CC))),)
38393c690ebSJustin Chadwell# not using clang
384d7b4cd41SJustin ChadwellWARNINGS	+=		-Wunused-but-set-variable -Wmaybe-uninitialized	\
385d7b4cd41SJustin Chadwell				-Wpacked-bitfield-compat -Wshift-overflow=2 \
386d7b4cd41SJustin Chadwell				-Wlogical-op
38793c690ebSJustin Chadwellelse
38893c690ebSJustin Chadwell# using clang
389d7b4cd41SJustin ChadwellWARNINGS	+=		-Wshift-overflow -Wshift-sign-overflow \
390d7b4cd41SJustin Chadwell				-Wlogical-op-parentheses
39100296576SAmbroise Vincentendif
39200296576SAmbroise Vincent
3936336b07aSYann Gautierifneq (${E},0)
3946336b07aSYann GautierERRORS := -Werror
3956336b07aSYann Gautierendif
3966336b07aSYann Gautier
397ea7a57a3SRoberto VargasCPPFLAGS		=	${DEFINES} ${INCLUDES} ${MBEDTLS_INC} -nostdinc	\
3989ab81b5eSJustin Chadwell				$(ERRORS) $(WARNINGS)
39959de5096SMasahiro YamadaASFLAGS			+=	$(CPPFLAGS) $(ASFLAGS_$(ARCH))			\
400d5dfdeb6SJulius Werner				-ffreestanding -Wa,--fatal-warnings
40159de5096SMasahiro YamadaTF_CFLAGS		+=	$(CPPFLAGS) $(TF_CFLAGS_$(ARCH))		\
402ebd6efaeSSamuel Holland				-ffunction-sections -fdata-sections		\
403ebd6efaeSSamuel Holland				-ffreestanding -fno-builtin -fno-common		\
404ebd6efaeSSamuel Holland				-Os -std=gnu99
40573c99d4eSJuan Castillo
406bebcf27fSMark Brown$(eval $(call add_define,SVE_VECTOR_LEN))
407bebcf27fSMark Brown
4081f461979SJustin Chadwellifeq (${SANITIZE_UB},on)
4091f461979SJustin ChadwellTF_CFLAGS		+=	-fsanitize=undefined -fno-sanitize-recover
4101f461979SJustin Chadwellendif
4111f461979SJustin Chadwellifeq (${SANITIZE_UB},trap)
4121f461979SJustin ChadwellTF_CFLAGS		+=	-fsanitize=undefined -fno-sanitize-recover	\
4131f461979SJustin Chadwell				-fsanitize-undefined-trap-on-error
4141f461979SJustin Chadwellendif
4151f461979SJustin Chadwell
416f7ec31dbSdavid cunadoGCC_V_OUTPUT		:=	$(shell $(CC) -v 2>&1)
417f7ec31dbSdavid cunado
418641f16e7SAmbroise Vincent# LD = armlink
419c2ad38ceSVarun Wadekarifneq ($(findstring armlink,$(notdir $(LD))),)
420c2ad38ceSVarun WadekarTF_LDFLAGS		+=	--diag_error=warning --lto_level=O1
421c2ad38ceSVarun WadekarTF_LDFLAGS		+=	--remove --info=unused,unusedsymbols
422edbce9aaSzelalem-awekeTF_LDFLAGS		+=	$(TF_LDFLAGS_$(ARCH))
423641f16e7SAmbroise Vincent
424641f16e7SAmbroise Vincent# LD = gcc (used when GCC LTO is enabled)
425edbce9aaSzelalem-awekeelse ifneq ($(findstring gcc,$(notdir $(LD))),)
426edbce9aaSzelalem-aweke# Pass ld options with Wl or Xlinker switches
427edbce9aaSzelalem-awekeTF_LDFLAGS		+=	-Wl,--fatal-warnings -O1
428edbce9aaSzelalem-awekeTF_LDFLAGS		+=	-Wl,--gc-sections
429edbce9aaSzelalem-awekeifeq ($(ENABLE_LTO),1)
430edbce9aaSzelalem-aweke	ifeq (${ARCH},aarch64)
431edbce9aaSzelalem-aweke		TF_LDFLAGS	+=	-flto -fuse-linker-plugin
432edbce9aaSzelalem-aweke	endif
433edbce9aaSzelalem-awekeendif
434edbce9aaSzelalem-aweke# GCC automatically adds fix-cortex-a53-843419 flag when used to link
435edbce9aaSzelalem-aweke# which breaks some builds, so disable if errata fix is not explicitly enabled
436edbce9aaSzelalem-awekeifneq (${ERRATA_A53_843419},1)
437edbce9aaSzelalem-aweke	TF_LDFLAGS	+= 	-mno-fix-cortex-a53-843419
438edbce9aaSzelalem-awekeendif
439edbce9aaSzelalem-awekeTF_LDFLAGS		+= 	-nostdlib
440edbce9aaSzelalem-awekeTF_LDFLAGS		+=	$(subst --,-Xlinker --,$(TF_LDFLAGS_$(ARCH)))
441641f16e7SAmbroise Vincent
442641f16e7SAmbroise Vincent# LD = gcc-ld (ld) or llvm-ld (ld.lld) or other
443c2ad38ceSVarun Wadekarelse
444c2b8806fSDouglas RaillardTF_LDFLAGS		+=	--fatal-warnings -O1
445c2b8806fSDouglas RaillardTF_LDFLAGS		+=	--gc-sections
446641f16e7SAmbroise Vincent# ld.lld doesn't recognize the errata flags,
447641f16e7SAmbroise Vincent# therefore don't add those in that case
448641f16e7SAmbroise Vincentifeq ($(findstring ld.lld,$(notdir $(LD))),)
449c2b8806fSDouglas RaillardTF_LDFLAGS		+=	$(TF_LDFLAGS_$(ARCH))
450edbce9aaSzelalem-awekeendif
451641f16e7SAmbroise Vincentendif
45273c99d4eSJuan Castillo
45303b397a8SNishanth MenonDTC_FLAGS		+=	-I dts -O dtb
454a6de824fSLouis MayencourtDTC_CPPFLAGS		+=	-P -nostdinc -Iinclude -Ifdts -undef \
455a6de824fSLouis Mayencourt				-x assembler-with-cpp $(DEFINES)
45603b397a8SNishanth Menon
45773c99d4eSJuan Castillo################################################################################
45873c99d4eSJuan Castillo# Common sources and include directories
45973c99d4eSJuan Castillo################################################################################
4606a0da736SJayanth Dodderi Chidanandinclude ${MAKE_HELPERS_DIRECTORY}arch_features.mk
461d801fbb0Sdp-arminclude lib/compiler-rt/compiler-rt.mk
46273c99d4eSJuan Castillo
46373c99d4eSJuan CastilloBL_COMMON_SOURCES	+=	common/bl_common.c			\
4647f56e9a3SSoby Mathew				common/tf_log.c				\
4659d29c227SSoby Mathew				common/${ARCH}/debug.S			\
46691b48c9fSJulius Werner				drivers/console/multi_console.c		\
4679d29c227SSoby Mathew				lib/${ARCH}/cache_helpers.S		\
4689d29c227SSoby Mathew				lib/${ARCH}/misc_helpers.S		\
469566034fcSSoby Mathew				plat/common/plat_bl_common.c		\
4707f56e9a3SSoby Mathew				plat/common/plat_log_common.c		\
47175311203Sdp-arm				plat/common/${ARCH}/plat_common.c	\
4729d29c227SSoby Mathew				plat/common/${ARCH}/platform_helpers.S	\
47361f72a34SRoberto Vargas				${COMPILER_RT_SRCS}
474d7a6b0f8SRyan Harkin
4758422a840SAntonio Nino Diazifeq ($(notdir $(CC)),armclang)
4768422a840SAntonio Nino DiazBL_COMMON_SOURCES	+=	lib/${ARCH}/armclang_printf.S
4778422a840SAntonio Nino Diazendif
4788422a840SAntonio Nino Diaz
4791f461979SJustin Chadwellifeq (${SANITIZE_UB},on)
4801f461979SJustin ChadwellBL_COMMON_SOURCES	+=	plat/common/ubsan.c
4811f461979SJustin Chadwellendif
4821f461979SJustin Chadwell
48301d237cbSYann GautierINCLUDES		+=	-Iinclude				\
484f5478dedSAntonio Nino Diaz				-Iinclude/arch/${ARCH}			\
48509d40e0eSAntonio Nino Diaz				-Iinclude/lib/cpus/${ARCH}		\
48609d40e0eSAntonio Nino Diaz				-Iinclude/lib/el3_runtime/${ARCH}	\
48709d40e0eSAntonio Nino Diaz				${PLAT_INCLUDES}			\
48809d40e0eSAntonio Nino Diaz				${SPD_INCLUDES}
48909d40e0eSAntonio Nino Diaz
4909c6d1c50SAntonio Nino Diazinclude common/backtrace/backtrace.mk
4919c6d1c50SAntonio Nino Diaz
49273c99d4eSJuan Castillo################################################################################
49373c99d4eSJuan Castillo# Generic definitions
49473c99d4eSJuan Castillo################################################################################
49573c99d4eSJuan Castillo
496231c1470SEvan Lloydinclude ${MAKE_HELPERS_DIRECTORY}plat_helpers.mk
497231c1470SEvan Lloyd
49829214e95SGrant Likelyifeq (${BUILD_BASE},)
49973c99d4eSJuan Castillo     BUILD_BASE		:=	./build
50029214e95SGrant Likelyendif
50129214e95SGrant LikelyBUILD_PLAT		:=	$(abspath ${BUILD_BASE})/${PLAT}/${BUILD_TYPE}
50273c99d4eSJuan Castillo
503231c1470SEvan LloydSPDS			:=	$(sort $(filter-out none, $(patsubst services/spd/%,%,$(wildcard services/spd/*))))
50473c99d4eSJuan Castillo
50573c99d4eSJuan Castillo# Platforms providing their own TBB makefile may override this value
50673c99d4eSJuan CastilloINCLUDE_TBBR_MK		:=	1
50773c99d4eSJuan Castillo
50873c99d4eSJuan Castillo
50973c99d4eSJuan Castillo################################################################################
51073c99d4eSJuan Castillo# Include SPD Makefile if one has been specified
51173c99d4eSJuan Castillo################################################################################
51273c99d4eSJuan Castillo
51373c99d4eSJuan Castilloifneq (${SPD},none)
5149d29c227SSoby Mathew    ifeq (${ARCH},aarch32)
5159d29c227SSoby Mathew        $(error "Error: SPD is incompatible with AArch32.")
5169d29c227SSoby Mathew    endif
51728f39f02SMax Shvetsov
5184c117f6cSSandrine Bailleux    ifdef EL3_PAYLOAD_BASE
5194c117f6cSSandrine Bailleux        $(warning "SPD and EL3_PAYLOAD_BASE are incompatible build options.")
5204c117f6cSSandrine Bailleux        $(warning "The SPD and its BL32 companion will be present but ignored.")
5214c117f6cSSandrine Bailleux    endif
52228f39f02SMax Shvetsov
523c3fb00d9SAchin Gupta    ifeq (${SPD},spmd)
524c3fb00d9SAchin Gupta        # SPMD is located in std_svc directory
525c3fb00d9SAchin Gupta        SPD_DIR := std_svc
52628f39f02SMax Shvetsov
527033039f8SMax Shvetsov        ifeq ($(SPMD_SPM_AT_SEL2),1)
52828f39f02SMax Shvetsov            ifeq ($(CTX_INCLUDE_EL2_REGS),0)
529033039f8SMax Shvetsov                $(error SPMD with SPM at S-EL2 requires CTX_INCLUDE_EL2_REGS option)
530033039f8SMax Shvetsov            endif
5311d63ae4dSMarc Bonnici	    ifeq ($(SPMC_AT_EL3),1)
5321d63ae4dSMarc Bonnici                $(error SPM cannot be enabled in both S-EL2 and EL3.)
5331d63ae4dSMarc Bonnici            endif
53428f39f02SMax Shvetsov        endif
535db1ef41aSOlivier Deprez
536db1ef41aSOlivier Deprez        ifeq ($(findstring optee_sp,$(ARM_SPMC_MANIFEST_DTS)),optee_sp)
537db1ef41aSOlivier Deprez            DTC_CPPFLAGS	+=	-DOPTEE_SP_FW_CONFIG
538db1ef41aSOlivier Deprez        endif
539ca932481SDavidson K
540ca932481SDavidson K        ifeq ($(TS_SP_FW_CONFIG),1)
541ca932481SDavidson K            DTC_CPPFLAGS	+=	-DTS_SP_FW_CONFIG
542ca932481SDavidson K        endif
54333993a37SBalint Dobszay
54433993a37SBalint Dobszay        ifneq ($(ARM_BL2_SP_LIST_DTS),)
54533993a37SBalint Dobszay            DTC_CPPFLAGS += -DARM_BL2_SP_LIST_DTS=$(ARM_BL2_SP_LIST_DTS)
54633993a37SBalint Dobszay        endif
54746789a7cSBalint Dobszay
54846789a7cSBalint Dobszay        ifneq ($(SP_LAYOUT_FILE),)
54946789a7cSBalint Dobszay            BL2_ENABLE_SP_LOAD := 1
55046789a7cSBalint Dobszay        endif
551c3fb00d9SAchin Gupta    else
552c3fb00d9SAchin Gupta        # All other SPDs in spd directory
553c3fb00d9SAchin Gupta        SPD_DIR := spd
554c3fb00d9SAchin Gupta    endif
555c3fb00d9SAchin Gupta
55673c99d4eSJuan Castillo    # We expect to locate an spd.mk under the specified SPD directory
557c3fb00d9SAchin Gupta    SPD_MAKE	:=	$(wildcard services/${SPD_DIR}/${SPD}/${SPD}.mk)
558c3fb00d9SAchin Gupta
55973c99d4eSJuan Castillo    ifeq (${SPD_MAKE},)
560c3fb00d9SAchin Gupta        $(error Error: No services/${SPD_DIR}/${SPD}/${SPD}.mk located)
56173c99d4eSJuan Castillo    endif
56273c99d4eSJuan Castillo    $(info Including ${SPD_MAKE})
56373c99d4eSJuan Castillo    include ${SPD_MAKE}
56473c99d4eSJuan Castillo
56570d1fc53SJuan Castillo    # If there's BL32 companion for the chosen SPD, we expect that the SPD's
56670d1fc53SJuan Castillo    # Makefile would set NEED_BL32 to "yes". In this case, the build system
56770d1fc53SJuan Castillo    # supports two mutually exclusive options:
56870d1fc53SJuan Castillo    # * BL32 is built from source: then BL32_SOURCES must contain the list
56970d1fc53SJuan Castillo    #   of source files to build BL32
57070d1fc53SJuan Castillo    # * BL32 is a prebuilt binary: then BL32 must point to the image file
57170d1fc53SJuan Castillo    #   that will be included in the FIP
57270d1fc53SJuan Castillo    # If both BL32_SOURCES and BL32 are defined, the binary takes precedence
57370d1fc53SJuan Castillo    # over the sources.
574e35c4045SJeenu Viswambharanendif
575e35c4045SJeenu Viswambharan
57651faada7SDouglas Raillard################################################################################
5775b18de09SZelalem Aweke# Include rmmd Makefile if RME is enabled
5785b18de09SZelalem Aweke################################################################################
5795b18de09SZelalem Aweke
5805b18de09SZelalem Awekeifneq (${ENABLE_RME},0)
5815b18de09SZelalem Awekeifneq (${ARCH},aarch64)
5825b18de09SZelalem Aweke	$(error ENABLE_RME requires AArch64)
5835b18de09SZelalem Awekeendif
5841d63ae4dSMarc Bonniciifeq ($(SPMC_AT_EL3),1)
5851d63ae4dSMarc Bonnici	$(error SPMC_AT_EL3 and ENABLE_RME cannot both be enabled.)
5861d63ae4dSMarc Bonniciendif
5875b18de09SZelalem Awekeinclude services/std_svc/rmmd/rmmd.mk
5885b18de09SZelalem Aweke$(warning "RME is an experimental feature")
5895b18de09SZelalem Awekeendif
5905b18de09SZelalem Aweke
5915b18de09SZelalem Aweke################################################################################
59273c99d4eSJuan Castillo# Include the platform specific Makefile after the SPD Makefile (the platform
59373c99d4eSJuan Castillo# makefile may use all previous definitions in this file)
59473c99d4eSJuan Castillo################################################################################
5952da8d8bfSJeenu Viswambharan
59673c99d4eSJuan Castilloinclude ${PLAT_MAKEFILE_FULL}
5970f21c547SJuan Castillo
5988012cc5cSMasahiro Yamada$(eval $(call MAKE_PREREQ_DIR,${BUILD_PLAT}))
5998012cc5cSMasahiro Yamada
60026e63c44SEtienne Carriereifeq (${ARM_ARCH_MAJOR},7)
60126e63c44SEtienne Carriereinclude make_helpers/armv7-a-cpus.mk
60226e63c44SEtienne Carriereendif
60326e63c44SEtienne Carriere
6043bd17c0fSSoby MathewPIE_FOUND		:=	$(findstring --enable-default-pie,${GCC_V_OUTPUT})
6053bd17c0fSSoby Mathewifneq ($(PIE_FOUND),)
6063bd17c0fSSoby Mathew	TF_CFLAGS	+=	-fno-PIE
6077b592418SSamuel Hollandifneq ($(findstring gcc,$(notdir $(LD))),)
6087b592418SSamuel Holland	TF_LDFLAGS	+=	-no-pie
6097b592418SSamuel Hollandendif
6103bd17c0fSSoby Mathewendif
611320920c1SMasahiro Yamada
612320920c1SMasahiro Yamadaifneq ($(findstring gcc,$(notdir $(LD))),)
613320920c1SMasahiro Yamada	PIE_LDFLAGS	+=	-Wl,-pie -Wl,--no-dynamic-linker
614320920c1SMasahiro Yamadaelse
615320920c1SMasahiro Yamada	PIE_LDFLAGS	+=	-pie --no-dynamic-linker
616320920c1SMasahiro Yamadaendif
617320920c1SMasahiro Yamada
618320920c1SMasahiro Yamadaifeq ($(ENABLE_PIE),1)
61969af7fcfSMasahiro Yamadaifeq ($(BL2_AT_EL3),1)
62069af7fcfSMasahiro Yamadaifneq ($(BL2_IN_XIP_MEM),1)
62169af7fcfSMasahiro Yamada	BL2_CFLAGS	+=	-fpie
62269af7fcfSMasahiro Yamada	BL2_LDFLAGS	+=	$(PIE_LDFLAGS)
62369af7fcfSMasahiro Yamadaendif
62469af7fcfSMasahiro Yamadaendif
625320920c1SMasahiro Yamada	BL31_CFLAGS	+=	-fpie
626320920c1SMasahiro Yamada	BL31_LDFLAGS	+=	$(PIE_LDFLAGS)
627d974301dSMasahiro Yamada	BL32_CFLAGS	+=	-fpie
628d974301dSMasahiro Yamada	BL32_LDFLAGS	+=	$(PIE_LDFLAGS)
629d974301dSMasahiro Yamadaendif
6303bd17c0fSSoby Mathew
631d5e97a1dSMasahiro Yamadaifeq (${ARCH},aarch64)
6329cefb4b1SMasahiro YamadaBL1_CPPFLAGS += -DIMAGE_AT_EL3
633d5e97a1dSMasahiro Yamadaifeq ($(BL2_AT_EL3),1)
6349cefb4b1SMasahiro YamadaBL2_CPPFLAGS += -DIMAGE_AT_EL3
635d5e97a1dSMasahiro Yamadaelse
6369cefb4b1SMasahiro YamadaBL2_CPPFLAGS += -DIMAGE_AT_EL1
637d5e97a1dSMasahiro Yamadaendif
6389cefb4b1SMasahiro YamadaBL2U_CPPFLAGS += -DIMAGE_AT_EL1
6399cefb4b1SMasahiro YamadaBL31_CPPFLAGS += -DIMAGE_AT_EL3
6409cefb4b1SMasahiro YamadaBL32_CPPFLAGS += -DIMAGE_AT_EL1
641d5e97a1dSMasahiro Yamadaendif
642d5e97a1dSMasahiro Yamada
64354035fc4SSandrine Bailleux# Include the CPU specific operations makefile, which provides default
64454035fc4SSandrine Bailleux# values for all CPU errata workarounds and CPU specific optimisations.
64554035fc4SSandrine Bailleux# This can be overridden by the platform.
64673c99d4eSJuan Castilloinclude lib/cpus/cpu-ops.mk
6474f6ad66aSAchin Gupta
648a4409008Sdp-armifeq (${ARCH},aarch32)
649a4409008Sdp-armNEED_BL32 := yes
650a4409008Sdp-arm
651a4409008Sdp-arm################################################################################
652a4409008Sdp-arm# Build `AARCH32_SP` as BL32 image for AArch32
653a4409008Sdp-arm################################################################################
654a4409008Sdp-armifneq (${AARCH32_SP},none)
655a4409008Sdp-arm# We expect to locate an sp.mk under the specified AARCH32_SP directory
656a4409008Sdp-armAARCH32_SP_MAKE	:=	$(wildcard bl32/${AARCH32_SP}/${AARCH32_SP}.mk)
657a4409008Sdp-arm
658a4409008Sdp-armifeq (${AARCH32_SP_MAKE},)
659a4409008Sdp-arm  $(error Error: No bl32/${AARCH32_SP}/${AARCH32_SP}.mk located)
660a4409008Sdp-armendif
661a4409008Sdp-arm
662a4409008Sdp-arm$(info Including ${AARCH32_SP_MAKE})
663a4409008Sdp-arminclude ${AARCH32_SP_MAKE}
664a4409008Sdp-armendif
665a4409008Sdp-arm
666a4409008Sdp-armendif
6674f6ad66aSAchin Gupta
66873c99d4eSJuan Castillo################################################################################
66977f1f7a1SVarun Wadekar# Include libc if not overridden
67077f1f7a1SVarun Wadekar################################################################################
67177f1f7a1SVarun Wadekarifeq (${OVERRIDE_LIBC},0)
67277f1f7a1SVarun Wadekarinclude lib/libc/libc.mk
67377f1f7a1SVarun Wadekarendif
67477f1f7a1SVarun Wadekar
67577f1f7a1SVarun Wadekar################################################################################
676cf2c8a33SAntonio Nino Diaz# Check incompatible options
677cf2c8a33SAntonio Nino Diaz################################################################################
678cf2c8a33SAntonio Nino Diaz
679cf2c8a33SAntonio Nino Diazifdef EL3_PAYLOAD_BASE
68068450a6dSAntonio Nino Diaz        ifdef PRELOADED_BL33_BASE
68168450a6dSAntonio Nino Diaz                $(warning "PRELOADED_BL33_BASE and EL3_PAYLOAD_BASE are \
68268450a6dSAntonio Nino Diaz                incompatible build options. EL3_PAYLOAD_BASE has priority.")
683cf2c8a33SAntonio Nino Diaz        endif
68476580f3dSQixiang Xu        ifneq (${GENERATE_COT},0)
68576580f3dSQixiang Xu                $(error "GENERATE_COT and EL3_PAYLOAD_BASE are incompatible build options.")
68676580f3dSQixiang Xu        endif
68776580f3dSQixiang Xu        ifneq (${TRUSTED_BOARD_BOOT},0)
68876580f3dSQixiang Xu                $(error "TRUSTED_BOARD_BOOT and EL3_PAYLOAD_BASE are incompatible build options.")
68976580f3dSQixiang Xu        endif
690cf2c8a33SAntonio Nino Diazendif
691cf2c8a33SAntonio Nino Diaz
692cf2c8a33SAntonio Nino Diazifeq (${NEED_BL33},yes)
693cf2c8a33SAntonio Nino Diaz        ifdef EL3_PAYLOAD_BASE
694cf2c8a33SAntonio Nino Diaz                $(warning "BL33 image is not needed when option \
695cf2c8a33SAntonio Nino Diaz                BL33_PAYLOAD_BASE is used and won't be added to the FIP file.")
696cf2c8a33SAntonio Nino Diaz        endif
69768450a6dSAntonio Nino Diaz        ifdef PRELOADED_BL33_BASE
69868450a6dSAntonio Nino Diaz                $(warning "BL33 image is not needed when option \
69968450a6dSAntonio Nino Diaz                PRELOADED_BL33_BASE is used and won't be added to the FIP \
70068450a6dSAntonio Nino Diaz                file.")
701cf2c8a33SAntonio Nino Diaz        endif
702cf2c8a33SAntonio Nino Diazendif
703cf2c8a33SAntonio Nino Diaz
704d4593e47SJeenu Viswambharan# When building for systems with hardware-assisted coherency, there's no need to
705d4593e47SJeenu Viswambharan# use USE_COHERENT_MEM. Require that USE_COHERENT_MEM must be set to 0 too.
706d4593e47SJeenu Viswambharanifeq ($(HW_ASSISTED_COHERENCY)-$(USE_COHERENT_MEM),1-1)
707d4593e47SJeenu Viswambharan$(error USE_COHERENT_MEM cannot be enabled with HW_ASSISTED_COHERENCY)
708d4593e47SJeenu Viswambharanendif
7091a0a3f06SYatharth Kochar
7107d173fc5SJiafei Pan#For now, BL2_IN_XIP_MEM is only supported when BL2_AT_EL3 is 1.
7117d173fc5SJiafei Panifeq ($(BL2_AT_EL3)-$(BL2_IN_XIP_MEM),0-1)
7127d173fc5SJiafei Pan$(error "BL2_IN_XIP_MEM is only supported when BL2_AT_EL3 is enabled")
7137d173fc5SJiafei Panendif
7147d173fc5SJiafei Pan
71514c6016aSJeenu Viswambharan# For RAS_EXTENSION, require that EAs are handled in EL3 first
71614c6016aSJeenu Viswambharanifeq ($(RAS_EXTENSION),1)
71714c6016aSJeenu Viswambharan    ifneq ($(HANDLE_EA_EL3_FIRST),1)
71814c6016aSJeenu Viswambharan        $(error For RAS_EXTENSION, HANDLE_EA_EL3_FIRST must also be 1)
71914c6016aSJeenu Viswambharan    endif
72014c6016aSJeenu Viswambharanendif
72114c6016aSJeenu Viswambharan
7221a7c1cfeSJeenu Viswambharan# When FAULT_INJECTION_SUPPORT is used, require that RAS_EXTENSION is enabled
7231a7c1cfeSJeenu Viswambharanifeq ($(FAULT_INJECTION_SUPPORT),1)
7241a7c1cfeSJeenu Viswambharan    ifneq ($(RAS_EXTENSION),1)
7251a7c1cfeSJeenu Viswambharan        $(error For FAULT_INJECTION_SUPPORT, RAS_EXTENSION must also be 1)
7261a7c1cfeSJeenu Viswambharan    endif
7271a7c1cfeSJeenu Viswambharanendif
7281a7c1cfeSJeenu Viswambharan
729ed51b51fSRoberto Vargas# DYN_DISABLE_AUTH can be set only when TRUSTED_BOARD_BOOT=1
730209a60ccSSoby Mathewifeq ($(DYN_DISABLE_AUTH), 1)
731209a60ccSSoby Mathew    ifeq (${TRUSTED_BOARD_BOOT}, 0)
732209a60ccSSoby Mathew        $(error "TRUSTED_BOARD_BOOT must be enabled for DYN_DISABLE_AUTH to be set.")
733209a60ccSSoby Mathew    endif
734209a60ccSSoby Mathewendif
735209a60ccSSoby Mathew
7362bf4f27fSManish V Badarkheifeq ($(MEASURED_BOOT)-$(TRUSTED_BOARD_BOOT),1-1)
7372bf4f27fSManish V Badarkhe# Support authentication verification and hash calculation
7382bf4f27fSManish V Badarkhe    CRYPTO_SUPPORT := 3
7392bf4f27fSManish V Badarkheelse ifeq ($(DRTM_SUPPORT)-$(TRUSTED_BOARD_BOOT),1-1)
7402bf4f27fSManish V Badarkhe# Support authentication verification and hash calculation
7412bf4f27fSManish V Badarkhe    CRYPTO_SUPPORT := 3
7422bf4f27fSManish V Badarkheelse ifneq ($(filter 1,${MEASURED_BOOT} ${DRTM_SUPPORT}),)
7432bf4f27fSManish V Badarkhe# Support hash calculation only
7442bf4f27fSManish V Badarkhe    CRYPTO_SUPPORT := 2
7452bf4f27fSManish V Badarkheelse ifeq (${TRUSTED_BOARD_BOOT},1)
7462bf4f27fSManish V Badarkhe# Support authentication verification only
747c9c56f6eSManish V Badarkhe    CRYPTO_SUPPORT := 1
748c9c56f6eSManish V Badarkheelse
749c9c56f6eSManish V Badarkhe    CRYPTO_SUPPORT := 0
750c9c56f6eSManish V Badarkheendif
751c9c56f6eSManish V Badarkhe
752cbf9e84aSBalint Dobszay# SDEI_IN_FCONF is only supported when SDEI_SUPPORT is enabled.
753cbf9e84aSBalint Dobszayifeq ($(SDEI_SUPPORT)-$(SDEI_IN_FCONF),0-1)
754700e7685SManish Pandey$(error "SDEI_IN_FCONF is only supported when SDEI_SUPPORT is enabled")
75584ef9cd8SManish V Badarkheendif
75684ef9cd8SManish V Badarkhe
757b86048c4SAntonio Nino Diaz# If pointer authentication is used in the firmware, make sure that all the
7589fc59639SAlexei Fedorov# registers associated to it are also saved and restored.
7599fc59639SAlexei Fedorov# Not doing it would leak the value of the keys used by EL3 to EL1 and S-EL1.
760b86048c4SAntonio Nino Diazifeq ($(ENABLE_PAUTH),1)
7619fc59639SAlexei Fedorov    ifeq ($(CTX_INCLUDE_PAUTH_REGS),0)
7629fc59639SAlexei Fedorov        $(error Pointer Authentication requires CTX_INCLUDE_PAUTH_REGS=1)
76306715f85SAlexei Fedorov    endif
7649fc59639SAlexei Fedorovendif
7659fc59639SAlexei Fedorov
76606715f85SAlexei Fedorovifeq ($(CTX_INCLUDE_PAUTH_REGS),1)
7679fc59639SAlexei Fedorov    ifneq (${ARCH},aarch64)
7689fc59639SAlexei Fedorov        $(error CTX_INCLUDE_PAUTH_REGS requires AArch64)
769b86048c4SAntonio Nino Diaz    endif
770b86048c4SAntonio Nino Diazendif
7719fc59639SAlexei Fedorov
7729dd94382SJustin Chadwellifeq ($(CTX_INCLUDE_MTE_REGS),1)
7739dd94382SJustin Chadwell    ifneq (${ARCH},aarch64)
7749dd94382SJustin Chadwell        $(error CTX_INCLUDE_MTE_REGS requires AArch64)
7759dd94382SJustin Chadwell    endif
7769dd94382SJustin Chadwellendif
7779dd94382SJustin Chadwell
778396b339dSManish V Badarkheifeq ($(PSA_FWU_SUPPORT),1)
779396b339dSManish V Badarkhe    $(info PSA_FWU_SUPPORT is an experimental feature)
780396b339dSManish V Badarkheendif
781396b339dSManish V Badarkhe
7826a0da736SJayanth Dodderi Chidanandifeq ($(FEATURE_DETECTION),1)
7836a0da736SJayanth Dodderi Chidanand    $(info FEATURE_DETECTION is an experimental feature)
7846a0da736SJayanth Dodderi Chidanandendif
7856a0da736SJayanth Dodderi Chidanand
78660e8f3cfSPetre-Ionut Tudorifeq (${ARM_XLAT_TABLES_LIB_V1}, 1)
78760e8f3cfSPetre-Ionut Tudor    ifeq (${ALLOW_RO_XLAT_TABLES}, 1)
78860e8f3cfSPetre-Ionut Tudor        $(error "ALLOW_RO_XLAT_TABLES requires translation tables library v2")
78960e8f3cfSPetre-Ionut Tudor    endif
79060e8f3cfSPetre-Ionut Tudorendif
79160e8f3cfSPetre-Ionut Tudor
7927cda17bbSSumit Gargifneq (${DECRYPTION_SUPPORT},none)
7937cda17bbSSumit Garg    ifeq (${TRUSTED_BOARD_BOOT}, 0)
7947cda17bbSSumit Garg        $(error TRUSTED_BOARD_BOOT must be enabled for DECRYPTION_SUPPORT to be set)
7957cda17bbSSumit Garg    endif
7967cda17bbSSumit Gargendif
7977cda17bbSSumit Garg
798744ad974Sjohpow01# Ensure that no Aarch64-only features are enabled in Aarch32 build
799dc78e62dSjohpow01ifeq (${ARCH},aarch32)
800744ad974Sjohpow01
801744ad974Sjohpow01    # SME/SVE only supported on AArch64
802dc78e62dSjohpow01    ifeq (${ENABLE_SME_FOR_NS},1)
803dc78e62dSjohpow01        $(error "ENABLE_SME_FOR_NS cannot be used with ARCH=aarch32")
804dc78e62dSjohpow01    endif
805dc78e62dSjohpow01    ifeq (${ENABLE_SVE_FOR_NS},1)
806dc78e62dSjohpow01        # Warning instead of error due to CI dependency on this
80724ab2c0aSYann Gautier        $(error "ENABLE_SVE_FOR_NS cannot be used with ARCH=aarch32")
808dc78e62dSjohpow01    endif
809744ad974Sjohpow01
810ff86e0b4SJuan Pablo Conde    # BRBE is not supported in AArch32
811744ad974Sjohpow01    ifeq (${ENABLE_BRBE_FOR_NS},1)
812744ad974Sjohpow01        $(error "ENABLE_BRBE_FOR_NS cannot be used with ARCH=aarch32")
813744ad974Sjohpow01    endif
814744ad974Sjohpow01
815ff86e0b4SJuan Pablo Conde    # FEAT_RNG_TRAP is not supported in AArch32
816ff86e0b4SJuan Pablo Conde    ifeq (${ENABLE_FEAT_RNG_TRAP},1)
817ff86e0b4SJuan Pablo Conde        $(error "ENABLE_FEAT_RNG_TRAP cannot be used with ARCH=aarch32")
818ff86e0b4SJuan Pablo Conde    endif
819dc78e62dSjohpow01endif
820dc78e62dSjohpow01
821dc78e62dSjohpow01# Ensure ENABLE_RME is not used with SME
822dc78e62dSjohpow01ifeq (${ENABLE_RME},1)
823dc78e62dSjohpow01    ifeq (${ENABLE_SME_FOR_NS},1)
824dc78e62dSjohpow01        $(error "ENABLE_SME_FOR_NS cannot be used with ENABLE_RME")
825dc78e62dSjohpow01    endif
826dc78e62dSjohpow01endif
827dc78e62dSjohpow01
828dc78e62dSjohpow01# Secure SME/SVE requires the non-secure component as well
829dc78e62dSjohpow01ifeq (${ENABLE_SME_FOR_SWD},1)
830dc78e62dSjohpow01    ifeq (${ENABLE_SME_FOR_NS},0)
831dc78e62dSjohpow01        $(error "ENABLE_SME_FOR_SWD requires ENABLE_SME_FOR_NS")
832dc78e62dSjohpow01    endif
833dc78e62dSjohpow01endif
834dc78e62dSjohpow01ifeq (${ENABLE_SVE_FOR_SWD},1)
835dc78e62dSjohpow01    ifeq (${ENABLE_SVE_FOR_NS},0)
836dc78e62dSjohpow01        $(error "ENABLE_SVE_FOR_SWD requires ENABLE_SVE_FOR_NS")
837dc78e62dSjohpow01    endif
838dc78e62dSjohpow01endif
839dc78e62dSjohpow01
840dc78e62dSjohpow01# SVE and SME cannot be used with CTX_INCLUDE_FPREGS since secure manager does
841dc78e62dSjohpow01# its own context management including FPU registers.
842dc78e62dSjohpow01ifeq (${CTX_INCLUDE_FPREGS},1)
843dc78e62dSjohpow01    ifeq (${ENABLE_SME_FOR_NS},1)
844dc78e62dSjohpow01        $(error "ENABLE_SME_FOR_NS cannot be used with CTX_INCLUDE_FPREGS")
845dc78e62dSjohpow01    endif
846dc78e62dSjohpow01    ifeq (${ENABLE_SVE_FOR_NS},1)
847dc78e62dSjohpow01        # Warning instead of error due to CI dependency on this
848dc78e62dSjohpow01        $(warning "ENABLE_SVE_FOR_NS cannot be used with CTX_INCLUDE_FPREGS")
849dc78e62dSjohpow01        $(warning "Forced ENABLE_SVE_FOR_NS=0")
850dc78e62dSjohpow01        override ENABLE_SVE_FOR_NS	:= 0
851dc78e62dSjohpow01    endif
852dc78e62dSjohpow01endif
853dc78e62dSjohpow01
85400e28874SManish V Badarkheifeq ($(DRTM_SUPPORT),1)
85500e28874SManish V Badarkhe    $(info DRTM_SUPPORT is an experimental feature)
85600e28874SManish V Badarkheendif
85700e28874SManish V Badarkhe
858274a69e7SChris Kayifeq (${ENABLE_RME},1)
859274a69e7SChris Kay    ifneq (${SEPARATE_CODE_AND_RODATA},1)
860274a69e7SChris Kay        $(error `ENABLE_RME=1` requires `SEPARATE_CODE_AND_RODATA=1`)
861274a69e7SChris Kay    endif
862274a69e7SChris Kayendif
863274a69e7SChris Kay
864cf2c8a33SAntonio Nino Diaz################################################################################
86573c99d4eSJuan Castillo# Process platform overrideable behaviour
86673c99d4eSJuan Castillo################################################################################
8674f6ad66aSAchin Gupta
8685f24ce96SManish Pandeyifdef BL1_SOURCES
8695f24ce96SManish PandeyNEED_BL1 := yes
8705f24ce96SManish Pandeyendif
8715f24ce96SManish Pandey
8725f24ce96SManish Pandeyifdef BL2_SOURCES
8735f24ce96SManish Pandey	NEED_BL2 := yes
8745f24ce96SManish Pandey
875bd97f83aSJohn Tsichritzis	# Using BL2 implies that a BL33 image also needs to be supplied for the FIP and
876bd97f83aSJohn Tsichritzis	# Certificate generation tools. This flag can be overridden by the platform.
877cf2c8a33SAntonio Nino Diaz	ifdef EL3_PAYLOAD_BASE
878cf2c8a33SAntonio Nino Diaz                # If booting an EL3 payload there is no need for a BL33 image
879cf2c8a33SAntonio Nino Diaz                # in the FIP file.
8804c117f6cSSandrine Bailleux                NEED_BL33		:=	no
881cf2c8a33SAntonio Nino Diaz        else
88268450a6dSAntonio Nino Diaz                ifdef PRELOADED_BL33_BASE
883cf2c8a33SAntonio Nino Diaz                        # If booting a BL33 preloaded image there is no need of
884cf2c8a33SAntonio Nino Diaz                        # another one in the FIP file.
885cf2c8a33SAntonio Nino Diaz                        NEED_BL33		:=	no
886cf2c8a33SAntonio Nino Diaz                else
887cf2c8a33SAntonio Nino Diaz                        NEED_BL33		?=	yes
888cf2c8a33SAntonio Nino Diaz                endif
8894c117f6cSSandrine Bailleux        endif
89073c99d4eSJuan Castilloendif
8916f971622SJuan Castillo
8925f24ce96SManish Pandeyifdef BL2U_SOURCES
8935f24ce96SManish PandeyNEED_BL2U := yes
8945f24ce96SManish Pandeyendif
8955f24ce96SManish Pandey
8964d045d0eSMasahiro Yamada# If SCP_BL2 is given, we always want FIP to include it.
8974d045d0eSMasahiro Yamadaifdef SCP_BL2
8984d045d0eSMasahiro Yamada        NEED_SCP_BL2		:=	yes
8994d045d0eSMasahiro Yamadaendif
9004d045d0eSMasahiro Yamada
9015744e874SSoby Mathew# For AArch32, BL31 is not currently supported.
9025744e874SSoby Mathewifneq (${ARCH},aarch32)
9035744e874SSoby Mathew    ifdef BL31_SOURCES
9045744e874SSoby Mathew        # When booting an EL3 payload, there is no need to compile the BL31 image nor
9055744e874SSoby Mathew        # put it in the FIP.
9065744e874SSoby Mathew        ifndef EL3_PAYLOAD_BASE
9075744e874SSoby Mathew            NEED_BL31 := yes
9085744e874SSoby Mathew        endif
9095744e874SSoby Mathew    endif
9105744e874SSoby Mathewendif
9115744e874SSoby Mathew
91273c99d4eSJuan Castillo# Process TBB related flags
9136f971622SJuan Castilloifneq (${GENERATE_COT},0)
91473c99d4eSJuan Castillo        # Common cert_create options
9156f971622SJuan Castillo        ifneq (${CREATE_KEYS},0)
9166f971622SJuan Castillo                $(eval CRT_ARGS += -n)
9170191262dSYatharth Kochar                $(eval FWU_CRT_ARGS += -n)
918fd34e7baSJuan Castillo                ifneq (${SAVE_KEYS},0)
919fd34e7baSJuan Castillo                        $(eval CRT_ARGS += -k)
9200191262dSYatharth Kochar                        $(eval FWU_CRT_ARGS += -k)
921fd34e7baSJuan Castillo                endif
9226f971622SJuan Castillo        endif
92373c99d4eSJuan Castillo        # Include TBBR makefile (unless the platform indicates otherwise)
92473c99d4eSJuan Castillo        ifeq (${INCLUDE_TBBR_MK},1)
92573c99d4eSJuan Castillo                include make_helpers/tbbr/tbbr_tools.mk
92673c99d4eSJuan Castillo        endif
9276f971622SJuan Castilloendif
9286f971622SJuan Castillo
9291c75d5dfSMasahiro Yamadaifneq (${FIP_ALIGN},0)
9301c75d5dfSMasahiro YamadaFIP_ARGS += --align ${FIP_ALIGN}
9311c75d5dfSMasahiro Yamadaendif
9321c75d5dfSMasahiro Yamada
9335f24ce96SManish Pandeyifdef FDT_SOURCES
9345f24ce96SManish PandeyNEED_FDT := yes
9355f24ce96SManish Pandeyendif
9365f24ce96SManish Pandey
93773c99d4eSJuan Castillo################################################################################
93846e5e035SMichalis Pappas# Include libraries' Makefile that are used in all BL
93946e5e035SMichalis Pappas################################################################################
94046e5e035SMichalis Pappas
94146e5e035SMichalis Pappasinclude lib/stack_protector/stack_protector.mk
94246e5e035SMichalis Pappas
94346e5e035SMichalis Pappas################################################################################
944819281eeSdp-arm# Auxiliary tools (fiptool, cert_create, etc)
94573c99d4eSJuan Castillo################################################################################
94673c99d4eSJuan Castillo
94773c99d4eSJuan Castillo# Variables for use with Certificate Generation Tool
94873c99d4eSJuan CastilloCRTTOOLPATH		?=	tools/cert_create
94942a45b51SEvan LloydCRTTOOL			?=	${CRTTOOLPATH}/cert_create${BIN_EXT}
95073c99d4eSJuan Castillo
95190aa901fSSumit Garg# Variables for use with Firmware Encryption Tool
95290aa901fSSumit GargENCTOOLPATH		?=	tools/encrypt_fw
95390aa901fSSumit GargENCTOOL			?=	${ENCTOOLPATH}/encrypt_fw${BIN_EXT}
95490aa901fSSumit Garg
95573c99d4eSJuan Castillo# Variables for use with Firmware Image Package
956819281eeSdp-armFIPTOOLPATH		?=	tools/fiptool
957819281eeSdp-armFIPTOOL			?=	${FIPTOOLPATH}/fiptool${BIN_EXT}
95873c99d4eSJuan Castillo
95926010da1SAntonio Nino Diaz# Variables for use with sptool
96026010da1SAntonio Nino DiazSPTOOLPATH		?=	tools/sptool
961822c7279SJ-AlvesSPTOOL			?=	${SPTOOLPATH}/sptool.py
962ce2b1ec6SManish PandeySP_MK_GEN		?=	${SPTOOLPATH}/sp_mk_generator.py
96326010da1SAntonio Nino Diaz
9645accce5bSRoberto Vargas# Variables for use with ROMLIB
9655accce5bSRoberto VargasROMLIBPATH		?=	lib/romlib
9665accce5bSRoberto Vargas
967cfe83910SLouis Mayencourt# Variable for use with Python
968cfe83910SLouis MayencourtPYTHON			?=	python3
969cfe83910SLouis Mayencourt
970cfe83910SLouis Mayencourt# Variables for use with PRINT_MEMORY_MAP
971cfe83910SLouis MayencourtPRINT_MEMORY_MAP_PATH		?=	tools/memory
972cfe83910SLouis MayencourtPRINT_MEMORY_MAP		?=	${PRINT_MEMORY_MAP_PATH}/print_memory_map.py
973cfe83910SLouis Mayencourt
9746de32378SMadhukar Pappireddy# Variables for use with documentation build using Sphinx tool
9756de32378SMadhukar PappireddyDOCS_PATH		?=	docs
9766de32378SMadhukar Pappireddy
9771f1c0206SAbdul Halim, Muhammad Hadi Asyrafi# Defination of SIMICS flag
9781f1c0206SAbdul Halim, Muhammad Hadi AsyrafiSIMICS_BUILD	?=	0
9791f1c0206SAbdul Halim, Muhammad Hadi Asyrafi
9808a86052dSSoby Mathew################################################################################
9818a86052dSSoby Mathew# Include BL specific makefiles
9828a86052dSSoby Mathew################################################################################
9835f24ce96SManish Pandey
9845f24ce96SManish Pandeyifeq (${NEED_BL1},yes)
9858a86052dSSoby Mathewinclude bl1/bl1.mk
9868a86052dSSoby Mathewendif
9878a86052dSSoby Mathew
9885f24ce96SManish Pandeyifeq (${NEED_BL2},yes)
9898a86052dSSoby Mathewinclude bl2/bl2.mk
9908a86052dSSoby Mathewendif
9918a86052dSSoby Mathew
9925f24ce96SManish Pandeyifeq (${NEED_BL2U},yes)
9938a86052dSSoby Mathewinclude bl2u/bl2u.mk
9948a86052dSSoby Mathewendif
9958a86052dSSoby Mathew
9965744e874SSoby Mathewifeq (${NEED_BL31},yes)
9978a86052dSSoby Mathewinclude bl31/bl31.mk
9988a86052dSSoby Mathewendif
99903b397a8SNishanth Menon
100073c99d4eSJuan Castillo################################################################################
100173c99d4eSJuan Castillo# Build options checks
100273c99d4eSJuan Castillo################################################################################
100373c99d4eSJuan Castillo
1004327131c4SLeonardo Sandoval$(eval $(call assert_booleans,\
1005327131c4SLeonardo Sandoval    $(sort \
1006327131c4SLeonardo Sandoval        ALLOW_RO_XLAT_TABLES \
100746789a7cSBalint Dobszay        BL2_ENABLE_SP_LOAD \
1008327131c4SLeonardo Sandoval        COLD_BOOT_SINGLE_CPU \
1009327131c4SLeonardo Sandoval        CREATE_KEYS \
1010327131c4SLeonardo Sandoval        CTX_INCLUDE_AARCH32_REGS \
1011327131c4SLeonardo Sandoval        CTX_INCLUDE_FPREGS \
1012327131c4SLeonardo Sandoval        CTX_INCLUDE_EL2_REGS \
1013327131c4SLeonardo Sandoval        DEBUG \
10140063dd17SJavier Almansa Sobrino        DISABLE_MTPMU \
1015327131c4SLeonardo Sandoval        DYN_DISABLE_AUTH \
1016327131c4SLeonardo Sandoval        EL3_EXCEPTION_HANDLING \
1017327131c4SLeonardo Sandoval        ENABLE_AMU \
10181fd685a7SChris Kay        ENABLE_AMU_AUXILIARY_COUNTERS \
1019742ca230SChris Kay        ENABLE_AMU_FCONF \
1020873d4241Sjohpow01        AMU_RESTRICT_COUNTERS \
1021327131c4SLeonardo Sandoval        ENABLE_ASSERTIONS \
1022327131c4SLeonardo Sandoval        ENABLE_PIE \
1023327131c4SLeonardo Sandoval        ENABLE_PMF \
1024327131c4SLeonardo Sandoval        ENABLE_PSCI_STAT \
1025327131c4SLeonardo Sandoval        ENABLE_RUNTIME_INSTRUMENTATION \
1026dc78e62dSjohpow01        ENABLE_SME_FOR_NS \
1027dc78e62dSjohpow01        ENABLE_SME_FOR_SWD \
1028327131c4SLeonardo Sandoval        ENABLE_SPE_FOR_LOWER_ELS \
1029327131c4SLeonardo Sandoval        ENABLE_SVE_FOR_NS \
10300c5e7d1cSMax Shvetsov        ENABLE_SVE_FOR_SWD \
1031327131c4SLeonardo Sandoval        ERROR_DEPRECATED \
1032327131c4SLeonardo Sandoval        FAULT_INJECTION_SUPPORT \
1033327131c4SLeonardo Sandoval        GENERATE_COT \
1034327131c4SLeonardo Sandoval        GICV2_G0_FOR_EL3 \
1035327131c4SLeonardo Sandoval        HANDLE_EA_EL3_FIRST \
1036327131c4SLeonardo Sandoval        HW_ASSISTED_COHERENCY \
1037327131c4SLeonardo Sandoval        INVERTED_MEMMAP \
1038327131c4SLeonardo Sandoval        MEASURED_BOOT \
103900e28874SManish V Badarkhe        DRTM_SUPPORT \
1040327131c4SLeonardo Sandoval        NS_TIMER_SWITCH \
1041327131c4SLeonardo Sandoval        OVERRIDE_LIBC \
1042327131c4SLeonardo Sandoval        PL011_GENERIC_UART \
10430ce2072dSTamas Ban        PLAT_RSS_NOT_SUPPORTED \
1044327131c4SLeonardo Sandoval        PROGRAMMABLE_RESET_ADDRESS \
1045327131c4SLeonardo Sandoval        PSCI_EXTENDED_STATE_ID \
1046327131c4SLeonardo Sandoval        RESET_TO_BL31 \
104725844ff7SJorge Ramirez-Ortiz        RESET_TO_BL31_WITH_PARAMS \
1048327131c4SLeonardo Sandoval        SAVE_KEYS \
1049327131c4SLeonardo Sandoval        SEPARATE_CODE_AND_RODATA \
105096a8ed14SJiafei Pan        SEPARATE_BL2_NOLOAD_REGION \
1051327131c4SLeonardo Sandoval        SEPARATE_NOBITS_REGION \
1052327131c4SLeonardo Sandoval        SPIN_ON_BL1_EXIT \
1053327131c4SLeonardo Sandoval        SPM_MM \
10541d63ae4dSMarc Bonnici        SPMC_AT_EL3 \
1055327131c4SLeonardo Sandoval        SPMD_SPM_AT_SEL2 \
1056327131c4SLeonardo Sandoval        TRUSTED_BOARD_BOOT \
1057327131c4SLeonardo Sandoval        USE_COHERENT_MEM \
1058327131c4SLeonardo Sandoval        USE_DEBUGFS \
1059327131c4SLeonardo Sandoval        ARM_IO_IN_DTB \
1060327131c4SLeonardo Sandoval        SDEI_IN_FCONF \
1061327131c4SLeonardo Sandoval        SEC_INT_DESC_IN_FCONF \
1062327131c4SLeonardo Sandoval        USE_ROMLIB \
1063327131c4SLeonardo Sandoval        USE_TBBR_DEFS \
1064327131c4SLeonardo Sandoval        WARMBOOT_ENABLE_DCACHE_EARLY \
1065327131c4SLeonardo Sandoval        BL2_AT_EL3 \
1066327131c4SLeonardo Sandoval        BL2_IN_XIP_MEM \
1067327131c4SLeonardo Sandoval        BL2_INV_DCACHE \
1068327131c4SLeonardo Sandoval        USE_SPINLOCK_CAS \
1069327131c4SLeonardo Sandoval        ENCRYPT_BL31 \
1070327131c4SLeonardo Sandoval        ENCRYPT_BL32 \
1071327131c4SLeonardo Sandoval        ERRATA_SPECULATIVE_AT \
107200e8f79cSManish Pandey        RAS_TRAP_NS_ERR_REC_ACCESS \
1073327131c4SLeonardo Sandoval        COT_DESC_IN_DTB \
1074327131c4SLeonardo Sandoval        USE_SP804_TIMER \
1075396b339dSManish V Badarkhe        PSA_FWU_SUPPORT \
1076d4582d30SManish V Badarkhe        ENABLE_SYS_REG_TRACE_FOR_NS \
107768120783SChris Kay        ENABLE_MPMM \
107868120783SChris Kay        ENABLE_MPMM_FCONF \
10791f1c0206SAbdul Halim, Muhammad Hadi Asyrafi        SIMICS_BUILD \
10806a0da736SJayanth Dodderi Chidanand        FEATURE_DETECTION \
1081327131c4SLeonardo Sandoval)))
108273c99d4eSJuan Castillo
1083327131c4SLeonardo Sandoval$(eval $(call assert_numerics,\
1084327131c4SLeonardo Sandoval    $(sort \
1085327131c4SLeonardo Sandoval        ARM_ARCH_MAJOR \
1086327131c4SLeonardo Sandoval        ARM_ARCH_MINOR \
1087327131c4SLeonardo Sandoval        BRANCH_PROTECTION \
10886a0da736SJayanth Dodderi Chidanand        CTX_INCLUDE_PAUTH_REGS \
10896a0da736SJayanth Dodderi Chidanand        CTX_INCLUDE_MTE_REGS \
10906a0da736SJayanth Dodderi Chidanand        CTX_INCLUDE_NEVE_REGS \
10912bf4f27fSManish V Badarkhe        CRYPTO_SUPPORT \
10921298f2f1SJayanth Dodderi Chidanand        ENABLE_BRBE_FOR_NS \
109347c681b7SJayanth Dodderi Chidanand        ENABLE_TRBE_FOR_NS \
10946a0da736SJayanth Dodderi Chidanand        ENABLE_BTI \
10956a0da736SJayanth Dodderi Chidanand        ENABLE_PAUTH \
10966a0da736SJayanth Dodderi Chidanand        ENABLE_FEAT_AMUv1 \
10976a0da736SJayanth Dodderi Chidanand        ENABLE_FEAT_AMUv1p1 \
10986a0da736SJayanth Dodderi Chidanand        ENABLE_FEAT_CSV2_2 \
10996a0da736SJayanth Dodderi Chidanand        ENABLE_FEAT_DIT \
11006a0da736SJayanth Dodderi Chidanand        ENABLE_FEAT_ECV \
11016a0da736SJayanth Dodderi Chidanand        ENABLE_FEAT_FGT \
11026a0da736SJayanth Dodderi Chidanand        ENABLE_FEAT_HCX \
11036a0da736SJayanth Dodderi Chidanand        ENABLE_FEAT_PAN \
11046a0da736SJayanth Dodderi Chidanand        ENABLE_FEAT_RNG \
1105ff86e0b4SJuan Pablo Conde        ENABLE_FEAT_RNG_TRAP \
11066a0da736SJayanth Dodderi Chidanand        ENABLE_FEAT_SB \
11076a0da736SJayanth Dodderi Chidanand        ENABLE_FEAT_SEL2 \
11086a0da736SJayanth Dodderi Chidanand        ENABLE_FEAT_VHE \
11096a0da736SJayanth Dodderi Chidanand        ENABLE_MPAM_FOR_LOWER_ELS \
11106a0da736SJayanth Dodderi Chidanand        ENABLE_RME \
11116a0da736SJayanth Dodderi Chidanand        ENABLE_TRF_FOR_NS \
1112327131c4SLeonardo Sandoval        FW_ENC_STATUS \
11135357f83dSManish V Badarkhe        NR_OF_FW_BANKS \
11145357f83dSManish V Badarkhe        NR_OF_IMAGES_IN_FW_BANK \
11156a0da736SJayanth Dodderi Chidanand        RAS_EXTENSION \
1116781d07a4SJayanth Dodderi Chidanand        TWED_DELAY \
1117781d07a4SJayanth Dodderi Chidanand        ENABLE_FEAT_TWED \
1118bebcf27fSMark Brown        SVE_VECTOR_LEN \
1119327131c4SLeonardo Sandoval)))
1120c877b414SJeenu Viswambharan
1121aacff749SJustin Chadwellifdef KEY_SIZE
1122aacff749SJustin Chadwell        $(eval $(call assert_numeric,KEY_SIZE))
1123aacff749SJustin Chadwellendif
1124aacff749SJustin Chadwell
11251f461979SJustin Chadwellifeq ($(filter $(SANITIZE_UB), on off trap),)
11261f461979SJustin Chadwell        $(error "Invalid value for SANITIZE_UB: can be one of on, off, trap")
11271f461979SJustin Chadwellendif
11281f461979SJustin Chadwell
112973c99d4eSJuan Castillo################################################################################
113073c99d4eSJuan Castillo# Add definitions to the cpp preprocessor based on the current build options.
113173c99d4eSJuan Castillo# This is done after including the platform specific makefile to allow the
113273c99d4eSJuan Castillo# platform to overwrite the default options
113373c99d4eSJuan Castillo################################################################################
113473c99d4eSJuan Castillo
1135327131c4SLeonardo Sandoval$(eval $(call add_defines,\
1136327131c4SLeonardo Sandoval    $(sort \
1137327131c4SLeonardo Sandoval        ALLOW_RO_XLAT_TABLES \
1138327131c4SLeonardo Sandoval        ARM_ARCH_MAJOR \
1139327131c4SLeonardo Sandoval        ARM_ARCH_MINOR \
114046789a7cSBalint Dobszay        BL2_ENABLE_SP_LOAD \
1141327131c4SLeonardo Sandoval        COLD_BOOT_SINGLE_CPU \
1142327131c4SLeonardo Sandoval        CTX_INCLUDE_AARCH32_REGS \
1143327131c4SLeonardo Sandoval        CTX_INCLUDE_FPREGS \
1144327131c4SLeonardo Sandoval        CTX_INCLUDE_PAUTH_REGS \
1145327131c4SLeonardo Sandoval        EL3_EXCEPTION_HANDLING \
1146327131c4SLeonardo Sandoval        CTX_INCLUDE_MTE_REGS \
1147327131c4SLeonardo Sandoval        CTX_INCLUDE_EL2_REGS \
1148062f8aafSArunachalam Ganapathy        CTX_INCLUDE_NEVE_REGS \
1149327131c4SLeonardo Sandoval        DECRYPTION_SUPPORT_${DECRYPTION_SUPPORT} \
11500063dd17SJavier Almansa Sobrino        DISABLE_MTPMU \
1151327131c4SLeonardo Sandoval        ENABLE_AMU \
11521fd685a7SChris Kay        ENABLE_AMU_AUXILIARY_COUNTERS \
1153742ca230SChris Kay        ENABLE_AMU_FCONF \
1154873d4241Sjohpow01        AMU_RESTRICT_COUNTERS \
1155327131c4SLeonardo Sandoval        ENABLE_ASSERTIONS \
1156327131c4SLeonardo Sandoval        ENABLE_BTI \
1157327131c4SLeonardo Sandoval        ENABLE_MPAM_FOR_LOWER_ELS \
1158327131c4SLeonardo Sandoval        ENABLE_PAUTH \
1159327131c4SLeonardo Sandoval        ENABLE_PIE \
1160327131c4SLeonardo Sandoval        ENABLE_PMF \
1161327131c4SLeonardo Sandoval        ENABLE_PSCI_STAT \
11625b18de09SZelalem Aweke        ENABLE_RME \
1163327131c4SLeonardo Sandoval        ENABLE_RUNTIME_INSTRUMENTATION \
1164dc78e62dSjohpow01        ENABLE_SME_FOR_NS \
1165dc78e62dSjohpow01        ENABLE_SME_FOR_SWD \
1166327131c4SLeonardo Sandoval        ENABLE_SPE_FOR_LOWER_ELS \
1167327131c4SLeonardo Sandoval        ENABLE_SVE_FOR_NS \
11680c5e7d1cSMax Shvetsov        ENABLE_SVE_FOR_SWD \
1169327131c4SLeonardo Sandoval        ENCRYPT_BL31 \
1170327131c4SLeonardo Sandoval        ENCRYPT_BL32 \
1171327131c4SLeonardo Sandoval        ERROR_DEPRECATED \
1172327131c4SLeonardo Sandoval        FAULT_INJECTION_SUPPORT \
1173327131c4SLeonardo Sandoval        GICV2_G0_FOR_EL3 \
1174327131c4SLeonardo Sandoval        HANDLE_EA_EL3_FIRST \
1175327131c4SLeonardo Sandoval        HW_ASSISTED_COHERENCY \
1176327131c4SLeonardo Sandoval        LOG_LEVEL \
1177327131c4SLeonardo Sandoval        MEASURED_BOOT \
117800e28874SManish V Badarkhe        DRTM_SUPPORT \
1179327131c4SLeonardo Sandoval        NS_TIMER_SWITCH \
1180327131c4SLeonardo Sandoval        PL011_GENERIC_UART \
1181327131c4SLeonardo Sandoval        PLAT_${PLAT} \
11820ce2072dSTamas Ban        PLAT_RSS_NOT_SUPPORTED \
1183327131c4SLeonardo Sandoval        PROGRAMMABLE_RESET_ADDRESS \
1184327131c4SLeonardo Sandoval        PSCI_EXTENDED_STATE_ID \
1185327131c4SLeonardo Sandoval        RAS_EXTENSION \
1186327131c4SLeonardo Sandoval        RESET_TO_BL31 \
118725844ff7SJorge Ramirez-Ortiz        RESET_TO_BL31_WITH_PARAMS \
1188327131c4SLeonardo Sandoval        SEPARATE_CODE_AND_RODATA \
118996a8ed14SJiafei Pan        SEPARATE_BL2_NOLOAD_REGION \
1190327131c4SLeonardo Sandoval        SEPARATE_NOBITS_REGION \
1191327131c4SLeonardo Sandoval        RECLAIM_INIT_CODE \
1192327131c4SLeonardo Sandoval        SPD_${SPD} \
1193327131c4SLeonardo Sandoval        SPIN_ON_BL1_EXIT \
1194327131c4SLeonardo Sandoval        SPM_MM \
11951d63ae4dSMarc Bonnici        SPMC_AT_EL3 \
1196327131c4SLeonardo Sandoval        SPMD_SPM_AT_SEL2 \
1197327131c4SLeonardo Sandoval        TRUSTED_BOARD_BOOT \
1198c9c56f6eSManish V Badarkhe        CRYPTO_SUPPORT \
11997dfb9911SJimmy Brisson        TRNG_SUPPORT \
1200327131c4SLeonardo Sandoval        USE_COHERENT_MEM \
1201327131c4SLeonardo Sandoval        USE_DEBUGFS \
1202327131c4SLeonardo Sandoval        ARM_IO_IN_DTB \
1203327131c4SLeonardo Sandoval        SDEI_IN_FCONF \
1204327131c4SLeonardo Sandoval        SEC_INT_DESC_IN_FCONF \
1205327131c4SLeonardo Sandoval        USE_ROMLIB \
1206327131c4SLeonardo Sandoval        USE_TBBR_DEFS \
1207327131c4SLeonardo Sandoval        WARMBOOT_ENABLE_DCACHE_EARLY \
1208327131c4SLeonardo Sandoval        BL2_AT_EL3 \
1209327131c4SLeonardo Sandoval        BL2_IN_XIP_MEM \
1210327131c4SLeonardo Sandoval        BL2_INV_DCACHE \
1211327131c4SLeonardo Sandoval        USE_SPINLOCK_CAS \
1212327131c4SLeonardo Sandoval        ERRATA_SPECULATIVE_AT \
121300e8f79cSManish Pandey        RAS_TRAP_NS_ERR_REC_ACCESS \
1214327131c4SLeonardo Sandoval        COT_DESC_IN_DTB \
1215327131c4SLeonardo Sandoval        USE_SP804_TIMER \
121612cd65e0STomas Pilar        ENABLE_FEAT_RNG \
1217ff86e0b4SJuan Pablo Conde        ENABLE_FEAT_RNG_TRAP \
12184e04478aSChris Kay        ENABLE_FEAT_SB \
12197d33ffe4SDaniel Boulby        ENABLE_FEAT_DIT \
12205357f83dSManish V Badarkhe        NR_OF_FW_BANKS \
12215357f83dSManish V Badarkhe        NR_OF_IMAGES_IN_FW_BANK \
1222396b339dSManish V Badarkhe        PSA_FWU_SUPPORT \
1223744ad974Sjohpow01        ENABLE_BRBE_FOR_NS \
1224813524eaSManish V Badarkhe        ENABLE_TRBE_FOR_NS \
1225d4582d30SManish V Badarkhe        ENABLE_SYS_REG_TRACE_FOR_NS \
12268fcd3d96SManish V Badarkhe        ENABLE_TRF_FOR_NS \
1227cb4ec47bSjohpow01        ENABLE_FEAT_HCX \
122868120783SChris Kay        ENABLE_MPMM \
122968120783SChris Kay        ENABLE_MPMM_FCONF \
1230f74cb0beSJayanth Dodderi Chidanand        ENABLE_FEAT_FGT \
1231f74cb0beSJayanth Dodderi Chidanand        ENABLE_FEAT_AMUv1 \
1232f74cb0beSJayanth Dodderi Chidanand        ENABLE_FEAT_ECV \
12331f1c0206SAbdul Halim, Muhammad Hadi Asyrafi        SIMICS_BUILD \
12346a0da736SJayanth Dodderi Chidanand        ENABLE_FEAT_AMUv1p1 \
12356a0da736SJayanth Dodderi Chidanand        ENABLE_FEAT_SEL2 \
12366a0da736SJayanth Dodderi Chidanand        ENABLE_FEAT_VHE \
12376a0da736SJayanth Dodderi Chidanand        ENABLE_FEAT_CSV2_2 \
12386a0da736SJayanth Dodderi Chidanand        ENABLE_FEAT_PAN \
12396a0da736SJayanth Dodderi Chidanand        FEATURE_DETECTION \
1240781d07a4SJayanth Dodderi Chidanand        TWED_DELAY \
1241781d07a4SJayanth Dodderi Chidanand        ENABLE_FEAT_TWED \
1242327131c4SLeonardo Sandoval)))
12432fae4b1eSJeenu Viswambharan
12441f461979SJustin Chadwellifeq (${SANITIZE_UB},trap)
12451f461979SJustin Chadwell        $(eval $(call add_define,MONITOR_TRAPS))
12461f461979SJustin Chadwellendif
12471f461979SJustin Chadwell
12484c117f6cSSandrine Bailleux# Define the EL3_PAYLOAD_BASE flag only if it is provided.
12494c117f6cSSandrine Bailleuxifdef EL3_PAYLOAD_BASE
12504c117f6cSSandrine Bailleux        $(eval $(call add_define,EL3_PAYLOAD_BASE))
1251cf2c8a33SAntonio Nino Diazelse
125268450a6dSAntonio Nino Diaz        # Define the PRELOADED_BL33_BASE flag only if it is provided and
125368450a6dSAntonio Nino Diaz        # EL3_PAYLOAD_BASE is not defined, as it has priority.
125468450a6dSAntonio Nino Diaz        ifdef PRELOADED_BL33_BASE
125568450a6dSAntonio Nino Diaz                $(eval $(call add_define,PRELOADED_BL33_BASE))
12564c117f6cSSandrine Bailleux        endif
1257cf2c8a33SAntonio Nino Diazendif
125873c99d4eSJuan Castillo
1259209a60ccSSoby Mathew# Define the DYN_DISABLE_AUTH flag only if set.
1260209a60ccSSoby Mathewifeq (${DYN_DISABLE_AUTH},1)
1261209a60ccSSoby Mathew$(eval $(call add_define,DYN_DISABLE_AUTH))
1262209a60ccSSoby Mathewendif
1263209a60ccSSoby Mathew
1264c2ad38ceSVarun Wadekarifneq ($(findstring armlink,$(notdir $(LD))),)
1265c2ad38ceSVarun Wadekar$(eval $(call add_define,USE_ARM_LINK))
1266c2ad38ceSVarun Wadekarendif
1267c2ad38ceSVarun Wadekar
1268ce2b1ec6SManish Pandey# Generate and include sp_gen.mk if SPD is spmd and SP_LAYOUT_FILE is defined
1269ce2b1ec6SManish Pandeyifeq (${SPD},spmd)
1270c33ff198SOlivier Deprezifdef SP_LAYOUT_FILE
1271ce2b1ec6SManish Pandey        -include $(BUILD_PLAT)/sp_gen.mk
1272ce2b1ec6SManish Pandey        FIP_DEPS += sp
127307c44475SManish Pandey        CRT_DEPS += sp
1274ce2b1ec6SManish Pandey        NEED_SP_PKG := yes
1275ce2b1ec6SManish Pandeyelse
1276c33ff198SOlivier Deprez        ifeq (${SPMD_SPM_AT_SEL2},1)
1277c33ff198SOlivier Deprez            $(error "SPMD with SPM at S-EL2 require SP_LAYOUT_FILE")
1278c33ff198SOlivier Deprez        endif
1279ce2b1ec6SManish Pandeyendif
1280ce2b1ec6SManish Pandeyendif
1281ce2b1ec6SManish Pandey
128273c99d4eSJuan Castillo################################################################################
128373c99d4eSJuan Castillo# Build targets
128473c99d4eSJuan Castillo################################################################################
128573c99d4eSJuan Castillo
128690aa901fSSumit Garg.PHONY:	all msg_start clean realclean distclean cscope locate-checkpatch checkcodebase checkpatch fiptool sptool fip sp fwu_fip certtool dtbs memmap doc enctool
128773c99d4eSJuan Castillo.SUFFIXES:
128873c99d4eSJuan Castillo
128973c99d4eSJuan Castilloall: msg_start
129073c99d4eSJuan Castillo
129173c99d4eSJuan Castillomsg_start:
129273c99d4eSJuan Castillo	@echo "Building ${PLAT}"
129373c99d4eSJuan Castillo
12947a24cba5SSoby Mathewifeq (${ERROR_DEPRECATED},0)
1295d5dfdeb6SJulius Werner# Check if deprecated declarations and cpp warnings should be treated as error or not.
1296c2ad38ceSVarun Wadekarifneq ($(findstring clang,$(notdir $(CC))),)
1297c2ad38ceSVarun Wadekar    CPPFLAGS		+= 	-Wno-error=deprecated-declarations
1298c2ad38ceSVarun Wadekarelse
1299bc1a03c7SDan Handley    CPPFLAGS		+= 	-Wno-error=deprecated-declarations -Wno-error=cpp
13007a24cba5SSoby Mathewendif
1301d5dfdeb6SJulius Wernerendif # !ERROR_DEPRECATED
13027a24cba5SSoby Mathew
13035accce5bSRoberto Vargas$(eval $(call MAKE_LIB_DIRS))
130461f72a34SRoberto Vargas$(eval $(call MAKE_LIB,c))
13055fee0287SRoberto Vargas
130673c99d4eSJuan Castillo# Expand build macros for the different images
130773c99d4eSJuan Castilloifeq (${NEED_BL1},yes)
1308b34635a0SChris KayBL1_SOURCES := $(sort ${BL1_SOURCES})
1309b34635a0SChris Kay
1310434d0491SZelalem Aweke$(eval $(call MAKE_BL,bl1))
131173c99d4eSJuan Castilloendif
131273c99d4eSJuan Castillo
131373c99d4eSJuan Castilloifeq (${NEED_BL2},yes)
1314c9b31ae8SRoberto Vargasifeq (${BL2_AT_EL3}, 0)
1315c9b31ae8SRoberto VargasFIP_BL2_ARGS := tb-fw
1316c9b31ae8SRoberto Vargasendif
1317c9b31ae8SRoberto Vargas
1318eb1acfb6SChris KayBL2_SOURCES := $(sort ${BL2_SOURCES})
1319eb1acfb6SChris Kay
132033950dd8SMasahiro Yamada$(if ${BL2}, $(eval $(call TOOL_ADD_IMG,bl2,--${FIP_BL2_ARGS})),\
1321434d0491SZelalem Aweke	$(eval $(call MAKE_BL,bl2,${FIP_BL2_ARGS})))
132273c99d4eSJuan Castilloendif
132373c99d4eSJuan Castillo
13244d045d0eSMasahiro Yamadaifeq (${NEED_SCP_BL2},yes)
132533950dd8SMasahiro Yamada$(eval $(call TOOL_ADD_IMG,scp_bl2,--scp-fw))
13264d045d0eSMasahiro Yamadaendif
13274d045d0eSMasahiro Yamada
132873c99d4eSJuan Castilloifeq (${NEED_BL31},yes)
132973c99d4eSJuan CastilloBL31_SOURCES += ${SPD_SOURCES}
133026d1e0c3SMadhukar Pappireddy# Sort BL31 source files to remove duplicates
133126d1e0c3SMadhukar PappireddyBL31_SOURCES := $(sort ${BL31_SOURCES})
1332c6ba9b45SSumit Gargifneq (${DECRYPTION_SUPPORT},none)
1333c6ba9b45SSumit Garg$(if ${BL31}, $(eval $(call TOOL_ADD_IMG,bl31,--soc-fw,,$(ENCRYPT_BL31))),\
1334434d0491SZelalem Aweke	$(eval $(call MAKE_BL,bl31,soc-fw,,$(ENCRYPT_BL31))))
1335c6ba9b45SSumit Gargelse
133633950dd8SMasahiro Yamada$(if ${BL31}, $(eval $(call TOOL_ADD_IMG,bl31,--soc-fw)),\
1337434d0491SZelalem Aweke	$(eval $(call MAKE_BL,bl31,soc-fw)))
133873c99d4eSJuan Castilloendif
1339c6ba9b45SSumit Gargendif
134073c99d4eSJuan Castillo
134170d1fc53SJuan Castillo# If a BL32 image is needed but neither BL32 nor BL32_SOURCES is defined, the
1342c939d13aSMasahiro Yamada# build system will call TOOL_ADD_IMG to print a warning message and abort the
134370d1fc53SJuan Castillo# process. Note that the dependency on BL32 applies to the FIP only.
134473c99d4eSJuan Castilloifeq (${NEED_BL32},yes)
134526d1e0c3SMadhukar Pappireddy# Sort BL32 source files to remove duplicates
134626d1e0c3SMadhukar PappireddyBL32_SOURCES := $(sort ${BL32_SOURCES})
13479cd15239SMasahiro YamadaBUILD_BL32 := $(if $(BL32),,$(if $(BL32_SOURCES),1))
13489cd15239SMasahiro Yamada
1349c6ba9b45SSumit Gargifneq (${DECRYPTION_SUPPORT},none)
1350434d0491SZelalem Aweke$(if ${BUILD_BL32}, $(eval $(call MAKE_BL,bl32,tos-fw,,$(ENCRYPT_BL32))),\
1351c6ba9b45SSumit Garg	$(eval $(call TOOL_ADD_IMG,bl32,--tos-fw,,$(ENCRYPT_BL32))))
1352c6ba9b45SSumit Gargelse
1353434d0491SZelalem Aweke$(if ${BUILD_BL32}, $(eval $(call MAKE_BL,bl32,tos-fw)),\
135433950dd8SMasahiro Yamada	$(eval $(call TOOL_ADD_IMG,bl32,--tos-fw)))
135573c99d4eSJuan Castilloendif
1356c6ba9b45SSumit Gargendif
135773c99d4eSJuan Castillo
13585b18de09SZelalem Aweke# If RMM image is needed but RMM is not defined, Test Realm Payload (TRP)
13595b18de09SZelalem Aweke# needs to be built from RMM_SOURCES.
13605b18de09SZelalem Awekeifeq (${NEED_RMM},yes)
13615b18de09SZelalem Aweke# Sort RMM source files to remove duplicates
13625b18de09SZelalem AwekeRMM_SOURCES := $(sort ${RMM_SOURCES})
13635b18de09SZelalem AwekeBUILD_RMM := $(if $(RMM),,$(if $(RMM_SOURCES),1))
13645b18de09SZelalem Aweke
13655b18de09SZelalem Aweke$(if ${BUILD_RMM}, $(eval $(call MAKE_BL,rmm,rmm-fw)),\
13665b18de09SZelalem Aweke         $(eval $(call TOOL_ADD_IMG,rmm,--rmm-fw)))
13675b18de09SZelalem Awekeendif
13685b18de09SZelalem Aweke
136973c99d4eSJuan Castillo# Add the BL33 image if required by the platform
137073c99d4eSJuan Castilloifeq (${NEED_BL33},yes)
137133950dd8SMasahiro Yamada$(eval $(call TOOL_ADD_IMG,bl33,--nt-fw))
1372db6071c9SJuan Castilloendif
1373db6071c9SJuan Castillo
13749003fa0bSYatharth Kocharifeq (${NEED_BL2U},yes)
137533950dd8SMasahiro Yamada$(if ${BL2U}, $(eval $(call TOOL_ADD_IMG,bl2u,--ap-fwu-cfg,FWU_)),\
1376434d0491SZelalem Aweke	$(eval $(call MAKE_BL,bl2u,ap-fwu-cfg,FWU_)))
13779003fa0bSYatharth Kocharendif
13789003fa0bSYatharth Kochar
137903b397a8SNishanth Menon# Expand build macros for the different images
138003b397a8SNishanth Menonifeq (${NEED_FDT},yes)
138103b397a8SNishanth Menon    $(eval $(call MAKE_DTBS,$(BUILD_PLAT)/fdts,$(FDT_SOURCES)))
138203b397a8SNishanth Menonendif
138303b397a8SNishanth Menon
1384ce2b1ec6SManish Pandey# Add Secure Partition packages
1385ce2b1ec6SManish Pandeyifeq (${NEED_SP_PKG},yes)
1386ce2b1ec6SManish Pandey$(BUILD_PLAT)/sp_gen.mk: ${SP_MK_GEN} ${SP_LAYOUT_FILE} | ${BUILD_PLAT}
13871e7528ecSRuari Phipps	${Q}${PYTHON} "$<" "$@" $(filter-out $<,$^) $(BUILD_PLAT) ${COT}
1388822c7279SJ-Alvessp: $(DTBS) $(BUILD_PLAT)/sp_gen.mk $(SP_PKGS)
1389ce2b1ec6SManish Pandey	@${ECHO_BLANK_LINE}
1390ce2b1ec6SManish Pandey	@echo "Built SP Images successfully"
1391ce2b1ec6SManish Pandey	@${ECHO_BLANK_LINE}
1392ce2b1ec6SManish Pandeyendif
1393ce2b1ec6SManish Pandey
139436eaaf37SIan Spraylocate-checkpatch:
139536eaaf37SIan Sprayifndef CHECKPATCH
139666079b04SEtienne Carriere	$(error "Please set CHECKPATCH to point to the Linux checkpatch.pl file, eg: CHECKPATCH=../linux/scripts/checkpatch.pl")
139736eaaf37SIan Sprayelse
139836eaaf37SIan Sprayifeq (,$(wildcard ${CHECKPATCH}))
139966079b04SEtienne Carriere	$(error "The file CHECKPATCH points to cannot be found, use eg: CHECKPATCH=../linux/scripts/checkpatch.pl")
140036eaaf37SIan Sprayendif
140136eaaf37SIan Sprayendif
140236eaaf37SIan Spray
14034f6ad66aSAchin Guptaclean:
14044f6ad66aSAchin Gupta	@echo "  CLEAN"
1405f1477d4aSEvan Lloyd	$(call SHELL_REMOVE_DIR,${BUILD_PLAT})
140688a1cf1eSSami Mujawarifdef UNIX_MK
14072f2cef46SJeenu Viswambharan	${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean
140888a1cf1eSSami Mujawarelse
140988a1cf1eSSami Mujawar# Clear the MAKEFLAGS as we do not want
141088a1cf1eSSami Mujawar# to pass the gnumake flags to nmake.
141188a1cf1eSSami Mujawar	${Q}set MAKEFLAGS= && ${MSVC_NMAKE} /nologo /f ${FIPTOOLPATH}/Makefile.msvc FIPTOOLPATH=$(subst /,\,$(FIPTOOLPATH)) FIPTOOL=$(subst /,\,$(FIPTOOL)) clean
141288a1cf1eSSami Mujawarendif
14136f971622SJuan Castillo	${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} clean
141490aa901fSSumit Garg	${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${ENCTOOLPATH} clean
14155accce5bSRoberto Vargas	${Q}${MAKE} --no-print-directory -C ${ROMLIBPATH} clean
14164f6ad66aSAchin Gupta
1417eaaeece2SJames Morrisseyrealclean distclean:
1418eaaeece2SJames Morrissey	@echo "  REALCLEAN"
1419f1477d4aSEvan Lloyd	$(call SHELL_REMOVE_DIR,${BUILD_BASE})
1420f1477d4aSEvan Lloyd	$(call SHELL_DELETE_ALL, ${CURDIR}/cscope.*)
142188a1cf1eSSami Mujawarifdef UNIX_MK
14222f2cef46SJeenu Viswambharan	${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean
142388a1cf1eSSami Mujawarelse
142488a1cf1eSSami Mujawar# Clear the MAKEFLAGS as we do not want
142588a1cf1eSSami Mujawar# to pass the gnumake flags to nmake.
142688a1cf1eSSami Mujawar	${Q}set MAKEFLAGS= && ${MSVC_NMAKE} /nologo /f ${FIPTOOLPATH}/Makefile.msvc FIPTOOLPATH=$(subst /,\,$(FIPTOOLPATH)) FIPTOOL=$(subst /,\,$(FIPTOOL)) realclean
142788a1cf1eSSami Mujawarendif
1428e15591aaSNicolas Boulenguez	${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} realclean
142990aa901fSSumit Garg	${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${ENCTOOLPATH} realclean
14305accce5bSRoberto Vargas	${Q}${MAKE} --no-print-directory -C ${ROMLIBPATH} clean
14314f6ad66aSAchin Gupta
143236eaaf37SIan Spraycheckcodebase:		locate-checkpatch
143336eaaf37SIan Spray	@echo "  CHECKING STYLE"
143436eaaf37SIan Spray	@if test -d .git ; then						\
14351ef35512SPaul Beesley		git ls-files | grep -E -v 'libfdt|libc|docs|\.rst' |	\
14361a41e8c1SDan Handley		while read GIT_FILE ;					\
14371a41e8c1SDan Handley		do ${CHECKPATCH} ${CHECKCODE_ARGS} -f $$GIT_FILE ;	\
14381a41e8c1SDan Handley		done ;							\
143936eaaf37SIan Spray	else								\
14401a41e8c1SDan Handley		 find . -type f -not -iwholename "*.git*"		\
14411a41e8c1SDan Handley		 -not -iwholename "*build*"				\
14421a41e8c1SDan Handley		 -not -iwholename "*libfdt*"				\
144361f72a34SRoberto Vargas		 -not -iwholename "*libc*"				\
14441a41e8c1SDan Handley		 -not -iwholename "*docs*"				\
14451ef35512SPaul Beesley		 -not -iwholename "*.rst"				\
14461a41e8c1SDan Handley		 -exec ${CHECKPATCH} ${CHECKCODE_ARGS} -f {} \; ;	\
144736eaaf37SIan Spray	fi
144836eaaf37SIan Spray
144936eaaf37SIan Spraycheckpatch:		locate-checkpatch
145036eaaf37SIan Spray	@echo "  CHECKING STYLE"
145102a76d5fSYann Gautier	@if test -n "${CHECKPATCH_OPTS}"; then				\
145202a76d5fSYann Gautier		echo "    with ${CHECKPATCH_OPTS} option(s)";		\
145302a76d5fSYann Gautier	fi
145451d28937SAntonio Nino Diaz	${Q}COMMON_COMMIT=$$(git merge-base HEAD ${BASE_COMMIT});	\
145577a0a7f1SYann Gautier	for commit in `git rev-list --no-merges $$COMMON_COMMIT..HEAD`;	\
145677a0a7f1SYann Gautier	do								\
145751d28937SAntonio Nino Diaz		printf "\n[*] Checking style of '$$commit'\n\n";	\
145851d28937SAntonio Nino Diaz		git log --format=email "$$commit~..$$commit"		\
145902a76d5fSYann Gautier			-- ${CHECK_PATHS} |				\
146002a76d5fSYann Gautier			${CHECKPATCH} ${CHECKPATCH_OPTS} - || true;	\
146151d28937SAntonio Nino Diaz		git diff --format=email "$$commit~..$$commit"		\
146202a76d5fSYann Gautier			-- ${CHECK_PATHS} |				\
146302a76d5fSYann Gautier			${CHECKPATCH}  ${CHECKPATCH_OPTS} - || true;	\
146451d28937SAntonio Nino Diaz	done
146536eaaf37SIan Spray
146673c99d4eSJuan Castillocerttool: ${CRTTOOL}
146773c99d4eSJuan Castillo
1468a9812206SPali Rohár${CRTTOOL}: FORCE
1469fafd3ec9SManish 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}
1470f1477d4aSEvan Lloyd	@${ECHO_BLANK_LINE}
14716f971622SJuan Castillo	@echo "Built $@ successfully"
1472f1477d4aSEvan Lloyd	@${ECHO_BLANK_LINE}
14736f971622SJuan Castillo
14746f971622SJuan Castilloifneq (${GENERATE_COT},0)
147573c99d4eSJuan Castillocertificates: ${CRT_DEPS} ${CRTTOOL}
14766f971622SJuan Castillo	${Q}${CRTTOOL} ${CRT_ARGS}
1477f1477d4aSEvan Lloyd	@${ECHO_BLANK_LINE}
14786f971622SJuan Castillo	@echo "Built $@ successfully"
14796f971622SJuan Castillo	@echo "Certificates can be found in ${BUILD_PLAT}"
1480f1477d4aSEvan Lloyd	@${ECHO_BLANK_LINE}
148173c99d4eSJuan Castilloendif
148227713fb4SSoby Mathew
148373c99d4eSJuan Castillo${BUILD_PLAT}/${FIP_NAME}: ${FIP_DEPS} ${FIPTOOL}
14844727fd13SPali Rohár	$(eval ${CHECK_FIP_CMD})
1485819281eeSdp-arm	${Q}${FIPTOOL} create ${FIP_ARGS} $@
1486819281eeSdp-arm	${Q}${FIPTOOL} info $@
1487f1477d4aSEvan Lloyd	@${ECHO_BLANK_LINE}
14882f2cef46SJeenu Viswambharan	@echo "Built $@ successfully"
1489f1477d4aSEvan Lloyd	@${ECHO_BLANK_LINE}
1490f58ad36fSHarry Liebel
14910191262dSYatharth Kocharifneq (${GENERATE_COT},0)
14920191262dSYatharth Kocharfwu_certificates: ${FWU_CRT_DEPS} ${CRTTOOL}
14930191262dSYatharth Kochar	${Q}${CRTTOOL} ${FWU_CRT_ARGS}
1494052ab529SEvan Lloyd	@${ECHO_BLANK_LINE}
14950191262dSYatharth Kochar	@echo "Built $@ successfully"
14960191262dSYatharth Kochar	@echo "FWU certificates can be found in ${BUILD_PLAT}"
1497052ab529SEvan Lloyd	@${ECHO_BLANK_LINE}
14980191262dSYatharth Kocharendif
14990191262dSYatharth Kochar
15000191262dSYatharth Kochar${BUILD_PLAT}/${FWU_FIP_NAME}: ${FWU_FIP_DEPS} ${FIPTOOL}
15014727fd13SPali Rohár	$(eval ${CHECK_FWU_FIP_CMD})
1502819281eeSdp-arm	${Q}${FIPTOOL} create ${FWU_FIP_ARGS} $@
1503819281eeSdp-arm	${Q}${FIPTOOL} info $@
1504052ab529SEvan Lloyd	@${ECHO_BLANK_LINE}
15050191262dSYatharth Kochar	@echo "Built $@ successfully"
1506052ab529SEvan Lloyd	@${ECHO_BLANK_LINE}
15070191262dSYatharth Kochar
150873c99d4eSJuan Castillofiptool: ${FIPTOOL}
150973c99d4eSJuan Castillofip: ${BUILD_PLAT}/${FIP_NAME}
15100191262dSYatharth Kocharfwu_fip: ${BUILD_PLAT}/${FWU_FIP_NAME}
151173c99d4eSJuan Castillo
1512a9812206SPali Rohár${FIPTOOL}: FORCE
151388a1cf1eSSami Mujawarifdef UNIX_MK
15140a956f81SRoss Burton	${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" FIPTOOL=${FIPTOOL} OPENSSL_DIR=${OPENSSL_DIR} --no-print-directory -C ${FIPTOOLPATH}
151588a1cf1eSSami Mujawarelse
151688a1cf1eSSami Mujawar# Clear the MAKEFLAGS as we do not want
151788a1cf1eSSami Mujawar# to pass the gnumake flags to nmake.
151888a1cf1eSSami Mujawar	${Q}set MAKEFLAGS= && ${MSVC_NMAKE} /nologo /f ${FIPTOOLPATH}/Makefile.msvc FIPTOOLPATH=$(subst /,\,$(FIPTOOLPATH)) FIPTOOL=$(subst /,\,$(FIPTOOL))
151988a1cf1eSSami Mujawarendif
1520f58ad36fSHarry Liebel
1521a9812206SPali Rohárromlib.bin: libraries FORCE
1522bbb24f61SJohn 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
15235accce5bSRoberto Vargas
1524cfe83910SLouis Mayencourt# Call print_memory_map tool
1525cfe83910SLouis Mayencourtmemmap: all
1526b890b36dSLouis Mayencourt	${Q}${PYTHON} ${PRINT_MEMORY_MAP} ${BUILD_PLAT} ${INVERTED_MEMMAP}
1527cfe83910SLouis Mayencourt
15286de32378SMadhukar Pappireddydoc:
15296de32378SMadhukar Pappireddy	@echo "  BUILD DOCUMENTATION"
15306de32378SMadhukar Pappireddy	${Q}${MAKE} --no-print-directory -C ${DOCS_PATH} html
15316de32378SMadhukar Pappireddy
153290aa901fSSumit Gargenctool: ${ENCTOOL}
153390aa901fSSumit Garg
1534a9812206SPali Rohár${ENCTOOL}: FORCE
1535fafd3ec9SManish V Badarkhe	${Q}${MAKE} PLAT=${PLAT} BUILD_INFO=0 OPENSSL_DIR=${OPENSSL_DIR} ENCTOOL=${ENCTOOL} --no-print-directory -C ${ENCTOOLPATH}
153690aa901fSSumit Garg	@${ECHO_BLANK_LINE}
153790aa901fSSumit Garg	@echo "Built $@ successfully"
153890aa901fSSumit Garg	@${ECHO_BLANK_LINE}
153990aa901fSSumit Garg
154035fab8c9SJoakim Bechcscope:
154135fab8c9SJoakim Bech	@echo "  CSCOPE"
154235fab8c9SJoakim Bech	${Q}find ${CURDIR} -name "*.[chsS]" > cscope.files
154335fab8c9SJoakim Bech	${Q}cscope -b -q -k
154435fab8c9SJoakim Bech
154572ee3314SRyan Harkinhelp:
15467c23126cSJohn Tsichritzis	@echo "usage: ${MAKE} [PLAT=<platform>] [OPTIONS] [TARGET]"
154772ee3314SRyan Harkin	@echo ""
154872ee3314SRyan Harkin	@echo "PLAT is used to specify which platform you wish to build."
154908c7ed0fSSandrine Bailleux	@echo "If no platform is specified, PLAT defaults to: ${DEFAULT_PLAT}"
155072ee3314SRyan Harkin	@echo ""
15517c23126cSJohn Tsichritzis	@echo "platform = ${PLATFORM_LIST}"
15527c23126cSJohn Tsichritzis	@echo ""
15531b578596SSandrine Bailleux	@echo "Please refer to the User Guide for a list of all supported options."
15541b578596SSandrine Bailleux	@echo "Note that the build system doesn't track dependencies for build "
15551b578596SSandrine Bailleux	@echo "options. Therefore, if any of the build options are changed "
15561b578596SSandrine Bailleux	@echo "from a previous build, a clean build must be performed."
15571b578596SSandrine Bailleux	@echo ""
155872ee3314SRyan Harkin	@echo "Supported Targets:"
15591b578596SSandrine Bailleux	@echo "  all            Build all individual bootloader binaries"
156036eaaf37SIan Spray	@echo "  bl1            Build the BL1 binary"
15618aa559c0SJeenu Viswambharan	@echo "  bl2            Build the BL2 binary"
15629003fa0bSYatharth Kochar	@echo "  bl2u           Build the BL2U binary"
1563d178637dSJuan Castillo	@echo "  bl31           Build the BL31 binary"
15649d29c227SSoby Mathew	@echo "  bl32           Build the BL32 binary. If ARCH=aarch32, then "
15659d29c227SSoby Mathew	@echo "                 this builds secure payload specified by AARCH32_SP"
156673c99d4eSJuan Castillo	@echo "  certificates   Build the certificates (requires 'GENERATE_COT=1')"
15671b578596SSandrine Bailleux	@echo "  fip            Build the Firmware Image Package (FIP)"
15680191262dSYatharth Kochar	@echo "  fwu_fip        Build the FWU Firmware Image Package (FIP)"
156936eaaf37SIan Spray	@echo "  checkcodebase  Check the coding style of the entire source tree"
157036eaaf37SIan Spray	@echo "  checkpatch     Check the coding style on changes in the current"
157136eaaf37SIan Spray	@echo "                 branch against BASE_COMMIT (default origin/master)"
157272ee3314SRyan Harkin	@echo "  clean          Clean the build for the selected platform"
157335fab8c9SJoakim Bech	@echo "  cscope         Generate cscope index"
157472ee3314SRyan Harkin	@echo "  distclean      Remove all build artifacts for all platforms"
15756f971622SJuan Castillo	@echo "  certtool       Build the Certificate generation tool"
157690aa901fSSumit Garg	@echo "  enctool        Build the Firmware encryption tool"
1577f58ad36fSHarry Liebel	@echo "  fiptool        Build the Firmware Image Package (FIP) creation tool"
1578ce2b1ec6SManish Pandey	@echo "  sp             Build the Secure Partition Packages"
157926010da1SAntonio Nino Diaz	@echo "  sptool         Build the Secure Partition Package creation tool"
158038c14d88SSoby Mathew	@echo "  dtbs           Build the Device Tree Blobs (if required for the platform)"
1581cfe83910SLouis Mayencourt	@echo "  memmap         Print the memory map of the built binaries"
15826de32378SMadhukar Pappireddy	@echo "  doc            Build html based documentation using Sphinx tool"
158372ee3314SRyan Harkin	@echo ""
15841b578596SSandrine Bailleux	@echo "Note: most build targets require PLAT to be set to a specific platform."
158572ee3314SRyan Harkin	@echo ""
158672ee3314SRyan Harkin	@echo "example: build all targets for the FVP platform:"
158772ee3314SRyan Harkin	@echo "  CROSS_COMPILE=aarch64-none-elf- make PLAT=fvp all"
1588a9812206SPali Rohár
1589a9812206SPali Rohár.PHONY: FORCE
1590a9812206SPali RohárFORCE:;
1591