14f6ad66aSAchin Gupta# 201cf14ddSMaksims Svecovs# Copyright (c) 2013-2023, 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 11b78ad00eSJuan Pablo CondeVERSION_MINOR := 9 12055ebecaSYann GautierVERSION_PATCH := 0 13055ebecaSYann GautierVERSION := ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH} 14aaa3e722SJuan Castillo 1588154678SJuan Castillo# Default goal is build all images 1688154678SJuan Castillo.DEFAULT_GOAL := all 1788154678SJuan Castillo 1872fc70edSDouglas Raillard# Avoid any implicit propagation of command line variable definitions to 1972fc70edSDouglas Raillard# sub-Makefiles, like CFLAGS that we reserved for the firmware images' 2072fc70edSDouglas Raillard# usage. Other command line options like "-s" are still propagated as usual. 2172fc70edSDouglas RaillardMAKEOVERRIDES = 2272fc70edSDouglas Raillard 23231c1470SEvan LloydMAKE_HELPERS_DIRECTORY := make_helpers/ 24231c1470SEvan Lloydinclude ${MAKE_HELPERS_DIRECTORY}build_macros.mk 25e7f54dbdSEvan Lloydinclude ${MAKE_HELPERS_DIRECTORY}build_env.mk 2673c99d4eSJuan Castillo 2773c99d4eSJuan Castillo################################################################################ 282fae4b1eSJeenu Viswambharan# Default values for build configurations, and their dependencies 2973c99d4eSJuan Castillo################################################################################ 30e35c4045SJeenu Viswambharan 312fae4b1eSJeenu Viswambharaninclude ${MAKE_HELPERS_DIRECTORY}defaults.mk 32872be88aSdp-arm 33cc8b5632SAntonio Nino Diaz# Assertions enabled for DEBUG builds by default 34cc8b5632SAntonio Nino DiazENABLE_ASSERTIONS := ${DEBUG} 352fae4b1eSJeenu ViswambharanENABLE_PMF := ${ENABLE_RUNTIME_INSTRUMENTATION} 362fae4b1eSJeenu ViswambharanPLAT := ${DEFAULT_PLAT} 3773c99d4eSJuan Castillo 3873c99d4eSJuan Castillo################################################################################ 3973c99d4eSJuan Castillo# Checkpatch script options 4073c99d4eSJuan Castillo################################################################################ 4173c99d4eSJuan Castillo 42f607739cSSandrine BailleuxCHECKCODE_ARGS := --no-patch 43f0b489c1SDan Handley# Do not check the coding style on imported library files or documentation files 444501843fSGilad Ben-YossefINC_ARM_DIRS_TO_CHECK := $(sort $(filter-out \ 454501843fSGilad Ben-Yossef include/drivers/arm/cryptocell, \ 464501843fSGilad Ben-Yossef $(wildcard include/drivers/arm/*))) 474501843fSGilad Ben-YossefINC_ARM_DIRS_TO_CHECK += include/drivers/arm/cryptocell/*.h 484501843fSGilad Ben-YossefINC_DRV_DIRS_TO_CHECK := $(sort $(filter-out \ 494501843fSGilad Ben-Yossef include/drivers/arm, \ 504501843fSGilad Ben-Yossef $(wildcard include/drivers/*))) 51f0b489c1SDan HandleyINC_LIB_DIRS_TO_CHECK := $(sort $(filter-out \ 521a41e8c1SDan Handley include/lib/libfdt \ 5361f72a34SRoberto Vargas include/lib/libc, \ 54f0b489c1SDan Handley $(wildcard include/lib/*))) 55f0b489c1SDan HandleyINC_DIRS_TO_CHECK := $(sort $(filter-out \ 564501843fSGilad Ben-Yossef include/lib \ 574501843fSGilad Ben-Yossef include/drivers, \ 58f0b489c1SDan Handley $(wildcard include/*))) 59f0b489c1SDan HandleyLIB_DIRS_TO_CHECK := $(sort $(filter-out \ 60d801fbb0Sdp-arm lib/compiler-rt \ 6155cdcf75SAntonio Nino Diaz lib/libfdt% \ 6261f72a34SRoberto Vargas lib/libc, \ 63a194255dSDaniel Boulby lib/zlib \ 64f0b489c1SDan Handley $(wildcard lib/*))) 65f0b489c1SDan HandleyROOT_DIRS_TO_CHECK := $(sort $(filter-out \ 66f0b489c1SDan Handley lib \ 67f0b489c1SDan Handley include \ 68f0b489c1SDan Handley docs \ 691ef35512SPaul Beesley %.rst, \ 70f0b489c1SDan Handley $(wildcard *))) 71f0b489c1SDan HandleyCHECK_PATHS := ${ROOT_DIRS_TO_CHECK} \ 72f0b489c1SDan Handley ${INC_DIRS_TO_CHECK} \ 73f0b489c1SDan Handley ${INC_LIB_DIRS_TO_CHECK} \ 744501843fSGilad Ben-Yossef ${LIB_DIRS_TO_CHECK} \ 754501843fSGilad Ben-Yossef ${INC_DRV_DIRS_TO_CHECK} \ 764501843fSGilad Ben-Yossef ${INC_ARM_DIRS_TO_CHECK} 7736eaaf37SIan Spray 7873c99d4eSJuan Castillo################################################################################ 7973c99d4eSJuan Castillo# Process build options 8073c99d4eSJuan Castillo################################################################################ 8173c99d4eSJuan Castillo 8273c99d4eSJuan Castillo# Verbose flag 83e35c4045SJeenu Viswambharanifeq (${V},0) 84b169f6a9SEvan Lloyd Q:=@ 85ee1ba6d4SAndre Przywara ECHO:=@echo 8636eaaf37SIan Spray CHECKCODE_ARGS += --no-summary --terse 874f6ad66aSAchin Guptaelse 88b169f6a9SEvan Lloyd Q:= 89b5a0f4bdSAntonio Nino Diaz ECHO:=$(ECHO_QUIET) 904f6ad66aSAchin Guptaendif 91ee1ba6d4SAndre Przywara 92ee1ba6d4SAndre Przywaraifneq ($(findstring s,$(filter-out --%,$(MAKEFLAGS))),) 93ee1ba6d4SAndre Przywara Q:=@ 94b5a0f4bdSAntonio Nino Diaz ECHO:=$(ECHO_QUIET) 95ee1ba6d4SAndre Przywaraendif 96ee1ba6d4SAndre Przywara 97ee1ba6d4SAndre Przywaraexport Q ECHO 982f2cef46SJeenu Viswambharan 9973c99d4eSJuan Castillo################################################################################ 10073c99d4eSJuan Castillo# Toolchain 10173c99d4eSJuan Castillo################################################################################ 10273c99d4eSJuan Castillo 10372610c41Sdp-armHOSTCC := gcc 10472610c41Sdp-armexport HOSTCC 10572610c41Sdp-arm 10673c99d4eSJuan CastilloCC := ${CROSS_COMPILE}gcc 10773c99d4eSJuan CastilloCPP := ${CROSS_COMPILE}cpp 10873c99d4eSJuan CastilloAS := ${CROSS_COMPILE}gcc 10973c99d4eSJuan CastilloAR := ${CROSS_COMPILE}ar 1102adee763SRoberto VargasLINKER := ${CROSS_COMPILE}ld 11173c99d4eSJuan CastilloOC := ${CROSS_COMPILE}objcopy 11273c99d4eSJuan CastilloOD := ${CROSS_COMPILE}objdump 11373c99d4eSJuan CastilloNM := ${CROSS_COMPILE}nm 11473c99d4eSJuan CastilloPP := ${CROSS_COMPILE}gcc -E 11538c14d88SSoby MathewDTC := dtc 11673c99d4eSJuan Castillo 117b25a577fSJulius Werner# Use ${LD}.bfd instead if it exists (as absolute path or together with $PATH). 118b25a577fSJulius Wernerifneq ($(strip $(wildcard ${LD}.bfd) \ 1192adee763SRoberto Vargas $(foreach dir,$(subst :, ,${PATH}),$(wildcard ${dir}/${LINKER}.bfd))),) 1202adee763SRoberto VargasLINKER := ${LINKER}.bfd 121b25a577fSJulius Wernerendif 122b25a577fSJulius Werner 123c5e1da83SJayanth Dodderi Chidanand################################################################################ 124c5e1da83SJayanth Dodderi Chidanand# Auxiliary tools (fiptool, cert_create, etc) 125c5e1da83SJayanth Dodderi Chidanand################################################################################ 126c5e1da83SJayanth Dodderi Chidanand 127c5e1da83SJayanth Dodderi Chidanand# Variables for use with Certificate Generation Tool 128c5e1da83SJayanth Dodderi ChidanandCRTTOOLPATH ?= tools/cert_create 129c5e1da83SJayanth Dodderi ChidanandCRTTOOL ?= ${CRTTOOLPATH}/cert_create${BIN_EXT} 130c5e1da83SJayanth Dodderi Chidanand 131c5e1da83SJayanth Dodderi Chidanand# Variables for use with Firmware Encryption Tool 132c5e1da83SJayanth Dodderi ChidanandENCTOOLPATH ?= tools/encrypt_fw 133c5e1da83SJayanth Dodderi ChidanandENCTOOL ?= ${ENCTOOLPATH}/encrypt_fw${BIN_EXT} 134c5e1da83SJayanth Dodderi Chidanand 135c5e1da83SJayanth Dodderi Chidanand# Variables for use with Firmware Image Package 136c5e1da83SJayanth Dodderi ChidanandFIPTOOLPATH ?= tools/fiptool 137c5e1da83SJayanth Dodderi ChidanandFIPTOOL ?= ${FIPTOOLPATH}/fiptool${BIN_EXT} 138c5e1da83SJayanth Dodderi Chidanand 139c5e1da83SJayanth Dodderi Chidanand# Variables for use with sptool 140c5e1da83SJayanth Dodderi ChidanandSPTOOLPATH ?= tools/sptool 141c5e1da83SJayanth Dodderi ChidanandSPTOOL ?= ${SPTOOLPATH}/sptool.py 142c5e1da83SJayanth Dodderi ChidanandSP_MK_GEN ?= ${SPTOOLPATH}/sp_mk_generator.py 14320629b31SKarl MeakinSP_DTS_LIST_FRAGMENT ?= ${BUILD_PLAT}/sp_list_fragment.dts 144c5e1da83SJayanth Dodderi Chidanand 145c5e1da83SJayanth Dodderi Chidanand# Variables for use with ROMLIB 146c5e1da83SJayanth Dodderi ChidanandROMLIBPATH ?= lib/romlib 147c5e1da83SJayanth Dodderi Chidanand 148c5e1da83SJayanth Dodderi Chidanand# Variable for use with Python 149c5e1da83SJayanth Dodderi ChidanandPYTHON ?= python3 150c5e1da83SJayanth Dodderi Chidanand 151c5e1da83SJayanth Dodderi Chidanand# Variables for use with documentation build using Sphinx tool 152c5e1da83SJayanth Dodderi ChidanandDOCS_PATH ?= docs 153c5e1da83SJayanth Dodderi Chidanand 154c5e1da83SJayanth Dodderi Chidanand################################################################################ 155c5e1da83SJayanth Dodderi Chidanand# Compiler Configuration based on ARCH_MAJOR and ARCH_MINOR flags 156c5e1da83SJayanth Dodderi Chidanand################################################################################ 15726e63c44SEtienne Carriereifeq (${ARM_ARCH_MAJOR},7) 15826e63c44SEtienne Carriere target32-directive = -target arm-none-eabi 159d4089fb8SGovindraj Raja# Will set march-directive from platform configuration 16026e63c44SEtienne Carriereelse 16126e63c44SEtienne Carriere target32-directive = -target armv8a-none-eabi 162c5e1da83SJayanth Dodderi Chidanandendif #(ARM_ARCH_MAJOR) 163c5e1da83SJayanth Dodderi Chidanand 164c5e1da83SJayanth Dodderi Chidanand################################################################################ 165c5e1da83SJayanth Dodderi Chidanand# Get Architecture Feature Modifiers 166c5e1da83SJayanth Dodderi Chidanand################################################################################ 167c5e1da83SJayanth Dodderi Chidanandarch-features = ${ARM_ARCH_FEATURE} 168c5e1da83SJayanth Dodderi Chidanand 169f1821790SAlexei Fedorov# Set the compiler's architecture feature modifiers 170f1821790SAlexei Fedorovifneq ($(arch-features), none) 171f1821790SAlexei Fedorov # Strip "none+" from arch-features 172f1821790SAlexei Fedorov arch-features := $(subst none+,,$(arch-features)) 173d4089fb8SGovindraj Raja march-directive := $(march-directive)+$(arch-features) 174f1821790SAlexei Fedorov# Print features 175f1821790SAlexei Fedorov $(info Arm Architecture Features specified: $(subst +, ,$(arch-features))) 176c5e1da83SJayanth Dodderi Chidanandendif #(arch-features) 1774e04478aSChris Kay 178c8a992fdSoriginifneq ($(findstring clang,$(notdir $(CC))),) 179fd18a8fcSVarun Wadekar ifneq ($(findstring armclang,$(notdir $(CC))),) 1807794d6c8SGovindraj Raja TF_CFLAGS_aarch32 := -target arm-arm-none-eabi 1817794d6c8SGovindraj Raja TF_CFLAGS_aarch64 := -target aarch64-arm-none-eabi 182c8a992fdSorigin LD := $(LINKER) 183c8a992fdSorigin else 1847794d6c8SGovindraj Raja TF_CFLAGS_aarch32 = $(target32-directive) 1857794d6c8SGovindraj Raja TF_CFLAGS_aarch64 := -target aarch64-elf 186c8a992fdSorigin LD := $(shell $(CC) --print-prog-name ld.lld) 187c8a992fdSorigin 188c8a992fdSorigin AR := $(shell $(CC) --print-prog-name llvm-ar) 189c8a992fdSorigin OD := $(shell $(CC) --print-prog-name llvm-objdump) 190c8a992fdSorigin OC := $(shell $(CC) --print-prog-name llvm-objcopy) 191641f16e7SAmbroise Vincent endif 192c8a992fdSorigin 193c8a992fdSorigin CPP := $(CC) -E $(TF_CFLAGS_$(ARCH)) 194c8a992fdSorigin PP := $(CC) -E $(TF_CFLAGS_$(ARCH)) 195c8a992fdSorigin AS := $(CC) -c -x assembler-with-cpp $(TF_CFLAGS_$(ARCH)) 196edbce9aaSzelalem-awekeelse ifneq ($(findstring gcc,$(notdir $(CC))),) 197edbce9aaSzelalem-aweke ifeq ($(ENABLE_LTO),1) 198edbce9aaSzelalem-aweke # Enable LTO only for aarch64 199edbce9aaSzelalem-aweke ifeq (${ARCH},aarch64) 200edbce9aaSzelalem-aweke LTO_CFLAGS = -flto 201edbce9aaSzelalem-aweke # Use gcc as a wrapper for the ld, recommended for LTO 202edbce9aaSzelalem-aweke LINKER := ${CROSS_COMPILE}gcc 203edbce9aaSzelalem-aweke endif 204edbce9aaSzelalem-aweke endif 205edbce9aaSzelalem-aweke LD = $(LINKER) 206d5461857Sdp-armelse 2072adee763SRoberto Vargas LD = $(LINKER) 208c5e1da83SJayanth Dodderi Chidanandendif #(clang) 209d5461857Sdp-arm 21032b209bfSAhmad Fatoum# Process Debug flag 21132b209bfSAhmad Fatoum$(eval $(call add_define,DEBUG)) 21232b209bfSAhmad Fatoumifneq (${DEBUG}, 0) 21332b209bfSAhmad Fatoum BUILD_TYPE := debug 2144466cf82SDaniel Boulby TF_CFLAGS += -g -gdwarf-4 2154466cf82SDaniel Boulby ASFLAGS += -g -Wa,-gdwarf-4 21632b209bfSAhmad Fatoum 21732b209bfSAhmad Fatoum # Use LOG_LEVEL_INFO by default for debug builds 21832b209bfSAhmad Fatoum LOG_LEVEL := 40 21932b209bfSAhmad Fatoumelse 22032b209bfSAhmad Fatoum BUILD_TYPE := release 22132b209bfSAhmad Fatoum # Use LOG_LEVEL_NOTICE by default for release builds 22232b209bfSAhmad Fatoum LOG_LEVEL := 20 223c5e1da83SJayanth Dodderi Chidanandendif #(Debug) 22432b209bfSAhmad Fatoum 225f1de4c8fSPeiyuan Song# Default build string (git branch and commit) 226f1de4c8fSPeiyuan Songifeq (${BUILD_STRING},) 227f1de4c8fSPeiyuan Song BUILD_STRING := $(shell git describe --always --dirty --tags 2> /dev/null) 228f1de4c8fSPeiyuan Songendif 229dddf4283Slaurenw-armVERSION_STRING := v${VERSION}(${BUILD_TYPE}):${BUILD_STRING} 230f1de4c8fSPeiyuan Song 2318fd9d4d5SAntonio Nino Diazifeq (${AARCH32_INSTRUCTION_SET},A32) 2328fd9d4d5SAntonio Nino Diaz TF_CFLAGS_aarch32 += -marm 2338fd9d4d5SAntonio Nino Diazelse ifeq (${AARCH32_INSTRUCTION_SET},T32) 2348fd9d4d5SAntonio Nino Diaz TF_CFLAGS_aarch32 += -mthumb 2358fd9d4d5SAntonio Nino Diazelse 2368fd9d4d5SAntonio Nino Diaz $(error Error: Unknown AArch32 instruction set ${AARCH32_INSTRUCTION_SET}) 237c5e1da83SJayanth Dodderi Chidanandendif #(AARCH32_INSTRUCTION_SET) 2388fd9d4d5SAntonio Nino Diaz 239a9c4dde3SSandrine BailleuxTF_CFLAGS_aarch32 += -mno-unaligned-access 240d5461857Sdp-armTF_CFLAGS_aarch64 += -mgeneral-regs-only -mstrict-align 2419d29c227SSoby Mathew 242d4089fb8SGovindraj RajaASFLAGS += $(march-directive) 243b86048c4SAntonio Nino Diaz 244c5e1da83SJayanth Dodderi Chidanand############################################################################## 245c5e1da83SJayanth Dodderi Chidanand# WARNINGS Configuration 246c5e1da83SJayanth Dodderi Chidanand############################################################################### 2479ab81b5eSJustin Chadwell# General warnings 2489ab81b5eSJustin ChadwellWARNINGS := -Wall -Wmissing-include-dirs -Wunused \ 249b7f6525dSJustin Chadwell -Wdisabled-optimization -Wvla -Wshadow \ 250d75a9ecdSBoyan Karatotev -Wredundant-decls 251d75a9ecdSBoyan Karatotev# stricter warnings 252d75a9ecdSBoyan KaratotevWARNINGS += -Wextra -Wno-trigraphs 253d75a9ecdSBoyan Karatotev# too verbose for generic build 254d75a9ecdSBoyan KaratotevWARNINGS += -Wno-missing-field-initializers \ 255d75a9ecdSBoyan Karatotev -Wno-type-limits -Wno-sign-compare \ 256d75a9ecdSBoyan Karatotev# on clang this flag gets reset if -Wextra is set after it. No difference on gcc 257d75a9ecdSBoyan KaratotevWARNINGS += -Wno-unused-parameter 2589ab81b5eSJustin Chadwell 2599ab81b5eSJustin Chadwell# Additional warnings 260d75a9ecdSBoyan Karatotev# Level 1 - infrequent warnings we should have none of 261d75a9ecdSBoyan Karatotev# full -Wextra 262d75a9ecdSBoyan KaratotevWARNING1 += -Wsign-compare 263d75a9ecdSBoyan KaratotevWARNING1 += -Wtype-limits 264d75a9ecdSBoyan KaratotevWARNING1 += -Wmissing-field-initializers 265e7c645b5SYann Gautier 266d75a9ecdSBoyan Karatotev# Level 2 - problematic warnings that we want 267d75a9ecdSBoyan Karatotev# zlib, compiler-rt, coreboot, and mbdedtls blow up with these 268d75a9ecdSBoyan Karatotev# TODO: disable just for them and move into default build 269d75a9ecdSBoyan KaratotevWARNING2 += -Wold-style-definition 270d75a9ecdSBoyan KaratotevWARNING2 += -Wmissing-prototypes 271d75a9ecdSBoyan KaratotevWARNING2 += -Wmissing-format-attribute 272d75a9ecdSBoyan Karatotev# TF-A aims to comply with this eventually. Effort too large at present 273d75a9ecdSBoyan KaratotevWARNING2 += -Wundef 274d141e638SBoyan Karatotev# currently very involved and many platforms set this off 275d141e638SBoyan KaratotevWARNING2 += -Wunused-const-variable=2 276e7c645b5SYann Gautier 277d75a9ecdSBoyan Karatotev# Level 3 - very pedantic, frequently ignored 278e7c645b5SYann GautierWARNING3 := -Wbad-function-cast 279d75a9ecdSBoyan KaratotevWARNING3 += -Waggregate-return 280d75a9ecdSBoyan KaratotevWARNING3 += -Wnested-externs 281d75a9ecdSBoyan KaratotevWARNING3 += -Wcast-align 282e7c645b5SYann GautierWARNING3 += -Wcast-qual 283e7c645b5SYann GautierWARNING3 += -Wconversion 284e7c645b5SYann GautierWARNING3 += -Wpacked 285e7c645b5SYann GautierWARNING3 += -Wpointer-arith 286e7c645b5SYann GautierWARNING3 += -Wswitch-default 287e7c645b5SYann Gautier 288d75a9ecdSBoyan Karatotev# Setting W is quite verbose and most warnings will be pre-existing issues 289d75a9ecdSBoyan Karatotev# outside of the contributor's control. Don't fail the build on them so warnings 290d75a9ecdSBoyan Karatotev# can be seen and hopefully addressed 291d75a9ecdSBoyan Karatotevifdef W 292d75a9ecdSBoyan Karatotev ifneq (${W},0) 293d75a9ecdSBoyan Karatotev E ?= 0 294d75a9ecdSBoyan Karatotev endif 295d75a9ecdSBoyan Karatotevendif 296d75a9ecdSBoyan Karatotev 297e7c645b5SYann Gautierifeq (${W},1) 2989ab81b5eSJustin Chadwell WARNINGS += $(WARNING1) 299e7c645b5SYann Gautierelse ifeq (${W},2) 3009ab81b5eSJustin Chadwell WARNINGS += $(WARNING1) $(WARNING2) 301e7c645b5SYann Gautierelse ifeq (${W},3) 3029ab81b5eSJustin Chadwell WARNINGS += $(WARNING1) $(WARNING2) $(WARNING3) 303c5e1da83SJayanth Dodderi Chidanandendif #(W) 304e7c645b5SYann Gautier 3059ab81b5eSJustin Chadwell# Compiler specific warnings 30600296576SAmbroise Vincentifeq ($(findstring clang,$(notdir $(CC))),) 30793c690ebSJustin Chadwell# not using clang 308d7b4cd41SJustin ChadwellWARNINGS += -Wunused-but-set-variable -Wmaybe-uninitialized \ 309d7b4cd41SJustin Chadwell -Wpacked-bitfield-compat -Wshift-overflow=2 \ 310d7b4cd41SJustin Chadwell -Wlogical-op 311dea23e24SGovindraj Raja 312dea23e24SGovindraj Raja# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105523 313dea23e24SGovindraj RajaTF_CFLAGS += $(call cc_option, --param=min-pagesize=0) 314dea23e24SGovindraj Raja 31593c690ebSJustin Chadwellelse 31693c690ebSJustin Chadwell# using clang 317d7b4cd41SJustin ChadwellWARNINGS += -Wshift-overflow -Wshift-sign-overflow \ 318d7b4cd41SJustin Chadwell -Wlogical-op-parentheses 319c5e1da83SJayanth Dodderi Chidanandendif #(Clang Warning) 32000296576SAmbroise Vincent 3216336b07aSYann Gautierifneq (${E},0) 3226336b07aSYann Gautier ERRORS := -Werror 323c5e1da83SJayanth Dodderi Chidanandendif #(E) 3246336b07aSYann Gautier 325c5e1da83SJayanth Dodderi Chidanand################################################################################ 326c5e1da83SJayanth Dodderi Chidanand# Compiler and Linker Directives 327c5e1da83SJayanth Dodderi Chidanand################################################################################ 328ea7a57a3SRoberto VargasCPPFLAGS = ${DEFINES} ${INCLUDES} ${MBEDTLS_INC} -nostdinc \ 3299ab81b5eSJustin Chadwell $(ERRORS) $(WARNINGS) 330d4089fb8SGovindraj RajaASFLAGS += $(CPPFLAGS) \ 331d5dfdeb6SJulius Werner -ffreestanding -Wa,--fatal-warnings 33259de5096SMasahiro YamadaTF_CFLAGS += $(CPPFLAGS) $(TF_CFLAGS_$(ARCH)) \ 333ebd6efaeSSamuel Holland -ffunction-sections -fdata-sections \ 334ebd6efaeSSamuel Holland -ffreestanding -fno-builtin -fno-common \ 335ebd6efaeSSamuel Holland -Os -std=gnu99 33673c99d4eSJuan Castillo 3371f461979SJustin Chadwellifeq (${SANITIZE_UB},on) 3381f461979SJustin Chadwell TF_CFLAGS += -fsanitize=undefined -fno-sanitize-recover 339c5e1da83SJayanth Dodderi Chidanandendif #(${SANITIZE_UB},on) 340c5e1da83SJayanth Dodderi Chidanand 3411f461979SJustin Chadwellifeq (${SANITIZE_UB},trap) 3421f461979SJustin Chadwell TF_CFLAGS += -fsanitize=undefined -fno-sanitize-recover \ 3431f461979SJustin Chadwell -fsanitize-undefined-trap-on-error 344c5e1da83SJayanth Dodderi Chidanandendif #(${SANITIZE_UB},trap) 3451f461979SJustin Chadwell 346f7ec31dbSdavid cunadoGCC_V_OUTPUT := $(shell $(CC) -v 2>&1) 347f7ec31dbSdavid cunado 3481f49db5fSMarco FelschTF_LDFLAGS += -z noexecstack 3491f49db5fSMarco Felsch 350641f16e7SAmbroise Vincent# LD = armlink 351c2ad38ceSVarun Wadekarifneq ($(findstring armlink,$(notdir $(LD))),) 352c2ad38ceSVarun Wadekar TF_LDFLAGS += --diag_error=warning --lto_level=O1 353c2ad38ceSVarun Wadekar TF_LDFLAGS += --remove --info=unused,unusedsymbols 354edbce9aaSzelalem-aweke TF_LDFLAGS += $(TF_LDFLAGS_$(ARCH)) 355641f16e7SAmbroise Vincent 356641f16e7SAmbroise Vincent# LD = gcc (used when GCC LTO is enabled) 357edbce9aaSzelalem-awekeelse ifneq ($(findstring gcc,$(notdir $(LD))),) 358edbce9aaSzelalem-aweke # Pass ld options with Wl or Xlinker switches 359edbce9aaSzelalem-aweke TF_LDFLAGS += -Wl,--fatal-warnings -O1 360edbce9aaSzelalem-aweke TF_LDFLAGS += -Wl,--gc-sections 361ac98b82aSChris Kay 362ac98b82aSChris Kay TF_LDFLAGS += -Wl,-z,common-page-size=4096 #Configure page size constants 363ac98b82aSChris Kay TF_LDFLAGS += -Wl,-z,max-page-size=4096 364ac98b82aSChris Kay 365edbce9aaSzelalem-aweke ifeq ($(ENABLE_LTO),1) 366edbce9aaSzelalem-aweke ifeq (${ARCH},aarch64) 367edbce9aaSzelalem-aweke TF_LDFLAGS += -flto -fuse-linker-plugin 368edbce9aaSzelalem-aweke endif 369c5e1da83SJayanth Dodderi Chidanand endif #(ENABLE_LTO) 370c5e1da83SJayanth Dodderi Chidanand 371edbce9aaSzelalem-aweke# GCC automatically adds fix-cortex-a53-843419 flag when used to link 372edbce9aaSzelalem-aweke# which breaks some builds, so disable if errata fix is not explicitly enabled 373cfe6767fSYann Gautier ifeq (${ARCH},aarch64) 374edbce9aaSzelalem-aweke ifneq (${ERRATA_A53_843419},1) 375edbce9aaSzelalem-aweke TF_LDFLAGS += -mno-fix-cortex-a53-843419 376edbce9aaSzelalem-aweke endif 377cfe6767fSYann Gautier endif 378edbce9aaSzelalem-aweke TF_LDFLAGS += -nostdlib 379edbce9aaSzelalem-aweke TF_LDFLAGS += $(subst --,-Xlinker --,$(TF_LDFLAGS_$(ARCH))) 380641f16e7SAmbroise Vincent 381641f16e7SAmbroise Vincent# LD = gcc-ld (ld) or llvm-ld (ld.lld) or other 382c2ad38ceSVarun Wadekarelse 3831f49db5fSMarco Felsch# With ld.bfd version 2.39 and newer new warnings are added. Skip those since we 3841f49db5fSMarco Felsch# are not loaded by a elf loader. 3851f49db5fSMarco Felsch TF_LDFLAGS += $(call ld_option, --no-warn-rwx-segments) 386ebac6922SYabin Cui TF_LDFLAGS += -O1 387c2b8806fSDouglas Raillard TF_LDFLAGS += --gc-sections 388ac98b82aSChris Kay 389ac98b82aSChris Kay TF_LDFLAGS += -z common-page-size=4096 # Configure page size constants 390ac98b82aSChris Kay TF_LDFLAGS += -z max-page-size=4096 391ac98b82aSChris Kay 392641f16e7SAmbroise Vincent# ld.lld doesn't recognize the errata flags, 393ebac6922SYabin Cui# therefore don't add those in that case. 394ebac6922SYabin Cui# ld.lld reports section type mismatch warnings, 395ebac6922SYabin Cui# therefore don't add --fatal-warnings to it. 396641f16e7SAmbroise Vincent ifeq ($(findstring ld.lld,$(notdir $(LD))),) 397ebac6922SYabin Cui TF_LDFLAGS += $(TF_LDFLAGS_$(ARCH)) --fatal-warnings 398edbce9aaSzelalem-aweke endif 399c5e1da83SJayanth Dodderi Chidanand 400c5e1da83SJayanth Dodderi Chidanandendif #(LD = armlink) 40173c99d4eSJuan Castillo 40203b397a8SNishanth MenonDTC_FLAGS += -I dts -O dtb 403a6de824fSLouis MayencourtDTC_CPPFLAGS += -P -nostdinc -Iinclude -Ifdts -undef \ 404a6de824fSLouis Mayencourt -x assembler-with-cpp $(DEFINES) 40503b397a8SNishanth Menon 40673c99d4eSJuan Castillo################################################################################ 407f5211420SGovindraj Raja# Setup ARCH_MAJOR/MINOR before parsing arch_features. 408f5211420SGovindraj Raja################################################################################ 409f5211420SGovindraj Rajaifeq (${ENABLE_RME},1) 410f5211420SGovindraj Raja ARM_ARCH_MAJOR := 8 411f5211420SGovindraj Raja ARM_ARCH_MINOR := 6 412f5211420SGovindraj Rajaendif 413f5211420SGovindraj Raja 414f5211420SGovindraj Raja################################################################################ 41573c99d4eSJuan Castillo# Common sources and include directories 41673c99d4eSJuan Castillo################################################################################ 4176a0da736SJayanth Dodderi Chidanandinclude ${MAKE_HELPERS_DIRECTORY}arch_features.mk 418d801fbb0Sdp-arminclude lib/compiler-rt/compiler-rt.mk 41973c99d4eSJuan Castillo 42073c99d4eSJuan CastilloBL_COMMON_SOURCES += common/bl_common.c \ 4217f56e9a3SSoby Mathew common/tf_log.c \ 4229d29c227SSoby Mathew common/${ARCH}/debug.S \ 42391b48c9fSJulius Werner drivers/console/multi_console.c \ 4249d29c227SSoby Mathew lib/${ARCH}/cache_helpers.S \ 4259d29c227SSoby Mathew lib/${ARCH}/misc_helpers.S \ 426c73686a1SBoyan Karatotev lib/extensions/pmuv3/${ARCH}/pmuv3.c \ 427566034fcSSoby Mathew plat/common/plat_bl_common.c \ 4287f56e9a3SSoby Mathew plat/common/plat_log_common.c \ 42975311203Sdp-arm plat/common/${ARCH}/plat_common.c \ 4309d29c227SSoby Mathew plat/common/${ARCH}/platform_helpers.S \ 43161f72a34SRoberto Vargas ${COMPILER_RT_SRCS} 432d7a6b0f8SRyan Harkin 4338422a840SAntonio Nino Diazifeq ($(notdir $(CC)),armclang) 4348422a840SAntonio Nino Diaz BL_COMMON_SOURCES += lib/${ARCH}/armclang_printf.S 4358422a840SAntonio Nino Diazendif 4368422a840SAntonio Nino Diaz 4371f461979SJustin Chadwellifeq (${SANITIZE_UB},on) 4381f461979SJustin Chadwell BL_COMMON_SOURCES += plat/common/ubsan.c 4391f461979SJustin Chadwellendif 4401f461979SJustin Chadwell 44101d237cbSYann GautierINCLUDES += -Iinclude \ 442f5478dedSAntonio Nino Diaz -Iinclude/arch/${ARCH} \ 44309d40e0eSAntonio Nino Diaz -Iinclude/lib/cpus/${ARCH} \ 44409d40e0eSAntonio Nino Diaz -Iinclude/lib/el3_runtime/${ARCH} \ 44509d40e0eSAntonio Nino Diaz ${PLAT_INCLUDES} \ 44609d40e0eSAntonio Nino Diaz ${SPD_INCLUDES} 44709d40e0eSAntonio Nino Diaz 4489c6d1c50SAntonio Nino Diazinclude common/backtrace/backtrace.mk 4499c6d1c50SAntonio Nino Diaz 45073c99d4eSJuan Castillo################################################################################ 4513547270fSGovindraj Raja# Generic definitions 4523547270fSGovindraj Raja################################################################################ 4533547270fSGovindraj Rajainclude ${MAKE_HELPERS_DIRECTORY}plat_helpers.mk 4543547270fSGovindraj Raja 4553547270fSGovindraj Rajaifeq (${BUILD_BASE},) 4563547270fSGovindraj Raja BUILD_BASE := ./build 4573547270fSGovindraj Rajaendif 4583547270fSGovindraj RajaBUILD_PLAT := $(abspath ${BUILD_BASE})/${PLAT}/${BUILD_TYPE} 4593547270fSGovindraj Raja 4603547270fSGovindraj RajaSPDS := $(sort $(filter-out none, $(patsubst services/spd/%,%,$(wildcard services/spd/*)))) 4613547270fSGovindraj Raja 4623547270fSGovindraj Raja# Platforms providing their own TBB makefile may override this value 4633547270fSGovindraj RajaINCLUDE_TBBR_MK := 1 4643547270fSGovindraj Raja 4653547270fSGovindraj Raja################################################################################ 4663547270fSGovindraj Raja# Include SPD Makefile if one has been specified 4673547270fSGovindraj Raja################################################################################ 4683547270fSGovindraj Raja 4693547270fSGovindraj Rajaifneq (${SPD},none) 4703547270fSGovindraj Raja ifeq (${ARCH},aarch32) 4713547270fSGovindraj Raja $(error "Error: SPD is incompatible with AArch32.") 4723547270fSGovindraj Raja endif 4733547270fSGovindraj Raja 4743547270fSGovindraj Raja ifdef EL3_PAYLOAD_BASE 4753547270fSGovindraj Raja $(warning "SPD and EL3_PAYLOAD_BASE are incompatible build options.") 4763547270fSGovindraj Raja $(warning "The SPD and its BL32 companion will be present but \ 4773547270fSGovindraj Raja ignored.") 4783547270fSGovindraj Raja endif 4793547270fSGovindraj Raja 4803547270fSGovindraj Raja ifeq (${SPD},spmd) 4813547270fSGovindraj Raja # SPMD is located in std_svc directory 4823547270fSGovindraj Raja SPD_DIR := std_svc 4833547270fSGovindraj Raja 4843547270fSGovindraj Raja ifeq ($(SPMD_SPM_AT_SEL2),1) 4853547270fSGovindraj Raja CTX_INCLUDE_EL2_REGS := 1 4863547270fSGovindraj Raja ifeq ($(SPMC_AT_EL3),1) 4873547270fSGovindraj Raja $(error SPM cannot be enabled in both S-EL2 and EL3.) 4883547270fSGovindraj Raja endif 4893547270fSGovindraj Raja endif 4903547270fSGovindraj Raja 4913547270fSGovindraj Raja ifeq ($(findstring optee_sp,$(ARM_SPMC_MANIFEST_DTS)),optee_sp) 4923547270fSGovindraj Raja DTC_CPPFLAGS += -DOPTEE_SP_FW_CONFIG 4933547270fSGovindraj Raja endif 4943547270fSGovindraj Raja 4953547270fSGovindraj Raja ifeq ($(TS_SP_FW_CONFIG),1) 4963547270fSGovindraj Raja DTC_CPPFLAGS += -DTS_SP_FW_CONFIG 4973547270fSGovindraj Raja endif 4983547270fSGovindraj Raja 4993547270fSGovindraj Raja ifneq ($(ARM_BL2_SP_LIST_DTS),) 5003547270fSGovindraj Raja DTC_CPPFLAGS += -DARM_BL2_SP_LIST_DTS=$(ARM_BL2_SP_LIST_DTS) 5013547270fSGovindraj Raja endif 5023547270fSGovindraj Raja 5033547270fSGovindraj Raja ifneq ($(SP_LAYOUT_FILE),) 5043547270fSGovindraj Raja BL2_ENABLE_SP_LOAD := 1 5053547270fSGovindraj Raja endif 5063547270fSGovindraj Raja else 5073547270fSGovindraj Raja # All other SPDs in spd directory 5083547270fSGovindraj Raja SPD_DIR := spd 5093547270fSGovindraj Raja endif #(SPD) 5103547270fSGovindraj Raja 5113547270fSGovindraj Raja # We expect to locate an spd.mk under the specified SPD directory 5123547270fSGovindraj Raja SPD_MAKE := $(wildcard services/${SPD_DIR}/${SPD}/${SPD}.mk) 5133547270fSGovindraj Raja 5143547270fSGovindraj Raja ifeq (${SPD_MAKE},) 5153547270fSGovindraj Raja $(error Error: No services/${SPD_DIR}/${SPD}/${SPD}.mk located) 5163547270fSGovindraj Raja endif 5173547270fSGovindraj Raja $(info Including ${SPD_MAKE}) 5183547270fSGovindraj Raja include ${SPD_MAKE} 5193547270fSGovindraj Raja 5203547270fSGovindraj Raja # If there's BL32 companion for the chosen SPD, we expect that the SPD's 5213547270fSGovindraj Raja # Makefile would set NEED_BL32 to "yes". In this case, the build system 5223547270fSGovindraj Raja # supports two mutually exclusive options: 5233547270fSGovindraj Raja # * BL32 is built from source: then BL32_SOURCES must contain the list 5243547270fSGovindraj Raja # of source files to build BL32 5253547270fSGovindraj Raja # * BL32 is a prebuilt binary: then BL32 must point to the image file 5263547270fSGovindraj Raja # that will be included in the FIP 5273547270fSGovindraj Raja # If both BL32_SOURCES and BL32 are defined, the binary takes precedence 5283547270fSGovindraj Raja # over the sources. 5293547270fSGovindraj Rajaendif #(SPD=none) 5303547270fSGovindraj Raja 5313547270fSGovindraj Rajaifeq (${ENABLE_SPMD_LP}, 1) 5323547270fSGovindraj Rajaifneq (${SPD},spmd) 5333547270fSGovindraj Raja $(error Error: ENABLE_SPMD_LP requires SPD=spmd.) 5343547270fSGovindraj Rajaendif 5353547270fSGovindraj Rajaifeq ($(SPMC_AT_EL3),1) 5363547270fSGovindraj Raja $(error SPMC at EL3 not supported when enabling SPMD Logical partitions.) 5373547270fSGovindraj Rajaendif 5383547270fSGovindraj Rajaendif 5393547270fSGovindraj Raja 5403547270fSGovindraj Raja################################################################################ 541f5211420SGovindraj Raja# Process BRANCH_PROTECTION value and set 542f5211420SGovindraj Raja# Pointer Authentication and Branch Target Identification flags 543f5211420SGovindraj Raja################################################################################ 544f5211420SGovindraj Rajaifeq (${BRANCH_PROTECTION},0) 545f5211420SGovindraj Raja # Default value turns off all types of branch protection 546f5211420SGovindraj Raja BP_OPTION := none 547f5211420SGovindraj Rajaelse ifneq (${ARCH},aarch64) 548f5211420SGovindraj Raja $(error BRANCH_PROTECTION requires AArch64) 549f5211420SGovindraj Rajaelse ifeq (${BRANCH_PROTECTION},1) 550f5211420SGovindraj Raja # Enables all types of branch protection features 551f5211420SGovindraj Raja BP_OPTION := standard 552f5211420SGovindraj Raja ENABLE_BTI := 1 553f5211420SGovindraj Raja ENABLE_PAUTH := 1 554f5211420SGovindraj Rajaelse ifeq (${BRANCH_PROTECTION},2) 555f5211420SGovindraj Raja # Return address signing to its standard level 556f5211420SGovindraj Raja BP_OPTION := pac-ret 557f5211420SGovindraj Raja ENABLE_PAUTH := 1 558f5211420SGovindraj Rajaelse ifeq (${BRANCH_PROTECTION},3) 559f5211420SGovindraj Raja # Extend the signing to include leaf functions 560f5211420SGovindraj Raja BP_OPTION := pac-ret+leaf 561f5211420SGovindraj Raja ENABLE_PAUTH := 1 562f5211420SGovindraj Rajaelse ifeq (${BRANCH_PROTECTION},4) 563f5211420SGovindraj Raja # Turn on branch target identification mechanism 564f5211420SGovindraj Raja BP_OPTION := bti 565f5211420SGovindraj Raja ENABLE_BTI := 1 566f5211420SGovindraj Rajaelse 567f5211420SGovindraj Raja $(error Unknown BRANCH_PROTECTION value ${BRANCH_PROTECTION}) 568f5211420SGovindraj Rajaendif #(BRANCH_PROTECTION) 569f5211420SGovindraj Raja 570f5211420SGovindraj Rajaifeq ($(ENABLE_PAUTH),1) 571f5211420SGovindraj Raja CTX_INCLUDE_PAUTH_REGS := 1 572f5211420SGovindraj Rajaendif 573f5211420SGovindraj Rajaifneq (${BP_OPTION},none) 574f5211420SGovindraj Raja TF_CFLAGS_aarch64 += -mbranch-protection=${BP_OPTION} 575f5211420SGovindraj Rajaendif #(BP_OPTION) 576f5211420SGovindraj Raja 577f5211420SGovindraj Raja# Pointer Authentication sources 578f5211420SGovindraj Rajaifeq (${ENABLE_PAUTH}, 1) 579f5211420SGovindraj Raja# arm/common/aarch64/arm_pauth.c contains a sample platform hook to complete the 580f5211420SGovindraj Raja# Pauth support. As it's not secure, it must be reimplemented for real platforms 581f5211420SGovindraj Raja BL_COMMON_SOURCES += lib/extensions/pauth/pauth_helpers.S 582f5211420SGovindraj Rajaendif 583f5211420SGovindraj Raja 5843547270fSGovindraj Raja################################################################################ 5853547270fSGovindraj Raja# Include the platform specific Makefile after the SPD Makefile (the platform 5863547270fSGovindraj Raja# makefile may use all previous definitions in this file) 5873547270fSGovindraj Raja################################################################################ 5883547270fSGovindraj Rajainclude ${PLAT_MAKEFILE_FULL} 5893547270fSGovindraj Raja 5903547270fSGovindraj Raja################################################################################ 5913547270fSGovindraj Raja# Setup arch_features based on ARM_ARCH_MAJOR, ARM_ARCH_MINOR provided from 5923547270fSGovindraj Raja# platform. 5933547270fSGovindraj Raja################################################################################ 5943547270fSGovindraj Rajainclude ${MAKE_HELPERS_DIRECTORY}arch_features.mk 5953547270fSGovindraj Raja 596f5211420SGovindraj Raja#################################################### 597f5211420SGovindraj Raja# Enable required options for Memory Stack Tagging. 598f5211420SGovindraj Raja#################################################### 599f5211420SGovindraj Raja 600f5211420SGovindraj Raja# Currently, these options are enabled only for clang and armclang compiler. 601f5211420SGovindraj Rajaifeq (${SUPPORT_STACK_MEMTAG},yes) 602f5211420SGovindraj Raja ifdef mem_tag_arch_support 603f5211420SGovindraj Raja # Check for armclang and clang compilers 604f5211420SGovindraj Raja ifneq ( ,$(filter $(notdir $(CC)),armclang clang)) 605f5211420SGovindraj Raja # Add "memtag" architecture feature modifier if not specified 606f5211420SGovindraj Raja ifeq ( ,$(findstring memtag,$(arch-features))) 607f5211420SGovindraj Raja arch-features := $(arch-features)+memtag 608f5211420SGovindraj Raja endif # memtag 609f5211420SGovindraj Raja ifeq ($(notdir $(CC)),armclang) 610f5211420SGovindraj Raja TF_CFLAGS += -mmemtag-stack 611f5211420SGovindraj Raja else ifeq ($(notdir $(CC)),clang) 612f5211420SGovindraj Raja TF_CFLAGS += -fsanitize=memtag 613f5211420SGovindraj Raja endif # armclang 614f5211420SGovindraj Raja endif 615f5211420SGovindraj Raja else 616f5211420SGovindraj Raja $(error "Error: stack memory tagging is not supported for \ 617f5211420SGovindraj Raja architecture ${ARCH},armv${ARM_ARCH_MAJOR}.${ARM_ARCH_MINOR}-a") 618f5211420SGovindraj Raja endif #(mem_tag_arch_support) 619f5211420SGovindraj Rajaendif #(SUPPORT_STACK_MEMTAG) 620f5211420SGovindraj Raja 621f5211420SGovindraj Raja################################################################################ 622f5211420SGovindraj Raja# RME dependent flags configuration, Enable optional features for RME. 623f5211420SGovindraj Raja################################################################################ 624f5211420SGovindraj Raja# FEAT_RME 625f5211420SGovindraj Rajaifeq (${ENABLE_RME},1) 626d638029fSGovindraj Raja # RME doesn't support BRBE 627d638029fSGovindraj Raja ENABLE_BRBE_FOR_NS := 0 628d638029fSGovindraj Raja 629f5211420SGovindraj Raja # RME doesn't support PIE 630f5211420SGovindraj Raja ifneq (${ENABLE_PIE},0) 631f5211420SGovindraj Raja $(error ENABLE_RME does not support PIE) 632f5211420SGovindraj Raja endif 633f5211420SGovindraj Raja 634f5211420SGovindraj Raja # RME doesn't support BRBE 635f5211420SGovindraj Raja ifneq (${ENABLE_BRBE_FOR_NS},0) 636f5211420SGovindraj Raja $(error ENABLE_RME does not support BRBE.) 637f5211420SGovindraj Raja endif 638f5211420SGovindraj Raja 639f5211420SGovindraj Raja # RME requires AARCH64 640f5211420SGovindraj Raja ifneq (${ARCH},aarch64) 641f5211420SGovindraj Raja $(error ENABLE_RME requires AArch64) 642f5211420SGovindraj Raja endif 643f5211420SGovindraj Raja 644f5211420SGovindraj Raja # RME requires el2 context to be saved for now. 645f5211420SGovindraj Raja CTX_INCLUDE_EL2_REGS := 1 646f5211420SGovindraj Raja CTX_INCLUDE_AARCH32_REGS := 0 647f5211420SGovindraj Raja CTX_INCLUDE_PAUTH_REGS := 1 648f5211420SGovindraj Raja 649f5211420SGovindraj Raja # RME enables CSV2_2 extension by default. 650f5211420SGovindraj Raja ENABLE_FEAT_CSV2_2 = 1 651f5211420SGovindraj Rajaendif #(FEAT_RME) 652f5211420SGovindraj Raja 653f5211420SGovindraj Raja################################################################################ 65473c99d4eSJuan Castillo# Generic definitions 65573c99d4eSJuan Castillo################################################################################ 656231c1470SEvan Lloydinclude ${MAKE_HELPERS_DIRECTORY}plat_helpers.mk 657231c1470SEvan Lloyd 65829214e95SGrant Likelyifeq (${BUILD_BASE},) 65973c99d4eSJuan Castillo BUILD_BASE := ./build 66029214e95SGrant Likelyendif 66129214e95SGrant LikelyBUILD_PLAT := $(abspath ${BUILD_BASE})/${PLAT}/${BUILD_TYPE} 66273c99d4eSJuan Castillo 663231c1470SEvan LloydSPDS := $(sort $(filter-out none, $(patsubst services/spd/%,%,$(wildcard services/spd/*)))) 66473c99d4eSJuan Castillo 66573c99d4eSJuan Castillo# Platforms providing their own TBB makefile may override this value 66673c99d4eSJuan CastilloINCLUDE_TBBR_MK := 1 66773c99d4eSJuan Castillo 66873c99d4eSJuan Castillo################################################################################ 66973c99d4eSJuan Castillo# Include SPD Makefile if one has been specified 67073c99d4eSJuan Castillo################################################################################ 67173c99d4eSJuan Castillo 67273c99d4eSJuan Castilloifneq (${SPD},none) 6739d29c227SSoby Mathew ifeq (${ARCH},aarch32) 6749d29c227SSoby Mathew $(error "Error: SPD is incompatible with AArch32.") 6759d29c227SSoby Mathew endif 67628f39f02SMax Shvetsov 6774c117f6cSSandrine Bailleux ifdef EL3_PAYLOAD_BASE 6784c117f6cSSandrine Bailleux $(warning "SPD and EL3_PAYLOAD_BASE are incompatible build options.") 679c5e1da83SJayanth Dodderi Chidanand $(warning "The SPD and its BL32 companion will be present but \ 680c5e1da83SJayanth Dodderi Chidanand ignored.") 6814c117f6cSSandrine Bailleux endif 68228f39f02SMax Shvetsov 683c3fb00d9SAchin Gupta ifeq (${SPD},spmd) 684c3fb00d9SAchin Gupta # SPMD is located in std_svc directory 685c3fb00d9SAchin Gupta SPD_DIR := std_svc 68628f39f02SMax Shvetsov 687033039f8SMax Shvetsov ifeq ($(SPMD_SPM_AT_SEL2),1) 688f1910cc1SGovindraj Raja CTX_INCLUDE_EL2_REGS := 1 6891d63ae4dSMarc Bonnici ifeq ($(SPMC_AT_EL3),1) 6901d63ae4dSMarc Bonnici $(error SPM cannot be enabled in both S-EL2 and EL3.) 6911d63ae4dSMarc Bonnici endif 69228f39f02SMax Shvetsov endif 693db1ef41aSOlivier Deprez 694db1ef41aSOlivier Deprez ifeq ($(findstring optee_sp,$(ARM_SPMC_MANIFEST_DTS)),optee_sp) 695db1ef41aSOlivier Deprez DTC_CPPFLAGS += -DOPTEE_SP_FW_CONFIG 696db1ef41aSOlivier Deprez endif 697ca932481SDavidson K 698ca932481SDavidson K ifeq ($(TS_SP_FW_CONFIG),1) 699ca932481SDavidson K DTC_CPPFLAGS += -DTS_SP_FW_CONFIG 700ca932481SDavidson K endif 70133993a37SBalint Dobszay 70233993a37SBalint Dobszay ifneq ($(ARM_BL2_SP_LIST_DTS),) 70333993a37SBalint Dobszay DTC_CPPFLAGS += -DARM_BL2_SP_LIST_DTS=$(ARM_BL2_SP_LIST_DTS) 70433993a37SBalint Dobszay endif 70546789a7cSBalint Dobszay 70646789a7cSBalint Dobszay ifneq ($(SP_LAYOUT_FILE),) 70746789a7cSBalint Dobszay BL2_ENABLE_SP_LOAD := 1 70846789a7cSBalint Dobszay endif 709801cd3c8SNishant Sharma 710801cd3c8SNishant Sharma ifeq ($(SPMC_AT_EL3_SEL0_SP),1) 711801cd3c8SNishant Sharma ifneq ($(SPMC_AT_EL3),1) 712801cd3c8SNishant Sharma $(error SEL0 SP cannot be enabled without SPMC at EL3) 713801cd3c8SNishant Sharma endif 714801cd3c8SNishant Sharma endif 715c3fb00d9SAchin Gupta else 716c3fb00d9SAchin Gupta # All other SPDs in spd directory 717c3fb00d9SAchin Gupta SPD_DIR := spd 718c5e1da83SJayanth Dodderi Chidanand endif #(SPD) 719c3fb00d9SAchin Gupta 72073c99d4eSJuan Castillo # We expect to locate an spd.mk under the specified SPD directory 721c3fb00d9SAchin Gupta SPD_MAKE := $(wildcard services/${SPD_DIR}/${SPD}/${SPD}.mk) 722c3fb00d9SAchin Gupta 72373c99d4eSJuan Castillo ifeq (${SPD_MAKE},) 724c3fb00d9SAchin Gupta $(error Error: No services/${SPD_DIR}/${SPD}/${SPD}.mk located) 72573c99d4eSJuan Castillo endif 72673c99d4eSJuan Castillo $(info Including ${SPD_MAKE}) 72773c99d4eSJuan Castillo include ${SPD_MAKE} 72873c99d4eSJuan Castillo 72970d1fc53SJuan Castillo # If there's BL32 companion for the chosen SPD, we expect that the SPD's 73070d1fc53SJuan Castillo # Makefile would set NEED_BL32 to "yes". In this case, the build system 73170d1fc53SJuan Castillo # supports two mutually exclusive options: 73270d1fc53SJuan Castillo # * BL32 is built from source: then BL32_SOURCES must contain the list 73370d1fc53SJuan Castillo # of source files to build BL32 73470d1fc53SJuan Castillo # * BL32 is a prebuilt binary: then BL32 must point to the image file 73570d1fc53SJuan Castillo # that will be included in the FIP 73670d1fc53SJuan Castillo # If both BL32_SOURCES and BL32 are defined, the binary takes precedence 73770d1fc53SJuan Castillo # over the sources. 738c5e1da83SJayanth Dodderi Chidanandendif #(SPD=none) 739e35c4045SJeenu Viswambharan 740890b5088SRaghu Krishnamurthyifeq (${ENABLE_SPMD_LP}, 1) 741890b5088SRaghu Krishnamurthyifneq (${SPD},spmd) 742890b5088SRaghu Krishnamurthy $(error Error: ENABLE_SPMD_LP requires SPD=spmd.) 743890b5088SRaghu Krishnamurthyendif 744890b5088SRaghu Krishnamurthyifeq ($(SPMC_AT_EL3),1) 745890b5088SRaghu Krishnamurthy $(error SPMC at EL3 not supported when enabling SPMD Logical partitions.) 746890b5088SRaghu Krishnamurthyendif 747890b5088SRaghu Krishnamurthyendif 748890b5088SRaghu Krishnamurthy 749f1910cc1SGovindraj Rajaifeq (${CTX_INCLUDE_EL2_REGS}, 1) 750f1910cc1SGovindraj Raja ifeq (${SPD},none) 751f1910cc1SGovindraj Raja ifeq (${ENABLE_RME},0) 752c5e1da83SJayanth Dodderi Chidanand $(error CTX_INCLUDE_EL2_REGS is available only when SPD \ 753c5e1da83SJayanth Dodderi Chidanand or RME is enabled) 754f1910cc1SGovindraj Raja endif 755f1910cc1SGovindraj Raja endif 756f1910cc1SGovindraj Rajaendif 757f1910cc1SGovindraj Raja 75851faada7SDouglas Raillard################################################################################ 7595b18de09SZelalem Aweke# Include rmmd Makefile if RME is enabled 7605b18de09SZelalem Aweke################################################################################ 7615b18de09SZelalem Awekeifneq (${ENABLE_RME},0) 7625b18de09SZelalem Aweke ifneq (${ARCH},aarch64) 7635b18de09SZelalem Aweke $(error ENABLE_RME requires AArch64) 7645b18de09SZelalem Aweke endif 7651d63ae4dSMarc Bonnici ifeq ($(SPMC_AT_EL3),1) 7661d63ae4dSMarc Bonnici $(error SPMC_AT_EL3 and ENABLE_RME cannot both be enabled.) 7671d63ae4dSMarc Bonnici endif 768c5e1da83SJayanth Dodderi Chidanand 7694fba2e1fSBoyan Karatotev ifneq (${SPD}, none) 7704fba2e1fSBoyan Karatotev ifneq (${SPD}, spmd) 7714fba2e1fSBoyan Karatotev $(error ENABLE_RME is incompatible with SPD=${SPD}. Use SPD=spmd) 7724fba2e1fSBoyan Karatotev endif 7734fba2e1fSBoyan Karatotev endif 7745b18de09SZelalem Awekeinclude services/std_svc/rmmd/rmmd.mk 7755b18de09SZelalem Aweke$(warning "RME is an experimental feature") 7765b18de09SZelalem Awekeendif 7775b18de09SZelalem Aweke 7783547270fSGovindraj Rajaifeq (${CTX_INCLUDE_EL2_REGS}, 1) 7793547270fSGovindraj Raja ifeq (${SPD},none) 7803547270fSGovindraj Raja ifeq (${ENABLE_RME},0) 7813547270fSGovindraj Raja $(error CTX_INCLUDE_EL2_REGS is available only when SPD \ 7823547270fSGovindraj Raja or RME is enabled) 7833547270fSGovindraj Raja endif 7843547270fSGovindraj Raja endif 7853547270fSGovindraj Rajaendif 7860f21c547SJuan Castillo 7877794d6c8SGovindraj Raja################################################################################ 7887794d6c8SGovindraj Raja# Platform specific Makefile might provide us ARCH_MAJOR/MINOR use that to come 7897794d6c8SGovindraj Raja# up with appropriate march values for compiler. 7907794d6c8SGovindraj Raja################################################################################ 7917794d6c8SGovindraj Rajainclude ${MAKE_HELPERS_DIRECTORY}march.mk 7927794d6c8SGovindraj Raja 7937794d6c8SGovindraj RajaTF_CFLAGS += $(march-directive) 7947794d6c8SGovindraj Raja 79542d4d3baSArvind Ram Prakash# This internal flag is common option which is set to 1 for scenarios 79642d4d3baSArvind Ram Prakash# when the BL2 is running in EL3 level. This occurs in two scenarios - 79742d4d3baSArvind Ram Prakash# 4 world system running BL2 at EL3 and two world system without BL1 running 79842d4d3baSArvind Ram Prakash# BL2 in EL3 79942d4d3baSArvind Ram Prakash 80042d4d3baSArvind Ram Prakashifeq (${RESET_TO_BL2},1) 80142d4d3baSArvind Ram Prakash BL2_RUNS_AT_EL3 := 1 80242d4d3baSArvind Ram Prakash ifeq (${ENABLE_RME},1) 803c5e1da83SJayanth Dodderi Chidanand $(error RESET_TO_BL2=1 and ENABLE_RME=1 configuration is not \ 804c5e1da83SJayanth Dodderi Chidanand supported at the moment.) 80542d4d3baSArvind Ram Prakash endif 80642d4d3baSArvind Ram Prakashelse ifeq (${ENABLE_RME},1) 80742d4d3baSArvind Ram Prakash BL2_RUNS_AT_EL3 := 1 80842d4d3baSArvind Ram Prakashelse 80942d4d3baSArvind Ram Prakash BL2_RUNS_AT_EL3 := 0 81042d4d3baSArvind Ram Prakashendif 81142d4d3baSArvind Ram Prakash 812*f87e54f7SManish Pandey# This internal flag is set to 1 when Firmware First handling of External aborts 813*f87e54f7SManish Pandey# is required by lowe ELs. Currently only NS requires this support. 814*f87e54f7SManish Pandeyifeq ($(HANDLE_EA_EL3_FIRST_NS),1) 815*f87e54f7SManish Pandey FFH_SUPPORT := 1 816*f87e54f7SManish Pandeyelse 817*f87e54f7SManish Pandey FFH_SUPPORT := 0 818*f87e54f7SManish Pandeyendif 819*f87e54f7SManish Pandey 8208012cc5cSMasahiro Yamada$(eval $(call MAKE_PREREQ_DIR,${BUILD_PLAT})) 8218012cc5cSMasahiro Yamada 82226e63c44SEtienne Carriereifeq (${ARM_ARCH_MAJOR},7) 82326e63c44SEtienne Carriereinclude make_helpers/armv7-a-cpus.mk 82426e63c44SEtienne Carriereendif 82526e63c44SEtienne Carriere 8263bd17c0fSSoby MathewPIE_FOUND := $(findstring --enable-default-pie,${GCC_V_OUTPUT}) 8273bd17c0fSSoby Mathewifneq ($(PIE_FOUND),) 8283bd17c0fSSoby Mathew TF_CFLAGS += -fno-PIE 8297b592418SSamuel Hollandifneq ($(findstring gcc,$(notdir $(LD))),) 8307b592418SSamuel Holland TF_LDFLAGS += -no-pie 8317b592418SSamuel Hollandendif 832c5e1da83SJayanth Dodderi Chidanandendif #(PIE_FOUND) 833320920c1SMasahiro Yamada 834320920c1SMasahiro Yamadaifneq ($(findstring gcc,$(notdir $(LD))),) 835320920c1SMasahiro Yamada PIE_LDFLAGS += -Wl,-pie -Wl,--no-dynamic-linker 836320920c1SMasahiro Yamadaelse 837320920c1SMasahiro Yamada PIE_LDFLAGS += -pie --no-dynamic-linker 838320920c1SMasahiro Yamadaendif 839320920c1SMasahiro Yamada 840320920c1SMasahiro Yamadaifeq ($(ENABLE_PIE),1) 84142d4d3baSArvind Ram Prakash ifeq ($(RESET_TO_BL2),1) 84269af7fcfSMasahiro Yamada ifneq ($(BL2_IN_XIP_MEM),1) 843966660ecSChris Kay BL2_CPPFLAGS += -fpie 84469af7fcfSMasahiro Yamada BL2_CFLAGS += -fpie 84569af7fcfSMasahiro Yamada BL2_LDFLAGS += $(PIE_LDFLAGS) 846c5e1da83SJayanth Dodderi Chidanand endif #(BL2_IN_XIP_MEM) 847c5e1da83SJayanth Dodderi Chidanand endif #(RESET_TO_BL2) 848966660ecSChris Kay BL31_CPPFLAGS += -fpie 849320920c1SMasahiro Yamada BL31_CFLAGS += -fpie 850320920c1SMasahiro Yamada BL31_LDFLAGS += $(PIE_LDFLAGS) 851966660ecSChris Kay 852966660ecSChris Kay BL32_CPPFLAGS += -fpie 853d974301dSMasahiro Yamada BL32_CFLAGS += -fpie 854d974301dSMasahiro Yamada BL32_LDFLAGS += $(PIE_LDFLAGS) 855c5e1da83SJayanth Dodderi Chidanandendif #(ENABLE_PIE) 8563bd17c0fSSoby Mathew 857007433d8SBoyan KaratotevBL1_CPPFLAGS += -DREPORT_ERRATA=${DEBUG} 858007433d8SBoyan KaratotevBL31_CPPFLAGS += -DREPORT_ERRATA=${DEBUG} 859007433d8SBoyan KaratotevBL32_CPPFLAGS += -DREPORT_ERRATA=${DEBUG} 860007433d8SBoyan Karatotev 8619cefb4b1SMasahiro YamadaBL1_CPPFLAGS += -DIMAGE_AT_EL3 86242d4d3baSArvind Ram Prakashifeq ($(RESET_TO_BL2),1) 8639cefb4b1SMasahiro Yamada BL2_CPPFLAGS += -DIMAGE_AT_EL3 864d5e97a1dSMasahiro Yamadaelse 8659cefb4b1SMasahiro Yamada BL2_CPPFLAGS += -DIMAGE_AT_EL1 866c5e1da83SJayanth Dodderi Chidanandendif #(RESET_TO_BL2) 867007433d8SBoyan Karatotev 868007433d8SBoyan Karatotevifeq (${ARCH},aarch64) 8699cefb4b1SMasahiro Yamada BL2U_CPPFLAGS += -DIMAGE_AT_EL1 8709cefb4b1SMasahiro Yamada BL31_CPPFLAGS += -DIMAGE_AT_EL3 8719cefb4b1SMasahiro Yamada BL32_CPPFLAGS += -DIMAGE_AT_EL1 872007433d8SBoyan Karatotevelse 873007433d8SBoyan Karatotev BL32_CPPFLAGS += -DIMAGE_AT_EL3 874d5e97a1dSMasahiro Yamadaendif 875d5e97a1dSMasahiro Yamada 87654035fc4SSandrine Bailleux# Include the CPU specific operations makefile, which provides default 87754035fc4SSandrine Bailleux# values for all CPU errata workarounds and CPU specific optimisations. 87854035fc4SSandrine Bailleux# This can be overridden by the platform. 87973c99d4eSJuan Castilloinclude lib/cpus/cpu-ops.mk 8804f6ad66aSAchin Gupta 881a4409008Sdp-arm################################################################################ 882a4409008Sdp-arm# Build `AARCH32_SP` as BL32 image for AArch32 883a4409008Sdp-arm################################################################################ 884c5e1da83SJayanth Dodderi Chidanandifeq (${ARCH},aarch32) 885c5e1da83SJayanth Dodderi Chidanand NEED_BL32 := yes 886c5e1da83SJayanth Dodderi Chidanand 887a4409008Sdp-arm ifneq (${AARCH32_SP},none) 888a4409008Sdp-arm # We expect to locate an sp.mk under the specified AARCH32_SP directory 889a4409008Sdp-arm AARCH32_SP_MAKE := $(wildcard bl32/${AARCH32_SP}/${AARCH32_SP}.mk) 890a4409008Sdp-arm 891a4409008Sdp-arm ifeq (${AARCH32_SP_MAKE},) 892a4409008Sdp-arm $(error Error: No bl32/${AARCH32_SP}/${AARCH32_SP}.mk located) 893a4409008Sdp-arm endif 894a4409008Sdp-arm $(info Including ${AARCH32_SP_MAKE}) 895a4409008Sdp-arm include ${AARCH32_SP_MAKE} 896a4409008Sdp-arm endif 897c5e1da83SJayanth Dodderi Chidanandendif #(ARCH=aarch32) 8984f6ad66aSAchin Gupta 89973c99d4eSJuan Castillo################################################################################ 90077f1f7a1SVarun Wadekar# Include libc if not overridden 90177f1f7a1SVarun Wadekar################################################################################ 90277f1f7a1SVarun Wadekarifeq (${OVERRIDE_LIBC},0) 90377f1f7a1SVarun Wadekarinclude lib/libc/libc.mk 90477f1f7a1SVarun Wadekarendif 90577f1f7a1SVarun Wadekar 90677f1f7a1SVarun Wadekar################################################################################ 907c5e1da83SJayanth Dodderi Chidanand# Check incompatible options and dependencies 908cf2c8a33SAntonio Nino Diaz################################################################################ 909cf2c8a33SAntonio Nino Diaz 910c5e1da83SJayanth Dodderi Chidanand# USE_DEBUGFS experimental feature recommended only in debug builds 911c5e1da83SJayanth Dodderi Chidanandifeq (${USE_DEBUGFS},1) 912c5e1da83SJayanth Dodderi Chidanand ifeq (${DEBUG},1) 913c5e1da83SJayanth Dodderi Chidanand $(warning DEBUGFS experimental feature is enabled.) 914c5e1da83SJayanth Dodderi Chidanand else 915c5e1da83SJayanth Dodderi Chidanand $(warning DEBUGFS experimental, recommended in DEBUG builds ONLY) 916c5e1da83SJayanth Dodderi Chidanand endif 917c5e1da83SJayanth Dodderi Chidanandendif #(USE_DEBUGFS) 918c5e1da83SJayanth Dodderi Chidanand 919c5e1da83SJayanth Dodderi Chidanand# USE_SPINLOCK_CAS requires AArch64 build 920c5e1da83SJayanth Dodderi Chidanandifeq (${USE_SPINLOCK_CAS},1) 921c5e1da83SJayanth Dodderi Chidanand ifneq (${ARCH},aarch64) 922c5e1da83SJayanth Dodderi Chidanand $(error USE_SPINLOCK_CAS requires AArch64) 923c5e1da83SJayanth Dodderi Chidanand endif 924c5e1da83SJayanth Dodderi Chidanandendif #(USE_SPINLOCK_CAS) 925c5e1da83SJayanth Dodderi Chidanand 926c5e1da83SJayanth Dodderi Chidanand# The cert_create tool cannot generate certificates individually, so we use the 927c5e1da83SJayanth Dodderi Chidanand# target 'certificates' to create them all 928c5e1da83SJayanth Dodderi Chidanandifneq (${GENERATE_COT},0) 929c5e1da83SJayanth Dodderi Chidanand FIP_DEPS += certificates 930c5e1da83SJayanth Dodderi Chidanand FWU_FIP_DEPS += fwu_certificates 931c5e1da83SJayanth Dodderi Chidanandendif 932c5e1da83SJayanth Dodderi Chidanand 933c5e1da83SJayanth Dodderi Chidanandifneq (${DECRYPTION_SUPPORT},none) 934c5e1da83SJayanth Dodderi Chidanand ENC_ARGS += -f ${FW_ENC_STATUS} 935c5e1da83SJayanth Dodderi Chidanand ENC_ARGS += -k ${ENC_KEY} 936c5e1da83SJayanth Dodderi Chidanand ENC_ARGS += -n ${ENC_NONCE} 937c5e1da83SJayanth Dodderi Chidanand FIP_DEPS += enctool 938c5e1da83SJayanth Dodderi Chidanand FWU_FIP_DEPS += enctool 939c5e1da83SJayanth Dodderi Chidanandendif #(DECRYPTION_SUPPORT) 940c5e1da83SJayanth Dodderi Chidanand 941cf2c8a33SAntonio Nino Diazifdef EL3_PAYLOAD_BASE 94268450a6dSAntonio Nino Diaz ifdef PRELOADED_BL33_BASE 94368450a6dSAntonio Nino Diaz $(warning "PRELOADED_BL33_BASE and EL3_PAYLOAD_BASE are \ 94468450a6dSAntonio Nino Diaz incompatible build options. EL3_PAYLOAD_BASE has priority.") 945cf2c8a33SAntonio Nino Diaz endif 94676580f3dSQixiang Xu ifneq (${GENERATE_COT},0) 947c5e1da83SJayanth Dodderi Chidanand $(error "GENERATE_COT and EL3_PAYLOAD_BASE are incompatible \ 948c5e1da83SJayanth Dodderi Chidanand build options.") 94976580f3dSQixiang Xu endif 95076580f3dSQixiang Xu ifneq (${TRUSTED_BOARD_BOOT},0) 951c5e1da83SJayanth Dodderi Chidanand $(error "TRUSTED_BOARD_BOOT and EL3_PAYLOAD_BASE are \ 952c5e1da83SJayanth Dodderi Chidanand incompatible \ build options.") 95376580f3dSQixiang Xu endif 954c5e1da83SJayanth Dodderi Chidanandendif #(EL3_PAYLOAD_BASE) 955cf2c8a33SAntonio Nino Diaz 956cf2c8a33SAntonio Nino Diazifeq (${NEED_BL33},yes) 957cf2c8a33SAntonio Nino Diaz ifdef EL3_PAYLOAD_BASE 958cf2c8a33SAntonio Nino Diaz $(warning "BL33 image is not needed when option \ 959cf2c8a33SAntonio Nino Diaz BL33_PAYLOAD_BASE is used and won't be added to the FIP file.") 960cf2c8a33SAntonio Nino Diaz endif 96168450a6dSAntonio Nino Diaz ifdef PRELOADED_BL33_BASE 96268450a6dSAntonio Nino Diaz $(warning "BL33 image is not needed when option \ 963c5e1da83SJayanth Dodderi Chidanand PRELOADED_BL33_BASE is used and won't be added to the FIP file.") 964cf2c8a33SAntonio Nino Diaz endif 965c5e1da83SJayanth Dodderi Chidanandendif #(NEED_BL33) 966cf2c8a33SAntonio Nino Diaz 967d4593e47SJeenu Viswambharan# When building for systems with hardware-assisted coherency, there's no need to 968d4593e47SJeenu Viswambharan# use USE_COHERENT_MEM. Require that USE_COHERENT_MEM must be set to 0 too. 969d4593e47SJeenu Viswambharanifeq ($(HW_ASSISTED_COHERENCY)-$(USE_COHERENT_MEM),1-1) 970d4593e47SJeenu Viswambharan $(error USE_COHERENT_MEM cannot be enabled with HW_ASSISTED_COHERENCY) 971d4593e47SJeenu Viswambharanendif 9721a0a3f06SYatharth Kochar 97342d4d3baSArvind Ram Prakash#For now, BL2_IN_XIP_MEM is only supported when RESET_TO_BL2 is 1. 97442d4d3baSArvind Ram Prakashifeq ($(RESET_TO_BL2)-$(BL2_IN_XIP_MEM),0-1) 97542d4d3baSArvind Ram Prakash $(error "BL2_IN_XIP_MEM is only supported when RESET_TO_BL2 is enabled") 9767d173fc5SJiafei Panendif 9777d173fc5SJiafei Pan 9789202d519SManish Pandey# RAS_EXTENSION is deprecated, provide alternate build options 97914c6016aSJeenu Viswambharanifeq ($(RAS_EXTENSION),1) 980c5e1da83SJayanth Dodderi Chidanand $(error "RAS_EXTENSION is now deprecated, please use ENABLE_FEAT_RAS \ 981*f87e54f7SManish Pandey and HANDLE_EA_EL3_FIRST_NS instead") 9829202d519SManish Pandeyendif 983c5e1da83SJayanth Dodderi Chidanand 984c5e1da83SJayanth Dodderi Chidanand 9859202d519SManish Pandey# When FAULT_INJECTION_SUPPORT is used, require that FEAT_RAS is enabled 9861a7c1cfeSJeenu Viswambharanifeq ($(FAULT_INJECTION_SUPPORT),1) 9876503ff29SAndre Przywara ifeq ($(ENABLE_FEAT_RAS),0) 9886503ff29SAndre Przywara $(error For FAULT_INJECTION_SUPPORT, ENABLE_FEAT_RAS must not be 0) 9891a7c1cfeSJeenu Viswambharan endif 990c5e1da83SJayanth Dodderi Chidanandendif #(FAULT_INJECTION_SUPPORT) 9911a7c1cfeSJeenu Viswambharan 992ed51b51fSRoberto Vargas# DYN_DISABLE_AUTH can be set only when TRUSTED_BOARD_BOOT=1 993209a60ccSSoby Mathewifeq ($(DYN_DISABLE_AUTH), 1) 994209a60ccSSoby Mathew ifeq (${TRUSTED_BOARD_BOOT}, 0) 995c5e1da83SJayanth Dodderi Chidanand $(error "TRUSTED_BOARD_BOOT must be enabled for DYN_DISABLE_AUTH \ 996c5e1da83SJayanth Dodderi Chidanand to be set.") 997209a60ccSSoby Mathew endif 998c5e1da83SJayanth Dodderi Chidanandendif #(DYN_DISABLE_AUTH) 999209a60ccSSoby Mathew 10002bf4f27fSManish V Badarkheifeq ($(MEASURED_BOOT)-$(TRUSTED_BOARD_BOOT),1-1) 10012bf4f27fSManish V Badarkhe# Support authentication verification and hash calculation 10022bf4f27fSManish V Badarkhe CRYPTO_SUPPORT := 3 10032bf4f27fSManish V Badarkheelse ifeq ($(DRTM_SUPPORT)-$(TRUSTED_BOARD_BOOT),1-1) 10042bf4f27fSManish V Badarkhe# Support authentication verification and hash calculation 10052bf4f27fSManish V Badarkhe CRYPTO_SUPPORT := 3 10062bf4f27fSManish V Badarkheelse ifneq ($(filter 1,${MEASURED_BOOT} ${DRTM_SUPPORT}),) 10072bf4f27fSManish V Badarkhe# Support hash calculation only 10082bf4f27fSManish V Badarkhe CRYPTO_SUPPORT := 2 10092bf4f27fSManish V Badarkheelse ifeq (${TRUSTED_BOARD_BOOT},1) 10102bf4f27fSManish V Badarkhe# Support authentication verification only 1011c9c56f6eSManish V Badarkhe CRYPTO_SUPPORT := 1 1012c9c56f6eSManish V Badarkheelse 1013c9c56f6eSManish V Badarkhe CRYPTO_SUPPORT := 0 1014c5e1da83SJayanth Dodderi Chidanandendif #($(MEASURED_BOOT)-$(TRUSTED_BOARD_BOOT)) 1015c9c56f6eSManish V Badarkhe 1016cbf9e84aSBalint Dobszay# SDEI_IN_FCONF is only supported when SDEI_SUPPORT is enabled. 1017cbf9e84aSBalint Dobszayifeq ($(SDEI_SUPPORT)-$(SDEI_IN_FCONF),0-1) 1018700e7685SManish Pandey $(error "SDEI_IN_FCONF is only supported when SDEI_SUPPORT is enabled") 101984ef9cd8SManish V Badarkheendif 102084ef9cd8SManish V Badarkhe 1021b86048c4SAntonio Nino Diaz# If pointer authentication is used in the firmware, make sure that all the 10229fc59639SAlexei Fedorov# registers associated to it are also saved and restored. 10239fc59639SAlexei Fedorov# Not doing it would leak the value of the keys used by EL3 to EL1 and S-EL1. 1024b86048c4SAntonio Nino Diazifeq ($(ENABLE_PAUTH),1) 10259fc59639SAlexei Fedorov ifeq ($(CTX_INCLUDE_PAUTH_REGS),0) 10269fc59639SAlexei Fedorov $(error Pointer Authentication requires CTX_INCLUDE_PAUTH_REGS=1) 102706715f85SAlexei Fedorov endif 1028c5e1da83SJayanth Dodderi Chidanandendif #(ENABLE_PAUTH) 10299fc59639SAlexei Fedorov 103006715f85SAlexei Fedorovifeq ($(CTX_INCLUDE_PAUTH_REGS),1) 10319fc59639SAlexei Fedorov ifneq (${ARCH},aarch64) 10329fc59639SAlexei Fedorov $(error CTX_INCLUDE_PAUTH_REGS requires AArch64) 1033b86048c4SAntonio Nino Diaz endif 1034c5e1da83SJayanth Dodderi Chidanandendif #(CTX_INCLUDE_PAUTH_REGS) 10359fc59639SAlexei Fedorov 10369dd94382SJustin Chadwellifeq ($(CTX_INCLUDE_MTE_REGS),1) 10379dd94382SJustin Chadwell ifneq (${ARCH},aarch64) 10389dd94382SJustin Chadwell $(error CTX_INCLUDE_MTE_REGS requires AArch64) 10399dd94382SJustin Chadwell endif 1040c5e1da83SJayanth Dodderi Chidanandendif #(CTX_INCLUDE_MTE_REGS) 10419dd94382SJustin Chadwell 1042396b339dSManish V Badarkheifeq ($(PSA_FWU_SUPPORT),1) 1043396b339dSManish V Badarkhe $(info PSA_FWU_SUPPORT is an experimental feature) 1044c5e1da83SJayanth Dodderi Chidanandendif #(PSA_FWU_SUPPORT) 1045396b339dSManish V Badarkhe 10466a0da736SJayanth Dodderi Chidanandifeq ($(FEATURE_DETECTION),1) 10476a0da736SJayanth Dodderi Chidanand $(info FEATURE_DETECTION is an experimental feature) 1048c5e1da83SJayanth Dodderi Chidanandendif #(FEATURE_DETECTION) 10496a0da736SJayanth Dodderi Chidanand 105003d3c0d7SJayanth Dodderi Chidanandifneq ($(ENABLE_SME2_FOR_NS), 0) 105103d3c0d7SJayanth Dodderi Chidanand ifeq (${ENABLE_SME_FOR_NS}, 0) 1052c5e1da83SJayanth Dodderi Chidanand $(warning "ENABLE_SME2_FOR_NS requires ENABLE_SME_FOR_NS also \ 1053c5e1da83SJayanth Dodderi Chidanand to be set") 105403d3c0d7SJayanth Dodderi Chidanand $(warning "Forced ENABLE_SME_FOR_NS=1") 105503d3c0d7SJayanth Dodderi Chidanand override ENABLE_SME_FOR_NS := 1 105603d3c0d7SJayanth Dodderi Chidanand endif 1057c5e1da83SJayanth Dodderi Chidanandendif #(ENABLE_SME2_FOR_NS) 105845007acdSJayanth Dodderi Chidanand 105960e8f3cfSPetre-Ionut Tudorifeq (${ARM_XLAT_TABLES_LIB_V1}, 1) 106060e8f3cfSPetre-Ionut Tudor ifeq (${ALLOW_RO_XLAT_TABLES}, 1) 1061c5e1da83SJayanth Dodderi Chidanand $(error "ALLOW_RO_XLAT_TABLES requires translation tables \ 1062c5e1da83SJayanth Dodderi Chidanand library v2") 106360e8f3cfSPetre-Ionut Tudor endif 1064c5e1da83SJayanth Dodderi Chidanandendif #(ARM_XLAT_TABLES_LIB_V1) 106560e8f3cfSPetre-Ionut Tudor 10667cda17bbSSumit Gargifneq (${DECRYPTION_SUPPORT},none) 10677cda17bbSSumit Garg ifeq (${TRUSTED_BOARD_BOOT}, 0) 1068c5e1da83SJayanth Dodderi Chidanand $(error TRUSTED_BOARD_BOOT must be enabled for DECRYPTION_SUPPORT \ 1069c5e1da83SJayanth Dodderi Chidanand to be set) 10707cda17bbSSumit Garg endif 1071c5e1da83SJayanth Dodderi Chidanandendif #(DECRYPTION_SUPPORT) 10727cda17bbSSumit Garg 1073744ad974Sjohpow01# Ensure that no Aarch64-only features are enabled in Aarch32 build 1074dc78e62dSjohpow01ifeq (${ARCH},aarch32) 1075744ad974Sjohpow01 1076744ad974Sjohpow01 # SME/SVE only supported on AArch64 107745007acdSJayanth Dodderi Chidanand ifneq (${ENABLE_SME_FOR_NS},0) 1078dc78e62dSjohpow01 $(error "ENABLE_SME_FOR_NS cannot be used with ARCH=aarch32") 1079dc78e62dSjohpow01 endif 108003d3c0d7SJayanth Dodderi Chidanand 1081dc78e62dSjohpow01 ifeq (${ENABLE_SVE_FOR_NS},1) 1082dc78e62dSjohpow01 # Warning instead of error due to CI dependency on this 108324ab2c0aSYann Gautier $(error "ENABLE_SVE_FOR_NS cannot be used with ARCH=aarch32") 1084dc78e62dSjohpow01 endif 1085744ad974Sjohpow01 1086ff86e0b4SJuan Pablo Conde # BRBE is not supported in AArch32 1087744ad974Sjohpow01 ifeq (${ENABLE_BRBE_FOR_NS},1) 1088744ad974Sjohpow01 $(error "ENABLE_BRBE_FOR_NS cannot be used with ARCH=aarch32") 1089744ad974Sjohpow01 endif 1090744ad974Sjohpow01 1091ff86e0b4SJuan Pablo Conde # FEAT_RNG_TRAP is not supported in AArch32 1092ff86e0b4SJuan Pablo Conde ifeq (${ENABLE_FEAT_RNG_TRAP},1) 1093ff86e0b4SJuan Pablo Conde $(error "ENABLE_FEAT_RNG_TRAP cannot be used with ARCH=aarch32") 1094ff86e0b4SJuan Pablo Conde endif 1095c5e1da83SJayanth Dodderi Chidanandendif #(ARCH=aarch32) 1096dc78e62dSjohpow01 10970d122947SBoyan Karatotevifneq (${ENABLE_SME_FOR_NS},0) 10980d122947SBoyan Karatotev ifeq (${ENABLE_SVE_FOR_NS},0) 10990d122947SBoyan Karatotev $(error "ENABLE_SME_FOR_NS requires ENABLE_SVE_FOR_NS") 11000d122947SBoyan Karatotev endif 1101c5e1da83SJayanth Dodderi Chidanandendif #(ENABLE_SME_FOR_NS) 11020d122947SBoyan Karatotev 1103dc78e62dSjohpow01# Secure SME/SVE requires the non-secure component as well 1104dc78e62dSjohpow01ifeq (${ENABLE_SME_FOR_SWD},1) 1105dc78e62dSjohpow01 ifeq (${ENABLE_SME_FOR_NS},0) 1106dc78e62dSjohpow01 $(error "ENABLE_SME_FOR_SWD requires ENABLE_SME_FOR_NS") 1107dc78e62dSjohpow01 endif 11080d122947SBoyan Karatotev ifeq (${ENABLE_SVE_FOR_SWD},0) 11090d122947SBoyan Karatotev $(error "ENABLE_SME_FOR_SWD requires ENABLE_SVE_FOR_SWD") 11100d122947SBoyan Karatotev endif 1111c5e1da83SJayanth Dodderi Chidanandendif #(ENABLE_SME_FOR_SWD) 1112c5e1da83SJayanth Dodderi Chidanand 1113dc78e62dSjohpow01ifeq (${ENABLE_SVE_FOR_SWD},1) 1114dc78e62dSjohpow01 ifeq (${ENABLE_SVE_FOR_NS},0) 1115dc78e62dSjohpow01 $(error "ENABLE_SVE_FOR_SWD requires ENABLE_SVE_FOR_NS") 1116dc78e62dSjohpow01 endif 1117c5e1da83SJayanth Dodderi Chidanandendif #(ENABLE_SVE_FOR_SWD) 1118dc78e62dSjohpow01 1119dc78e62dSjohpow01# SVE and SME cannot be used with CTX_INCLUDE_FPREGS since secure manager does 1120dc78e62dSjohpow01# its own context management including FPU registers. 1121dc78e62dSjohpow01ifeq (${CTX_INCLUDE_FPREGS},1) 112245007acdSJayanth Dodderi Chidanand ifneq (${ENABLE_SME_FOR_NS},0) 1123dc78e62dSjohpow01 $(error "ENABLE_SME_FOR_NS cannot be used with CTX_INCLUDE_FPREGS") 1124dc78e62dSjohpow01 endif 112503d3c0d7SJayanth Dodderi Chidanand 1126dc78e62dSjohpow01 ifeq (${ENABLE_SVE_FOR_NS},1) 1127dc78e62dSjohpow01 # Warning instead of error due to CI dependency on this 1128dc78e62dSjohpow01 $(warning "ENABLE_SVE_FOR_NS cannot be used with CTX_INCLUDE_FPREGS") 1129dc78e62dSjohpow01 $(warning "Forced ENABLE_SVE_FOR_NS=0") 1130dc78e62dSjohpow01 override ENABLE_SVE_FOR_NS := 0 1131dc78e62dSjohpow01 endif 1132c5e1da83SJayanth Dodderi Chidanandendif #(CTX_INCLUDE_FPREGS) 1133dc78e62dSjohpow01 113400e28874SManish V Badarkheifeq ($(DRTM_SUPPORT),1) 113500e28874SManish V Badarkhe $(info DRTM_SUPPORT is an experimental feature) 113600e28874SManish V Badarkheendif 113700e28874SManish V Badarkhe 11383ba2c151SRaymond Maoifeq (${TRANSFER_LIST},1) 11393ba2c151SRaymond Mao $(info TRANSFER_LIST is an experimental feature) 11403ba2c151SRaymond Maoendif 11413ba2c151SRaymond Mao 1142274a69e7SChris Kayifeq (${ENABLE_RME},1) 1143274a69e7SChris Kay ifneq (${SEPARATE_CODE_AND_RODATA},1) 1144274a69e7SChris Kay $(error `ENABLE_RME=1` requires `SEPARATE_CODE_AND_RODATA=1`) 1145274a69e7SChris Kay endif 1146274a69e7SChris Kayendif 1147274a69e7SChris Kay 1148c5e1da83SJayanth Dodderi Chidanand# Determine if FEAT_RNG is supported 1149c5e1da83SJayanth Dodderi ChidanandENABLE_FEAT_RNG = $(if $(findstring rng,${arch-features}),1,0) 1150c5e1da83SJayanth Dodderi Chidanand 1151c5e1da83SJayanth Dodderi Chidanand# Determine if FEAT_SB is supported 1152c5e1da83SJayanth Dodderi ChidanandENABLE_FEAT_SB = $(if $(findstring sb,${arch-features}),1,0) 1153c5e1da83SJayanth Dodderi Chidanand 11545782b890SManish V Badarkheifeq ($(PSA_CRYPTO),1) 11555782b890SManish V Badarkhe $(info PSA_CRYPTO is an experimental feature) 11565782b890SManish V Badarkheendif 11575782b890SManish V Badarkhe 1158cf2c8a33SAntonio Nino Diaz################################################################################ 115973c99d4eSJuan Castillo# Process platform overrideable behaviour 116073c99d4eSJuan Castillo################################################################################ 11614f6ad66aSAchin Gupta 11625f24ce96SManish Pandeyifdef BL1_SOURCES 11635f24ce96SManish Pandey NEED_BL1 := yes 1164c5e1da83SJayanth Dodderi Chidanandendif #(BL1_SOURCES) 11655f24ce96SManish Pandey 11665f24ce96SManish Pandeyifdef BL2_SOURCES 11675f24ce96SManish Pandey NEED_BL2 := yes 11685f24ce96SManish Pandey 1169bd97f83aSJohn Tsichritzis # Using BL2 implies that a BL33 image also needs to be supplied for the FIP and 1170bd97f83aSJohn Tsichritzis # Certificate generation tools. This flag can be overridden by the platform. 1171cf2c8a33SAntonio Nino Diaz ifdef EL3_PAYLOAD_BASE 1172cf2c8a33SAntonio Nino Diaz # If booting an EL3 payload there is no need for a BL33 image 1173cf2c8a33SAntonio Nino Diaz # in the FIP file. 11744c117f6cSSandrine Bailleux NEED_BL33 := no 1175cf2c8a33SAntonio Nino Diaz else 117668450a6dSAntonio Nino Diaz ifdef PRELOADED_BL33_BASE 1177cf2c8a33SAntonio Nino Diaz # If booting a BL33 preloaded image there is no need of 1178cf2c8a33SAntonio Nino Diaz # another one in the FIP file. 1179cf2c8a33SAntonio Nino Diaz NEED_BL33 := no 1180cf2c8a33SAntonio Nino Diaz else 1181cf2c8a33SAntonio Nino Diaz NEED_BL33 ?= yes 1182cf2c8a33SAntonio Nino Diaz endif 11834c117f6cSSandrine Bailleux endif 1184c5e1da83SJayanth Dodderi Chidanandendif #(BL2_SOURCES) 11856f971622SJuan Castillo 11865f24ce96SManish Pandeyifdef BL2U_SOURCES 11875f24ce96SManish Pandey NEED_BL2U := yes 1188c5e1da83SJayanth Dodderi Chidanandendif #(BL2U_SOURCES) 11895f24ce96SManish Pandey 11904d045d0eSMasahiro Yamada# If SCP_BL2 is given, we always want FIP to include it. 11914d045d0eSMasahiro Yamadaifdef SCP_BL2 11924d045d0eSMasahiro Yamada NEED_SCP_BL2 := yes 1193c5e1da83SJayanth Dodderi Chidanandendif #(SCP_BL2) 11944d045d0eSMasahiro Yamada 11955744e874SSoby Mathew# For AArch32, BL31 is not currently supported. 11965744e874SSoby Mathewifneq (${ARCH},aarch32) 11975744e874SSoby Mathew ifdef BL31_SOURCES 1198c5e1da83SJayanth Dodderi Chidanand # When booting an EL3 payload, there is no need to compile the BL31 1199c5e1da83SJayanth Dodderi Chidanand # image nor put it in the FIP. 12005744e874SSoby Mathew ifndef EL3_PAYLOAD_BASE 12015744e874SSoby Mathew NEED_BL31 := yes 12025744e874SSoby Mathew endif 12035744e874SSoby Mathew endif 1204c5e1da83SJayanth Dodderi Chidanandendif #(ARCH=aarch64) 12055744e874SSoby Mathew 120673c99d4eSJuan Castillo# Process TBB related flags 12076f971622SJuan Castilloifneq (${GENERATE_COT},0) 120873c99d4eSJuan Castillo # Common cert_create options 12096f971622SJuan Castillo ifneq (${CREATE_KEYS},0) 12106f971622SJuan Castillo $(eval CRT_ARGS += -n) 12110191262dSYatharth Kochar $(eval FWU_CRT_ARGS += -n) 1212fd34e7baSJuan Castillo ifneq (${SAVE_KEYS},0) 1213fd34e7baSJuan Castillo $(eval CRT_ARGS += -k) 12140191262dSYatharth Kochar $(eval FWU_CRT_ARGS += -k) 1215fd34e7baSJuan Castillo endif 12166f971622SJuan Castillo endif 121773c99d4eSJuan Castillo # Include TBBR makefile (unless the platform indicates otherwise) 121873c99d4eSJuan Castillo ifeq (${INCLUDE_TBBR_MK},1) 121973c99d4eSJuan Castillo include make_helpers/tbbr/tbbr_tools.mk 122073c99d4eSJuan Castillo endif 1221c5e1da83SJayanth Dodderi Chidanandendif #(GENERATE_COT) 12226f971622SJuan Castillo 12231c75d5dfSMasahiro Yamadaifneq (${FIP_ALIGN},0) 12241c75d5dfSMasahiro Yamada FIP_ARGS += --align ${FIP_ALIGN} 1225c5e1da83SJayanth Dodderi Chidanandendif #(FIP_ALIGN) 12261c75d5dfSMasahiro Yamada 12275f24ce96SManish Pandeyifdef FDT_SOURCES 12285f24ce96SManish Pandey NEED_FDT := yes 1229c5e1da83SJayanth Dodderi Chidanandendif #(FDT_SOURCES) 12305f24ce96SManish Pandey 123173c99d4eSJuan Castillo################################################################################ 123246e5e035SMichalis Pappas# Include libraries' Makefile that are used in all BL 123346e5e035SMichalis Pappas################################################################################ 123446e5e035SMichalis Pappas 123546e5e035SMichalis Pappasinclude lib/stack_protector/stack_protector.mk 123646e5e035SMichalis Pappas 123746e5e035SMichalis Pappas################################################################################ 12388a86052dSSoby Mathew# Include BL specific makefiles 12398a86052dSSoby Mathew################################################################################ 12405f24ce96SManish Pandey 12415f24ce96SManish Pandeyifeq (${NEED_BL1},yes) 12428a86052dSSoby Mathewinclude bl1/bl1.mk 12438a86052dSSoby Mathewendif 12448a86052dSSoby Mathew 12455f24ce96SManish Pandeyifeq (${NEED_BL2},yes) 12468a86052dSSoby Mathewinclude bl2/bl2.mk 12478a86052dSSoby Mathewendif 12488a86052dSSoby Mathew 12495f24ce96SManish Pandeyifeq (${NEED_BL2U},yes) 12508a86052dSSoby Mathewinclude bl2u/bl2u.mk 12518a86052dSSoby Mathewendif 12528a86052dSSoby Mathew 12535744e874SSoby Mathewifeq (${NEED_BL31},yes) 12548a86052dSSoby Mathewinclude bl31/bl31.mk 12558a86052dSSoby Mathewendif 125603b397a8SNishanth Menon 125773c99d4eSJuan Castillo################################################################################ 125873c99d4eSJuan Castillo# Build options checks 125973c99d4eSJuan Castillo################################################################################ 126073c99d4eSJuan Castillo 1261c5e1da83SJayanth Dodderi Chidanand# Boolean_Flags 1262327131c4SLeonardo Sandoval$(eval $(call assert_booleans,\ 1263327131c4SLeonardo Sandoval $(sort \ 1264327131c4SLeonardo Sandoval ALLOW_RO_XLAT_TABLES \ 126546789a7cSBalint Dobszay BL2_ENABLE_SP_LOAD \ 1266327131c4SLeonardo Sandoval COLD_BOOT_SINGLE_CPU \ 1267327131c4SLeonardo Sandoval CREATE_KEYS \ 1268327131c4SLeonardo Sandoval CTX_INCLUDE_AARCH32_REGS \ 1269327131c4SLeonardo Sandoval CTX_INCLUDE_FPREGS \ 1270327131c4SLeonardo Sandoval CTX_INCLUDE_EL2_REGS \ 1271327131c4SLeonardo Sandoval DEBUG \ 1272327131c4SLeonardo Sandoval DYN_DISABLE_AUTH \ 1273327131c4SLeonardo Sandoval EL3_EXCEPTION_HANDLING \ 12741fd685a7SChris Kay ENABLE_AMU_AUXILIARY_COUNTERS \ 1275742ca230SChris Kay ENABLE_AMU_FCONF \ 1276873d4241Sjohpow01 AMU_RESTRICT_COUNTERS \ 1277327131c4SLeonardo Sandoval ENABLE_ASSERTIONS \ 127824077098SAndre Przywara ENABLE_FEAT_SB \ 1279327131c4SLeonardo Sandoval ENABLE_PIE \ 1280327131c4SLeonardo Sandoval ENABLE_PMF \ 1281327131c4SLeonardo Sandoval ENABLE_PSCI_STAT \ 1282327131c4SLeonardo Sandoval ENABLE_RUNTIME_INSTRUMENTATION \ 1283dc78e62dSjohpow01 ENABLE_SME_FOR_SWD \ 12840c5e7d1cSMax Shvetsov ENABLE_SVE_FOR_SWD \ 1285970a4a8dSManish Pandey ENABLE_FEAT_RAS \ 1286*f87e54f7SManish Pandey FFH_SUPPORT \ 1287327131c4SLeonardo Sandoval ERROR_DEPRECATED \ 1288327131c4SLeonardo Sandoval FAULT_INJECTION_SUPPORT \ 1289327131c4SLeonardo Sandoval GENERATE_COT \ 1290327131c4SLeonardo Sandoval GICV2_G0_FOR_EL3 \ 129146cc41d5SManish Pandey HANDLE_EA_EL3_FIRST_NS \ 1292327131c4SLeonardo Sandoval HW_ASSISTED_COHERENCY \ 1293327131c4SLeonardo Sandoval MEASURED_BOOT \ 129400e28874SManish V Badarkhe DRTM_SUPPORT \ 1295327131c4SLeonardo Sandoval NS_TIMER_SWITCH \ 1296327131c4SLeonardo Sandoval OVERRIDE_LIBC \ 1297327131c4SLeonardo Sandoval PL011_GENERIC_UART \ 12980ce2072dSTamas Ban PLAT_RSS_NOT_SUPPORTED \ 1299327131c4SLeonardo Sandoval PROGRAMMABLE_RESET_ADDRESS \ 1300327131c4SLeonardo Sandoval PSCI_EXTENDED_STATE_ID \ 130164b4710bSWing Li PSCI_OS_INIT_MODE \ 1302327131c4SLeonardo Sandoval RESET_TO_BL31 \ 1303327131c4SLeonardo Sandoval SAVE_KEYS \ 1304327131c4SLeonardo Sandoval SEPARATE_CODE_AND_RODATA \ 130596a8ed14SJiafei Pan SEPARATE_BL2_NOLOAD_REGION \ 1306327131c4SLeonardo Sandoval SEPARATE_NOBITS_REGION \ 1307327131c4SLeonardo Sandoval SPIN_ON_BL1_EXIT \ 1308327131c4SLeonardo Sandoval SPM_MM \ 13091d63ae4dSMarc Bonnici SPMC_AT_EL3 \ 1310801cd3c8SNishant Sharma SPMC_AT_EL3_SEL0_SP \ 1311327131c4SLeonardo Sandoval SPMD_SPM_AT_SEL2 \ 1312890b5088SRaghu Krishnamurthy ENABLE_SPMD_LP \ 13133ba2c151SRaymond Mao TRANSFER_LIST \ 1314327131c4SLeonardo Sandoval TRUSTED_BOARD_BOOT \ 1315327131c4SLeonardo Sandoval USE_COHERENT_MEM \ 1316327131c4SLeonardo Sandoval USE_DEBUGFS \ 1317327131c4SLeonardo Sandoval ARM_IO_IN_DTB \ 1318327131c4SLeonardo Sandoval SDEI_IN_FCONF \ 1319327131c4SLeonardo Sandoval SEC_INT_DESC_IN_FCONF \ 1320327131c4SLeonardo Sandoval USE_ROMLIB \ 1321327131c4SLeonardo Sandoval USE_TBBR_DEFS \ 1322327131c4SLeonardo Sandoval WARMBOOT_ENABLE_DCACHE_EARLY \ 132342d4d3baSArvind Ram Prakash RESET_TO_BL2 \ 1324327131c4SLeonardo Sandoval BL2_IN_XIP_MEM \ 1325327131c4SLeonardo Sandoval BL2_INV_DCACHE \ 1326327131c4SLeonardo Sandoval USE_SPINLOCK_CAS \ 1327327131c4SLeonardo Sandoval ENCRYPT_BL31 \ 1328327131c4SLeonardo Sandoval ENCRYPT_BL32 \ 1329327131c4SLeonardo Sandoval ERRATA_SPECULATIVE_AT \ 133000e8f79cSManish Pandey RAS_TRAP_NS_ERR_REC_ACCESS \ 1331327131c4SLeonardo Sandoval COT_DESC_IN_DTB \ 1332327131c4SLeonardo Sandoval USE_SP804_TIMER \ 1333396b339dSManish V Badarkhe PSA_FWU_SUPPORT \ 133468120783SChris Kay ENABLE_MPMM \ 133568120783SChris Kay ENABLE_MPMM_FCONF \ 13366a0da736SJayanth Dodderi Chidanand FEATURE_DETECTION \ 13370b22e591SJayanth Dodderi Chidanand TRNG_SUPPORT \ 1338ffea3844SSona Mathew ERRATA_ABI_SUPPORT \ 1339ef63f5beSSona Mathew ERRATA_NON_ARM_INTERCONNECT \ 134004c7303bSOkash Khawaja CONDITIONAL_CMO \ 13415782b890SManish V Badarkhe PSA_CRYPTO \ 134285bebe18SSandrine Bailleux ENABLE_CONSOLE_GETC \ 1343327131c4SLeonardo Sandoval))) 134473c99d4eSJuan Castillo 1345c5e1da83SJayanth Dodderi Chidanand# Numeric_Flags 1346327131c4SLeonardo Sandoval$(eval $(call assert_numerics,\ 1347327131c4SLeonardo Sandoval $(sort \ 1348327131c4SLeonardo Sandoval ARM_ARCH_MAJOR \ 1349327131c4SLeonardo Sandoval ARM_ARCH_MINOR \ 1350327131c4SLeonardo Sandoval BRANCH_PROTECTION \ 13516a0da736SJayanth Dodderi Chidanand CTX_INCLUDE_PAUTH_REGS \ 13526a0da736SJayanth Dodderi Chidanand CTX_INCLUDE_MTE_REGS \ 13536a0da736SJayanth Dodderi Chidanand CTX_INCLUDE_NEVE_REGS \ 13542bf4f27fSManish V Badarkhe CRYPTO_SUPPORT \ 135583a4dae1SBoyan Karatotev DISABLE_MTPMU \ 13561298f2f1SJayanth Dodderi Chidanand ENABLE_BRBE_FOR_NS \ 135747c681b7SJayanth Dodderi Chidanand ENABLE_TRBE_FOR_NS \ 13586a0da736SJayanth Dodderi Chidanand ENABLE_BTI \ 13596a0da736SJayanth Dodderi Chidanand ENABLE_PAUTH \ 1360d23acc9eSAndre Przywara ENABLE_FEAT_AMU \ 13616a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_AMUv1p1 \ 13626a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_CSV2_2 \ 13636a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_DIT \ 13646a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_ECV \ 13656a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_FGT \ 13666a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_HCX \ 13676a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_PAN \ 13686a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_RNG \ 1369ff86e0b4SJuan Pablo Conde ENABLE_FEAT_RNG_TRAP \ 13706a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_SEL2 \ 1371d3331603SMark Brown ENABLE_FEAT_TCR2 \ 1372062b6c6bSMark Brown ENABLE_FEAT_S2PIE \ 1373062b6c6bSMark Brown ENABLE_FEAT_S1PIE \ 1374062b6c6bSMark Brown ENABLE_FEAT_S2POE \ 1375062b6c6bSMark Brown ENABLE_FEAT_S1POE \ 1376688ab57bSMark Brown ENABLE_FEAT_GCS \ 13776a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_VHE \ 13784d0b6632SMaksims Svecovs ENABLE_FEAT_MTE_PERM \ 1379edebefbcSArvind Ram Prakash ENABLE_FEAT_MPAM \ 13806a0da736SJayanth Dodderi Chidanand ENABLE_RME \ 13816437a09aSAndre Przywara ENABLE_SPE_FOR_NS \ 1382603a0c6fSAndre Przywara ENABLE_SYS_REG_TRACE_FOR_NS \ 138345007acdSJayanth Dodderi Chidanand ENABLE_SME_FOR_NS \ 138403d3c0d7SJayanth Dodderi Chidanand ENABLE_SME2_FOR_NS \ 13852b0bc4e0SJayanth Dodderi Chidanand ENABLE_SVE_FOR_NS \ 13866a0da736SJayanth Dodderi Chidanand ENABLE_TRF_FOR_NS \ 1387327131c4SLeonardo Sandoval FW_ENC_STATUS \ 13885357f83dSManish V Badarkhe NR_OF_FW_BANKS \ 13895357f83dSManish V Badarkhe NR_OF_IMAGES_IN_FW_BANK \ 1390781d07a4SJayanth Dodderi Chidanand TWED_DELAY \ 1391781d07a4SJayanth Dodderi Chidanand ENABLE_FEAT_TWED \ 1392bebcf27fSMark Brown SVE_VECTOR_LEN \ 13930ed3be6fSVarun Wadekar IMPDEF_SYSREG_TRAP \ 1394327131c4SLeonardo Sandoval))) 1395c877b414SJeenu Viswambharan 1396aacff749SJustin Chadwellifdef KEY_SIZE 1397aacff749SJustin Chadwell $(eval $(call assert_numeric,KEY_SIZE)) 1398aacff749SJustin Chadwellendif 1399aacff749SJustin Chadwell 14001f461979SJustin Chadwellifeq ($(filter $(SANITIZE_UB), on off trap),) 14011f461979SJustin Chadwell $(error "Invalid value for SANITIZE_UB: can be one of on, off, trap") 14021f461979SJustin Chadwellendif 14031f461979SJustin Chadwell 140473c99d4eSJuan Castillo################################################################################ 140573c99d4eSJuan Castillo# Add definitions to the cpp preprocessor based on the current build options. 140673c99d4eSJuan Castillo# This is done after including the platform specific makefile to allow the 140773c99d4eSJuan Castillo# platform to overwrite the default options 140873c99d4eSJuan Castillo################################################################################ 140973c99d4eSJuan Castillo 1410327131c4SLeonardo Sandoval$(eval $(call add_defines,\ 1411327131c4SLeonardo Sandoval $(sort \ 1412327131c4SLeonardo Sandoval ALLOW_RO_XLAT_TABLES \ 1413327131c4SLeonardo Sandoval ARM_ARCH_MAJOR \ 1414327131c4SLeonardo Sandoval ARM_ARCH_MINOR \ 141546789a7cSBalint Dobszay BL2_ENABLE_SP_LOAD \ 1416327131c4SLeonardo Sandoval COLD_BOOT_SINGLE_CPU \ 1417327131c4SLeonardo Sandoval CTX_INCLUDE_AARCH32_REGS \ 1418327131c4SLeonardo Sandoval CTX_INCLUDE_FPREGS \ 1419327131c4SLeonardo Sandoval CTX_INCLUDE_PAUTH_REGS \ 1420327131c4SLeonardo Sandoval EL3_EXCEPTION_HANDLING \ 1421327131c4SLeonardo Sandoval CTX_INCLUDE_MTE_REGS \ 1422327131c4SLeonardo Sandoval CTX_INCLUDE_EL2_REGS \ 1423062f8aafSArunachalam Ganapathy CTX_INCLUDE_NEVE_REGS \ 1424327131c4SLeonardo Sandoval DECRYPTION_SUPPORT_${DECRYPTION_SUPPORT} \ 14250063dd17SJavier Almansa Sobrino DISABLE_MTPMU \ 1426d23acc9eSAndre Przywara ENABLE_FEAT_AMU \ 14271fd685a7SChris Kay ENABLE_AMU_AUXILIARY_COUNTERS \ 1428742ca230SChris Kay ENABLE_AMU_FCONF \ 1429873d4241Sjohpow01 AMU_RESTRICT_COUNTERS \ 1430327131c4SLeonardo Sandoval ENABLE_ASSERTIONS \ 1431327131c4SLeonardo Sandoval ENABLE_BTI \ 1432edebefbcSArvind Ram Prakash ENABLE_FEAT_MPAM \ 1433327131c4SLeonardo Sandoval ENABLE_PAUTH \ 1434327131c4SLeonardo Sandoval ENABLE_PIE \ 1435327131c4SLeonardo Sandoval ENABLE_PMF \ 1436327131c4SLeonardo Sandoval ENABLE_PSCI_STAT \ 14375b18de09SZelalem Aweke ENABLE_RME \ 1438327131c4SLeonardo Sandoval ENABLE_RUNTIME_INSTRUMENTATION \ 1439dc78e62dSjohpow01 ENABLE_SME_FOR_NS \ 144003d3c0d7SJayanth Dodderi Chidanand ENABLE_SME2_FOR_NS \ 1441dc78e62dSjohpow01 ENABLE_SME_FOR_SWD \ 144290118bb5SAndre Przywara ENABLE_SPE_FOR_NS \ 1443327131c4SLeonardo Sandoval ENABLE_SVE_FOR_NS \ 14440c5e7d1cSMax Shvetsov ENABLE_SVE_FOR_SWD \ 1445970a4a8dSManish Pandey ENABLE_FEAT_RAS \ 1446*f87e54f7SManish Pandey FFH_SUPPORT \ 1447327131c4SLeonardo Sandoval ENCRYPT_BL31 \ 1448327131c4SLeonardo Sandoval ENCRYPT_BL32 \ 1449327131c4SLeonardo Sandoval ERROR_DEPRECATED \ 1450327131c4SLeonardo Sandoval FAULT_INJECTION_SUPPORT \ 1451327131c4SLeonardo Sandoval GICV2_G0_FOR_EL3 \ 145246cc41d5SManish Pandey HANDLE_EA_EL3_FIRST_NS \ 1453327131c4SLeonardo Sandoval HW_ASSISTED_COHERENCY \ 1454327131c4SLeonardo Sandoval LOG_LEVEL \ 1455327131c4SLeonardo Sandoval MEASURED_BOOT \ 145600e28874SManish V Badarkhe DRTM_SUPPORT \ 1457327131c4SLeonardo Sandoval NS_TIMER_SWITCH \ 1458327131c4SLeonardo Sandoval PL011_GENERIC_UART \ 1459327131c4SLeonardo Sandoval PLAT_${PLAT} \ 14600ce2072dSTamas Ban PLAT_RSS_NOT_SUPPORTED \ 1461327131c4SLeonardo Sandoval PROGRAMMABLE_RESET_ADDRESS \ 1462327131c4SLeonardo Sandoval PSCI_EXTENDED_STATE_ID \ 146364b4710bSWing Li PSCI_OS_INIT_MODE \ 1464327131c4SLeonardo Sandoval RESET_TO_BL31 \ 1465327131c4SLeonardo Sandoval SEPARATE_CODE_AND_RODATA \ 146696a8ed14SJiafei Pan SEPARATE_BL2_NOLOAD_REGION \ 1467327131c4SLeonardo Sandoval SEPARATE_NOBITS_REGION \ 1468327131c4SLeonardo Sandoval RECLAIM_INIT_CODE \ 1469327131c4SLeonardo Sandoval SPD_${SPD} \ 1470327131c4SLeonardo Sandoval SPIN_ON_BL1_EXIT \ 1471327131c4SLeonardo Sandoval SPM_MM \ 14721d63ae4dSMarc Bonnici SPMC_AT_EL3 \ 1473801cd3c8SNishant Sharma SPMC_AT_EL3_SEL0_SP \ 1474327131c4SLeonardo Sandoval SPMD_SPM_AT_SEL2 \ 14753ba2c151SRaymond Mao TRANSFER_LIST \ 1476327131c4SLeonardo Sandoval TRUSTED_BOARD_BOOT \ 1477c9c56f6eSManish V Badarkhe CRYPTO_SUPPORT \ 14787dfb9911SJimmy Brisson TRNG_SUPPORT \ 1479ffea3844SSona Mathew ERRATA_ABI_SUPPORT \ 1480ef63f5beSSona Mathew ERRATA_NON_ARM_INTERCONNECT \ 1481327131c4SLeonardo Sandoval USE_COHERENT_MEM \ 1482327131c4SLeonardo Sandoval USE_DEBUGFS \ 1483327131c4SLeonardo Sandoval ARM_IO_IN_DTB \ 1484327131c4SLeonardo Sandoval SDEI_IN_FCONF \ 1485327131c4SLeonardo Sandoval SEC_INT_DESC_IN_FCONF \ 1486327131c4SLeonardo Sandoval USE_ROMLIB \ 1487327131c4SLeonardo Sandoval USE_TBBR_DEFS \ 1488327131c4SLeonardo Sandoval WARMBOOT_ENABLE_DCACHE_EARLY \ 148942d4d3baSArvind Ram Prakash RESET_TO_BL2 \ 149042d4d3baSArvind Ram Prakash BL2_RUNS_AT_EL3 \ 1491327131c4SLeonardo Sandoval BL2_IN_XIP_MEM \ 1492327131c4SLeonardo Sandoval BL2_INV_DCACHE \ 1493327131c4SLeonardo Sandoval USE_SPINLOCK_CAS \ 1494327131c4SLeonardo Sandoval ERRATA_SPECULATIVE_AT \ 149500e8f79cSManish Pandey RAS_TRAP_NS_ERR_REC_ACCESS \ 1496327131c4SLeonardo Sandoval COT_DESC_IN_DTB \ 1497327131c4SLeonardo Sandoval USE_SP804_TIMER \ 149812cd65e0STomas Pilar ENABLE_FEAT_RNG \ 1499ff86e0b4SJuan Pablo Conde ENABLE_FEAT_RNG_TRAP \ 15004e04478aSChris Kay ENABLE_FEAT_SB \ 15017d33ffe4SDaniel Boulby ENABLE_FEAT_DIT \ 15025357f83dSManish V Badarkhe NR_OF_FW_BANKS \ 15035357f83dSManish V Badarkhe NR_OF_IMAGES_IN_FW_BANK \ 1504396b339dSManish V Badarkhe PSA_FWU_SUPPORT \ 1505744ad974Sjohpow01 ENABLE_BRBE_FOR_NS \ 1506813524eaSManish V Badarkhe ENABLE_TRBE_FOR_NS \ 1507d4582d30SManish V Badarkhe ENABLE_SYS_REG_TRACE_FOR_NS \ 15088fcd3d96SManish V Badarkhe ENABLE_TRF_FOR_NS \ 1509cb4ec47bSjohpow01 ENABLE_FEAT_HCX \ 151068120783SChris Kay ENABLE_MPMM \ 151168120783SChris Kay ENABLE_MPMM_FCONF \ 1512f74cb0beSJayanth Dodderi Chidanand ENABLE_FEAT_FGT \ 1513f74cb0beSJayanth Dodderi Chidanand ENABLE_FEAT_ECV \ 15146a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_AMUv1p1 \ 15156a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_SEL2 \ 15166a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_VHE \ 15176a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_CSV2_2 \ 15186a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_PAN \ 1519d3331603SMark Brown ENABLE_FEAT_TCR2 \ 1520062b6c6bSMark Brown ENABLE_FEAT_S2PIE \ 1521062b6c6bSMark Brown ENABLE_FEAT_S1PIE \ 1522062b6c6bSMark Brown ENABLE_FEAT_S2POE \ 1523062b6c6bSMark Brown ENABLE_FEAT_S1POE \ 1524688ab57bSMark Brown ENABLE_FEAT_GCS \ 15254d0b6632SMaksims Svecovs ENABLE_FEAT_MTE_PERM \ 15266a0da736SJayanth Dodderi Chidanand FEATURE_DETECTION \ 1527781d07a4SJayanth Dodderi Chidanand TWED_DELAY \ 1528781d07a4SJayanth Dodderi Chidanand ENABLE_FEAT_TWED \ 152904c7303bSOkash Khawaja CONDITIONAL_CMO \ 15300ed3be6fSVarun Wadekar IMPDEF_SYSREG_TRAP \ 1531a8cf6faeSJayanth Dodderi Chidanand SVE_VECTOR_LEN \ 1532890b5088SRaghu Krishnamurthy ENABLE_SPMD_LP \ 15335782b890SManish V Badarkhe PSA_CRYPTO \ 153485bebe18SSandrine Bailleux ENABLE_CONSOLE_GETC \ 1535327131c4SLeonardo Sandoval))) 15362fae4b1eSJeenu Viswambharan 15371f461979SJustin Chadwellifeq (${SANITIZE_UB},trap) 15381f461979SJustin Chadwell $(eval $(call add_define,MONITOR_TRAPS)) 1539c5e1da83SJayanth Dodderi Chidanandendif #(SANITIZE_UB) 15401f461979SJustin Chadwell 15414c117f6cSSandrine Bailleux# Define the EL3_PAYLOAD_BASE flag only if it is provided. 15424c117f6cSSandrine Bailleuxifdef EL3_PAYLOAD_BASE 15434c117f6cSSandrine Bailleux $(eval $(call add_define,EL3_PAYLOAD_BASE)) 1544cf2c8a33SAntonio Nino Diazelse 154568450a6dSAntonio Nino Diaz# Define the PRELOADED_BL33_BASE flag only if it is provided and 154668450a6dSAntonio Nino Diaz# EL3_PAYLOAD_BASE is not defined, as it has priority. 154768450a6dSAntonio Nino Diaz ifdef PRELOADED_BL33_BASE 154868450a6dSAntonio Nino Diaz $(eval $(call add_define,PRELOADED_BL33_BASE)) 15494c117f6cSSandrine Bailleux endif 1550c5e1da83SJayanth Dodderi Chidanandendif #(EL3_PAYLOAD_BASE) 155173c99d4eSJuan Castillo 1552209a60ccSSoby Mathew# Define the DYN_DISABLE_AUTH flag only if set. 1553209a60ccSSoby Mathewifeq (${DYN_DISABLE_AUTH},1) 1554209a60ccSSoby Mathew $(eval $(call add_define,DYN_DISABLE_AUTH)) 1555209a60ccSSoby Mathewendif 1556209a60ccSSoby Mathew 1557c2ad38ceSVarun Wadekarifneq ($(findstring armlink,$(notdir $(LD))),) 1558c2ad38ceSVarun Wadekar $(eval $(call add_define,USE_ARM_LINK)) 1559c2ad38ceSVarun Wadekarendif 1560c2ad38ceSVarun Wadekar 1561ce2b1ec6SManish Pandey# Generate and include sp_gen.mk if SPD is spmd and SP_LAYOUT_FILE is defined 1562ce2b1ec6SManish Pandeyifeq (${SPD},spmd) 1563c33ff198SOlivier Deprezifdef SP_LAYOUT_FILE 1564ce2b1ec6SManish Pandey -include $(BUILD_PLAT)/sp_gen.mk 1565ce2b1ec6SManish Pandey FIP_DEPS += sp 156607c44475SManish Pandey CRT_DEPS += sp 1567ce2b1ec6SManish Pandey NEED_SP_PKG := yes 1568ce2b1ec6SManish Pandeyelse 1569c33ff198SOlivier Deprez ifeq (${SPMD_SPM_AT_SEL2},1) 1570c33ff198SOlivier Deprez $(error "SPMD with SPM at S-EL2 require SP_LAYOUT_FILE") 1571c33ff198SOlivier Deprez endif 1572c5e1da83SJayanth Dodderi Chidanandendif #(SP_LAYOUT_FILE) 1573c5e1da83SJayanth Dodderi Chidanandendif #(SPD) 1574ce2b1ec6SManish Pandey 157573c99d4eSJuan Castillo################################################################################ 157673c99d4eSJuan Castillo# Build targets 157773c99d4eSJuan Castillo################################################################################ 157873c99d4eSJuan Castillo 157990aa901fSSumit Garg.PHONY: all msg_start clean realclean distclean cscope locate-checkpatch checkcodebase checkpatch fiptool sptool fip sp fwu_fip certtool dtbs memmap doc enctool 158073c99d4eSJuan Castillo.SUFFIXES: 158173c99d4eSJuan Castillo 158273c99d4eSJuan Castilloall: msg_start 158373c99d4eSJuan Castillo 158473c99d4eSJuan Castillomsg_start: 158573c99d4eSJuan Castillo @echo "Building ${PLAT}" 158673c99d4eSJuan Castillo 15877a24cba5SSoby Mathewifeq (${ERROR_DEPRECATED},0) 1588d5dfdeb6SJulius Werner# Check if deprecated declarations and cpp warnings should be treated as error or not. 1589c2ad38ceSVarun Wadekarifneq ($(findstring clang,$(notdir $(CC))),) 1590c2ad38ceSVarun Wadekar CPPFLAGS += -Wno-error=deprecated-declarations 1591c2ad38ceSVarun Wadekarelse 1592bc1a03c7SDan Handley CPPFLAGS += -Wno-error=deprecated-declarations -Wno-error=cpp 15937a24cba5SSoby Mathewendif 1594c5e1da83SJayanth Dodderi Chidanandendif #(!ERROR_DEPRECATED) 15957a24cba5SSoby Mathew 15965accce5bSRoberto Vargas$(eval $(call MAKE_LIB_DIRS)) 159761f72a34SRoberto Vargas$(eval $(call MAKE_LIB,c)) 15985fee0287SRoberto Vargas 159973c99d4eSJuan Castillo# Expand build macros for the different images 160073c99d4eSJuan Castilloifeq (${NEED_BL1},yes) 1601b34635a0SChris KayBL1_SOURCES := $(sort ${BL1_SOURCES}) 1602434d0491SZelalem Aweke$(eval $(call MAKE_BL,bl1)) 1603c5e1da83SJayanth Dodderi Chidanandendif #(NEED_BL1) 160473c99d4eSJuan Castillo 160573c99d4eSJuan Castilloifeq (${NEED_BL2},yes) 1606c5e1da83SJayanth Dodderi Chidanand 160742d4d3baSArvind Ram Prakashifeq (${RESET_TO_BL2}, 0) 1608c9b31ae8SRoberto VargasFIP_BL2_ARGS := tb-fw 1609c9b31ae8SRoberto Vargasendif 1610c9b31ae8SRoberto Vargas 1611eb1acfb6SChris KayBL2_SOURCES := $(sort ${BL2_SOURCES}) 1612eb1acfb6SChris Kay 161333950dd8SMasahiro Yamada$(if ${BL2}, $(eval $(call TOOL_ADD_IMG,bl2,--${FIP_BL2_ARGS})),\ 1614434d0491SZelalem Aweke $(eval $(call MAKE_BL,bl2,${FIP_BL2_ARGS}))) 1615c5e1da83SJayanth Dodderi Chidanand 1616c5e1da83SJayanth Dodderi Chidanandendif #(NEED_BL2) 161773c99d4eSJuan Castillo 16184d045d0eSMasahiro Yamadaifeq (${NEED_SCP_BL2},yes) 161933950dd8SMasahiro Yamada$(eval $(call TOOL_ADD_IMG,scp_bl2,--scp-fw)) 1620c5e1da83SJayanth Dodderi Chidanandendif #(NEED_SCP_BL2) 16214d045d0eSMasahiro Yamada 162273c99d4eSJuan Castilloifeq (${NEED_BL31},yes) 162373c99d4eSJuan CastilloBL31_SOURCES += ${SPD_SOURCES} 162426d1e0c3SMadhukar Pappireddy# Sort BL31 source files to remove duplicates 162526d1e0c3SMadhukar PappireddyBL31_SOURCES := $(sort ${BL31_SOURCES}) 1626c6ba9b45SSumit Gargifneq (${DECRYPTION_SUPPORT},none) 1627c6ba9b45SSumit Garg$(if ${BL31}, $(eval $(call TOOL_ADD_IMG,bl31,--soc-fw,,$(ENCRYPT_BL31))),\ 1628434d0491SZelalem Aweke $(eval $(call MAKE_BL,bl31,soc-fw,,$(ENCRYPT_BL31)))) 1629c6ba9b45SSumit Gargelse 163033950dd8SMasahiro Yamada$(if ${BL31}, $(eval $(call TOOL_ADD_IMG,bl31,--soc-fw)),\ 1631434d0491SZelalem Aweke $(eval $(call MAKE_BL,bl31,soc-fw))) 1632c5e1da83SJayanth Dodderi Chidanandendif #(DECRYPTION_SUPPORT) 1633c5e1da83SJayanth Dodderi Chidanandendif #(NEED_BL31) 163473c99d4eSJuan Castillo 163570d1fc53SJuan Castillo# If a BL32 image is needed but neither BL32 nor BL32_SOURCES is defined, the 1636c939d13aSMasahiro Yamada# build system will call TOOL_ADD_IMG to print a warning message and abort the 163770d1fc53SJuan Castillo# process. Note that the dependency on BL32 applies to the FIP only. 163873c99d4eSJuan Castilloifeq (${NEED_BL32},yes) 163926d1e0c3SMadhukar Pappireddy# Sort BL32 source files to remove duplicates 164026d1e0c3SMadhukar PappireddyBL32_SOURCES := $(sort ${BL32_SOURCES}) 16419cd15239SMasahiro YamadaBUILD_BL32 := $(if $(BL32),,$(if $(BL32_SOURCES),1)) 16429cd15239SMasahiro Yamada 1643c6ba9b45SSumit Gargifneq (${DECRYPTION_SUPPORT},none) 1644434d0491SZelalem Aweke$(if ${BUILD_BL32}, $(eval $(call MAKE_BL,bl32,tos-fw,,$(ENCRYPT_BL32))),\ 1645c6ba9b45SSumit Garg $(eval $(call TOOL_ADD_IMG,bl32,--tos-fw,,$(ENCRYPT_BL32)))) 1646c6ba9b45SSumit Gargelse 1647434d0491SZelalem Aweke$(if ${BUILD_BL32}, $(eval $(call MAKE_BL,bl32,tos-fw)),\ 164833950dd8SMasahiro Yamada $(eval $(call TOOL_ADD_IMG,bl32,--tos-fw))) 1649c5e1da83SJayanth Dodderi Chidanandendif #(DECRYPTION_SUPPORT) 1650c5e1da83SJayanth Dodderi Chidanandendif #(NEED_BL32) 165173c99d4eSJuan Castillo 16525b18de09SZelalem Aweke# If RMM image is needed but RMM is not defined, Test Realm Payload (TRP) 16535b18de09SZelalem Aweke# needs to be built from RMM_SOURCES. 16545b18de09SZelalem Awekeifeq (${NEED_RMM},yes) 16555b18de09SZelalem Aweke# Sort RMM source files to remove duplicates 16565b18de09SZelalem AwekeRMM_SOURCES := $(sort ${RMM_SOURCES}) 16575b18de09SZelalem AwekeBUILD_RMM := $(if $(RMM),,$(if $(RMM_SOURCES),1)) 16585b18de09SZelalem Aweke 16595b18de09SZelalem Aweke$(if ${BUILD_RMM}, $(eval $(call MAKE_BL,rmm,rmm-fw)),\ 16605b18de09SZelalem Aweke $(eval $(call TOOL_ADD_IMG,rmm,--rmm-fw))) 1661c5e1da83SJayanth Dodderi Chidanandendif #(NEED_RMM) 16625b18de09SZelalem Aweke 166373c99d4eSJuan Castillo# Add the BL33 image if required by the platform 166473c99d4eSJuan Castilloifeq (${NEED_BL33},yes) 166533950dd8SMasahiro Yamada$(eval $(call TOOL_ADD_IMG,bl33,--nt-fw)) 1666c5e1da83SJayanth Dodderi Chidanandendif #(NEED_BL33) 1667db6071c9SJuan Castillo 16689003fa0bSYatharth Kocharifeq (${NEED_BL2U},yes) 166933950dd8SMasahiro Yamada$(if ${BL2U}, $(eval $(call TOOL_ADD_IMG,bl2u,--ap-fwu-cfg,FWU_)),\ 1670434d0491SZelalem Aweke $(eval $(call MAKE_BL,bl2u,ap-fwu-cfg,FWU_))) 1671c5e1da83SJayanth Dodderi Chidanandendif #(NEED_BL2U) 16729003fa0bSYatharth Kochar 167303b397a8SNishanth Menon# Expand build macros for the different images 167403b397a8SNishanth Menonifeq (${NEED_FDT},yes) 167503b397a8SNishanth Menon $(eval $(call MAKE_DTBS,$(BUILD_PLAT)/fdts,$(FDT_SOURCES))) 1676c5e1da83SJayanth Dodderi Chidanandendif #(NEED_FDT) 167703b397a8SNishanth Menon 1678ce2b1ec6SManish Pandey# Add Secure Partition packages 1679ce2b1ec6SManish Pandeyifeq (${NEED_SP_PKG},yes) 1680ce2b1ec6SManish Pandey$(BUILD_PLAT)/sp_gen.mk : ${SP_MK_GEN} ${SP_LAYOUT_FILE} | ${BUILD_PLAT} 168120629b31SKarl Meakin ${PYTHON} "$<" "$@" $(filter-out $<,$^) $(BUILD_PLAT) ${COT} ${SP_DTS_LIST_FRAGMENT} 1682822c7279SJ-Alvessp: $(DTBS) $(BUILD_PLAT)/sp_gen.mk $(SP_PKGS) 1683ce2b1ec6SManish Pandey @${ECHO_BLANK_LINE} 1684ce2b1ec6SManish Pandey @echo "Built SP Images successfully" 1685ce2b1ec6SManish Pandey @${ECHO_BLANK_LINE} 1686c5e1da83SJayanth Dodderi Chidanandendif #(NEED_SP_PKG) 1687ce2b1ec6SManish Pandey 168836eaaf37SIan Spraylocate-checkpatch: 168936eaaf37SIan Sprayifndef CHECKPATCH 169066079b04SEtienne Carriere $(error "Please set CHECKPATCH to point to the Linux checkpatch.pl file, eg: CHECKPATCH=../linux/scripts/checkpatch.pl") 169136eaaf37SIan Sprayelse 169236eaaf37SIan Sprayifeq (,$(wildcard ${CHECKPATCH})) 169366079b04SEtienne Carriere $(error "The file CHECKPATCH points to cannot be found, use eg: CHECKPATCH=../linux/scripts/checkpatch.pl") 169436eaaf37SIan Sprayendif 1695c5e1da83SJayanth Dodderi Chidanandendif #(CHECKPATCH) 169636eaaf37SIan Spray 16974f6ad66aSAchin Guptaclean: 16984f6ad66aSAchin Gupta @echo " CLEAN" 1699f1477d4aSEvan Lloyd $(call SHELL_REMOVE_DIR,${BUILD_PLAT}) 170088a1cf1eSSami Mujawarifdef UNIX_MK 17012f2cef46SJeenu Viswambharan ${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean 170288a1cf1eSSami Mujawarelse 170388a1cf1eSSami Mujawar# Clear the MAKEFLAGS as we do not want 170488a1cf1eSSami Mujawar# to pass the gnumake flags to nmake. 170588a1cf1eSSami Mujawar ${Q}set MAKEFLAGS= && ${MSVC_NMAKE} /nologo /f ${FIPTOOLPATH}/Makefile.msvc FIPTOOLPATH=$(subst /,\,$(FIPTOOLPATH)) FIPTOOL=$(subst /,\,$(FIPTOOL)) clean 1706c5e1da83SJayanth Dodderi Chidanandendif #(UNIX_MK) 17076f971622SJuan Castillo ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} clean 170890aa901fSSumit Garg ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${ENCTOOLPATH} clean 17095accce5bSRoberto Vargas ${Q}${MAKE} --no-print-directory -C ${ROMLIBPATH} clean 17104f6ad66aSAchin Gupta 1711eaaeece2SJames Morrisseyrealclean distclean: 1712eaaeece2SJames Morrissey @echo " REALCLEAN" 1713f1477d4aSEvan Lloyd $(call SHELL_REMOVE_DIR,${BUILD_BASE}) 1714f1477d4aSEvan Lloyd $(call SHELL_DELETE_ALL, ${CURDIR}/cscope.*) 171588a1cf1eSSami Mujawarifdef UNIX_MK 17162f2cef46SJeenu Viswambharan ${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean 171788a1cf1eSSami Mujawarelse 171888a1cf1eSSami Mujawar# Clear the MAKEFLAGS as we do not want 171988a1cf1eSSami Mujawar# to pass the gnumake flags to nmake. 172088a1cf1eSSami Mujawar ${Q}set MAKEFLAGS= && ${MSVC_NMAKE} /nologo /f ${FIPTOOLPATH}/Makefile.msvc FIPTOOLPATH=$(subst /,\,$(FIPTOOLPATH)) FIPTOOL=$(subst /,\,$(FIPTOOL)) realclean 1721c5e1da83SJayanth Dodderi Chidanandendif #(UNIX_MK) 1722e15591aaSNicolas Boulenguez ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} realclean 172390aa901fSSumit Garg ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${ENCTOOLPATH} realclean 17245accce5bSRoberto Vargas ${Q}${MAKE} --no-print-directory -C ${ROMLIBPATH} clean 17254f6ad66aSAchin Gupta 172636eaaf37SIan Spraycheckcodebase: locate-checkpatch 172736eaaf37SIan Spray @echo " CHECKING STYLE" 172836eaaf37SIan Spray @if test -d .git ; then \ 17291ef35512SPaul Beesley git ls-files | grep -E -v 'libfdt|libc|docs|\.rst' | \ 17301a41e8c1SDan Handley while read GIT_FILE ; \ 17311a41e8c1SDan Handley do ${CHECKPATCH} ${CHECKCODE_ARGS} -f $$GIT_FILE ; \ 17321a41e8c1SDan Handley done ; \ 173336eaaf37SIan Spray else \ 17341a41e8c1SDan Handley find . -type f -not -iwholename "*.git*" \ 17351a41e8c1SDan Handley -not -iwholename "*build*" \ 17361a41e8c1SDan Handley -not -iwholename "*libfdt*" \ 173761f72a34SRoberto Vargas -not -iwholename "*libc*" \ 17381a41e8c1SDan Handley -not -iwholename "*docs*" \ 17391ef35512SPaul Beesley -not -iwholename "*.rst" \ 17401a41e8c1SDan Handley -exec ${CHECKPATCH} ${CHECKCODE_ARGS} -f {} \; ; \ 174136eaaf37SIan Spray fi 174236eaaf37SIan Spray 174336eaaf37SIan Spraycheckpatch: locate-checkpatch 174436eaaf37SIan Spray @echo " CHECKING STYLE" 174502a76d5fSYann Gautier @if test -n "${CHECKPATCH_OPTS}"; then \ 174602a76d5fSYann Gautier echo " with ${CHECKPATCH_OPTS} option(s)"; \ 174702a76d5fSYann Gautier fi 174851d28937SAntonio Nino Diaz ${Q}COMMON_COMMIT=$$(git merge-base HEAD ${BASE_COMMIT}); \ 174977a0a7f1SYann Gautier for commit in `git rev-list --no-merges $$COMMON_COMMIT..HEAD`; \ 175077a0a7f1SYann Gautier do \ 175151d28937SAntonio Nino Diaz printf "\n[*] Checking style of '$$commit'\n\n"; \ 175251d28937SAntonio Nino Diaz git log --format=email "$$commit~..$$commit" \ 175302a76d5fSYann Gautier -- ${CHECK_PATHS} | \ 175402a76d5fSYann Gautier ${CHECKPATCH} ${CHECKPATCH_OPTS} - || true; \ 175551d28937SAntonio Nino Diaz git diff --format=email "$$commit~..$$commit" \ 175602a76d5fSYann Gautier -- ${CHECK_PATHS} | \ 175702a76d5fSYann Gautier ${CHECKPATCH} ${CHECKPATCH_OPTS} - || true; \ 175851d28937SAntonio Nino Diaz done 175936eaaf37SIan Spray 176073c99d4eSJuan Castillocerttool: ${CRTTOOL} 176173c99d4eSJuan Castillo 1762a9812206SPali Rohár${CRTTOOL}: FORCE 1763598b166bSLionel Debieve ${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 1764f1477d4aSEvan Lloyd @${ECHO_BLANK_LINE} 17656f971622SJuan Castillo @echo "Built $@ successfully" 1766f1477d4aSEvan Lloyd @${ECHO_BLANK_LINE} 17676f971622SJuan Castillo 17686f971622SJuan Castilloifneq (${GENERATE_COT},0) 176973c99d4eSJuan Castillocertificates: ${CRT_DEPS} ${CRTTOOL} 17706f971622SJuan Castillo ${Q}${CRTTOOL} ${CRT_ARGS} 1771f1477d4aSEvan Lloyd @${ECHO_BLANK_LINE} 17726f971622SJuan Castillo @echo "Built $@ successfully" 17736f971622SJuan Castillo @echo "Certificates can be found in ${BUILD_PLAT}" 1774f1477d4aSEvan Lloyd @${ECHO_BLANK_LINE} 1775c5e1da83SJayanth Dodderi Chidanandendif #(GENERATE_COT) 177627713fb4SSoby Mathew 177773c99d4eSJuan Castillo${BUILD_PLAT}/${FIP_NAME}: ${FIP_DEPS} ${FIPTOOL} 17784727fd13SPali Rohár $(eval ${CHECK_FIP_CMD}) 1779819281eeSdp-arm ${Q}${FIPTOOL} create ${FIP_ARGS} $@ 1780819281eeSdp-arm ${Q}${FIPTOOL} info $@ 1781f1477d4aSEvan Lloyd @${ECHO_BLANK_LINE} 17822f2cef46SJeenu Viswambharan @echo "Built $@ successfully" 1783f1477d4aSEvan Lloyd @${ECHO_BLANK_LINE} 1784f58ad36fSHarry Liebel 17850191262dSYatharth Kocharifneq (${GENERATE_COT},0) 17860191262dSYatharth Kocharfwu_certificates: ${FWU_CRT_DEPS} ${CRTTOOL} 17870191262dSYatharth Kochar ${Q}${CRTTOOL} ${FWU_CRT_ARGS} 1788052ab529SEvan Lloyd @${ECHO_BLANK_LINE} 17890191262dSYatharth Kochar @echo "Built $@ successfully" 17900191262dSYatharth Kochar @echo "FWU certificates can be found in ${BUILD_PLAT}" 1791052ab529SEvan Lloyd @${ECHO_BLANK_LINE} 1792c5e1da83SJayanth Dodderi Chidanandendif #(GENERATE_COT) 17930191262dSYatharth Kochar 17940191262dSYatharth Kochar${BUILD_PLAT}/${FWU_FIP_NAME}: ${FWU_FIP_DEPS} ${FIPTOOL} 17954727fd13SPali Rohár $(eval ${CHECK_FWU_FIP_CMD}) 1796819281eeSdp-arm ${Q}${FIPTOOL} create ${FWU_FIP_ARGS} $@ 1797819281eeSdp-arm ${Q}${FIPTOOL} info $@ 1798052ab529SEvan Lloyd @${ECHO_BLANK_LINE} 17990191262dSYatharth Kochar @echo "Built $@ successfully" 1800052ab529SEvan Lloyd @${ECHO_BLANK_LINE} 18010191262dSYatharth Kochar 180273c99d4eSJuan Castillofiptool: ${FIPTOOL} 180373c99d4eSJuan Castillofip: ${BUILD_PLAT}/${FIP_NAME} 18040191262dSYatharth Kocharfwu_fip: ${BUILD_PLAT}/${FWU_FIP_NAME} 180573c99d4eSJuan Castillo 1806a9812206SPali Rohár${FIPTOOL}: FORCE 180788a1cf1eSSami Mujawarifdef UNIX_MK 1808598b166bSLionel Debieve ${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" FIPTOOL=${FIPTOOL} OPENSSL_DIR=${OPENSSL_DIR} DEBUG=${DEBUG} V=${V} --no-print-directory -C ${FIPTOOLPATH} all 180988a1cf1eSSami Mujawarelse 181088a1cf1eSSami Mujawar# Clear the MAKEFLAGS as we do not want 181188a1cf1eSSami Mujawar# to pass the gnumake flags to nmake. 181288a1cf1eSSami Mujawar ${Q}set MAKEFLAGS= && ${MSVC_NMAKE} /nologo /f ${FIPTOOLPATH}/Makefile.msvc FIPTOOLPATH=$(subst /,\,$(FIPTOOLPATH)) FIPTOOL=$(subst /,\,$(FIPTOOL)) 1813c5e1da83SJayanth Dodderi Chidanandendif #(UNIX_MK) 1814f58ad36fSHarry Liebel 1815a9812206SPali Rohárromlib.bin: libraries FORCE 1816bbb24f61SJohn 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 18175accce5bSRoberto Vargas 1818cfe83910SLouis Mayencourtmemmap: all 1819af5b49e9SHarrison Mutaiifdef UNIX_MK 1820af5b49e9SHarrison Mutai ${Q}PYTHONPATH=${CURDIR}/tools/memory \ 1821af5b49e9SHarrison Mutai ${PYTHON} -m memory.memmap -sr ${BUILD_PLAT} 1822af5b49e9SHarrison Mutaielse 1823af5b49e9SHarrison Mutai ${Q}set PYTHONPATH=${CURDIR}/tools/memory && \ 1824af5b49e9SHarrison Mutai ${PYTHON} -m memory.memmap -sr ${BUILD_PLAT} 1825af5b49e9SHarrison Mutaiendif 1826cfe83910SLouis Mayencourt 18276de32378SMadhukar Pappireddydoc: 18286de32378SMadhukar Pappireddy @echo " BUILD DOCUMENTATION" 18296de32378SMadhukar Pappireddy ${Q}${MAKE} --no-print-directory -C ${DOCS_PATH} html 18306de32378SMadhukar Pappireddy 183190aa901fSSumit Gargenctool: ${ENCTOOL} 183290aa901fSSumit Garg 1833a9812206SPali Rohár${ENCTOOL}: FORCE 1834598b166bSLionel Debieve ${Q}${MAKE} PLAT=${PLAT} BUILD_INFO=0 OPENSSL_DIR=${OPENSSL_DIR} ENCTOOL=${ENCTOOL} DEBUG=${DEBUG} V=${V} --no-print-directory -C ${ENCTOOLPATH} all 183590aa901fSSumit Garg @${ECHO_BLANK_LINE} 183690aa901fSSumit Garg @echo "Built $@ successfully" 183790aa901fSSumit Garg @${ECHO_BLANK_LINE} 183890aa901fSSumit Garg 183935fab8c9SJoakim Bechcscope: 184035fab8c9SJoakim Bech @echo " CSCOPE" 184135fab8c9SJoakim Bech ${Q}find ${CURDIR} -name "*.[chsS]" > cscope.files 184235fab8c9SJoakim Bech ${Q}cscope -b -q -k 184335fab8c9SJoakim Bech 184472ee3314SRyan Harkinhelp: 18457c23126cSJohn Tsichritzis @echo "usage: ${MAKE} [PLAT=<platform>] [OPTIONS] [TARGET]" 184672ee3314SRyan Harkin @echo "" 184772ee3314SRyan Harkin @echo "PLAT is used to specify which platform you wish to build." 184808c7ed0fSSandrine Bailleux @echo "If no platform is specified, PLAT defaults to: ${DEFAULT_PLAT}" 184972ee3314SRyan Harkin @echo "" 18507c23126cSJohn Tsichritzis @echo "platform = ${PLATFORM_LIST}" 18517c23126cSJohn Tsichritzis @echo "" 18521b578596SSandrine Bailleux @echo "Please refer to the User Guide for a list of all supported options." 18531b578596SSandrine Bailleux @echo "Note that the build system doesn't track dependencies for build " 18541b578596SSandrine Bailleux @echo "options. Therefore, if any of the build options are changed " 18551b578596SSandrine Bailleux @echo "from a previous build, a clean build must be performed." 18561b578596SSandrine Bailleux @echo "" 185772ee3314SRyan Harkin @echo "Supported Targets:" 18581b578596SSandrine Bailleux @echo " all Build all individual bootloader binaries" 185936eaaf37SIan Spray @echo " bl1 Build the BL1 binary" 18608aa559c0SJeenu Viswambharan @echo " bl2 Build the BL2 binary" 18619003fa0bSYatharth Kochar @echo " bl2u Build the BL2U binary" 1862d178637dSJuan Castillo @echo " bl31 Build the BL31 binary" 18639d29c227SSoby Mathew @echo " bl32 Build the BL32 binary. If ARCH=aarch32, then " 18649d29c227SSoby Mathew @echo " this builds secure payload specified by AARCH32_SP" 186573c99d4eSJuan Castillo @echo " certificates Build the certificates (requires 'GENERATE_COT=1')" 18661b578596SSandrine Bailleux @echo " fip Build the Firmware Image Package (FIP)" 18670191262dSYatharth Kochar @echo " fwu_fip Build the FWU Firmware Image Package (FIP)" 186836eaaf37SIan Spray @echo " checkcodebase Check the coding style of the entire source tree" 186936eaaf37SIan Spray @echo " checkpatch Check the coding style on changes in the current" 187036eaaf37SIan Spray @echo " branch against BASE_COMMIT (default origin/master)" 187172ee3314SRyan Harkin @echo " clean Clean the build for the selected platform" 187235fab8c9SJoakim Bech @echo " cscope Generate cscope index" 187372ee3314SRyan Harkin @echo " distclean Remove all build artifacts for all platforms" 18746f971622SJuan Castillo @echo " certtool Build the Certificate generation tool" 187590aa901fSSumit Garg @echo " enctool Build the Firmware encryption tool" 1876f58ad36fSHarry Liebel @echo " fiptool Build the Firmware Image Package (FIP) creation tool" 1877ce2b1ec6SManish Pandey @echo " sp Build the Secure Partition Packages" 187826010da1SAntonio Nino Diaz @echo " sptool Build the Secure Partition Package creation tool" 187938c14d88SSoby Mathew @echo " dtbs Build the Device Tree Blobs (if required for the platform)" 1880cfe83910SLouis Mayencourt @echo " memmap Print the memory map of the built binaries" 18816de32378SMadhukar Pappireddy @echo " doc Build html based documentation using Sphinx tool" 188272ee3314SRyan Harkin @echo "" 18831b578596SSandrine Bailleux @echo "Note: most build targets require PLAT to be set to a specific platform." 188472ee3314SRyan Harkin @echo "" 188572ee3314SRyan Harkin @echo "example: build all targets for the FVP platform:" 188672ee3314SRyan Harkin @echo " CROSS_COMPILE=aarch64-none-elf- make PLAT=fvp all" 1887a9812206SPali Rohár 1888a9812206SPali Rohár.PHONY: FORCE 1889a9812206SPali RohárFORCE:; 1890