xref: /rk3399_ARM-atf/Makefile (revision b57e16a4f96b6cfa4da9e3b2cc6d6d4533da1950)
1#
2# Copyright (c) 2013-2023, Arm Limited and Contributors. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6
7#
8# Trusted Firmware Version
9#
10VERSION_MAJOR			:= 2
11VERSION_MINOR			:= 8
12VERSION				:= ${VERSION_MAJOR}.${VERSION_MINOR}
13
14# Default goal is build all images
15.DEFAULT_GOAL			:= all
16
17# Avoid any implicit propagation of command line variable definitions to
18# sub-Makefiles, like CFLAGS that we reserved for the firmware images'
19# usage. Other command line options like "-s" are still propagated as usual.
20MAKEOVERRIDES =
21
22MAKE_HELPERS_DIRECTORY := make_helpers/
23include ${MAKE_HELPERS_DIRECTORY}build_macros.mk
24include ${MAKE_HELPERS_DIRECTORY}build_env.mk
25
26################################################################################
27# Default values for build configurations, and their dependencies
28################################################################################
29
30include ${MAKE_HELPERS_DIRECTORY}defaults.mk
31
32# Assertions enabled for DEBUG builds by default
33ENABLE_ASSERTIONS		:= ${DEBUG}
34ENABLE_PMF			:= ${ENABLE_RUNTIME_INSTRUMENTATION}
35PLAT				:= ${DEFAULT_PLAT}
36
37################################################################################
38# Checkpatch script options
39################################################################################
40
41CHECKCODE_ARGS		:=	--no-patch
42# Do not check the coding style on imported library files or documentation files
43INC_ARM_DIRS_TO_CHECK	:=	$(sort $(filter-out                     \
44					include/drivers/arm/cryptocell,	\
45					$(wildcard include/drivers/arm/*)))
46INC_ARM_DIRS_TO_CHECK	+=	include/drivers/arm/cryptocell/*.h
47INC_DRV_DIRS_TO_CHECK	:=	$(sort $(filter-out			\
48					include/drivers/arm,		\
49					$(wildcard include/drivers/*)))
50INC_LIB_DIRS_TO_CHECK	:=	$(sort $(filter-out			\
51					include/lib/libfdt		\
52					include/lib/libc,		\
53					$(wildcard include/lib/*)))
54INC_DIRS_TO_CHECK	:=	$(sort $(filter-out			\
55					include/lib			\
56					include/drivers,		\
57					$(wildcard include/*)))
58LIB_DIRS_TO_CHECK	:=	$(sort $(filter-out			\
59					lib/compiler-rt			\
60					lib/libfdt%			\
61					lib/libc,			\
62					lib/zlib			\
63					$(wildcard lib/*)))
64ROOT_DIRS_TO_CHECK	:=	$(sort $(filter-out			\
65					lib				\
66					include				\
67					docs				\
68					%.rst,				\
69					$(wildcard *)))
70CHECK_PATHS		:=	${ROOT_DIRS_TO_CHECK}			\
71				${INC_DIRS_TO_CHECK}			\
72				${INC_LIB_DIRS_TO_CHECK}		\
73				${LIB_DIRS_TO_CHECK}			\
74				${INC_DRV_DIRS_TO_CHECK}		\
75				${INC_ARM_DIRS_TO_CHECK}
76
77
78################################################################################
79# Process build options
80################################################################################
81
82# Verbose flag
83ifeq (${V},0)
84        Q:=@
85        ECHO:=@echo
86        CHECKCODE_ARGS	+=	--no-summary --terse
87else
88        Q:=
89        ECHO:=$(ECHO_QUIET)
90endif
91
92ifneq ($(findstring s,$(filter-out --%,$(MAKEFLAGS))),)
93        Q:=@
94        ECHO:=$(ECHO_QUIET)
95endif
96
97export Q ECHO
98
99# The cert_create tool cannot generate certificates individually, so we use the
100# target 'certificates' to create them all
101ifneq (${GENERATE_COT},0)
102        FIP_DEPS += certificates
103        FWU_FIP_DEPS += fwu_certificates
104endif
105
106# Process BRANCH_PROTECTION value and set
107# Pointer Authentication and Branch Target Identification flags
108ifeq (${BRANCH_PROTECTION},0)
109	# Default value turns off all types of branch protection
110	BP_OPTION := none
111else ifneq (${ARCH},aarch64)
112        $(error BRANCH_PROTECTION requires AArch64)
113else ifeq (${BRANCH_PROTECTION},1)
114	# Enables all types of branch protection features
115	BP_OPTION := standard
116	ENABLE_BTI := 1
117	ENABLE_PAUTH := 1
118else ifeq (${BRANCH_PROTECTION},2)
119	# Return address signing to its standard level
120	BP_OPTION := pac-ret
121	ENABLE_PAUTH := 1
122else ifeq (${BRANCH_PROTECTION},3)
123	# Extend the signing to include leaf functions
124	BP_OPTION := pac-ret+leaf
125	ENABLE_PAUTH := 1
126else ifeq (${BRANCH_PROTECTION},4)
127	# Turn on branch target identification mechanism
128	BP_OPTION := bti
129	ENABLE_BTI := 1
130else
131        $(error Unknown BRANCH_PROTECTION value ${BRANCH_PROTECTION})
132endif
133
134# FEAT_RME
135ifeq (${ENABLE_RME},1)
136# RME doesn't support PIE
137ifneq (${ENABLE_PIE},0)
138        $(error ENABLE_RME does not support PIE)
139endif
140# RME doesn't support BRBE
141ifneq (${ENABLE_BRBE_FOR_NS},0)
142        $(error ENABLE_RME does not support BRBE.)
143endif
144# RME requires AARCH64
145ifneq (${ARCH},aarch64)
146        $(error ENABLE_RME requires AArch64)
147endif
148# RME requires el2 context to be saved for now.
149CTX_INCLUDE_EL2_REGS := 1
150CTX_INCLUDE_AARCH32_REGS := 0
151ARM_ARCH_MAJOR := 8
152ARM_ARCH_MINOR := 5
153ENABLE_FEAT_ECV = 1
154ENABLE_FEAT_FGT = 1
155
156# RME enables CSV2_2 extension by default.
157ENABLE_FEAT_CSV2_2 = 1
158
159endif
160
161# USE_SPINLOCK_CAS requires AArch64 build
162ifeq (${USE_SPINLOCK_CAS},1)
163ifneq (${ARCH},aarch64)
164        $(error USE_SPINLOCK_CAS requires AArch64)
165endif
166endif
167
168# USE_DEBUGFS experimental feature recommended only in debug builds
169ifeq (${USE_DEBUGFS},1)
170ifeq (${DEBUG},1)
171        $(warning DEBUGFS experimental feature is enabled.)
172else
173        $(warning DEBUGFS experimental, recommended in DEBUG builds ONLY)
174endif
175endif
176
177ifneq (${DECRYPTION_SUPPORT},none)
178ENC_ARGS += -f ${FW_ENC_STATUS}
179ENC_ARGS += -k ${ENC_KEY}
180ENC_ARGS += -n ${ENC_NONCE}
181FIP_DEPS += enctool
182FWU_FIP_DEPS += enctool
183endif
184
185################################################################################
186# Toolchain
187################################################################################
188
189HOSTCC			:=	gcc
190export HOSTCC
191
192CC			:=	${CROSS_COMPILE}gcc
193CPP			:=	${CROSS_COMPILE}cpp
194AS			:=	${CROSS_COMPILE}gcc
195AR			:=	${CROSS_COMPILE}ar
196LINKER			:=	${CROSS_COMPILE}ld
197OC			:=	${CROSS_COMPILE}objcopy
198OD			:=	${CROSS_COMPILE}objdump
199NM			:=	${CROSS_COMPILE}nm
200PP			:=	${CROSS_COMPILE}gcc -E
201DTC			:=	dtc
202
203# Use ${LD}.bfd instead if it exists (as absolute path or together with $PATH).
204ifneq ($(strip $(wildcard ${LD}.bfd) \
205	$(foreach dir,$(subst :, ,${PATH}),$(wildcard ${dir}/${LINKER}.bfd))),)
206LINKER			:=	${LINKER}.bfd
207endif
208
209ifeq (${ARM_ARCH_MAJOR},7)
210target32-directive	= 	-target arm-none-eabi
211# Will set march32-directive from platform configuration
212else
213target32-directive	= 	-target armv8a-none-eabi
214
215# Set the compiler's target architecture profile based on
216# ARM_ARCH_MAJOR ARM_ARCH_MINOR options
217ifeq (${ARM_ARCH_MINOR},0)
218march32-directive	= 	-march=armv${ARM_ARCH_MAJOR}-a
219march64-directive	= 	-march=armv${ARM_ARCH_MAJOR}-a
220else
221march32-directive	= 	-march=armv${ARM_ARCH_MAJOR}.${ARM_ARCH_MINOR}-a
222march64-directive	= 	-march=armv${ARM_ARCH_MAJOR}.${ARM_ARCH_MINOR}-a
223endif
224endif
225
226# Memory tagging is supported in architecture Armv8.5-A AArch64 and onwards
227ifeq ($(ARCH), aarch64)
228# Check if revision is greater than or equal to 8.5
229ifeq "8.5" "$(word 1, $(sort 8.5 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))"
230mem_tag_arch_support	= 	yes
231endif
232endif
233
234# Get architecture feature modifiers
235arch-features		=	${ARM_ARCH_FEATURE}
236
237# Enable required options for memory stack tagging.
238# Currently, these options are enabled only for clang and armclang compiler.
239ifeq (${SUPPORT_STACK_MEMTAG},yes)
240ifdef mem_tag_arch_support
241# Check for armclang and clang compilers
242ifneq ( ,$(filter $(notdir $(CC)),armclang clang))
243# Add "memtag" architecture feature modifier if not specified
244ifeq ( ,$(findstring memtag,$(arch-features)))
245arch-features       	:=       $(arch-features)+memtag
246endif	# memtag
247ifeq ($(notdir $(CC)),armclang)
248TF_CFLAGS		+=	-mmemtag-stack
249else ifeq ($(notdir $(CC)),clang)
250TF_CFLAGS		+=	-fsanitize=memtag
251endif	# armclang
252endif	# armclang clang
253else
254$(error "Error: stack memory tagging is not supported for architecture \
255	${ARCH},armv${ARM_ARCH_MAJOR}.${ARM_ARCH_MINOR}-a")
256endif	# mem_tag_arch_support
257endif	# SUPPORT_STACK_MEMTAG
258
259# Set the compiler's architecture feature modifiers
260ifneq ($(arch-features), none)
261# Strip "none+" from arch-features
262arch-features		:=	$(subst none+,,$(arch-features))
263ifeq ($(ARCH), aarch32)
264march32-directive	:=	$(march32-directive)+$(arch-features)
265else
266march64-directive	:=	$(march64-directive)+$(arch-features)
267endif
268# Print features
269$(info Arm Architecture Features specified: $(subst +, ,$(arch-features)))
270endif	# arch-features
271
272# Determine if FEAT_RNG is supported
273ENABLE_FEAT_RNG		=	$(if $(findstring rng,${arch-features}),1,0)
274
275# Determine if FEAT_SB is supported
276ENABLE_FEAT_SB		=	$(if $(findstring sb,${arch-features}),1,0)
277
278ifneq ($(findstring clang,$(notdir $(CC))),)
279	ifneq ($(findstring armclang,$(notdir $(CC))),)
280		TF_CFLAGS_aarch32	:=	-target arm-arm-none-eabi $(march32-directive)
281		TF_CFLAGS_aarch64	:=	-target aarch64-arm-none-eabi $(march64-directive)
282		LD			:=	$(LINKER)
283	else
284		TF_CFLAGS_aarch32	=	$(target32-directive) $(march32-directive)
285		TF_CFLAGS_aarch64	:=	-target aarch64-elf $(march64-directive)
286		LD			:=	$(shell $(CC) --print-prog-name ld.lld)
287
288		AR			:=	$(shell $(CC) --print-prog-name llvm-ar)
289		OD			:=	$(shell $(CC) --print-prog-name llvm-objdump)
290		OC			:=	$(shell $(CC) --print-prog-name llvm-objcopy)
291	endif
292
293	CPP		:=	$(CC) -E $(TF_CFLAGS_$(ARCH))
294	PP		:=	$(CC) -E $(TF_CFLAGS_$(ARCH))
295	AS		:=	$(CC) -c -x assembler-with-cpp $(TF_CFLAGS_$(ARCH))
296else ifneq ($(findstring gcc,$(notdir $(CC))),)
297TF_CFLAGS_aarch32	=	$(march32-directive)
298TF_CFLAGS_aarch64	=	$(march64-directive)
299ifeq ($(ENABLE_LTO),1)
300	# Enable LTO only for aarch64
301	ifeq (${ARCH},aarch64)
302		LTO_CFLAGS	=	-flto
303		# Use gcc as a wrapper for the ld, recommended for LTO
304		LINKER		:=	${CROSS_COMPILE}gcc
305	endif
306endif
307LD			=	$(LINKER)
308else
309TF_CFLAGS_aarch32	=	$(march32-directive)
310TF_CFLAGS_aarch64	=	$(march64-directive)
311LD			=	$(LINKER)
312endif
313
314# Process Debug flag
315$(eval $(call add_define,DEBUG))
316ifneq (${DEBUG}, 0)
317        BUILD_TYPE	:=	debug
318        TF_CFLAGS	+=	-g -gdwarf-4
319        ASFLAGS		+=	-g -Wa,-gdwarf-4
320
321        # Use LOG_LEVEL_INFO by default for debug builds
322        LOG_LEVEL	:=	40
323else
324        BUILD_TYPE	:=	release
325        # Use LOG_LEVEL_NOTICE by default for release builds
326        LOG_LEVEL	:=	20
327endif
328
329# Default build string (git branch and commit)
330ifeq (${BUILD_STRING},)
331        BUILD_STRING  :=  $(shell git describe --always --dirty --tags 2> /dev/null)
332endif
333VERSION_STRING    :=  v${VERSION}(${BUILD_TYPE}):${BUILD_STRING}
334
335ifeq (${AARCH32_INSTRUCTION_SET},A32)
336TF_CFLAGS_aarch32	+=	-marm
337else ifeq (${AARCH32_INSTRUCTION_SET},T32)
338TF_CFLAGS_aarch32	+=	-mthumb
339else
340$(error Error: Unknown AArch32 instruction set ${AARCH32_INSTRUCTION_SET})
341endif
342
343TF_CFLAGS_aarch32	+=	-mno-unaligned-access
344TF_CFLAGS_aarch64	+=	-mgeneral-regs-only -mstrict-align
345
346ifneq (${BP_OPTION},none)
347TF_CFLAGS_aarch64	+=	-mbranch-protection=${BP_OPTION}
348endif
349
350ASFLAGS_aarch32		=	$(march32-directive)
351ASFLAGS_aarch64		=	$(march64-directive)
352
353# General warnings
354WARNINGS		:=	-Wall -Wmissing-include-dirs -Wunused	\
355				-Wdisabled-optimization -Wvla -Wshadow	\
356				-Wredundant-decls
357# stricter warnings
358WARNINGS		+=	-Wextra -Wno-trigraphs
359# too verbose for generic build
360WARNINGS		+=	-Wno-missing-field-initializers \
361				-Wno-type-limits -Wno-sign-compare \
362# on clang this flag gets reset if -Wextra is set after it. No difference on gcc
363WARNINGS		+=	-Wno-unused-parameter
364
365# Additional warnings
366# Level 1 - infrequent warnings we should have none of
367# full -Wextra
368WARNING1 += -Wsign-compare
369WARNING1 += -Wtype-limits
370WARNING1 += -Wmissing-field-initializers
371
372# Level 2 - problematic warnings that we want
373# zlib, compiler-rt, coreboot, and mbdedtls blow up with these
374# TODO: disable just for them and move into default build
375WARNING2 += -Wold-style-definition
376WARNING2 += -Wmissing-prototypes
377WARNING2 += -Wmissing-format-attribute
378# TF-A aims to comply with this eventually. Effort too large at present
379WARNING2 += -Wundef
380# currently very involved and many platforms set this off
381WARNING2 += -Wunused-const-variable=2
382
383# Level 3 - very pedantic, frequently ignored
384WARNING3 := -Wbad-function-cast
385WARNING3 += -Waggregate-return
386WARNING3 += -Wnested-externs
387WARNING3 += -Wcast-align
388WARNING3 += -Wcast-qual
389WARNING3 += -Wconversion
390WARNING3 += -Wpacked
391WARNING3 += -Wpointer-arith
392WARNING3 += -Wswitch-default
393
394# Setting W is quite verbose and most warnings will be pre-existing issues
395# outside of the contributor's control. Don't fail the build on them so warnings
396# can be seen and hopefully addressed
397ifdef W
398ifneq (${W},0)
399E	 ?= 0
400endif
401endif
402
403ifeq (${W},1)
404WARNINGS += $(WARNING1)
405else ifeq (${W},2)
406WARNINGS += $(WARNING1) $(WARNING2)
407else ifeq (${W},3)
408WARNINGS += $(WARNING1) $(WARNING2) $(WARNING3)
409endif
410
411# Compiler specific warnings
412ifeq ($(findstring clang,$(notdir $(CC))),)
413# not using clang
414WARNINGS	+=		-Wunused-but-set-variable -Wmaybe-uninitialized	\
415				-Wpacked-bitfield-compat -Wshift-overflow=2 \
416				-Wlogical-op
417else
418# using clang
419WARNINGS	+=		-Wshift-overflow -Wshift-sign-overflow \
420				-Wlogical-op-parentheses
421endif
422
423ifneq (${E},0)
424ERRORS := -Werror
425endif
426
427CPPFLAGS		=	${DEFINES} ${INCLUDES} ${MBEDTLS_INC} -nostdinc	\
428				$(ERRORS) $(WARNINGS)
429ASFLAGS			+=	$(CPPFLAGS) $(ASFLAGS_$(ARCH))			\
430				-ffreestanding -Wa,--fatal-warnings
431TF_CFLAGS		+=	$(CPPFLAGS) $(TF_CFLAGS_$(ARCH))		\
432				-ffunction-sections -fdata-sections		\
433				-ffreestanding -fno-builtin -fno-common		\
434				-Os -std=gnu99
435
436$(eval $(call add_define,SVE_VECTOR_LEN))
437
438ifeq (${SANITIZE_UB},on)
439TF_CFLAGS		+=	-fsanitize=undefined -fno-sanitize-recover
440endif
441ifeq (${SANITIZE_UB},trap)
442TF_CFLAGS		+=	-fsanitize=undefined -fno-sanitize-recover	\
443				-fsanitize-undefined-trap-on-error
444endif
445
446GCC_V_OUTPUT		:=	$(shell $(CC) -v 2>&1)
447
448TF_LDFLAGS		+=	-z noexecstack
449
450# LD = armlink
451ifneq ($(findstring armlink,$(notdir $(LD))),)
452TF_LDFLAGS		+=	--diag_error=warning --lto_level=O1
453TF_LDFLAGS		+=	--remove --info=unused,unusedsymbols
454TF_LDFLAGS		+=	$(TF_LDFLAGS_$(ARCH))
455
456# LD = gcc (used when GCC LTO is enabled)
457else ifneq ($(findstring gcc,$(notdir $(LD))),)
458# Pass ld options with Wl or Xlinker switches
459TF_LDFLAGS		+=	-Wl,--fatal-warnings -O1
460TF_LDFLAGS		+=	-Wl,--gc-sections
461
462TF_LDFLAGS		+=	-Wl,-z,common-page-size=4096 # Configure page size constants
463TF_LDFLAGS		+=	-Wl,-z,max-page-size=4096
464
465ifeq ($(ENABLE_LTO),1)
466	ifeq (${ARCH},aarch64)
467		TF_LDFLAGS	+=	-flto -fuse-linker-plugin
468	endif
469endif
470# GCC automatically adds fix-cortex-a53-843419 flag when used to link
471# which breaks some builds, so disable if errata fix is not explicitly enabled
472ifneq (${ERRATA_A53_843419},1)
473	TF_LDFLAGS	+= 	-mno-fix-cortex-a53-843419
474endif
475TF_LDFLAGS		+= 	-nostdlib
476TF_LDFLAGS		+=	$(subst --,-Xlinker --,$(TF_LDFLAGS_$(ARCH)))
477
478# LD = gcc-ld (ld) or llvm-ld (ld.lld) or other
479else
480# With ld.bfd version 2.39 and newer new warnings are added. Skip those since we
481# are not loaded by a elf loader.
482TF_LDFLAGS		+=	$(call ld_option, --no-warn-rwx-segments)
483TF_LDFLAGS		+=	-O1
484TF_LDFLAGS		+=	--gc-sections
485
486TF_LDFLAGS		+=	-z common-page-size=4096 # Configure page size constants
487TF_LDFLAGS		+=	-z max-page-size=4096
488
489# ld.lld doesn't recognize the errata flags,
490# therefore don't add those in that case.
491# ld.lld reports section type mismatch warnings,
492# therefore don't add --fatal-warnings to it.
493ifeq ($(findstring ld.lld,$(notdir $(LD))),)
494TF_LDFLAGS		+=	$(TF_LDFLAGS_$(ARCH)) --fatal-warnings
495endif
496endif
497
498DTC_FLAGS		+=	-I dts -O dtb
499DTC_CPPFLAGS		+=	-P -nostdinc -Iinclude -Ifdts -undef \
500				-x assembler-with-cpp $(DEFINES)
501
502################################################################################
503# Common sources and include directories
504################################################################################
505include ${MAKE_HELPERS_DIRECTORY}arch_features.mk
506include lib/compiler-rt/compiler-rt.mk
507
508BL_COMMON_SOURCES	+=	common/bl_common.c			\
509				common/tf_log.c				\
510				common/${ARCH}/debug.S			\
511				drivers/console/multi_console.c		\
512				lib/${ARCH}/cache_helpers.S		\
513				lib/${ARCH}/misc_helpers.S		\
514				plat/common/plat_bl_common.c		\
515				plat/common/plat_log_common.c		\
516				plat/common/${ARCH}/plat_common.c	\
517				plat/common/${ARCH}/platform_helpers.S	\
518				${COMPILER_RT_SRCS}
519
520# Pointer Authentication sources
521ifeq (${ENABLE_PAUTH}, 1)
522# arm/common/aarch64/arm_pauth.c contains a sample platform hook to complete the
523# Pauth support. As it's not secure, it must be reimplemented for real platforms
524BL_COMMON_SOURCES	+=	lib/extensions/pauth/pauth_helpers.S
525endif
526
527ifeq ($(notdir $(CC)),armclang)
528BL_COMMON_SOURCES	+=	lib/${ARCH}/armclang_printf.S
529endif
530
531ifeq (${SANITIZE_UB},on)
532BL_COMMON_SOURCES	+=	plat/common/ubsan.c
533endif
534
535INCLUDES		+=	-Iinclude				\
536				-Iinclude/arch/${ARCH}			\
537				-Iinclude/lib/cpus/${ARCH}		\
538				-Iinclude/lib/el3_runtime/${ARCH}	\
539				${PLAT_INCLUDES}			\
540				${SPD_INCLUDES}
541
542include common/backtrace/backtrace.mk
543
544################################################################################
545# Generic definitions
546################################################################################
547
548include ${MAKE_HELPERS_DIRECTORY}plat_helpers.mk
549
550ifeq (${BUILD_BASE},)
551     BUILD_BASE		:=	./build
552endif
553BUILD_PLAT		:=	$(abspath ${BUILD_BASE})/${PLAT}/${BUILD_TYPE}
554
555SPDS			:=	$(sort $(filter-out none, $(patsubst services/spd/%,%,$(wildcard services/spd/*))))
556
557# Platforms providing their own TBB makefile may override this value
558INCLUDE_TBBR_MK		:=	1
559
560
561################################################################################
562# Include SPD Makefile if one has been specified
563################################################################################
564
565ifneq (${SPD},none)
566    ifeq (${ARCH},aarch32)
567        $(error "Error: SPD is incompatible with AArch32.")
568    endif
569
570    ifdef EL3_PAYLOAD_BASE
571        $(warning "SPD and EL3_PAYLOAD_BASE are incompatible build options.")
572        $(warning "The SPD and its BL32 companion will be present but ignored.")
573    endif
574
575    ifeq (${SPD},spmd)
576        # SPMD is located in std_svc directory
577        SPD_DIR := std_svc
578
579        ifeq ($(SPMD_SPM_AT_SEL2),1)
580            CTX_INCLUDE_EL2_REGS := 1
581	    ifeq ($(SPMC_AT_EL3),1)
582                $(error SPM cannot be enabled in both S-EL2 and EL3.)
583            endif
584        endif
585
586        ifeq ($(findstring optee_sp,$(ARM_SPMC_MANIFEST_DTS)),optee_sp)
587            DTC_CPPFLAGS	+=	-DOPTEE_SP_FW_CONFIG
588        endif
589
590        ifeq ($(TS_SP_FW_CONFIG),1)
591            DTC_CPPFLAGS	+=	-DTS_SP_FW_CONFIG
592        endif
593
594        ifneq ($(ARM_BL2_SP_LIST_DTS),)
595            DTC_CPPFLAGS += -DARM_BL2_SP_LIST_DTS=$(ARM_BL2_SP_LIST_DTS)
596        endif
597
598        ifneq ($(SP_LAYOUT_FILE),)
599            BL2_ENABLE_SP_LOAD := 1
600        endif
601    else
602        # All other SPDs in spd directory
603        SPD_DIR := spd
604    endif
605
606    # We expect to locate an spd.mk under the specified SPD directory
607    SPD_MAKE	:=	$(wildcard services/${SPD_DIR}/${SPD}/${SPD}.mk)
608
609    ifeq (${SPD_MAKE},)
610        $(error Error: No services/${SPD_DIR}/${SPD}/${SPD}.mk located)
611    endif
612    $(info Including ${SPD_MAKE})
613    include ${SPD_MAKE}
614
615    # If there's BL32 companion for the chosen SPD, we expect that the SPD's
616    # Makefile would set NEED_BL32 to "yes". In this case, the build system
617    # supports two mutually exclusive options:
618    # * BL32 is built from source: then BL32_SOURCES must contain the list
619    #   of source files to build BL32
620    # * BL32 is a prebuilt binary: then BL32 must point to the image file
621    #   that will be included in the FIP
622    # If both BL32_SOURCES and BL32 are defined, the binary takes precedence
623    # over the sources.
624endif
625
626ifeq (${CTX_INCLUDE_EL2_REGS}, 1)
627ifeq (${SPD},none)
628ifeq (${ENABLE_RME},0)
629    $(error CTX_INCLUDE_EL2_REGS is available only when SPD or RME is enabled)
630endif
631endif
632endif
633
634################################################################################
635# Include rmmd Makefile if RME is enabled
636################################################################################
637
638ifneq (${ENABLE_RME},0)
639ifneq (${ARCH},aarch64)
640	$(error ENABLE_RME requires AArch64)
641endif
642ifeq ($(SPMC_AT_EL3),1)
643	$(error SPMC_AT_EL3 and ENABLE_RME cannot both be enabled.)
644endif
645include services/std_svc/rmmd/rmmd.mk
646$(warning "RME is an experimental feature")
647endif
648
649################################################################################
650# Include the platform specific Makefile after the SPD Makefile (the platform
651# makefile may use all previous definitions in this file)
652################################################################################
653
654include ${PLAT_MAKEFILE_FULL}
655
656# This internal flag is common option which is set to 1 for scenarios
657# when the BL2 is running in EL3 level. This occurs in two scenarios -
658# 4 world system running BL2 at EL3 and two world system without BL1 running
659# BL2 in EL3
660
661ifeq (${RESET_TO_BL2},1)
662	BL2_RUNS_AT_EL3	:=	1
663    ifeq (${ENABLE_RME},1)
664        $(error RESET_TO_BL2=1 and ENABLE_RME=1 configuration is not supported at the moment.)
665    endif
666else ifeq (${ENABLE_RME},1)
667	BL2_RUNS_AT_EL3	:=	1
668else
669	BL2_RUNS_AT_EL3	:=	0
670endif
671
672$(eval $(call MAKE_PREREQ_DIR,${BUILD_PLAT}))
673
674ifeq (${ARM_ARCH_MAJOR},7)
675include make_helpers/armv7-a-cpus.mk
676endif
677
678PIE_FOUND		:=	$(findstring --enable-default-pie,${GCC_V_OUTPUT})
679ifneq ($(PIE_FOUND),)
680	TF_CFLAGS	+=	-fno-PIE
681ifneq ($(findstring gcc,$(notdir $(LD))),)
682	TF_LDFLAGS	+=	-no-pie
683endif
684endif
685
686ifneq ($(findstring gcc,$(notdir $(LD))),)
687	PIE_LDFLAGS	+=	-Wl,-pie -Wl,--no-dynamic-linker
688else
689	PIE_LDFLAGS	+=	-pie --no-dynamic-linker
690endif
691
692ifeq ($(ENABLE_PIE),1)
693ifeq ($(RESET_TO_BL2),1)
694ifneq ($(BL2_IN_XIP_MEM),1)
695	BL2_CPPFLAGS	+=	-fpie
696	BL2_CFLAGS	+=	-fpie
697	BL2_LDFLAGS	+=	$(PIE_LDFLAGS)
698endif
699endif
700	BL31_CPPFLAGS	+=	-fpie
701	BL31_CFLAGS 	+=	-fpie
702	BL31_LDFLAGS	+=	$(PIE_LDFLAGS)
703
704	BL32_CPPFLAGS	+=	-fpie
705	BL32_CFLAGS	+=	-fpie
706	BL32_LDFLAGS	+=	$(PIE_LDFLAGS)
707endif
708
709ifeq (${ARCH},aarch64)
710BL1_CPPFLAGS += -DIMAGE_AT_EL3
711ifeq ($(RESET_TO_BL2),1)
712BL2_CPPFLAGS += -DIMAGE_AT_EL3
713else
714BL2_CPPFLAGS += -DIMAGE_AT_EL1
715endif
716BL2U_CPPFLAGS += -DIMAGE_AT_EL1
717BL31_CPPFLAGS += -DIMAGE_AT_EL3
718BL32_CPPFLAGS += -DIMAGE_AT_EL1
719endif
720
721# Include the CPU specific operations makefile, which provides default
722# values for all CPU errata workarounds and CPU specific optimisations.
723# This can be overridden by the platform.
724include lib/cpus/cpu-ops.mk
725
726ifeq (${ARCH},aarch32)
727NEED_BL32 := yes
728
729################################################################################
730# Build `AARCH32_SP` as BL32 image for AArch32
731################################################################################
732ifneq (${AARCH32_SP},none)
733# We expect to locate an sp.mk under the specified AARCH32_SP directory
734AARCH32_SP_MAKE	:=	$(wildcard bl32/${AARCH32_SP}/${AARCH32_SP}.mk)
735
736ifeq (${AARCH32_SP_MAKE},)
737  $(error Error: No bl32/${AARCH32_SP}/${AARCH32_SP}.mk located)
738endif
739
740$(info Including ${AARCH32_SP_MAKE})
741include ${AARCH32_SP_MAKE}
742endif
743
744endif
745
746################################################################################
747# Include libc if not overridden
748################################################################################
749ifeq (${OVERRIDE_LIBC},0)
750include lib/libc/libc.mk
751endif
752
753################################################################################
754# Check incompatible options
755################################################################################
756
757ifdef EL3_PAYLOAD_BASE
758        ifdef PRELOADED_BL33_BASE
759                $(warning "PRELOADED_BL33_BASE and EL3_PAYLOAD_BASE are \
760                incompatible build options. EL3_PAYLOAD_BASE has priority.")
761        endif
762        ifneq (${GENERATE_COT},0)
763                $(error "GENERATE_COT and EL3_PAYLOAD_BASE are incompatible build options.")
764        endif
765        ifneq (${TRUSTED_BOARD_BOOT},0)
766                $(error "TRUSTED_BOARD_BOOT and EL3_PAYLOAD_BASE are incompatible build options.")
767        endif
768endif
769
770ifeq (${NEED_BL33},yes)
771        ifdef EL3_PAYLOAD_BASE
772                $(warning "BL33 image is not needed when option \
773                BL33_PAYLOAD_BASE is used and won't be added to the FIP file.")
774        endif
775        ifdef PRELOADED_BL33_BASE
776                $(warning "BL33 image is not needed when option \
777                PRELOADED_BL33_BASE is used and won't be added to the FIP \
778                file.")
779        endif
780endif
781
782# When building for systems with hardware-assisted coherency, there's no need to
783# use USE_COHERENT_MEM. Require that USE_COHERENT_MEM must be set to 0 too.
784ifeq ($(HW_ASSISTED_COHERENCY)-$(USE_COHERENT_MEM),1-1)
785$(error USE_COHERENT_MEM cannot be enabled with HW_ASSISTED_COHERENCY)
786endif
787
788#For now, BL2_IN_XIP_MEM is only supported when RESET_TO_BL2 is 1.
789ifeq ($(RESET_TO_BL2)-$(BL2_IN_XIP_MEM),0-1)
790$(error "BL2_IN_XIP_MEM is only supported when RESET_TO_BL2 is enabled")
791endif
792
793# For RAS_EXTENSION, require that EAs are handled in EL3 first
794ifeq ($(RAS_EXTENSION),1)
795    ifneq ($(HANDLE_EA_EL3_FIRST_NS),1)
796        $(error For RAS_EXTENSION, HANDLE_EA_EL3_FIRST_NS must also be 1)
797    endif
798endif
799
800# When FAULT_INJECTION_SUPPORT is used, require that RAS_EXTENSION is enabled
801ifeq ($(FAULT_INJECTION_SUPPORT),1)
802    ifneq ($(RAS_EXTENSION),1)
803        $(error For FAULT_INJECTION_SUPPORT, RAS_EXTENSION must also be 1)
804    endif
805endif
806
807# DYN_DISABLE_AUTH can be set only when TRUSTED_BOARD_BOOT=1
808ifeq ($(DYN_DISABLE_AUTH), 1)
809    ifeq (${TRUSTED_BOARD_BOOT}, 0)
810        $(error "TRUSTED_BOARD_BOOT must be enabled for DYN_DISABLE_AUTH to be set.")
811    endif
812endif
813
814ifeq ($(MEASURED_BOOT)-$(TRUSTED_BOARD_BOOT),1-1)
815# Support authentication verification and hash calculation
816    CRYPTO_SUPPORT := 3
817else ifeq ($(DRTM_SUPPORT)-$(TRUSTED_BOARD_BOOT),1-1)
818# Support authentication verification and hash calculation
819    CRYPTO_SUPPORT := 3
820else ifneq ($(filter 1,${MEASURED_BOOT} ${DRTM_SUPPORT}),)
821# Support hash calculation only
822    CRYPTO_SUPPORT := 2
823else ifeq (${TRUSTED_BOARD_BOOT},1)
824# Support authentication verification only
825    CRYPTO_SUPPORT := 1
826else
827    CRYPTO_SUPPORT := 0
828endif
829
830# SDEI_IN_FCONF is only supported when SDEI_SUPPORT is enabled.
831ifeq ($(SDEI_SUPPORT)-$(SDEI_IN_FCONF),0-1)
832$(error "SDEI_IN_FCONF is only supported when SDEI_SUPPORT is enabled")
833endif
834
835# If pointer authentication is used in the firmware, make sure that all the
836# registers associated to it are also saved and restored.
837# Not doing it would leak the value of the keys used by EL3 to EL1 and S-EL1.
838ifeq ($(ENABLE_PAUTH),1)
839    ifeq ($(CTX_INCLUDE_PAUTH_REGS),0)
840        $(error Pointer Authentication requires CTX_INCLUDE_PAUTH_REGS=1)
841    endif
842endif
843
844ifeq ($(CTX_INCLUDE_PAUTH_REGS),1)
845    ifneq (${ARCH},aarch64)
846        $(error CTX_INCLUDE_PAUTH_REGS requires AArch64)
847    endif
848endif
849
850ifeq ($(CTX_INCLUDE_MTE_REGS),1)
851    ifneq (${ARCH},aarch64)
852        $(error CTX_INCLUDE_MTE_REGS requires AArch64)
853    endif
854endif
855
856ifeq ($(PSA_FWU_SUPPORT),1)
857    $(info PSA_FWU_SUPPORT is an experimental feature)
858endif
859
860ifeq ($(FEATURE_DETECTION),1)
861    $(info FEATURE_DETECTION is an experimental feature)
862endif
863
864ifeq (${ARM_XLAT_TABLES_LIB_V1}, 1)
865    ifeq (${ALLOW_RO_XLAT_TABLES}, 1)
866        $(error "ALLOW_RO_XLAT_TABLES requires translation tables library v2")
867    endif
868endif
869
870ifneq (${DECRYPTION_SUPPORT},none)
871    ifeq (${TRUSTED_BOARD_BOOT}, 0)
872        $(error TRUSTED_BOARD_BOOT must be enabled for DECRYPTION_SUPPORT to be set)
873    endif
874endif
875
876# Ensure that no Aarch64-only features are enabled in Aarch32 build
877ifeq (${ARCH},aarch32)
878
879    # SME/SVE only supported on AArch64
880    ifeq (${ENABLE_SME_FOR_NS},1)
881        $(error "ENABLE_SME_FOR_NS cannot be used with ARCH=aarch32")
882    endif
883    ifeq (${ENABLE_SVE_FOR_NS},1)
884        # Warning instead of error due to CI dependency on this
885        $(error "ENABLE_SVE_FOR_NS cannot be used with ARCH=aarch32")
886    endif
887
888    # BRBE is not supported in AArch32
889    ifeq (${ENABLE_BRBE_FOR_NS},1)
890        $(error "ENABLE_BRBE_FOR_NS cannot be used with ARCH=aarch32")
891    endif
892
893    # FEAT_RNG_TRAP is not supported in AArch32
894    ifeq (${ENABLE_FEAT_RNG_TRAP},1)
895        $(error "ENABLE_FEAT_RNG_TRAP cannot be used with ARCH=aarch32")
896    endif
897endif
898
899# Ensure ENABLE_RME is not used with SME
900ifeq (${ENABLE_RME},1)
901    ifeq (${ENABLE_SME_FOR_NS},1)
902        $(error "ENABLE_SME_FOR_NS cannot be used with ENABLE_RME")
903    endif
904endif
905
906# Secure SME/SVE requires the non-secure component as well
907ifeq (${ENABLE_SME_FOR_SWD},1)
908    ifeq (${ENABLE_SME_FOR_NS},0)
909        $(error "ENABLE_SME_FOR_SWD requires ENABLE_SME_FOR_NS")
910    endif
911endif
912ifeq (${ENABLE_SVE_FOR_SWD},1)
913    ifeq (${ENABLE_SVE_FOR_NS},0)
914        $(error "ENABLE_SVE_FOR_SWD requires ENABLE_SVE_FOR_NS")
915    endif
916endif
917
918# SVE and SME cannot be used with CTX_INCLUDE_FPREGS since secure manager does
919# its own context management including FPU registers.
920ifeq (${CTX_INCLUDE_FPREGS},1)
921    ifeq (${ENABLE_SME_FOR_NS},1)
922        $(error "ENABLE_SME_FOR_NS cannot be used with CTX_INCLUDE_FPREGS")
923    endif
924    ifeq (${ENABLE_SVE_FOR_NS},1)
925        # Warning instead of error due to CI dependency on this
926        $(warning "ENABLE_SVE_FOR_NS cannot be used with CTX_INCLUDE_FPREGS")
927        $(warning "Forced ENABLE_SVE_FOR_NS=0")
928        override ENABLE_SVE_FOR_NS	:= 0
929    endif
930endif
931
932ifeq ($(DRTM_SUPPORT),1)
933    $(info DRTM_SUPPORT is an experimental feature)
934endif
935
936ifeq (${ENABLE_RME},1)
937    ifneq (${SEPARATE_CODE_AND_RODATA},1)
938        $(error `ENABLE_RME=1` requires `SEPARATE_CODE_AND_RODATA=1`)
939    endif
940endif
941
942################################################################################
943# Process platform overrideable behaviour
944################################################################################
945
946ifdef BL1_SOURCES
947NEED_BL1 := yes
948endif
949
950ifdef BL2_SOURCES
951	NEED_BL2 := yes
952
953	# Using BL2 implies that a BL33 image also needs to be supplied for the FIP and
954	# Certificate generation tools. This flag can be overridden by the platform.
955	ifdef EL3_PAYLOAD_BASE
956                # If booting an EL3 payload there is no need for a BL33 image
957                # in the FIP file.
958                NEED_BL33		:=	no
959        else
960                ifdef PRELOADED_BL33_BASE
961                        # If booting a BL33 preloaded image there is no need of
962                        # another one in the FIP file.
963                        NEED_BL33		:=	no
964                else
965                        NEED_BL33		?=	yes
966                endif
967        endif
968endif
969
970ifdef BL2U_SOURCES
971NEED_BL2U := yes
972endif
973
974# If SCP_BL2 is given, we always want FIP to include it.
975ifdef SCP_BL2
976        NEED_SCP_BL2		:=	yes
977endif
978
979# For AArch32, BL31 is not currently supported.
980ifneq (${ARCH},aarch32)
981    ifdef BL31_SOURCES
982        # When booting an EL3 payload, there is no need to compile the BL31 image nor
983        # put it in the FIP.
984        ifndef EL3_PAYLOAD_BASE
985            NEED_BL31 := yes
986        endif
987    endif
988endif
989
990# Process TBB related flags
991ifneq (${GENERATE_COT},0)
992        # Common cert_create options
993        ifneq (${CREATE_KEYS},0)
994                $(eval CRT_ARGS += -n)
995                $(eval FWU_CRT_ARGS += -n)
996                ifneq (${SAVE_KEYS},0)
997                        $(eval CRT_ARGS += -k)
998                        $(eval FWU_CRT_ARGS += -k)
999                endif
1000        endif
1001        # Include TBBR makefile (unless the platform indicates otherwise)
1002        ifeq (${INCLUDE_TBBR_MK},1)
1003                include make_helpers/tbbr/tbbr_tools.mk
1004        endif
1005endif
1006
1007ifneq (${FIP_ALIGN},0)
1008FIP_ARGS += --align ${FIP_ALIGN}
1009endif
1010
1011ifdef FDT_SOURCES
1012NEED_FDT := yes
1013endif
1014
1015################################################################################
1016# Include libraries' Makefile that are used in all BL
1017################################################################################
1018
1019include lib/stack_protector/stack_protector.mk
1020
1021################################################################################
1022# Auxiliary tools (fiptool, cert_create, etc)
1023################################################################################
1024
1025# Variables for use with Certificate Generation Tool
1026CRTTOOLPATH		?=	tools/cert_create
1027CRTTOOL			?=	${CRTTOOLPATH}/cert_create${BIN_EXT}
1028
1029# Variables for use with Firmware Encryption Tool
1030ENCTOOLPATH		?=	tools/encrypt_fw
1031ENCTOOL			?=	${ENCTOOLPATH}/encrypt_fw${BIN_EXT}
1032
1033# Variables for use with Firmware Image Package
1034FIPTOOLPATH		?=	tools/fiptool
1035FIPTOOL			?=	${FIPTOOLPATH}/fiptool${BIN_EXT}
1036
1037# Variables for use with sptool
1038SPTOOLPATH		?=	tools/sptool
1039SPTOOL			?=	${SPTOOLPATH}/sptool.py
1040SP_MK_GEN		?=	${SPTOOLPATH}/sp_mk_generator.py
1041
1042# Variables for use with ROMLIB
1043ROMLIBPATH		?=	lib/romlib
1044
1045# Variable for use with Python
1046PYTHON			?=	python3
1047
1048# Variables for use with PRINT_MEMORY_MAP
1049PRINT_MEMORY_MAP_PATH		?=	tools/memory
1050PRINT_MEMORY_MAP		?=	${PRINT_MEMORY_MAP_PATH}/print_memory_map.py
1051
1052# Variables for use with documentation build using Sphinx tool
1053DOCS_PATH		?=	docs
1054
1055# Defination of SIMICS flag
1056SIMICS_BUILD	?=	0
1057
1058################################################################################
1059# Include BL specific makefiles
1060################################################################################
1061
1062ifeq (${NEED_BL1},yes)
1063include bl1/bl1.mk
1064endif
1065
1066ifeq (${NEED_BL2},yes)
1067include bl2/bl2.mk
1068endif
1069
1070ifeq (${NEED_BL2U},yes)
1071include bl2u/bl2u.mk
1072endif
1073
1074ifeq (${NEED_BL31},yes)
1075include bl31/bl31.mk
1076endif
1077
1078################################################################################
1079# Build options checks
1080################################################################################
1081
1082$(eval $(call assert_booleans,\
1083    $(sort \
1084        ALLOW_RO_XLAT_TABLES \
1085        BL2_ENABLE_SP_LOAD \
1086        COLD_BOOT_SINGLE_CPU \
1087        CREATE_KEYS \
1088        CTX_INCLUDE_AARCH32_REGS \
1089        CTX_INCLUDE_FPREGS \
1090        CTX_INCLUDE_EL2_REGS \
1091        DEBUG \
1092        DISABLE_MTPMU \
1093        DYN_DISABLE_AUTH \
1094        EL3_EXCEPTION_HANDLING \
1095        ENABLE_AMU_AUXILIARY_COUNTERS \
1096        ENABLE_AMU_FCONF \
1097        AMU_RESTRICT_COUNTERS \
1098        ENABLE_ASSERTIONS \
1099        ENABLE_FEAT_SB \
1100        ENABLE_PIE \
1101        ENABLE_PMF \
1102        ENABLE_PSCI_STAT \
1103        ENABLE_RUNTIME_INSTRUMENTATION \
1104        ENABLE_SME_FOR_NS \
1105        ENABLE_SME_FOR_SWD \
1106        ENABLE_SVE_FOR_NS \
1107        ENABLE_SVE_FOR_SWD \
1108        ERROR_DEPRECATED \
1109        FAULT_INJECTION_SUPPORT \
1110        GENERATE_COT \
1111        GICV2_G0_FOR_EL3 \
1112        HANDLE_EA_EL3_FIRST_NS \
1113        HW_ASSISTED_COHERENCY \
1114        INVERTED_MEMMAP \
1115        MEASURED_BOOT \
1116        DRTM_SUPPORT \
1117        NS_TIMER_SWITCH \
1118        OVERRIDE_LIBC \
1119        PL011_GENERIC_UART \
1120        PLAT_RSS_NOT_SUPPORTED \
1121        PROGRAMMABLE_RESET_ADDRESS \
1122        PSCI_EXTENDED_STATE_ID \
1123        RESET_TO_BL31 \
1124        RESET_TO_BL31_WITH_PARAMS \
1125        SAVE_KEYS \
1126        SEPARATE_CODE_AND_RODATA \
1127        SEPARATE_BL2_NOLOAD_REGION \
1128        SEPARATE_NOBITS_REGION \
1129        SPIN_ON_BL1_EXIT \
1130        SPM_MM \
1131        SPMC_AT_EL3 \
1132        SPMD_SPM_AT_SEL2 \
1133        TRUSTED_BOARD_BOOT \
1134        USE_COHERENT_MEM \
1135        USE_DEBUGFS \
1136        ARM_IO_IN_DTB \
1137        SDEI_IN_FCONF \
1138        SEC_INT_DESC_IN_FCONF \
1139        USE_ROMLIB \
1140        USE_TBBR_DEFS \
1141        WARMBOOT_ENABLE_DCACHE_EARLY \
1142        RESET_TO_BL2 \
1143        BL2_IN_XIP_MEM \
1144        BL2_INV_DCACHE \
1145        USE_SPINLOCK_CAS \
1146        ENCRYPT_BL31 \
1147        ENCRYPT_BL32 \
1148        ERRATA_SPECULATIVE_AT \
1149        RAS_TRAP_NS_ERR_REC_ACCESS \
1150        COT_DESC_IN_DTB \
1151        USE_SP804_TIMER \
1152        PSA_FWU_SUPPORT \
1153        ENABLE_MPMM \
1154        ENABLE_MPMM_FCONF \
1155        SIMICS_BUILD \
1156        FEATURE_DETECTION \
1157	TRNG_SUPPORT \
1158	CONDITIONAL_CMO \
1159)))
1160
1161$(eval $(call assert_numerics,\
1162    $(sort \
1163        ARM_ARCH_MAJOR \
1164        ARM_ARCH_MINOR \
1165        BRANCH_PROTECTION \
1166        CTX_INCLUDE_PAUTH_REGS \
1167        CTX_INCLUDE_MTE_REGS \
1168        CTX_INCLUDE_NEVE_REGS \
1169        CRYPTO_SUPPORT \
1170        ENABLE_BRBE_FOR_NS \
1171        ENABLE_TRBE_FOR_NS \
1172        ENABLE_BTI \
1173        ENABLE_PAUTH \
1174        ENABLE_FEAT_AMU \
1175        ENABLE_FEAT_AMUv1p1 \
1176        ENABLE_FEAT_CSV2_2 \
1177        ENABLE_FEAT_DIT \
1178        ENABLE_FEAT_ECV \
1179        ENABLE_FEAT_FGT \
1180        ENABLE_FEAT_HCX \
1181        ENABLE_FEAT_PAN \
1182        ENABLE_FEAT_RNG \
1183        ENABLE_FEAT_RNG_TRAP \
1184        ENABLE_FEAT_SEL2 \
1185        ENABLE_FEAT_TCR2 \
1186        ENABLE_FEAT_VHE \
1187        ENABLE_MPAM_FOR_LOWER_ELS \
1188        ENABLE_RME \
1189        ENABLE_SPE_FOR_NS \
1190        ENABLE_SYS_REG_TRACE_FOR_NS \
1191        ENABLE_TRF_FOR_NS \
1192        FW_ENC_STATUS \
1193        NR_OF_FW_BANKS \
1194        NR_OF_IMAGES_IN_FW_BANK \
1195        RAS_EXTENSION \
1196        TWED_DELAY \
1197        ENABLE_FEAT_TWED \
1198        SVE_VECTOR_LEN \
1199)))
1200
1201ifdef KEY_SIZE
1202        $(eval $(call assert_numeric,KEY_SIZE))
1203endif
1204
1205ifeq ($(filter $(SANITIZE_UB), on off trap),)
1206        $(error "Invalid value for SANITIZE_UB: can be one of on, off, trap")
1207endif
1208
1209################################################################################
1210# Add definitions to the cpp preprocessor based on the current build options.
1211# This is done after including the platform specific makefile to allow the
1212# platform to overwrite the default options
1213################################################################################
1214
1215$(eval $(call add_defines,\
1216    $(sort \
1217        ALLOW_RO_XLAT_TABLES \
1218        ARM_ARCH_MAJOR \
1219        ARM_ARCH_MINOR \
1220        BL2_ENABLE_SP_LOAD \
1221        COLD_BOOT_SINGLE_CPU \
1222        CTX_INCLUDE_AARCH32_REGS \
1223        CTX_INCLUDE_FPREGS \
1224        CTX_INCLUDE_PAUTH_REGS \
1225        EL3_EXCEPTION_HANDLING \
1226        CTX_INCLUDE_MTE_REGS \
1227        CTX_INCLUDE_EL2_REGS \
1228        CTX_INCLUDE_NEVE_REGS \
1229        DECRYPTION_SUPPORT_${DECRYPTION_SUPPORT} \
1230        DISABLE_MTPMU \
1231        ENABLE_FEAT_AMU \
1232        ENABLE_AMU_AUXILIARY_COUNTERS \
1233        ENABLE_AMU_FCONF \
1234        AMU_RESTRICT_COUNTERS \
1235        ENABLE_ASSERTIONS \
1236        ENABLE_BTI \
1237        ENABLE_MPAM_FOR_LOWER_ELS \
1238        ENABLE_PAUTH \
1239        ENABLE_PIE \
1240        ENABLE_PMF \
1241        ENABLE_PSCI_STAT \
1242        ENABLE_RME \
1243        ENABLE_RUNTIME_INSTRUMENTATION \
1244        ENABLE_SME_FOR_NS \
1245        ENABLE_SME_FOR_SWD \
1246        ENABLE_SPE_FOR_NS \
1247        ENABLE_SVE_FOR_NS \
1248        ENABLE_SVE_FOR_SWD \
1249        ENCRYPT_BL31 \
1250        ENCRYPT_BL32 \
1251        ERROR_DEPRECATED \
1252        FAULT_INJECTION_SUPPORT \
1253        GICV2_G0_FOR_EL3 \
1254        HANDLE_EA_EL3_FIRST_NS \
1255        HW_ASSISTED_COHERENCY \
1256        LOG_LEVEL \
1257        MEASURED_BOOT \
1258        DRTM_SUPPORT \
1259        NS_TIMER_SWITCH \
1260        PL011_GENERIC_UART \
1261        PLAT_${PLAT} \
1262        PLAT_RSS_NOT_SUPPORTED \
1263        PROGRAMMABLE_RESET_ADDRESS \
1264        PSCI_EXTENDED_STATE_ID \
1265        RAS_EXTENSION \
1266        RESET_TO_BL31 \
1267        RESET_TO_BL31_WITH_PARAMS \
1268        SEPARATE_CODE_AND_RODATA \
1269        SEPARATE_BL2_NOLOAD_REGION \
1270        SEPARATE_NOBITS_REGION \
1271        RECLAIM_INIT_CODE \
1272        SPD_${SPD} \
1273        SPIN_ON_BL1_EXIT \
1274        SPM_MM \
1275        SPMC_AT_EL3 \
1276        SPMD_SPM_AT_SEL2 \
1277        TRUSTED_BOARD_BOOT \
1278        CRYPTO_SUPPORT \
1279        TRNG_SUPPORT \
1280        USE_COHERENT_MEM \
1281        USE_DEBUGFS \
1282        ARM_IO_IN_DTB \
1283        SDEI_IN_FCONF \
1284        SEC_INT_DESC_IN_FCONF \
1285        USE_ROMLIB \
1286        USE_TBBR_DEFS \
1287        WARMBOOT_ENABLE_DCACHE_EARLY \
1288        RESET_TO_BL2 \
1289        BL2_RUNS_AT_EL3	\
1290        BL2_IN_XIP_MEM \
1291        BL2_INV_DCACHE \
1292        USE_SPINLOCK_CAS \
1293        ERRATA_SPECULATIVE_AT \
1294        RAS_TRAP_NS_ERR_REC_ACCESS \
1295        COT_DESC_IN_DTB \
1296        USE_SP804_TIMER \
1297        ENABLE_FEAT_RNG \
1298        ENABLE_FEAT_RNG_TRAP \
1299        ENABLE_FEAT_SB \
1300        ENABLE_FEAT_DIT \
1301        NR_OF_FW_BANKS \
1302        NR_OF_IMAGES_IN_FW_BANK \
1303        PSA_FWU_SUPPORT \
1304        ENABLE_BRBE_FOR_NS \
1305        ENABLE_TRBE_FOR_NS \
1306        ENABLE_SYS_REG_TRACE_FOR_NS \
1307        ENABLE_TRF_FOR_NS \
1308        ENABLE_FEAT_HCX \
1309        ENABLE_MPMM \
1310        ENABLE_MPMM_FCONF \
1311        ENABLE_FEAT_FGT \
1312        ENABLE_FEAT_ECV \
1313        SIMICS_BUILD \
1314        ENABLE_FEAT_AMUv1p1 \
1315        ENABLE_FEAT_SEL2 \
1316        ENABLE_FEAT_VHE \
1317        ENABLE_FEAT_CSV2_2 \
1318        ENABLE_FEAT_PAN \
1319        ENABLE_FEAT_TCR2 \
1320        FEATURE_DETECTION \
1321        TWED_DELAY \
1322        ENABLE_FEAT_TWED \
1323	CONDITIONAL_CMO \
1324)))
1325
1326ifeq (${SANITIZE_UB},trap)
1327        $(eval $(call add_define,MONITOR_TRAPS))
1328endif
1329
1330# Define the EL3_PAYLOAD_BASE flag only if it is provided.
1331ifdef EL3_PAYLOAD_BASE
1332        $(eval $(call add_define,EL3_PAYLOAD_BASE))
1333else
1334        # Define the PRELOADED_BL33_BASE flag only if it is provided and
1335        # EL3_PAYLOAD_BASE is not defined, as it has priority.
1336        ifdef PRELOADED_BL33_BASE
1337                $(eval $(call add_define,PRELOADED_BL33_BASE))
1338        endif
1339endif
1340
1341# Define the DYN_DISABLE_AUTH flag only if set.
1342ifeq (${DYN_DISABLE_AUTH},1)
1343$(eval $(call add_define,DYN_DISABLE_AUTH))
1344endif
1345
1346ifneq ($(findstring armlink,$(notdir $(LD))),)
1347$(eval $(call add_define,USE_ARM_LINK))
1348endif
1349
1350# Generate and include sp_gen.mk if SPD is spmd and SP_LAYOUT_FILE is defined
1351ifeq (${SPD},spmd)
1352ifdef SP_LAYOUT_FILE
1353        -include $(BUILD_PLAT)/sp_gen.mk
1354        FIP_DEPS += sp
1355        CRT_DEPS += sp
1356        NEED_SP_PKG := yes
1357else
1358        ifeq (${SPMD_SPM_AT_SEL2},1)
1359            $(error "SPMD with SPM at S-EL2 require SP_LAYOUT_FILE")
1360        endif
1361endif
1362endif
1363
1364################################################################################
1365# Build targets
1366################################################################################
1367
1368.PHONY:	all msg_start clean realclean distclean cscope locate-checkpatch checkcodebase checkpatch fiptool sptool fip sp fwu_fip certtool dtbs memmap doc enctool
1369.SUFFIXES:
1370
1371all: msg_start
1372
1373msg_start:
1374	@echo "Building ${PLAT}"
1375
1376ifeq (${ERROR_DEPRECATED},0)
1377# Check if deprecated declarations and cpp warnings should be treated as error or not.
1378ifneq ($(findstring clang,$(notdir $(CC))),)
1379    CPPFLAGS		+= 	-Wno-error=deprecated-declarations
1380else
1381    CPPFLAGS		+= 	-Wno-error=deprecated-declarations -Wno-error=cpp
1382endif
1383endif # !ERROR_DEPRECATED
1384
1385$(eval $(call MAKE_LIB_DIRS))
1386$(eval $(call MAKE_LIB,c))
1387
1388# Expand build macros for the different images
1389ifeq (${NEED_BL1},yes)
1390BL1_SOURCES := $(sort ${BL1_SOURCES})
1391
1392$(eval $(call MAKE_BL,bl1))
1393endif
1394
1395ifeq (${NEED_BL2},yes)
1396ifeq (${RESET_TO_BL2}, 0)
1397FIP_BL2_ARGS := tb-fw
1398endif
1399
1400BL2_SOURCES := $(sort ${BL2_SOURCES})
1401
1402$(if ${BL2}, $(eval $(call TOOL_ADD_IMG,bl2,--${FIP_BL2_ARGS})),\
1403	$(eval $(call MAKE_BL,bl2,${FIP_BL2_ARGS})))
1404endif
1405
1406ifeq (${NEED_SCP_BL2},yes)
1407$(eval $(call TOOL_ADD_IMG,scp_bl2,--scp-fw))
1408endif
1409
1410ifeq (${NEED_BL31},yes)
1411BL31_SOURCES += ${SPD_SOURCES}
1412# Sort BL31 source files to remove duplicates
1413BL31_SOURCES := $(sort ${BL31_SOURCES})
1414ifneq (${DECRYPTION_SUPPORT},none)
1415$(if ${BL31}, $(eval $(call TOOL_ADD_IMG,bl31,--soc-fw,,$(ENCRYPT_BL31))),\
1416	$(eval $(call MAKE_BL,bl31,soc-fw,,$(ENCRYPT_BL31))))
1417else
1418$(if ${BL31}, $(eval $(call TOOL_ADD_IMG,bl31,--soc-fw)),\
1419	$(eval $(call MAKE_BL,bl31,soc-fw)))
1420endif
1421endif
1422
1423# If a BL32 image is needed but neither BL32 nor BL32_SOURCES is defined, the
1424# build system will call TOOL_ADD_IMG to print a warning message and abort the
1425# process. Note that the dependency on BL32 applies to the FIP only.
1426ifeq (${NEED_BL32},yes)
1427# Sort BL32 source files to remove duplicates
1428BL32_SOURCES := $(sort ${BL32_SOURCES})
1429BUILD_BL32 := $(if $(BL32),,$(if $(BL32_SOURCES),1))
1430
1431ifneq (${DECRYPTION_SUPPORT},none)
1432$(if ${BUILD_BL32}, $(eval $(call MAKE_BL,bl32,tos-fw,,$(ENCRYPT_BL32))),\
1433	$(eval $(call TOOL_ADD_IMG,bl32,--tos-fw,,$(ENCRYPT_BL32))))
1434else
1435$(if ${BUILD_BL32}, $(eval $(call MAKE_BL,bl32,tos-fw)),\
1436	$(eval $(call TOOL_ADD_IMG,bl32,--tos-fw)))
1437endif
1438endif
1439
1440# If RMM image is needed but RMM is not defined, Test Realm Payload (TRP)
1441# needs to be built from RMM_SOURCES.
1442ifeq (${NEED_RMM},yes)
1443# Sort RMM source files to remove duplicates
1444RMM_SOURCES := $(sort ${RMM_SOURCES})
1445BUILD_RMM := $(if $(RMM),,$(if $(RMM_SOURCES),1))
1446
1447$(if ${BUILD_RMM}, $(eval $(call MAKE_BL,rmm,rmm-fw)),\
1448         $(eval $(call TOOL_ADD_IMG,rmm,--rmm-fw)))
1449endif
1450
1451# Add the BL33 image if required by the platform
1452ifeq (${NEED_BL33},yes)
1453$(eval $(call TOOL_ADD_IMG,bl33,--nt-fw))
1454endif
1455
1456ifeq (${NEED_BL2U},yes)
1457$(if ${BL2U}, $(eval $(call TOOL_ADD_IMG,bl2u,--ap-fwu-cfg,FWU_)),\
1458	$(eval $(call MAKE_BL,bl2u,ap-fwu-cfg,FWU_)))
1459endif
1460
1461# Expand build macros for the different images
1462ifeq (${NEED_FDT},yes)
1463    $(eval $(call MAKE_DTBS,$(BUILD_PLAT)/fdts,$(FDT_SOURCES)))
1464endif
1465
1466# Add Secure Partition packages
1467ifeq (${NEED_SP_PKG},yes)
1468$(BUILD_PLAT)/sp_gen.mk: ${SP_MK_GEN} ${SP_LAYOUT_FILE} | ${BUILD_PLAT}
1469	${Q}${PYTHON} "$<" "$@" $(filter-out $<,$^) $(BUILD_PLAT) ${COT}
1470sp: $(DTBS) $(BUILD_PLAT)/sp_gen.mk $(SP_PKGS)
1471	@${ECHO_BLANK_LINE}
1472	@echo "Built SP Images successfully"
1473	@${ECHO_BLANK_LINE}
1474endif
1475
1476locate-checkpatch:
1477ifndef CHECKPATCH
1478	$(error "Please set CHECKPATCH to point to the Linux checkpatch.pl file, eg: CHECKPATCH=../linux/scripts/checkpatch.pl")
1479else
1480ifeq (,$(wildcard ${CHECKPATCH}))
1481	$(error "The file CHECKPATCH points to cannot be found, use eg: CHECKPATCH=../linux/scripts/checkpatch.pl")
1482endif
1483endif
1484
1485clean:
1486	@echo "  CLEAN"
1487	$(call SHELL_REMOVE_DIR,${BUILD_PLAT})
1488ifdef UNIX_MK
1489	${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean
1490else
1491# Clear the MAKEFLAGS as we do not want
1492# to pass the gnumake flags to nmake.
1493	${Q}set MAKEFLAGS= && ${MSVC_NMAKE} /nologo /f ${FIPTOOLPATH}/Makefile.msvc FIPTOOLPATH=$(subst /,\,$(FIPTOOLPATH)) FIPTOOL=$(subst /,\,$(FIPTOOL)) clean
1494endif
1495	${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} clean
1496	${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${ENCTOOLPATH} clean
1497	${Q}${MAKE} --no-print-directory -C ${ROMLIBPATH} clean
1498
1499realclean distclean:
1500	@echo "  REALCLEAN"
1501	$(call SHELL_REMOVE_DIR,${BUILD_BASE})
1502	$(call SHELL_DELETE_ALL, ${CURDIR}/cscope.*)
1503ifdef UNIX_MK
1504	${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean
1505else
1506# Clear the MAKEFLAGS as we do not want
1507# to pass the gnumake flags to nmake.
1508	${Q}set MAKEFLAGS= && ${MSVC_NMAKE} /nologo /f ${FIPTOOLPATH}/Makefile.msvc FIPTOOLPATH=$(subst /,\,$(FIPTOOLPATH)) FIPTOOL=$(subst /,\,$(FIPTOOL)) realclean
1509endif
1510	${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} realclean
1511	${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${ENCTOOLPATH} realclean
1512	${Q}${MAKE} --no-print-directory -C ${ROMLIBPATH} clean
1513
1514checkcodebase:		locate-checkpatch
1515	@echo "  CHECKING STYLE"
1516	@if test -d .git ; then						\
1517		git ls-files | grep -E -v 'libfdt|libc|docs|\.rst' |	\
1518		while read GIT_FILE ;					\
1519		do ${CHECKPATCH} ${CHECKCODE_ARGS} -f $$GIT_FILE ;	\
1520		done ;							\
1521	else								\
1522		 find . -type f -not -iwholename "*.git*"		\
1523		 -not -iwholename "*build*"				\
1524		 -not -iwholename "*libfdt*"				\
1525		 -not -iwholename "*libc*"				\
1526		 -not -iwholename "*docs*"				\
1527		 -not -iwholename "*.rst"				\
1528		 -exec ${CHECKPATCH} ${CHECKCODE_ARGS} -f {} \; ;	\
1529	fi
1530
1531checkpatch:		locate-checkpatch
1532	@echo "  CHECKING STYLE"
1533	@if test -n "${CHECKPATCH_OPTS}"; then				\
1534		echo "    with ${CHECKPATCH_OPTS} option(s)";		\
1535	fi
1536	${Q}COMMON_COMMIT=$$(git merge-base HEAD ${BASE_COMMIT});	\
1537	for commit in `git rev-list --no-merges $$COMMON_COMMIT..HEAD`;	\
1538	do								\
1539		printf "\n[*] Checking style of '$$commit'\n\n";	\
1540		git log --format=email "$$commit~..$$commit"		\
1541			-- ${CHECK_PATHS} |				\
1542			${CHECKPATCH} ${CHECKPATCH_OPTS} - || true;	\
1543		git diff --format=email "$$commit~..$$commit"		\
1544			-- ${CHECK_PATHS} |				\
1545			${CHECKPATCH}  ${CHECKPATCH_OPTS} - || true;	\
1546	done
1547
1548certtool: ${CRTTOOL}
1549
1550${CRTTOOL}: FORCE
1551	${Q}${MAKE} PLAT=${PLAT} USE_TBBR_DEFS=${USE_TBBR_DEFS} COT=${COT} OPENSSL_DIR=${OPENSSL_DIR} CRTTOOL=${CRTTOOL} DEBUG=${DEBUG} V=${V} --no-print-directory -C ${CRTTOOLPATH} all
1552	@${ECHO_BLANK_LINE}
1553	@echo "Built $@ successfully"
1554	@${ECHO_BLANK_LINE}
1555
1556ifneq (${GENERATE_COT},0)
1557certificates: ${CRT_DEPS} ${CRTTOOL}
1558	${Q}${CRTTOOL} ${CRT_ARGS}
1559	@${ECHO_BLANK_LINE}
1560	@echo "Built $@ successfully"
1561	@echo "Certificates can be found in ${BUILD_PLAT}"
1562	@${ECHO_BLANK_LINE}
1563endif
1564
1565${BUILD_PLAT}/${FIP_NAME}: ${FIP_DEPS} ${FIPTOOL}
1566	$(eval ${CHECK_FIP_CMD})
1567	${Q}${FIPTOOL} create ${FIP_ARGS} $@
1568	${Q}${FIPTOOL} info $@
1569	@${ECHO_BLANK_LINE}
1570	@echo "Built $@ successfully"
1571	@${ECHO_BLANK_LINE}
1572
1573ifneq (${GENERATE_COT},0)
1574fwu_certificates: ${FWU_CRT_DEPS} ${CRTTOOL}
1575	${Q}${CRTTOOL} ${FWU_CRT_ARGS}
1576	@${ECHO_BLANK_LINE}
1577	@echo "Built $@ successfully"
1578	@echo "FWU certificates can be found in ${BUILD_PLAT}"
1579	@${ECHO_BLANK_LINE}
1580endif
1581
1582${BUILD_PLAT}/${FWU_FIP_NAME}: ${FWU_FIP_DEPS} ${FIPTOOL}
1583	$(eval ${CHECK_FWU_FIP_CMD})
1584	${Q}${FIPTOOL} create ${FWU_FIP_ARGS} $@
1585	${Q}${FIPTOOL} info $@
1586	@${ECHO_BLANK_LINE}
1587	@echo "Built $@ successfully"
1588	@${ECHO_BLANK_LINE}
1589
1590fiptool: ${FIPTOOL}
1591fip: ${BUILD_PLAT}/${FIP_NAME}
1592fwu_fip: ${BUILD_PLAT}/${FWU_FIP_NAME}
1593
1594${FIPTOOL}: FORCE
1595ifdef UNIX_MK
1596	${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" FIPTOOL=${FIPTOOL} OPENSSL_DIR=${OPENSSL_DIR} DEBUG=${DEBUG} V=${V} --no-print-directory -C ${FIPTOOLPATH} all
1597else
1598# Clear the MAKEFLAGS as we do not want
1599# to pass the gnumake flags to nmake.
1600	${Q}set MAKEFLAGS= && ${MSVC_NMAKE} /nologo /f ${FIPTOOLPATH}/Makefile.msvc FIPTOOLPATH=$(subst /,\,$(FIPTOOLPATH)) FIPTOOL=$(subst /,\,$(FIPTOOL))
1601endif
1602
1603romlib.bin: libraries FORCE
1604	${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
1605
1606# Call print_memory_map tool
1607memmap: all
1608	${Q}${PYTHON} ${PRINT_MEMORY_MAP} ${BUILD_PLAT} ${INVERTED_MEMMAP}
1609
1610doc:
1611	@echo "  BUILD DOCUMENTATION"
1612	${Q}${MAKE} --no-print-directory -C ${DOCS_PATH} html
1613
1614enctool: ${ENCTOOL}
1615
1616${ENCTOOL}: FORCE
1617	${Q}${MAKE} PLAT=${PLAT} BUILD_INFO=0 OPENSSL_DIR=${OPENSSL_DIR} ENCTOOL=${ENCTOOL} DEBUG=${DEBUG} V=${V} --no-print-directory -C ${ENCTOOLPATH} all
1618	@${ECHO_BLANK_LINE}
1619	@echo "Built $@ successfully"
1620	@${ECHO_BLANK_LINE}
1621
1622cscope:
1623	@echo "  CSCOPE"
1624	${Q}find ${CURDIR} -name "*.[chsS]" > cscope.files
1625	${Q}cscope -b -q -k
1626
1627help:
1628	@echo "usage: ${MAKE} [PLAT=<platform>] [OPTIONS] [TARGET]"
1629	@echo ""
1630	@echo "PLAT is used to specify which platform you wish to build."
1631	@echo "If no platform is specified, PLAT defaults to: ${DEFAULT_PLAT}"
1632	@echo ""
1633	@echo "platform = ${PLATFORM_LIST}"
1634	@echo ""
1635	@echo "Please refer to the User Guide for a list of all supported options."
1636	@echo "Note that the build system doesn't track dependencies for build "
1637	@echo "options. Therefore, if any of the build options are changed "
1638	@echo "from a previous build, a clean build must be performed."
1639	@echo ""
1640	@echo "Supported Targets:"
1641	@echo "  all            Build all individual bootloader binaries"
1642	@echo "  bl1            Build the BL1 binary"
1643	@echo "  bl2            Build the BL2 binary"
1644	@echo "  bl2u           Build the BL2U binary"
1645	@echo "  bl31           Build the BL31 binary"
1646	@echo "  bl32           Build the BL32 binary. If ARCH=aarch32, then "
1647	@echo "                 this builds secure payload specified by AARCH32_SP"
1648	@echo "  certificates   Build the certificates (requires 'GENERATE_COT=1')"
1649	@echo "  fip            Build the Firmware Image Package (FIP)"
1650	@echo "  fwu_fip        Build the FWU Firmware Image Package (FIP)"
1651	@echo "  checkcodebase  Check the coding style of the entire source tree"
1652	@echo "  checkpatch     Check the coding style on changes in the current"
1653	@echo "                 branch against BASE_COMMIT (default origin/master)"
1654	@echo "  clean          Clean the build for the selected platform"
1655	@echo "  cscope         Generate cscope index"
1656	@echo "  distclean      Remove all build artifacts for all platforms"
1657	@echo "  certtool       Build the Certificate generation tool"
1658	@echo "  enctool        Build the Firmware encryption tool"
1659	@echo "  fiptool        Build the Firmware Image Package (FIP) creation tool"
1660	@echo "  sp             Build the Secure Partition Packages"
1661	@echo "  sptool         Build the Secure Partition Package creation tool"
1662	@echo "  dtbs           Build the Device Tree Blobs (if required for the platform)"
1663	@echo "  memmap         Print the memory map of the built binaries"
1664	@echo "  doc            Build html based documentation using Sphinx tool"
1665	@echo ""
1666	@echo "Note: most build targets require PLAT to be set to a specific platform."
1667	@echo ""
1668	@echo "example: build all targets for the FVP platform:"
1669	@echo "  CROSS_COMPILE=aarch64-none-elf- make PLAT=fvp all"
1670
1671.PHONY: FORCE
1672FORCE:;
1673