14f6ad66aSAchin Gupta# 22d51b55eSBalint Dobszay# Copyright (c) 2013-2020, 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 11eca80334SMadhukar PappireddyVERSION_MINOR := 3 12aaa3e722SJuan Castillo 1388154678SJuan Castillo# Default goal is build all images 1488154678SJuan Castillo.DEFAULT_GOAL := all 1588154678SJuan Castillo 1672fc70edSDouglas Raillard# Avoid any implicit propagation of command line variable definitions to 1772fc70edSDouglas Raillard# sub-Makefiles, like CFLAGS that we reserved for the firmware images' 1872fc70edSDouglas Raillard# usage. Other command line options like "-s" are still propagated as usual. 1972fc70edSDouglas RaillardMAKEOVERRIDES = 2072fc70edSDouglas Raillard 21231c1470SEvan LloydMAKE_HELPERS_DIRECTORY := make_helpers/ 22231c1470SEvan Lloydinclude ${MAKE_HELPERS_DIRECTORY}build_macros.mk 23e7f54dbdSEvan Lloydinclude ${MAKE_HELPERS_DIRECTORY}build_env.mk 2473c99d4eSJuan Castillo 2573c99d4eSJuan Castillo################################################################################ 262fae4b1eSJeenu Viswambharan# Default values for build configurations, and their dependencies 2773c99d4eSJuan Castillo################################################################################ 28e35c4045SJeenu Viswambharan 292fae4b1eSJeenu Viswambharaninclude ${MAKE_HELPERS_DIRECTORY}defaults.mk 30872be88aSdp-arm 31cc8b5632SAntonio Nino Diaz# Assertions enabled for DEBUG builds by default 32cc8b5632SAntonio Nino DiazENABLE_ASSERTIONS := ${DEBUG} 332fae4b1eSJeenu ViswambharanENABLE_PMF := ${ENABLE_RUNTIME_INSTRUMENTATION} 342fae4b1eSJeenu ViswambharanPLAT := ${DEFAULT_PLAT} 3573c99d4eSJuan Castillo 3673c99d4eSJuan Castillo################################################################################ 3773c99d4eSJuan Castillo# Checkpatch script options 3873c99d4eSJuan Castillo################################################################################ 3973c99d4eSJuan Castillo 40f607739cSSandrine BailleuxCHECKCODE_ARGS := --no-patch 41f0b489c1SDan Handley# Do not check the coding style on imported library files or documentation files 424501843fSGilad Ben-YossefINC_ARM_DIRS_TO_CHECK := $(sort $(filter-out \ 434501843fSGilad Ben-Yossef include/drivers/arm/cryptocell, \ 444501843fSGilad Ben-Yossef $(wildcard include/drivers/arm/*))) 454501843fSGilad Ben-YossefINC_ARM_DIRS_TO_CHECK += include/drivers/arm/cryptocell/*.h 464501843fSGilad Ben-YossefINC_DRV_DIRS_TO_CHECK := $(sort $(filter-out \ 474501843fSGilad Ben-Yossef include/drivers/arm, \ 484501843fSGilad Ben-Yossef $(wildcard include/drivers/*))) 49f0b489c1SDan HandleyINC_LIB_DIRS_TO_CHECK := $(sort $(filter-out \ 501a41e8c1SDan Handley include/lib/libfdt \ 5161f72a34SRoberto Vargas include/lib/libc, \ 52f0b489c1SDan Handley $(wildcard include/lib/*))) 53f0b489c1SDan HandleyINC_DIRS_TO_CHECK := $(sort $(filter-out \ 544501843fSGilad Ben-Yossef include/lib \ 554501843fSGilad Ben-Yossef include/drivers, \ 56f0b489c1SDan Handley $(wildcard include/*))) 57f0b489c1SDan HandleyLIB_DIRS_TO_CHECK := $(sort $(filter-out \ 58d801fbb0Sdp-arm lib/compiler-rt \ 5955cdcf75SAntonio Nino Diaz lib/libfdt% \ 6061f72a34SRoberto Vargas lib/libc, \ 61f0b489c1SDan Handley $(wildcard lib/*))) 62f0b489c1SDan HandleyROOT_DIRS_TO_CHECK := $(sort $(filter-out \ 63f0b489c1SDan Handley lib \ 64f0b489c1SDan Handley include \ 65f0b489c1SDan Handley docs \ 661ef35512SPaul Beesley %.rst, \ 67f0b489c1SDan Handley $(wildcard *))) 68f0b489c1SDan HandleyCHECK_PATHS := ${ROOT_DIRS_TO_CHECK} \ 69f0b489c1SDan Handley ${INC_DIRS_TO_CHECK} \ 70f0b489c1SDan Handley ${INC_LIB_DIRS_TO_CHECK} \ 714501843fSGilad Ben-Yossef ${LIB_DIRS_TO_CHECK} \ 724501843fSGilad Ben-Yossef ${INC_DRV_DIRS_TO_CHECK} \ 734501843fSGilad Ben-Yossef ${INC_ARM_DIRS_TO_CHECK} 7436eaaf37SIan Spray 7573c99d4eSJuan Castillo 7673c99d4eSJuan Castillo################################################################################ 7773c99d4eSJuan Castillo# Process build options 7873c99d4eSJuan Castillo################################################################################ 7973c99d4eSJuan Castillo 8073c99d4eSJuan Castillo# Verbose flag 81e35c4045SJeenu Viswambharanifeq (${V},0) 82b169f6a9SEvan Lloyd Q:=@ 83ee1ba6d4SAndre Przywara ECHO:=@echo 8436eaaf37SIan Spray CHECKCODE_ARGS += --no-summary --terse 854f6ad66aSAchin Guptaelse 86b169f6a9SEvan Lloyd Q:= 87b5a0f4bdSAntonio Nino Diaz ECHO:=$(ECHO_QUIET) 884f6ad66aSAchin Guptaendif 89ee1ba6d4SAndre Przywara 90ee1ba6d4SAndre Przywaraifneq ($(findstring s,$(filter-out --%,$(MAKEFLAGS))),) 91ee1ba6d4SAndre Przywara Q:=@ 92b5a0f4bdSAntonio Nino Diaz ECHO:=$(ECHO_QUIET) 93ee1ba6d4SAndre Przywaraendif 94ee1ba6d4SAndre Przywara 95ee1ba6d4SAndre Przywaraexport Q ECHO 962f2cef46SJeenu Viswambharan 9773c99d4eSJuan Castillo# The cert_create tool cannot generate certificates individually, so we use the 9873c99d4eSJuan Castillo# target 'certificates' to create them all 9973c99d4eSJuan Castilloifneq (${GENERATE_COT},0) 10073c99d4eSJuan Castillo FIP_DEPS += certificates 1010191262dSYatharth Kochar FWU_FIP_DEPS += fwu_certificates 10273c99d4eSJuan Castilloendif 10373c99d4eSJuan Castillo 1049fc59639SAlexei Fedorov# Process BRANCH_PROTECTION value and set 1059fc59639SAlexei Fedorov# Pointer Authentication and Branch Target Identification flags 1069fc59639SAlexei Fedorovifeq (${BRANCH_PROTECTION},0) 1079fc59639SAlexei Fedorov # Default value turns off all types of branch protection 1089fc59639SAlexei Fedorov BP_OPTION := none 1099fc59639SAlexei Fedorovelse ifneq (${ARCH},aarch64) 1109fc59639SAlexei Fedorov $(error BRANCH_PROTECTION requires AArch64) 1119fc59639SAlexei Fedorovelse ifeq (${BRANCH_PROTECTION},1) 1129fc59639SAlexei Fedorov # Enables all types of branch protection features 1139fc59639SAlexei Fedorov BP_OPTION := standard 1149fc59639SAlexei Fedorov ENABLE_BTI := 1 1159fc59639SAlexei Fedorov ENABLE_PAUTH := 1 1169fc59639SAlexei Fedorovelse ifeq (${BRANCH_PROTECTION},2) 1179fc59639SAlexei Fedorov # Return address signing to its standard level 1189fc59639SAlexei Fedorov BP_OPTION := pac-ret 1199fc59639SAlexei Fedorov ENABLE_PAUTH := 1 1209fc59639SAlexei Fedorovelse ifeq (${BRANCH_PROTECTION},3) 1219fc59639SAlexei Fedorov # Extend the signing to include leaf functions 1229fc59639SAlexei Fedorov BP_OPTION := pac-ret+leaf 1239fc59639SAlexei Fedorov ENABLE_PAUTH := 1 124*3768fecfSAlexei Fedorovelse ifeq (${BRANCH_PROTECTION},4) 125*3768fecfSAlexei Fedorov # Turn on branch target identification mechanism 126*3768fecfSAlexei Fedorov BP_OPTION := bti 127*3768fecfSAlexei Fedorov ENABLE_BTI := 1 1289fc59639SAlexei Fedorovelse 1299fc59639SAlexei Fedorov $(error Unknown BRANCH_PROTECTION value ${BRANCH_PROTECTION}) 1309fc59639SAlexei Fedorovendif 13173c99d4eSJuan Castillo 132c97cba4eSSoby Mathew# USE_SPINLOCK_CAS requires AArch64 build 133c97cba4eSSoby Mathewifeq (${USE_SPINLOCK_CAS},1) 134c97cba4eSSoby Mathewifneq (${ARCH},aarch64) 135c97cba4eSSoby Mathew $(error USE_SPINLOCK_CAS requires AArch64) 136c97cba4eSSoby Mathewelse 137c97cba4eSSoby Mathew $(info USE_SPINLOCK_CAS is an experimental feature) 138c97cba4eSSoby Mathewendif 139c97cba4eSSoby Mathewendif 140c97cba4eSSoby Mathew 1410ca3913dSOlivier Deprez# USE_DEBUGFS experimental feature recommended only in debug builds 1420ca3913dSOlivier Deprezifeq (${USE_DEBUGFS},1) 1430ca3913dSOlivier Deprezifeq (${DEBUG},1) 1440ca3913dSOlivier Deprez $(warning DEBUGFS experimental feature is enabled.) 1450ca3913dSOlivier Deprezelse 1460ca3913dSOlivier Deprez $(warning DEBUGFS experimental, recommended in DEBUG builds ONLY) 1470ca3913dSOlivier Deprezendif 1480ca3913dSOlivier Deprezendif 1490ca3913dSOlivier Deprez 150c6ba9b45SSumit Gargifneq (${DECRYPTION_SUPPORT},none) 151c6ba9b45SSumit GargENC_ARGS += -f ${FW_ENC_STATUS} 152c6ba9b45SSumit GargENC_ARGS += -k ${ENC_KEY} 153c6ba9b45SSumit GargENC_ARGS += -n ${ENC_NONCE} 154c6ba9b45SSumit GargFIP_DEPS += enctool 155c6ba9b45SSumit GargFWU_FIP_DEPS += enctool 156c6ba9b45SSumit Gargendif 157c6ba9b45SSumit Garg 15873c99d4eSJuan Castillo################################################################################ 15973c99d4eSJuan Castillo# Toolchain 16073c99d4eSJuan Castillo################################################################################ 16173c99d4eSJuan Castillo 16272610c41Sdp-armHOSTCC := gcc 16372610c41Sdp-armexport HOSTCC 16472610c41Sdp-arm 16573c99d4eSJuan CastilloCC := ${CROSS_COMPILE}gcc 16673c99d4eSJuan CastilloCPP := ${CROSS_COMPILE}cpp 16773c99d4eSJuan CastilloAS := ${CROSS_COMPILE}gcc 16873c99d4eSJuan CastilloAR := ${CROSS_COMPILE}ar 1692adee763SRoberto VargasLINKER := ${CROSS_COMPILE}ld 17073c99d4eSJuan CastilloOC := ${CROSS_COMPILE}objcopy 17173c99d4eSJuan CastilloOD := ${CROSS_COMPILE}objdump 17273c99d4eSJuan CastilloNM := ${CROSS_COMPILE}nm 17373c99d4eSJuan CastilloPP := ${CROSS_COMPILE}gcc -E 17438c14d88SSoby MathewDTC := dtc 17573c99d4eSJuan Castillo 176b25a577fSJulius Werner# Use ${LD}.bfd instead if it exists (as absolute path or together with $PATH). 177b25a577fSJulius Wernerifneq ($(strip $(wildcard ${LD}.bfd) \ 1782adee763SRoberto Vargas $(foreach dir,$(subst :, ,${PATH}),$(wildcard ${dir}/${LINKER}.bfd))),) 1792adee763SRoberto VargasLINKER := ${LINKER}.bfd 180b25a577fSJulius Wernerendif 181b25a577fSJulius Werner 18226e63c44SEtienne Carriereifeq (${ARM_ARCH_MAJOR},7) 18326e63c44SEtienne Carrieretarget32-directive = -target arm-none-eabi 18426e63c44SEtienne Carriere# Will set march32-directive from platform configuration 18526e63c44SEtienne Carriereelse 18626e63c44SEtienne Carrieretarget32-directive = -target armv8a-none-eabi 187fa6f774bSAlexei Fedorov 188fa6f774bSAlexei Fedorov# Set the compiler's target architecture profile based on ARM_ARCH_MINOR option 189fa6f774bSAlexei Fedorovifeq (${ARM_ARCH_MINOR},0) 190da547d4bSSandrine Bailleuxmarch32-directive = -march=armv8-a 191fa6f774bSAlexei Fedorovmarch64-directive = -march=armv8-a 192fa6f774bSAlexei Fedorovelse 193fa6f774bSAlexei Fedorovmarch32-directive = -march=armv8.${ARM_ARCH_MINOR}-a 194fa6f774bSAlexei Fedorovmarch64-directive = -march=armv8.${ARM_ARCH_MINOR}-a 195fa6f774bSAlexei Fedorovendif 19626e63c44SEtienne Carriereendif 19726e63c44SEtienne Carriere 1987ff088d1SManish V Badarkhe# Memory tagging is supported in architecture Armv8.5-A AArch64 and onwards 1997ff088d1SManish V Badarkheifeq ($(ARCH), aarch64) 2007ff088d1SManish V Badarkheifeq ($(shell test $(ARM_ARCH_MAJOR) -gt 8; echo $$?),0) 2017ff088d1SManish V Badarkhemem_tag_arch_support = yes 2027ff088d1SManish V Badarkheelse ifeq ($(shell test $(ARM_ARCH_MAJOR) -eq 8 -a $(ARM_ARCH_MINOR) -ge 5; \ 2037ff088d1SManish V Badarkhe echo $$?),0) 2047ff088d1SManish V Badarkhemem_tag_arch_support = yes 2057ff088d1SManish V Badarkheendif 2067ff088d1SManish V Badarkheendif 2077ff088d1SManish V Badarkhe 2087ff088d1SManish V Badarkhe# Enabled required option for memory stack tagging. Currently, these options are 2097ff088d1SManish V Badarkhe# enabled only for clang and armclang compiler. 2107ff088d1SManish V Badarkheifeq (${SUPPORT_STACK_MEMTAG},yes) 2117ff088d1SManish V Badarkheifdef mem_tag_arch_support 2127ff088d1SManish V Badarkheifneq ( ,$(filter $(notdir $(CC)),armclang clang)) 2137ff088d1SManish V Badarkhemarch64-directive = -march=armv${ARM_ARCH_MAJOR}.${ARM_ARCH_MINOR}-a+memtag 2147ff088d1SManish V Badarkheifeq ($(notdir $(CC)),armclang) 2157ff088d1SManish V BadarkheTF_CFLAGS += -mmemtag-stack 2167ff088d1SManish V Badarkheelse ifeq ($(notdir $(CC)),clang) 2177ff088d1SManish V BadarkheTF_CFLAGS += -fsanitize=memtag 2187ff088d1SManish V Badarkheendif 2197ff088d1SManish V Badarkheendif 2207ff088d1SManish V Badarkheelse 2217ff088d1SManish V Badarkhe$(error "Error: stack memory tagging is not supported for architecture \ 2227ff088d1SManish V Badarkhe ${ARCH},armv${ARM_ARCH_MAJOR}.${ARM_ARCH_MINOR}-a") 2237ff088d1SManish V Badarkheendif 2247ff088d1SManish V Badarkheendif 2257ff088d1SManish V Badarkhe 226fd18a8fcSVarun Wadekarifneq ($(findstring armclang,$(notdir $(CC))),) 22726e63c44SEtienne CarriereTF_CFLAGS_aarch32 = -target arm-arm-none-eabi $(march32-directive) 228fa6f774bSAlexei FedorovTF_CFLAGS_aarch64 = -target aarch64-arm-none-eabi $(march64-directive) 2292adee763SRoberto VargasLD = $(LINKER) 2301684b873SRoberto VargasAS = $(CC) -c -x assembler-with-cpp $(TF_CFLAGS_$(ARCH)) 2317040155eSRoberto VargasCPP = $(CC) -E $(TF_CFLAGS_$(ARCH)) 2327040155eSRoberto VargasPP = $(CC) -E $(TF_CFLAGS_$(ARCH)) 2337559633bSdp-armelse ifneq ($(findstring clang,$(notdir $(CC))),) 234eff737c1SArve HjønnevågCLANG_CCDIR = $(if $(filter-out ./,$(dir $(CC))),$(dir $(CC)),) 235e2bfec0bSYann GautierTF_CFLAGS_aarch32 = $(target32-directive) $(march32-directive) 236fa6f774bSAlexei FedorovTF_CFLAGS_aarch64 = -target aarch64-elf $(march64-directive) 237eff737c1SArve HjønnevågLD = $(CLANG_CCDIR)ld.lld 238641f16e7SAmbroise Vincentifeq (, $(shell which $(LD))) 239641f16e7SAmbroise Vincent$(error "No $(LD) in PATH, make sure it is installed or set LD to a different linker") 240641f16e7SAmbroise Vincentendif 2411684b873SRoberto VargasAS = $(CC) -c -x assembler-with-cpp $(TF_CFLAGS_$(ARCH)) 2427040155eSRoberto VargasCPP = $(CC) -E 2437040155eSRoberto VargasPP = $(CC) -E 244edbce9aaSzelalem-awekeelse ifneq ($(findstring gcc,$(notdir $(CC))),) 245edbce9aaSzelalem-awekeTF_CFLAGS_aarch32 = $(march32-directive) 246edbce9aaSzelalem-awekeTF_CFLAGS_aarch64 = $(march64-directive) 247edbce9aaSzelalem-awekeifeq ($(ENABLE_LTO),1) 248edbce9aaSzelalem-aweke # Enable LTO only for aarch64 249edbce9aaSzelalem-aweke ifeq (${ARCH},aarch64) 250edbce9aaSzelalem-aweke LTO_CFLAGS = -flto 251edbce9aaSzelalem-aweke # Use gcc as a wrapper for the ld, recommended for LTO 252edbce9aaSzelalem-aweke LINKER := ${CROSS_COMPILE}gcc 253edbce9aaSzelalem-aweke endif 254edbce9aaSzelalem-awekeendif 255edbce9aaSzelalem-awekeLD = $(LINKER) 256d5461857Sdp-armelse 25726e63c44SEtienne CarriereTF_CFLAGS_aarch32 = $(march32-directive) 258fa6f774bSAlexei FedorovTF_CFLAGS_aarch64 = $(march64-directive) 2592adee763SRoberto VargasLD = $(LINKER) 260d5461857Sdp-armendif 261d5461857Sdp-arm 26232b209bfSAhmad Fatoum# Process Debug flag 26332b209bfSAhmad Fatoum$(eval $(call add_define,DEBUG)) 26432b209bfSAhmad Fatoumifneq (${DEBUG}, 0) 26532b209bfSAhmad Fatoum BUILD_TYPE := debug 26632b209bfSAhmad Fatoum TF_CFLAGS += -g 26732b209bfSAhmad Fatoum 26832b209bfSAhmad Fatoum ifneq ($(findstring clang,$(notdir $(CC))),) 26932b209bfSAhmad Fatoum ASFLAGS += -g 27032b209bfSAhmad Fatoum else 27132b209bfSAhmad Fatoum ASFLAGS += -g -Wa,--gdwarf-2 27232b209bfSAhmad Fatoum endif 27332b209bfSAhmad Fatoum 27432b209bfSAhmad Fatoum # Use LOG_LEVEL_INFO by default for debug builds 27532b209bfSAhmad Fatoum LOG_LEVEL := 40 27632b209bfSAhmad Fatoumelse 27732b209bfSAhmad Fatoum BUILD_TYPE := release 27832b209bfSAhmad Fatoum # Use LOG_LEVEL_NOTICE by default for release builds 27932b209bfSAhmad Fatoum LOG_LEVEL := 20 28032b209bfSAhmad Fatoumendif 28132b209bfSAhmad Fatoum 282f1de4c8fSPeiyuan Song# Default build string (git branch and commit) 283f1de4c8fSPeiyuan Songifeq (${BUILD_STRING},) 284f1de4c8fSPeiyuan Song BUILD_STRING := $(shell git describe --always --dirty --tags 2> /dev/null) 285f1de4c8fSPeiyuan Songendif 286f1de4c8fSPeiyuan SongVERSION_STRING := v${VERSION_MAJOR}.${VERSION_MINOR}(${BUILD_TYPE}):${BUILD_STRING} 287f1de4c8fSPeiyuan Song 2888fd9d4d5SAntonio Nino Diazifeq (${AARCH32_INSTRUCTION_SET},A32) 2898fd9d4d5SAntonio Nino DiazTF_CFLAGS_aarch32 += -marm 2908fd9d4d5SAntonio Nino Diazelse ifeq (${AARCH32_INSTRUCTION_SET},T32) 2918fd9d4d5SAntonio Nino DiazTF_CFLAGS_aarch32 += -mthumb 2928fd9d4d5SAntonio Nino Diazelse 2938fd9d4d5SAntonio Nino Diaz$(error Error: Unknown AArch32 instruction set ${AARCH32_INSTRUCTION_SET}) 2948fd9d4d5SAntonio Nino Diazendif 2958fd9d4d5SAntonio Nino Diaz 296a9c4dde3SSandrine BailleuxTF_CFLAGS_aarch32 += -mno-unaligned-access 297d5461857Sdp-armTF_CFLAGS_aarch64 += -mgeneral-regs-only -mstrict-align 2989d29c227SSoby Mathew 2999fc59639SAlexei Fedorovifneq (${BP_OPTION},none) 3009fc59639SAlexei FedorovTF_CFLAGS_aarch64 += -mbranch-protection=${BP_OPTION} 3019fc59639SAlexei Fedorovendif 3029fc59639SAlexei Fedorov 30326e63c44SEtienne CarriereASFLAGS_aarch32 = $(march32-directive) 304fa6f774bSAlexei FedorovASFLAGS_aarch64 = $(march64-directive) 305b86048c4SAntonio Nino Diaz 3069ab81b5eSJustin Chadwell# General warnings 3079ab81b5eSJustin ChadwellWARNINGS := -Wall -Wmissing-include-dirs -Wunused \ 308b7f6525dSJustin Chadwell -Wdisabled-optimization -Wvla -Wshadow \ 309ca661a00SMadhukar Pappireddy -Wno-unused-parameter -Wredundant-decls 3109ab81b5eSJustin Chadwell 3119ab81b5eSJustin Chadwell# Additional warnings 3129ab81b5eSJustin Chadwell# Level 1 313e7c645b5SYann GautierWARNING1 := -Wextra 314e7c645b5SYann GautierWARNING1 += -Wmissing-format-attribute 315e7c645b5SYann GautierWARNING1 += -Wmissing-prototypes 316e7c645b5SYann GautierWARNING1 += -Wold-style-definition 317e7c645b5SYann Gautier 318b7f6525dSJustin Chadwell# Level 2 319e7c645b5SYann GautierWARNING2 := -Waggregate-return 320e7c645b5SYann GautierWARNING2 += -Wcast-align 321e7c645b5SYann GautierWARNING2 += -Wnested-externs 322e7c645b5SYann Gautier 323e7c645b5SYann GautierWARNING3 := -Wbad-function-cast 324e7c645b5SYann GautierWARNING3 += -Wcast-qual 325e7c645b5SYann GautierWARNING3 += -Wconversion 326e7c645b5SYann GautierWARNING3 += -Wpacked 327e7c645b5SYann GautierWARNING3 += -Wpointer-arith 328e7c645b5SYann GautierWARNING3 += -Wswitch-default 329e7c645b5SYann Gautier 330e7c645b5SYann Gautierifeq (${W},1) 3319ab81b5eSJustin ChadwellWARNINGS += $(WARNING1) 332e7c645b5SYann Gautierelse ifeq (${W},2) 3339ab81b5eSJustin ChadwellWARNINGS += $(WARNING1) $(WARNING2) 334e7c645b5SYann Gautierelse ifeq (${W},3) 3359ab81b5eSJustin ChadwellWARNINGS += $(WARNING1) $(WARNING2) $(WARNING3) 336e7c645b5SYann Gautierendif 337e7c645b5SYann Gautier 3389ab81b5eSJustin Chadwell# Compiler specific warnings 33900296576SAmbroise Vincentifeq ($(findstring clang,$(notdir $(CC))),) 34093c690ebSJustin Chadwell# not using clang 341d7b4cd41SJustin ChadwellWARNINGS += -Wunused-but-set-variable -Wmaybe-uninitialized \ 342d7b4cd41SJustin Chadwell -Wpacked-bitfield-compat -Wshift-overflow=2 \ 343d7b4cd41SJustin Chadwell -Wlogical-op 34493c690ebSJustin Chadwellelse 34593c690ebSJustin Chadwell# using clang 346d7b4cd41SJustin ChadwellWARNINGS += -Wshift-overflow -Wshift-sign-overflow \ 347d7b4cd41SJustin Chadwell -Wlogical-op-parentheses 34800296576SAmbroise Vincentendif 34900296576SAmbroise Vincent 3506336b07aSYann Gautierifneq (${E},0) 3516336b07aSYann GautierERRORS := -Werror 3526336b07aSYann Gautierendif 3536336b07aSYann Gautier 354ea7a57a3SRoberto VargasCPPFLAGS = ${DEFINES} ${INCLUDES} ${MBEDTLS_INC} -nostdinc \ 3559ab81b5eSJustin Chadwell $(ERRORS) $(WARNINGS) 35659de5096SMasahiro YamadaASFLAGS += $(CPPFLAGS) $(ASFLAGS_$(ARCH)) \ 357d5dfdeb6SJulius Werner -ffreestanding -Wa,--fatal-warnings 35859de5096SMasahiro YamadaTF_CFLAGS += $(CPPFLAGS) $(TF_CFLAGS_$(ARCH)) \ 359ebd6efaeSSamuel Holland -ffunction-sections -fdata-sections \ 360ebd6efaeSSamuel Holland -ffreestanding -fno-builtin -fno-common \ 361ebd6efaeSSamuel Holland -Os -std=gnu99 36273c99d4eSJuan Castillo 3631f461979SJustin Chadwellifeq (${SANITIZE_UB},on) 3641f461979SJustin ChadwellTF_CFLAGS += -fsanitize=undefined -fno-sanitize-recover 3651f461979SJustin Chadwellendif 3661f461979SJustin Chadwellifeq (${SANITIZE_UB},trap) 3671f461979SJustin ChadwellTF_CFLAGS += -fsanitize=undefined -fno-sanitize-recover \ 3681f461979SJustin Chadwell -fsanitize-undefined-trap-on-error 3691f461979SJustin Chadwellendif 3701f461979SJustin Chadwell 371f7ec31dbSdavid cunadoGCC_V_OUTPUT := $(shell $(CC) -v 2>&1) 372f7ec31dbSdavid cunado 373641f16e7SAmbroise Vincent# LD = armlink 374c2ad38ceSVarun Wadekarifneq ($(findstring armlink,$(notdir $(LD))),) 375c2ad38ceSVarun WadekarTF_LDFLAGS += --diag_error=warning --lto_level=O1 376c2ad38ceSVarun WadekarTF_LDFLAGS += --remove --info=unused,unusedsymbols 377edbce9aaSzelalem-awekeTF_LDFLAGS += $(TF_LDFLAGS_$(ARCH)) 378641f16e7SAmbroise Vincent 379641f16e7SAmbroise Vincent# LD = gcc (used when GCC LTO is enabled) 380edbce9aaSzelalem-awekeelse ifneq ($(findstring gcc,$(notdir $(LD))),) 381edbce9aaSzelalem-aweke# Pass ld options with Wl or Xlinker switches 382edbce9aaSzelalem-awekeTF_LDFLAGS += -Wl,--fatal-warnings -O1 383edbce9aaSzelalem-awekeTF_LDFLAGS += -Wl,--gc-sections 384edbce9aaSzelalem-awekeifeq ($(ENABLE_LTO),1) 385edbce9aaSzelalem-aweke ifeq (${ARCH},aarch64) 386edbce9aaSzelalem-aweke TF_LDFLAGS += -flto -fuse-linker-plugin 387edbce9aaSzelalem-aweke endif 388edbce9aaSzelalem-awekeendif 389edbce9aaSzelalem-aweke# GCC automatically adds fix-cortex-a53-843419 flag when used to link 390edbce9aaSzelalem-aweke# which breaks some builds, so disable if errata fix is not explicitly enabled 391edbce9aaSzelalem-awekeifneq (${ERRATA_A53_843419},1) 392edbce9aaSzelalem-aweke TF_LDFLAGS += -mno-fix-cortex-a53-843419 393edbce9aaSzelalem-awekeendif 394edbce9aaSzelalem-awekeTF_LDFLAGS += -nostdlib 395edbce9aaSzelalem-awekeTF_LDFLAGS += $(subst --,-Xlinker --,$(TF_LDFLAGS_$(ARCH))) 396641f16e7SAmbroise Vincent 397641f16e7SAmbroise Vincent# LD = gcc-ld (ld) or llvm-ld (ld.lld) or other 398c2ad38ceSVarun Wadekarelse 399c2b8806fSDouglas RaillardTF_LDFLAGS += --fatal-warnings -O1 400c2b8806fSDouglas RaillardTF_LDFLAGS += --gc-sections 401641f16e7SAmbroise Vincent# ld.lld doesn't recognize the errata flags, 402641f16e7SAmbroise Vincent# therefore don't add those in that case 403641f16e7SAmbroise Vincentifeq ($(findstring ld.lld,$(notdir $(LD))),) 404c2b8806fSDouglas RaillardTF_LDFLAGS += $(TF_LDFLAGS_$(ARCH)) 405edbce9aaSzelalem-awekeendif 406641f16e7SAmbroise Vincentendif 40773c99d4eSJuan Castillo 40803b397a8SNishanth MenonDTC_FLAGS += -I dts -O dtb 409a6de824fSLouis MayencourtDTC_CPPFLAGS += -P -nostdinc -Iinclude -Ifdts -undef \ 410a6de824fSLouis Mayencourt -x assembler-with-cpp $(DEFINES) 41103b397a8SNishanth Menon 4120ab49645SAlexei Fedorovifeq ($(MEASURED_BOOT),1) 4130ab49645SAlexei FedorovDTC_CPPFLAGS += -DMEASURED_BOOT -DBL2_HASH_SIZE=${TCG_DIGEST_SIZE} 4140ab49645SAlexei Fedorovendif 4150ab49645SAlexei Fedorov 41673c99d4eSJuan Castillo################################################################################ 41773c99d4eSJuan Castillo# Common sources and include directories 41873c99d4eSJuan Castillo################################################################################ 419d801fbb0Sdp-arminclude lib/compiler-rt/compiler-rt.mk 42073c99d4eSJuan Castillo 42173c99d4eSJuan CastilloBL_COMMON_SOURCES += common/bl_common.c \ 4227f56e9a3SSoby Mathew common/tf_log.c \ 4239d29c227SSoby Mathew common/${ARCH}/debug.S \ 42491b48c9fSJulius Werner drivers/console/multi_console.c \ 4259d29c227SSoby Mathew lib/${ARCH}/cache_helpers.S \ 4269d29c227SSoby Mathew lib/${ARCH}/misc_helpers.S \ 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 DiazBL_COMMON_SOURCES += lib/${ARCH}/armclang_printf.S 4358422a840SAntonio Nino Diazendif 4368422a840SAntonio Nino Diaz 4371f461979SJustin Chadwellifeq (${SANITIZE_UB},on) 4381f461979SJustin ChadwellBL_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################################################################################ 45173c99d4eSJuan Castillo# Generic definitions 45273c99d4eSJuan Castillo################################################################################ 45373c99d4eSJuan Castillo 454231c1470SEvan Lloydinclude ${MAKE_HELPERS_DIRECTORY}plat_helpers.mk 455231c1470SEvan Lloyd 45673c99d4eSJuan CastilloBUILD_BASE := ./build 45773c99d4eSJuan CastilloBUILD_PLAT := ${BUILD_BASE}/${PLAT}/${BUILD_TYPE} 45873c99d4eSJuan Castillo 459231c1470SEvan LloydSPDS := $(sort $(filter-out none, $(patsubst services/spd/%,%,$(wildcard services/spd/*)))) 46073c99d4eSJuan Castillo 46173c99d4eSJuan Castillo# Platforms providing their own TBB makefile may override this value 46273c99d4eSJuan CastilloINCLUDE_TBBR_MK := 1 46373c99d4eSJuan Castillo 46473c99d4eSJuan Castillo 46573c99d4eSJuan Castillo################################################################################ 46673c99d4eSJuan Castillo# Include SPD Makefile if one has been specified 46773c99d4eSJuan Castillo################################################################################ 46873c99d4eSJuan Castillo 46973c99d4eSJuan Castilloifneq (${SPD},none) 4709d29c227SSoby Mathew ifeq (${ARCH},aarch32) 4719d29c227SSoby Mathew $(error "Error: SPD is incompatible with AArch32.") 4729d29c227SSoby Mathew endif 47328f39f02SMax Shvetsov 4744c117f6cSSandrine Bailleux ifdef EL3_PAYLOAD_BASE 4754c117f6cSSandrine Bailleux $(warning "SPD and EL3_PAYLOAD_BASE are incompatible build options.") 4764c117f6cSSandrine Bailleux $(warning "The SPD and its BL32 companion will be present but ignored.") 4774c117f6cSSandrine Bailleux endif 47828f39f02SMax Shvetsov 479c3fb00d9SAchin Gupta ifeq (${SPD},spmd) 480033039f8SMax Shvetsov $(warning "SPMD is an experimental feature") 481c3fb00d9SAchin Gupta # SPMD is located in std_svc directory 482c3fb00d9SAchin Gupta SPD_DIR := std_svc 48328f39f02SMax Shvetsov 484033039f8SMax Shvetsov ifeq ($(SPMD_SPM_AT_SEL2),1) 48528f39f02SMax Shvetsov ifeq ($(CTX_INCLUDE_EL2_REGS),0) 486033039f8SMax Shvetsov $(error SPMD with SPM at S-EL2 requires CTX_INCLUDE_EL2_REGS option) 487033039f8SMax Shvetsov endif 48828f39f02SMax Shvetsov endif 489c3fb00d9SAchin Gupta else 490c3fb00d9SAchin Gupta # All other SPDs in spd directory 491c3fb00d9SAchin Gupta SPD_DIR := spd 492c3fb00d9SAchin Gupta endif 493c3fb00d9SAchin Gupta 49473c99d4eSJuan Castillo # We expect to locate an spd.mk under the specified SPD directory 495c3fb00d9SAchin Gupta SPD_MAKE := $(wildcard services/${SPD_DIR}/${SPD}/${SPD}.mk) 496c3fb00d9SAchin Gupta 49773c99d4eSJuan Castillo ifeq (${SPD_MAKE},) 498c3fb00d9SAchin Gupta $(error Error: No services/${SPD_DIR}/${SPD}/${SPD}.mk located) 49973c99d4eSJuan Castillo endif 50073c99d4eSJuan Castillo $(info Including ${SPD_MAKE}) 50173c99d4eSJuan Castillo include ${SPD_MAKE} 50273c99d4eSJuan Castillo 50370d1fc53SJuan Castillo # If there's BL32 companion for the chosen SPD, we expect that the SPD's 50470d1fc53SJuan Castillo # Makefile would set NEED_BL32 to "yes". In this case, the build system 50570d1fc53SJuan Castillo # supports two mutually exclusive options: 50670d1fc53SJuan Castillo # * BL32 is built from source: then BL32_SOURCES must contain the list 50770d1fc53SJuan Castillo # of source files to build BL32 50870d1fc53SJuan Castillo # * BL32 is a prebuilt binary: then BL32 must point to the image file 50970d1fc53SJuan Castillo # that will be included in the FIP 51070d1fc53SJuan Castillo # If both BL32_SOURCES and BL32 are defined, the binary takes precedence 51170d1fc53SJuan Castillo # over the sources. 512e35c4045SJeenu Viswambharanendif 513e35c4045SJeenu Viswambharan 51451faada7SDouglas Raillard################################################################################ 51573c99d4eSJuan Castillo# Include the platform specific Makefile after the SPD Makefile (the platform 51673c99d4eSJuan Castillo# makefile may use all previous definitions in this file) 51773c99d4eSJuan Castillo################################################################################ 5182da8d8bfSJeenu Viswambharan 51973c99d4eSJuan Castilloinclude ${PLAT_MAKEFILE_FULL} 5200f21c547SJuan Castillo 5218012cc5cSMasahiro Yamada$(eval $(call MAKE_PREREQ_DIR,${BUILD_PLAT})) 5228012cc5cSMasahiro Yamada 52326e63c44SEtienne Carriereifeq (${ARM_ARCH_MAJOR},7) 52426e63c44SEtienne Carriereinclude make_helpers/armv7-a-cpus.mk 52526e63c44SEtienne Carriereendif 52626e63c44SEtienne Carriere 5273bd17c0fSSoby MathewPIE_FOUND := $(findstring --enable-default-pie,${GCC_V_OUTPUT}) 5283bd17c0fSSoby Mathewifneq ($(PIE_FOUND),) 5293bd17c0fSSoby Mathew TF_CFLAGS += -fno-PIE 5303bd17c0fSSoby Mathewendif 531320920c1SMasahiro Yamada 532320920c1SMasahiro Yamadaifneq ($(findstring gcc,$(notdir $(LD))),) 533320920c1SMasahiro Yamada PIE_LDFLAGS += -Wl,-pie -Wl,--no-dynamic-linker 534320920c1SMasahiro Yamadaelse 535320920c1SMasahiro Yamada PIE_LDFLAGS += -pie --no-dynamic-linker 536320920c1SMasahiro Yamadaendif 537320920c1SMasahiro Yamada 538320920c1SMasahiro Yamadaifeq ($(ENABLE_PIE),1) 53969af7fcfSMasahiro Yamadaifeq ($(BL2_AT_EL3),1) 54069af7fcfSMasahiro Yamadaifneq ($(BL2_IN_XIP_MEM),1) 54169af7fcfSMasahiro Yamada BL2_CFLAGS += -fpie 54269af7fcfSMasahiro Yamada BL2_LDFLAGS += $(PIE_LDFLAGS) 54369af7fcfSMasahiro Yamadaendif 54469af7fcfSMasahiro Yamadaendif 545320920c1SMasahiro Yamada BL31_CFLAGS += -fpie 546320920c1SMasahiro Yamada BL31_LDFLAGS += $(PIE_LDFLAGS) 547d974301dSMasahiro Yamadaifeq ($(ARCH),aarch64) 548d974301dSMasahiro Yamada BL32_CFLAGS += -fpie 549d974301dSMasahiro Yamada BL32_LDFLAGS += $(PIE_LDFLAGS) 550d974301dSMasahiro Yamadaendif 5513bd17c0fSSoby Mathewendif 5523bd17c0fSSoby Mathew 553d5e97a1dSMasahiro Yamadaifeq (${ARCH},aarch64) 5549cefb4b1SMasahiro YamadaBL1_CPPFLAGS += -DIMAGE_AT_EL3 555d5e97a1dSMasahiro Yamadaifeq ($(BL2_AT_EL3),1) 5569cefb4b1SMasahiro YamadaBL2_CPPFLAGS += -DIMAGE_AT_EL3 557d5e97a1dSMasahiro Yamadaelse 5589cefb4b1SMasahiro YamadaBL2_CPPFLAGS += -DIMAGE_AT_EL1 559d5e97a1dSMasahiro Yamadaendif 5609cefb4b1SMasahiro YamadaBL2U_CPPFLAGS += -DIMAGE_AT_EL1 5619cefb4b1SMasahiro YamadaBL31_CPPFLAGS += -DIMAGE_AT_EL3 5629cefb4b1SMasahiro YamadaBL32_CPPFLAGS += -DIMAGE_AT_EL1 563d5e97a1dSMasahiro Yamadaendif 564d5e97a1dSMasahiro Yamada 56554035fc4SSandrine Bailleux# Include the CPU specific operations makefile, which provides default 56654035fc4SSandrine Bailleux# values for all CPU errata workarounds and CPU specific optimisations. 56754035fc4SSandrine Bailleux# This can be overridden by the platform. 56873c99d4eSJuan Castilloinclude lib/cpus/cpu-ops.mk 5694f6ad66aSAchin Gupta 570a4409008Sdp-armifeq (${ARCH},aarch32) 571a4409008Sdp-armNEED_BL32 := yes 572a4409008Sdp-arm 573a4409008Sdp-arm################################################################################ 574a4409008Sdp-arm# Build `AARCH32_SP` as BL32 image for AArch32 575a4409008Sdp-arm################################################################################ 576a4409008Sdp-armifneq (${AARCH32_SP},none) 577a4409008Sdp-arm# We expect to locate an sp.mk under the specified AARCH32_SP directory 578a4409008Sdp-armAARCH32_SP_MAKE := $(wildcard bl32/${AARCH32_SP}/${AARCH32_SP}.mk) 579a4409008Sdp-arm 580a4409008Sdp-armifeq (${AARCH32_SP_MAKE},) 581a4409008Sdp-arm $(error Error: No bl32/${AARCH32_SP}/${AARCH32_SP}.mk located) 582a4409008Sdp-armendif 583a4409008Sdp-arm 584a4409008Sdp-arm$(info Including ${AARCH32_SP_MAKE}) 585a4409008Sdp-arminclude ${AARCH32_SP_MAKE} 586a4409008Sdp-armendif 587a4409008Sdp-arm 588a4409008Sdp-armendif 5894f6ad66aSAchin Gupta 59073c99d4eSJuan Castillo################################################################################ 59177f1f7a1SVarun Wadekar# Include libc if not overridden 59277f1f7a1SVarun Wadekar################################################################################ 59377f1f7a1SVarun Wadekarifeq (${OVERRIDE_LIBC},0) 59477f1f7a1SVarun Wadekarinclude lib/libc/libc.mk 59577f1f7a1SVarun Wadekarendif 59677f1f7a1SVarun Wadekar 59777f1f7a1SVarun Wadekar################################################################################ 598cf2c8a33SAntonio Nino Diaz# Check incompatible options 599cf2c8a33SAntonio Nino Diaz################################################################################ 600cf2c8a33SAntonio Nino Diaz 601cf2c8a33SAntonio Nino Diazifdef EL3_PAYLOAD_BASE 60268450a6dSAntonio Nino Diaz ifdef PRELOADED_BL33_BASE 60368450a6dSAntonio Nino Diaz $(warning "PRELOADED_BL33_BASE and EL3_PAYLOAD_BASE are \ 60468450a6dSAntonio Nino Diaz incompatible build options. EL3_PAYLOAD_BASE has priority.") 605cf2c8a33SAntonio Nino Diaz endif 60676580f3dSQixiang Xu ifneq (${GENERATE_COT},0) 60776580f3dSQixiang Xu $(error "GENERATE_COT and EL3_PAYLOAD_BASE are incompatible build options.") 60876580f3dSQixiang Xu endif 60976580f3dSQixiang Xu ifneq (${TRUSTED_BOARD_BOOT},0) 61076580f3dSQixiang Xu $(error "TRUSTED_BOARD_BOOT and EL3_PAYLOAD_BASE are incompatible build options.") 61176580f3dSQixiang Xu endif 612cf2c8a33SAntonio Nino Diazendif 613cf2c8a33SAntonio Nino Diaz 614cf2c8a33SAntonio Nino Diazifeq (${NEED_BL33},yes) 615cf2c8a33SAntonio Nino Diaz ifdef EL3_PAYLOAD_BASE 616cf2c8a33SAntonio Nino Diaz $(warning "BL33 image is not needed when option \ 617cf2c8a33SAntonio Nino Diaz BL33_PAYLOAD_BASE is used and won't be added to the FIP file.") 618cf2c8a33SAntonio Nino Diaz endif 61968450a6dSAntonio Nino Diaz ifdef PRELOADED_BL33_BASE 62068450a6dSAntonio Nino Diaz $(warning "BL33 image is not needed when option \ 62168450a6dSAntonio Nino Diaz PRELOADED_BL33_BASE is used and won't be added to the FIP \ 62268450a6dSAntonio Nino Diaz file.") 623cf2c8a33SAntonio Nino Diaz endif 624cf2c8a33SAntonio Nino Diazendif 625cf2c8a33SAntonio Nino Diaz 626d4593e47SJeenu Viswambharan# When building for systems with hardware-assisted coherency, there's no need to 627d4593e47SJeenu Viswambharan# use USE_COHERENT_MEM. Require that USE_COHERENT_MEM must be set to 0 too. 628d4593e47SJeenu Viswambharanifeq ($(HW_ASSISTED_COHERENCY)-$(USE_COHERENT_MEM),1-1) 629d4593e47SJeenu Viswambharan$(error USE_COHERENT_MEM cannot be enabled with HW_ASSISTED_COHERENCY) 630d4593e47SJeenu Viswambharanendif 6311a0a3f06SYatharth Kochar 6327d173fc5SJiafei Pan#For now, BL2_IN_XIP_MEM is only supported when BL2_AT_EL3 is 1. 6337d173fc5SJiafei Panifeq ($(BL2_AT_EL3)-$(BL2_IN_XIP_MEM),0-1) 6347d173fc5SJiafei Pan$(error "BL2_IN_XIP_MEM is only supported when BL2_AT_EL3 is enabled") 6357d173fc5SJiafei Panendif 6367d173fc5SJiafei Pan 63714c6016aSJeenu Viswambharan# For RAS_EXTENSION, require that EAs are handled in EL3 first 63814c6016aSJeenu Viswambharanifeq ($(RAS_EXTENSION),1) 63914c6016aSJeenu Viswambharan ifneq ($(HANDLE_EA_EL3_FIRST),1) 64014c6016aSJeenu Viswambharan $(error For RAS_EXTENSION, HANDLE_EA_EL3_FIRST must also be 1) 64114c6016aSJeenu Viswambharan endif 64214c6016aSJeenu Viswambharanendif 64314c6016aSJeenu Viswambharan 6441a7c1cfeSJeenu Viswambharan# When FAULT_INJECTION_SUPPORT is used, require that RAS_EXTENSION is enabled 6451a7c1cfeSJeenu Viswambharanifeq ($(FAULT_INJECTION_SUPPORT),1) 6461a7c1cfeSJeenu Viswambharan ifneq ($(RAS_EXTENSION),1) 6471a7c1cfeSJeenu Viswambharan $(error For FAULT_INJECTION_SUPPORT, RAS_EXTENSION must also be 1) 6481a7c1cfeSJeenu Viswambharan endif 6491a7c1cfeSJeenu Viswambharanendif 6501a7c1cfeSJeenu Viswambharan 651ed51b51fSRoberto Vargas# DYN_DISABLE_AUTH can be set only when TRUSTED_BOARD_BOOT=1 652209a60ccSSoby Mathewifeq ($(DYN_DISABLE_AUTH), 1) 653209a60ccSSoby Mathew ifeq (${TRUSTED_BOARD_BOOT}, 0) 654209a60ccSSoby Mathew $(error "TRUSTED_BOARD_BOOT must be enabled for DYN_DISABLE_AUTH to be set.") 655209a60ccSSoby Mathew endif 656209a60ccSSoby Mathewendif 657209a60ccSSoby Mathew 658cbf9e84aSBalint Dobszay# SDEI_IN_FCONF is only supported when SDEI_SUPPORT is enabled. 659cbf9e84aSBalint Dobszayifeq ($(SDEI_SUPPORT)-$(SDEI_IN_FCONF),0-1) 660cbf9e84aSBalint Dobszay$(error "SDEI_IN_FCONF is an experimental feature and is only supported when \ 661cbf9e84aSBalint Dobszay SDEI_SUPPORT is enabled") 662cbf9e84aSBalint Dobszayendif 663cbf9e84aSBalint Dobszay 664b86048c4SAntonio Nino Diaz# If pointer authentication is used in the firmware, make sure that all the 6659fc59639SAlexei Fedorov# registers associated to it are also saved and restored. 6669fc59639SAlexei Fedorov# Not doing it would leak the value of the keys used by EL3 to EL1 and S-EL1. 667b86048c4SAntonio Nino Diazifeq ($(ENABLE_PAUTH),1) 6689fc59639SAlexei Fedorov ifeq ($(CTX_INCLUDE_PAUTH_REGS),0) 6699fc59639SAlexei Fedorov $(error Pointer Authentication requires CTX_INCLUDE_PAUTH_REGS=1) 67006715f85SAlexei Fedorov endif 6719fc59639SAlexei Fedorovendif 6729fc59639SAlexei Fedorov 67306715f85SAlexei Fedorovifeq ($(CTX_INCLUDE_PAUTH_REGS),1) 6749fc59639SAlexei Fedorov ifneq (${ARCH},aarch64) 6759fc59639SAlexei Fedorov $(error CTX_INCLUDE_PAUTH_REGS requires AArch64) 676dfc66a17SJohn Tsichritzis else 67706715f85SAlexei Fedorov $(info CTX_INCLUDE_PAUTH_REGS is an experimental feature) 678b86048c4SAntonio Nino Diaz endif 679b86048c4SAntonio Nino Diazendif 6809fc59639SAlexei Fedorov 6819fc59639SAlexei Fedorovifeq ($(ENABLE_PAUTH),1) 6829fc59639SAlexei Fedorov $(info Pointer Authentication is an experimental feature) 6839fc59639SAlexei Fedorovendif 6849fc59639SAlexei Fedorov 6859fc59639SAlexei Fedorovifeq ($(ENABLE_BTI),1) 6869fc59639SAlexei Fedorov $(info Branch Protection is an experimental feature) 687dfc66a17SJohn Tsichritzisendif 688b86048c4SAntonio Nino Diaz 6899dd94382SJustin Chadwellifeq ($(CTX_INCLUDE_MTE_REGS),1) 6909dd94382SJustin Chadwell ifneq (${ARCH},aarch64) 6919dd94382SJustin Chadwell $(error CTX_INCLUDE_MTE_REGS requires AArch64) 6929dd94382SJustin Chadwell else 6939dd94382SJustin Chadwell $(info CTX_INCLUDE_MTE_REGS is an experimental feature) 6949dd94382SJustin Chadwell endif 6959dd94382SJustin Chadwellendif 6969dd94382SJustin Chadwell 6978c105290SAlexei Fedorovifeq ($(MEASURED_BOOT),1) 6988c105290SAlexei Fedorov ifneq (${TRUSTED_BOARD_BOOT},1) 6997cda17bbSSumit Garg $(error MEASURED_BOOT requires TRUSTED_BOARD_BOOT=1) 7008c105290SAlexei Fedorov else 7018c105290SAlexei Fedorov $(info MEASURED_BOOT is an experimental feature) 7028c105290SAlexei Fedorov endif 7038c105290SAlexei Fedorovendif 7048c105290SAlexei Fedorov 70560e8f3cfSPetre-Ionut Tudorifeq (${ARM_XLAT_TABLES_LIB_V1}, 1) 70660e8f3cfSPetre-Ionut Tudor ifeq (${ALLOW_RO_XLAT_TABLES}, 1) 70760e8f3cfSPetre-Ionut Tudor $(error "ALLOW_RO_XLAT_TABLES requires translation tables library v2") 70860e8f3cfSPetre-Ionut Tudor endif 70960e8f3cfSPetre-Ionut Tudorendif 71060e8f3cfSPetre-Ionut Tudor 7117cda17bbSSumit Gargifneq (${DECRYPTION_SUPPORT},none) 7127cda17bbSSumit Garg ifeq (${TRUSTED_BOARD_BOOT}, 0) 7137cda17bbSSumit Garg $(error TRUSTED_BOARD_BOOT must be enabled for DECRYPTION_SUPPORT to be set) 7147cda17bbSSumit Garg else 7157cda17bbSSumit Garg $(info DECRYPTION_SUPPORT is an experimental feature) 7167cda17bbSSumit Garg endif 7177cda17bbSSumit Gargendif 7187cda17bbSSumit Garg 719cf2c8a33SAntonio Nino Diaz################################################################################ 72073c99d4eSJuan Castillo# Process platform overrideable behaviour 72173c99d4eSJuan Castillo################################################################################ 7224f6ad66aSAchin Gupta 723bd97f83aSJohn Tsichritzis# Using BL2 implies that a BL33 image also needs to be supplied for the FIP and 724bd97f83aSJohn Tsichritzis# Certificate generation tools. This flag can be overridden by the platform. 72573c99d4eSJuan Castilloifdef BL2_SOURCES 726cf2c8a33SAntonio Nino Diaz ifdef EL3_PAYLOAD_BASE 727cf2c8a33SAntonio Nino Diaz # If booting an EL3 payload there is no need for a BL33 image 728cf2c8a33SAntonio Nino Diaz # in the FIP file. 7294c117f6cSSandrine Bailleux NEED_BL33 := no 730cf2c8a33SAntonio Nino Diaz else 73168450a6dSAntonio Nino Diaz ifdef PRELOADED_BL33_BASE 732cf2c8a33SAntonio Nino Diaz # If booting a BL33 preloaded image there is no need of 733cf2c8a33SAntonio Nino Diaz # another one in the FIP file. 734cf2c8a33SAntonio Nino Diaz NEED_BL33 := no 735cf2c8a33SAntonio Nino Diaz else 736cf2c8a33SAntonio Nino Diaz NEED_BL33 ?= yes 737cf2c8a33SAntonio Nino Diaz endif 7384c117f6cSSandrine Bailleux endif 73973c99d4eSJuan Castilloendif 7406f971622SJuan Castillo 7414d045d0eSMasahiro Yamada# If SCP_BL2 is given, we always want FIP to include it. 7424d045d0eSMasahiro Yamadaifdef SCP_BL2 7434d045d0eSMasahiro Yamada NEED_SCP_BL2 := yes 7444d045d0eSMasahiro Yamadaendif 7454d045d0eSMasahiro Yamada 7465744e874SSoby Mathew# For AArch32, BL31 is not currently supported. 7475744e874SSoby Mathewifneq (${ARCH},aarch32) 7485744e874SSoby Mathew ifdef BL31_SOURCES 7495744e874SSoby Mathew # When booting an EL3 payload, there is no need to compile the BL31 image nor 7505744e874SSoby Mathew # put it in the FIP. 7515744e874SSoby Mathew ifndef EL3_PAYLOAD_BASE 7525744e874SSoby Mathew NEED_BL31 := yes 7535744e874SSoby Mathew endif 7545744e874SSoby Mathew endif 7555744e874SSoby Mathewendif 7565744e874SSoby Mathew 75773c99d4eSJuan Castillo# Process TBB related flags 7586f971622SJuan Castilloifneq (${GENERATE_COT},0) 75973c99d4eSJuan Castillo # Common cert_create options 7606f971622SJuan Castillo ifneq (${CREATE_KEYS},0) 7616f971622SJuan Castillo $(eval CRT_ARGS += -n) 7620191262dSYatharth Kochar $(eval FWU_CRT_ARGS += -n) 763fd34e7baSJuan Castillo ifneq (${SAVE_KEYS},0) 764fd34e7baSJuan Castillo $(eval CRT_ARGS += -k) 7650191262dSYatharth Kochar $(eval FWU_CRT_ARGS += -k) 766fd34e7baSJuan Castillo endif 7676f971622SJuan Castillo endif 76873c99d4eSJuan Castillo # Include TBBR makefile (unless the platform indicates otherwise) 76973c99d4eSJuan Castillo ifeq (${INCLUDE_TBBR_MK},1) 77073c99d4eSJuan Castillo include make_helpers/tbbr/tbbr_tools.mk 77173c99d4eSJuan Castillo endif 7726f971622SJuan Castilloendif 7736f971622SJuan Castillo 7741c75d5dfSMasahiro Yamadaifneq (${FIP_ALIGN},0) 7751c75d5dfSMasahiro YamadaFIP_ARGS += --align ${FIP_ALIGN} 7761c75d5dfSMasahiro Yamadaendif 7771c75d5dfSMasahiro Yamada 77873c99d4eSJuan Castillo################################################################################ 77946e5e035SMichalis Pappas# Include libraries' Makefile that are used in all BL 78046e5e035SMichalis Pappas################################################################################ 78146e5e035SMichalis Pappas 78246e5e035SMichalis Pappasinclude lib/stack_protector/stack_protector.mk 78346e5e035SMichalis Pappas 78446e5e035SMichalis Pappas################################################################################ 785819281eeSdp-arm# Auxiliary tools (fiptool, cert_create, etc) 78673c99d4eSJuan Castillo################################################################################ 78773c99d4eSJuan Castillo 78873c99d4eSJuan Castillo# Variables for use with Certificate Generation Tool 78973c99d4eSJuan CastilloCRTTOOLPATH ?= tools/cert_create 79042a45b51SEvan LloydCRTTOOL ?= ${CRTTOOLPATH}/cert_create${BIN_EXT} 79173c99d4eSJuan Castillo 79290aa901fSSumit Garg# Variables for use with Firmware Encryption Tool 79390aa901fSSumit GargENCTOOLPATH ?= tools/encrypt_fw 79490aa901fSSumit GargENCTOOL ?= ${ENCTOOLPATH}/encrypt_fw${BIN_EXT} 79590aa901fSSumit Garg 79673c99d4eSJuan Castillo# Variables for use with Firmware Image Package 797819281eeSdp-armFIPTOOLPATH ?= tools/fiptool 798819281eeSdp-armFIPTOOL ?= ${FIPTOOLPATH}/fiptool${BIN_EXT} 79973c99d4eSJuan Castillo 80026010da1SAntonio Nino Diaz# Variables for use with sptool 80126010da1SAntonio Nino DiazSPTOOLPATH ?= tools/sptool 80226010da1SAntonio Nino DiazSPTOOL ?= ${SPTOOLPATH}/sptool${BIN_EXT} 803ce2b1ec6SManish PandeySP_MK_GEN ?= ${SPTOOLPATH}/sp_mk_generator.py 80426010da1SAntonio Nino Diaz 8055accce5bSRoberto Vargas# Variables for use with ROMLIB 8065accce5bSRoberto VargasROMLIBPATH ?= lib/romlib 8075accce5bSRoberto Vargas 808cfe83910SLouis Mayencourt# Variable for use with Python 809cfe83910SLouis MayencourtPYTHON ?= python3 810cfe83910SLouis Mayencourt 811cfe83910SLouis Mayencourt# Variables for use with PRINT_MEMORY_MAP 812cfe83910SLouis MayencourtPRINT_MEMORY_MAP_PATH ?= tools/memory 813cfe83910SLouis MayencourtPRINT_MEMORY_MAP ?= ${PRINT_MEMORY_MAP_PATH}/print_memory_map.py 814cfe83910SLouis Mayencourt 8156de32378SMadhukar Pappireddy# Variables for use with documentation build using Sphinx tool 8166de32378SMadhukar PappireddyDOCS_PATH ?= docs 8176de32378SMadhukar Pappireddy 8188a86052dSSoby Mathew################################################################################ 8198a86052dSSoby Mathew# Include BL specific makefiles 8208a86052dSSoby Mathew################################################################################ 8218a86052dSSoby Mathewifdef BL1_SOURCES 8228a86052dSSoby MathewNEED_BL1 := yes 8238a86052dSSoby Mathewinclude bl1/bl1.mk 8248a86052dSSoby Mathewendif 8258a86052dSSoby Mathew 8268a86052dSSoby Mathewifdef BL2_SOURCES 8278a86052dSSoby MathewNEED_BL2 := yes 8288a86052dSSoby Mathewinclude bl2/bl2.mk 8298a86052dSSoby Mathewendif 8308a86052dSSoby Mathew 8318a86052dSSoby Mathewifdef BL2U_SOURCES 8328a86052dSSoby MathewNEED_BL2U := yes 8338a86052dSSoby Mathewinclude bl2u/bl2u.mk 8348a86052dSSoby Mathewendif 8358a86052dSSoby Mathew 8365744e874SSoby Mathewifeq (${NEED_BL31},yes) 8378a86052dSSoby Mathewifdef BL31_SOURCES 8388a86052dSSoby Mathewinclude bl31/bl31.mk 8398a86052dSSoby Mathewendif 8408a86052dSSoby Mathewendif 8418a86052dSSoby Mathew 84203b397a8SNishanth Menonifdef FDT_SOURCES 84303b397a8SNishanth MenonNEED_FDT := yes 84403b397a8SNishanth Menonendif 84503b397a8SNishanth Menon 84673c99d4eSJuan Castillo################################################################################ 84773c99d4eSJuan Castillo# Build options checks 84873c99d4eSJuan Castillo################################################################################ 84973c99d4eSJuan Castillo 85060e8f3cfSPetre-Ionut Tudor$(eval $(call assert_boolean,ALLOW_RO_XLAT_TABLES)) 851a9bec67dSSandrine Bailleux$(eval $(call assert_boolean,COLD_BOOT_SINGLE_CPU)) 8522fae4b1eSJeenu Viswambharan$(eval $(call assert_boolean,CREATE_KEYS)) 8532fae4b1eSJeenu Viswambharan$(eval $(call assert_boolean,CTX_INCLUDE_AARCH32_REGS)) 8542fae4b1eSJeenu Viswambharan$(eval $(call assert_boolean,CTX_INCLUDE_FPREGS)) 8555283962eSAntonio Nino Diaz$(eval $(call assert_boolean,CTX_INCLUDE_PAUTH_REGS)) 8569dd94382SJustin Chadwell$(eval $(call assert_boolean,CTX_INCLUDE_MTE_REGS)) 85728f39f02SMax Shvetsov$(eval $(call assert_boolean,CTX_INCLUDE_EL2_REGS)) 8582fae4b1eSJeenu Viswambharan$(eval $(call assert_boolean,DEBUG)) 859209a60ccSSoby Mathew$(eval $(call assert_boolean,DYN_DISABLE_AUTH)) 860c8b55b8fSJeenu Viswambharan$(eval $(call assert_boolean,EL3_EXCEPTION_HANDLING)) 8610319a977SDimitris Papastamos$(eval $(call assert_boolean,ENABLE_AMU)) 862cc8b5632SAntonio Nino Diaz$(eval $(call assert_boolean,ENABLE_ASSERTIONS)) 8635f835918SJeenu Viswambharan$(eval $(call assert_boolean,ENABLE_MPAM_FOR_LOWER_ELS)) 8643bd17c0fSSoby Mathew$(eval $(call assert_boolean,ENABLE_PIE)) 865a31d8983SYatharth Kochar$(eval $(call assert_boolean,ENABLE_PMF)) 866170fb93dSYatharth Kochar$(eval $(call assert_boolean,ENABLE_PSCI_STAT)) 867872be88aSdp-arm$(eval $(call assert_boolean,ENABLE_RUNTIME_INSTRUMENTATION)) 868c1232c31SJeenu Viswambharan$(eval $(call assert_boolean,ENABLE_SPE_FOR_LOWER_ELS)) 8691a853370SDavid Cunado$(eval $(call assert_boolean,ENABLE_SVE_FOR_NS)) 8702fae4b1eSJeenu Viswambharan$(eval $(call assert_boolean,ERROR_DEPRECATED)) 8711a7c1cfeSJeenu Viswambharan$(eval $(call assert_boolean,FAULT_INJECTION_SUPPORT)) 8722fae4b1eSJeenu Viswambharan$(eval $(call assert_boolean,GENERATE_COT)) 87374dce7faSJeenu Viswambharan$(eval $(call assert_boolean,GICV2_G0_FOR_EL3)) 87476454abfSJeenu Viswambharan$(eval $(call assert_boolean,HANDLE_EA_EL3_FIRST)) 8753c251af3SJeenu Viswambharan$(eval $(call assert_boolean,HW_ASSISTED_COHERENCY)) 876b890b36dSLouis Mayencourt$(eval $(call assert_boolean,INVERTED_MEMMAP)) 8778c105290SAlexei Fedorov$(eval $(call assert_boolean,MEASURED_BOOT)) 8782fae4b1eSJeenu Viswambharan$(eval $(call assert_boolean,NS_TIMER_SWITCH)) 87977f1f7a1SVarun Wadekar$(eval $(call assert_boolean,OVERRIDE_LIBC)) 8802fae4b1eSJeenu Viswambharan$(eval $(call assert_boolean,PL011_GENERIC_UART)) 8812fae4b1eSJeenu Viswambharan$(eval $(call assert_boolean,PROGRAMMABLE_RESET_ADDRESS)) 8822fae4b1eSJeenu Viswambharan$(eval $(call assert_boolean,PSCI_EXTENDED_STATE_ID)) 88314c6016aSJeenu Viswambharan$(eval $(call assert_boolean,RAS_EXTENSION)) 8842fae4b1eSJeenu Viswambharan$(eval $(call assert_boolean,RESET_TO_BL31)) 8852fae4b1eSJeenu Viswambharan$(eval $(call assert_boolean,SAVE_KEYS)) 8862fae4b1eSJeenu Viswambharan$(eval $(call assert_boolean,SEPARATE_CODE_AND_RODATA)) 887f8578e64SSamuel Holland$(eval $(call assert_boolean,SEPARATE_NOBITS_REGION)) 8882fae4b1eSJeenu Viswambharan$(eval $(call assert_boolean,SPIN_ON_BL1_EXIT)) 8898855e52eSAntonio Nino Diaz$(eval $(call assert_boolean,SPM_MM)) 890033039f8SMax Shvetsov$(eval $(call assert_boolean,SPMD_SPM_AT_SEL2)) 8912fae4b1eSJeenu Viswambharan$(eval $(call assert_boolean,TRUSTED_BOARD_BOOT)) 8922fae4b1eSJeenu Viswambharan$(eval $(call assert_boolean,USE_COHERENT_MEM)) 8930ca3913dSOlivier Deprez$(eval $(call assert_boolean,USE_DEBUGFS)) 894a6de824fSLouis Mayencourt$(eval $(call assert_boolean,ARM_IO_IN_DTB)) 895cbf9e84aSBalint Dobszay$(eval $(call assert_boolean,SDEI_IN_FCONF)) 896452d5e5eSMadhukar Pappireddy$(eval $(call assert_boolean,SEC_INT_DESC_IN_FCONF)) 8975accce5bSRoberto Vargas$(eval $(call assert_boolean,USE_ROMLIB)) 898bb41eb7aSMasahiro Yamada$(eval $(call assert_boolean,USE_TBBR_DEFS)) 899bcc3c49cSSoby Mathew$(eval $(call assert_boolean,WARMBOOT_ENABLE_DCACHE_EARLY)) 900b1d27b48SRoberto Vargas$(eval $(call assert_boolean,BL2_AT_EL3)) 9017d173fc5SJiafei Pan$(eval $(call assert_boolean,BL2_IN_XIP_MEM)) 902b90f207aSHadi Asyrafi$(eval $(call assert_boolean,BL2_INV_DCACHE)) 903c97cba4eSSoby Mathew$(eval $(call assert_boolean,USE_SPINLOCK_CAS)) 904c6ba9b45SSumit Garg$(eval $(call assert_boolean,ENCRYPT_BL31)) 905c6ba9b45SSumit Garg$(eval $(call assert_boolean,ENCRYPT_BL32)) 90645aecff0SManish V Badarkhe$(eval $(call assert_boolean,ERRATA_SPECULATIVE_AT)) 907fbc44bd1SVarun Wadekar$(eval $(call assert_boolean,RAS_TRAP_LOWER_EL_ERR_ACCESS)) 90873c99d4eSJuan Castillo 909c877b414SJeenu Viswambharan$(eval $(call assert_numeric,ARM_ARCH_MAJOR)) 910c877b414SJeenu Viswambharan$(eval $(call assert_numeric,ARM_ARCH_MINOR)) 9119fc59639SAlexei Fedorov$(eval $(call assert_numeric,BRANCH_PROTECTION)) 912c6ba9b45SSumit Garg$(eval $(call assert_numeric,FW_ENC_STATUS)) 913c877b414SJeenu Viswambharan 914aacff749SJustin Chadwellifdef KEY_SIZE 915aacff749SJustin Chadwell $(eval $(call assert_numeric,KEY_SIZE)) 916aacff749SJustin Chadwellendif 917aacff749SJustin Chadwell 9181f461979SJustin Chadwellifeq ($(filter $(SANITIZE_UB), on off trap),) 9191f461979SJustin Chadwell $(error "Invalid value for SANITIZE_UB: can be one of on, off, trap") 9201f461979SJustin Chadwellendif 9211f461979SJustin Chadwell 92273c99d4eSJuan Castillo################################################################################ 92373c99d4eSJuan Castillo# Add definitions to the cpp preprocessor based on the current build options. 92473c99d4eSJuan Castillo# This is done after including the platform specific makefile to allow the 92573c99d4eSJuan Castillo# platform to overwrite the default options 92673c99d4eSJuan Castillo################################################################################ 92773c99d4eSJuan Castillo 92860e8f3cfSPetre-Ionut Tudor$(eval $(call add_define,ALLOW_RO_XLAT_TABLES)) 929c877b414SJeenu Viswambharan$(eval $(call add_define,ARM_ARCH_MAJOR)) 930c877b414SJeenu Viswambharan$(eval $(call add_define,ARM_ARCH_MINOR)) 931a9bec67dSSandrine Bailleux$(eval $(call add_define,COLD_BOOT_SINGLE_CPU)) 9322fae4b1eSJeenu Viswambharan$(eval $(call add_define,CTX_INCLUDE_AARCH32_REGS)) 9332fae4b1eSJeenu Viswambharan$(eval $(call add_define,CTX_INCLUDE_FPREGS)) 9345283962eSAntonio Nino Diaz$(eval $(call add_define,CTX_INCLUDE_PAUTH_REGS)) 935c8b55b8fSJeenu Viswambharan$(eval $(call add_define,EL3_EXCEPTION_HANDLING)) 9369dd94382SJustin Chadwell$(eval $(call add_define,CTX_INCLUDE_MTE_REGS)) 93728f39f02SMax Shvetsov$(eval $(call add_define,CTX_INCLUDE_EL2_REGS)) 9387cda17bbSSumit Garg$(eval $(call add_define,DECRYPTION_SUPPORT_${DECRYPTION_SUPPORT})) 9390319a977SDimitris Papastamos$(eval $(call add_define,ENABLE_AMU)) 940cc8b5632SAntonio Nino Diaz$(eval $(call add_define,ENABLE_ASSERTIONS)) 9419fc59639SAlexei Fedorov$(eval $(call add_define,ENABLE_BTI)) 9425f835918SJeenu Viswambharan$(eval $(call add_define,ENABLE_MPAM_FOR_LOWER_ELS)) 943b86048c4SAntonio Nino Diaz$(eval $(call add_define,ENABLE_PAUTH)) 9443bd17c0fSSoby Mathew$(eval $(call add_define,ENABLE_PIE)) 945a31d8983SYatharth Kochar$(eval $(call add_define,ENABLE_PMF)) 946170fb93dSYatharth Kochar$(eval $(call add_define,ENABLE_PSCI_STAT)) 947872be88aSdp-arm$(eval $(call add_define,ENABLE_RUNTIME_INSTRUMENTATION)) 948c1232c31SJeenu Viswambharan$(eval $(call add_define,ENABLE_SPE_FOR_LOWER_ELS)) 9491a853370SDavid Cunado$(eval $(call add_define,ENABLE_SVE_FOR_NS)) 950c6ba9b45SSumit Garg$(eval $(call add_define,ENCRYPT_BL31)) 951c6ba9b45SSumit Garg$(eval $(call add_define,ENCRYPT_BL32)) 9522fae4b1eSJeenu Viswambharan$(eval $(call add_define,ERROR_DEPRECATED)) 9531a7c1cfeSJeenu Viswambharan$(eval $(call add_define,FAULT_INJECTION_SUPPORT)) 95474dce7faSJeenu Viswambharan$(eval $(call add_define,GICV2_G0_FOR_EL3)) 95576454abfSJeenu Viswambharan$(eval $(call add_define,HANDLE_EA_EL3_FIRST)) 9563c251af3SJeenu Viswambharan$(eval $(call add_define,HW_ASSISTED_COHERENCY)) 9572fae4b1eSJeenu Viswambharan$(eval $(call add_define,LOG_LEVEL)) 9588c105290SAlexei Fedorov$(eval $(call add_define,MEASURED_BOOT)) 9592fae4b1eSJeenu Viswambharan$(eval $(call add_define,NS_TIMER_SWITCH)) 9602fae4b1eSJeenu Viswambharan$(eval $(call add_define,PL011_GENERIC_UART)) 9612fae4b1eSJeenu Viswambharan$(eval $(call add_define,PLAT_${PLAT})) 9622fae4b1eSJeenu Viswambharan$(eval $(call add_define,PROGRAMMABLE_RESET_ADDRESS)) 9632fae4b1eSJeenu Viswambharan$(eval $(call add_define,PSCI_EXTENDED_STATE_ID)) 96414c6016aSJeenu Viswambharan$(eval $(call add_define,RAS_EXTENSION)) 9652fae4b1eSJeenu Viswambharan$(eval $(call add_define,RESET_TO_BL31)) 9662fae4b1eSJeenu Viswambharan$(eval $(call add_define,SEPARATE_CODE_AND_RODATA)) 967f8578e64SSamuel Holland$(eval $(call add_define,SEPARATE_NOBITS_REGION)) 9681dcc28cfSDaniel Boulby$(eval $(call add_define,RECLAIM_INIT_CODE)) 9692fae4b1eSJeenu Viswambharan$(eval $(call add_define,SPD_${SPD})) 9702fae4b1eSJeenu Viswambharan$(eval $(call add_define,SPIN_ON_BL1_EXIT)) 9718855e52eSAntonio Nino Diaz$(eval $(call add_define,SPM_MM)) 972033039f8SMax Shvetsov$(eval $(call add_define,SPMD_SPM_AT_SEL2)) 9732fae4b1eSJeenu Viswambharan$(eval $(call add_define,TRUSTED_BOARD_BOOT)) 9742fae4b1eSJeenu Viswambharan$(eval $(call add_define,USE_COHERENT_MEM)) 9750ca3913dSOlivier Deprez$(eval $(call add_define,USE_DEBUGFS)) 976a6de824fSLouis Mayencourt$(eval $(call add_define,ARM_IO_IN_DTB)) 977cbf9e84aSBalint Dobszay$(eval $(call add_define,SDEI_IN_FCONF)) 978452d5e5eSMadhukar Pappireddy$(eval $(call add_define,SEC_INT_DESC_IN_FCONF)) 9795accce5bSRoberto Vargas$(eval $(call add_define,USE_ROMLIB)) 980bb41eb7aSMasahiro Yamada$(eval $(call add_define,USE_TBBR_DEFS)) 981bcc3c49cSSoby Mathew$(eval $(call add_define,WARMBOOT_ENABLE_DCACHE_EARLY)) 982b1d27b48SRoberto Vargas$(eval $(call add_define,BL2_AT_EL3)) 9837d173fc5SJiafei Pan$(eval $(call add_define,BL2_IN_XIP_MEM)) 984b90f207aSHadi Asyrafi$(eval $(call add_define,BL2_INV_DCACHE)) 985c97cba4eSSoby Mathew$(eval $(call add_define,USE_SPINLOCK_CAS)) 98645aecff0SManish V Badarkhe$(eval $(call add_define,ERRATA_SPECULATIVE_AT)) 987fbc44bd1SVarun Wadekar$(eval $(call add_define,RAS_TRAP_LOWER_EL_ERR_ACCESS)) 9882fae4b1eSJeenu Viswambharan 9891f461979SJustin Chadwellifeq (${SANITIZE_UB},trap) 9901f461979SJustin Chadwell $(eval $(call add_define,MONITOR_TRAPS)) 9911f461979SJustin Chadwellendif 9921f461979SJustin Chadwell 9934c117f6cSSandrine Bailleux# Define the EL3_PAYLOAD_BASE flag only if it is provided. 9944c117f6cSSandrine Bailleuxifdef EL3_PAYLOAD_BASE 9954c117f6cSSandrine Bailleux $(eval $(call add_define,EL3_PAYLOAD_BASE)) 996cf2c8a33SAntonio Nino Diazelse 99768450a6dSAntonio Nino Diaz # Define the PRELOADED_BL33_BASE flag only if it is provided and 99868450a6dSAntonio Nino Diaz # EL3_PAYLOAD_BASE is not defined, as it has priority. 99968450a6dSAntonio Nino Diaz ifdef PRELOADED_BL33_BASE 100068450a6dSAntonio Nino Diaz $(eval $(call add_define,PRELOADED_BL33_BASE)) 10014c117f6cSSandrine Bailleux endif 1002cf2c8a33SAntonio Nino Diazendif 100373c99d4eSJuan Castillo 1004209a60ccSSoby Mathew# Define the DYN_DISABLE_AUTH flag only if set. 1005209a60ccSSoby Mathewifeq (${DYN_DISABLE_AUTH},1) 1006209a60ccSSoby Mathew$(eval $(call add_define,DYN_DISABLE_AUTH)) 1007209a60ccSSoby Mathewendif 1008209a60ccSSoby Mathew 1009c2ad38ceSVarun Wadekarifneq ($(findstring armlink,$(notdir $(LD))),) 1010c2ad38ceSVarun Wadekar$(eval $(call add_define,USE_ARM_LINK)) 1011c2ad38ceSVarun Wadekarendif 1012c2ad38ceSVarun Wadekar 1013ce2b1ec6SManish Pandey# Generate and include sp_gen.mk if SPD is spmd and SP_LAYOUT_FILE is defined 1014ce2b1ec6SManish Pandeyifeq (${SPD},spmd) 1015c33ff198SOlivier Deprezifdef SP_LAYOUT_FILE 1016c33ff198SOlivier Deprez ifeq (${SPMD_SPM_AT_SEL2},0) 1017c33ff198SOlivier Deprez $(error "SPMD with SPM at S-EL1 does not require SP_LAYOUT_FILE") 1018c33ff198SOlivier Deprez endif 1019ce2b1ec6SManish Pandey -include $(BUILD_PLAT)/sp_gen.mk 1020ce2b1ec6SManish Pandey FIP_DEPS += sp 102107c44475SManish Pandey CRT_DEPS += sp 1022ce2b1ec6SManish Pandey NEED_SP_PKG := yes 1023ce2b1ec6SManish Pandeyelse 1024c33ff198SOlivier Deprez ifeq (${SPMD_SPM_AT_SEL2},1) 1025c33ff198SOlivier Deprez $(error "SPMD with SPM at S-EL2 require SP_LAYOUT_FILE") 1026c33ff198SOlivier Deprez endif 1027ce2b1ec6SManish Pandeyendif 1028ce2b1ec6SManish Pandeyendif 1029ce2b1ec6SManish Pandey 103073c99d4eSJuan Castillo################################################################################ 103173c99d4eSJuan Castillo# Build targets 103273c99d4eSJuan Castillo################################################################################ 103373c99d4eSJuan Castillo 103490aa901fSSumit Garg.PHONY: all msg_start clean realclean distclean cscope locate-checkpatch checkcodebase checkpatch fiptool sptool fip sp fwu_fip certtool dtbs memmap doc enctool 103573c99d4eSJuan Castillo.SUFFIXES: 103673c99d4eSJuan Castillo 103773c99d4eSJuan Castilloall: msg_start 103873c99d4eSJuan Castillo 103973c99d4eSJuan Castillomsg_start: 104073c99d4eSJuan Castillo @echo "Building ${PLAT}" 104173c99d4eSJuan Castillo 10427a24cba5SSoby Mathewifeq (${ERROR_DEPRECATED},0) 1043d5dfdeb6SJulius Werner# Check if deprecated declarations and cpp warnings should be treated as error or not. 1044c2ad38ceSVarun Wadekarifneq ($(findstring clang,$(notdir $(CC))),) 1045c2ad38ceSVarun Wadekar CPPFLAGS += -Wno-error=deprecated-declarations 1046c2ad38ceSVarun Wadekarelse 1047bc1a03c7SDan Handley CPPFLAGS += -Wno-error=deprecated-declarations -Wno-error=cpp 10487a24cba5SSoby Mathewendif 1049d5dfdeb6SJulius Werner# __ASSEMBLY__ is deprecated in favor of the compiler-builtin __ASSEMBLER__. 1050d5dfdeb6SJulius WernerASFLAGS += -D__ASSEMBLY__ 1051402b3cf8SJulius Werner# AARCH32/AARCH64 macros are deprecated in favor of the compiler-builtin __aarch64__. 1052402b3cf8SJulius Wernerifeq (${ARCH},aarch32) 1053402b3cf8SJulius Werner $(eval $(call add_define,AARCH32)) 1054402b3cf8SJulius Wernerelse 1055402b3cf8SJulius Werner $(eval $(call add_define,AARCH64)) 1056402b3cf8SJulius Wernerendif 1057d5dfdeb6SJulius Wernerendif # !ERROR_DEPRECATED 10587a24cba5SSoby Mathew 10595accce5bSRoberto Vargas$(eval $(call MAKE_LIB_DIRS)) 106061f72a34SRoberto Vargas$(eval $(call MAKE_LIB,c)) 10615fee0287SRoberto Vargas 106273c99d4eSJuan Castillo# Expand build macros for the different images 106373c99d4eSJuan Castilloifeq (${NEED_BL1},yes) 106473c99d4eSJuan Castillo$(eval $(call MAKE_BL,1)) 106573c99d4eSJuan Castilloendif 106673c99d4eSJuan Castillo 106773c99d4eSJuan Castilloifeq (${NEED_BL2},yes) 1068c9b31ae8SRoberto Vargasifeq (${BL2_AT_EL3}, 0) 1069c9b31ae8SRoberto VargasFIP_BL2_ARGS := tb-fw 1070c9b31ae8SRoberto Vargasendif 1071c9b31ae8SRoberto Vargas 107233950dd8SMasahiro Yamada$(if ${BL2}, $(eval $(call TOOL_ADD_IMG,bl2,--${FIP_BL2_ARGS})),\ 1073c9b31ae8SRoberto Vargas $(eval $(call MAKE_BL,2,${FIP_BL2_ARGS}))) 107473c99d4eSJuan Castilloendif 107573c99d4eSJuan Castillo 10764d045d0eSMasahiro Yamadaifeq (${NEED_SCP_BL2},yes) 107733950dd8SMasahiro Yamada$(eval $(call TOOL_ADD_IMG,scp_bl2,--scp-fw)) 10784d045d0eSMasahiro Yamadaendif 10794d045d0eSMasahiro Yamada 108073c99d4eSJuan Castilloifeq (${NEED_BL31},yes) 108173c99d4eSJuan CastilloBL31_SOURCES += ${SPD_SOURCES} 108226d1e0c3SMadhukar Pappireddy# Sort BL31 source files to remove duplicates 108326d1e0c3SMadhukar PappireddyBL31_SOURCES := $(sort ${BL31_SOURCES}) 1084c6ba9b45SSumit Gargifneq (${DECRYPTION_SUPPORT},none) 1085c6ba9b45SSumit Garg$(if ${BL31}, $(eval $(call TOOL_ADD_IMG,bl31,--soc-fw,,$(ENCRYPT_BL31))),\ 1086c6ba9b45SSumit Garg $(eval $(call MAKE_BL,31,soc-fw,,$(ENCRYPT_BL31)))) 1087c6ba9b45SSumit Gargelse 108833950dd8SMasahiro Yamada$(if ${BL31}, $(eval $(call TOOL_ADD_IMG,bl31,--soc-fw)),\ 10898f0617efSJuan Castillo $(eval $(call MAKE_BL,31,soc-fw))) 109073c99d4eSJuan Castilloendif 1091c6ba9b45SSumit Gargendif 109273c99d4eSJuan Castillo 109370d1fc53SJuan Castillo# If a BL32 image is needed but neither BL32 nor BL32_SOURCES is defined, the 1094c939d13aSMasahiro Yamada# build system will call TOOL_ADD_IMG to print a warning message and abort the 109570d1fc53SJuan Castillo# process. Note that the dependency on BL32 applies to the FIP only. 109673c99d4eSJuan Castilloifeq (${NEED_BL32},yes) 109726d1e0c3SMadhukar Pappireddy# Sort BL32 source files to remove duplicates 109826d1e0c3SMadhukar PappireddyBL32_SOURCES := $(sort ${BL32_SOURCES}) 10999cd15239SMasahiro YamadaBUILD_BL32 := $(if $(BL32),,$(if $(BL32_SOURCES),1)) 11009cd15239SMasahiro Yamada 1101c6ba9b45SSumit Gargifneq (${DECRYPTION_SUPPORT},none) 1102c6ba9b45SSumit Garg$(if ${BUILD_BL32}, $(eval $(call MAKE_BL,32,tos-fw,,$(ENCRYPT_BL32))),\ 1103c6ba9b45SSumit Garg $(eval $(call TOOL_ADD_IMG,bl32,--tos-fw,,$(ENCRYPT_BL32)))) 1104c6ba9b45SSumit Gargelse 11059cd15239SMasahiro Yamada$(if ${BUILD_BL32}, $(eval $(call MAKE_BL,32,tos-fw)),\ 110633950dd8SMasahiro Yamada $(eval $(call TOOL_ADD_IMG,bl32,--tos-fw))) 110773c99d4eSJuan Castilloendif 1108c6ba9b45SSumit Gargendif 110973c99d4eSJuan Castillo 111073c99d4eSJuan Castillo# Add the BL33 image if required by the platform 111173c99d4eSJuan Castilloifeq (${NEED_BL33},yes) 111233950dd8SMasahiro Yamada$(eval $(call TOOL_ADD_IMG,bl33,--nt-fw)) 1113db6071c9SJuan Castilloendif 1114db6071c9SJuan Castillo 11159003fa0bSYatharth Kocharifeq (${NEED_BL2U},yes) 111633950dd8SMasahiro Yamada$(if ${BL2U}, $(eval $(call TOOL_ADD_IMG,bl2u,--ap-fwu-cfg,FWU_)),\ 11171dc0714fSMasahiro Yamada $(eval $(call MAKE_BL,2u,ap-fwu-cfg,FWU_))) 11189003fa0bSYatharth Kocharendif 11199003fa0bSYatharth Kochar 112003b397a8SNishanth Menon# Expand build macros for the different images 112103b397a8SNishanth Menonifeq (${NEED_FDT},yes) 112203b397a8SNishanth Menon $(eval $(call MAKE_DTBS,$(BUILD_PLAT)/fdts,$(FDT_SOURCES))) 112303b397a8SNishanth Menonendif 112403b397a8SNishanth Menon 1125ce2b1ec6SManish Pandey# Add Secure Partition packages 1126ce2b1ec6SManish Pandeyifeq (${NEED_SP_PKG},yes) 1127ce2b1ec6SManish Pandey$(BUILD_PLAT)/sp_gen.mk: ${SP_MK_GEN} ${SP_LAYOUT_FILE} | ${BUILD_PLAT} 1128ce2b1ec6SManish Pandey ${Q}${PYTHON} "$<" "$@" $(filter-out $<,$^) $(BUILD_PLAT) 1129ce2b1ec6SManish Pandeysp: $(SPTOOL) $(DTBS) $(BUILD_PLAT)/sp_gen.mk 1130ce2b1ec6SManish Pandey ${Q}$(SPTOOL) $(SPTOOL_ARGS) 1131ce2b1ec6SManish Pandey @${ECHO_BLANK_LINE} 1132ce2b1ec6SManish Pandey @echo "Built SP Images successfully" 1133ce2b1ec6SManish Pandey @${ECHO_BLANK_LINE} 1134ce2b1ec6SManish Pandeyendif 1135ce2b1ec6SManish Pandey 113636eaaf37SIan Spraylocate-checkpatch: 113736eaaf37SIan Sprayifndef CHECKPATCH 113866079b04SEtienne Carriere $(error "Please set CHECKPATCH to point to the Linux checkpatch.pl file, eg: CHECKPATCH=../linux/scripts/checkpatch.pl") 113936eaaf37SIan Sprayelse 114036eaaf37SIan Sprayifeq (,$(wildcard ${CHECKPATCH})) 114166079b04SEtienne Carriere $(error "The file CHECKPATCH points to cannot be found, use eg: CHECKPATCH=../linux/scripts/checkpatch.pl") 114236eaaf37SIan Sprayendif 114336eaaf37SIan Sprayendif 114436eaaf37SIan Spray 11454f6ad66aSAchin Guptaclean: 11464f6ad66aSAchin Gupta @echo " CLEAN" 1147f1477d4aSEvan Lloyd $(call SHELL_REMOVE_DIR,${BUILD_PLAT}) 11482f2cef46SJeenu Viswambharan ${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean 11496f971622SJuan Castillo ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} clean 115090aa901fSSumit Garg ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${ENCTOOLPATH} clean 11515accce5bSRoberto Vargas ${Q}${MAKE} --no-print-directory -C ${ROMLIBPATH} clean 11524f6ad66aSAchin Gupta 1153eaaeece2SJames Morrisseyrealclean distclean: 1154eaaeece2SJames Morrissey @echo " REALCLEAN" 1155f1477d4aSEvan Lloyd $(call SHELL_REMOVE_DIR,${BUILD_BASE}) 1156f1477d4aSEvan Lloyd $(call SHELL_DELETE_ALL, ${CURDIR}/cscope.*) 11572f2cef46SJeenu Viswambharan ${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean 115826010da1SAntonio Nino Diaz ${Q}${MAKE} --no-print-directory -C ${SPTOOLPATH} clean 11596f971622SJuan Castillo ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} clean 116090aa901fSSumit Garg ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${ENCTOOLPATH} realclean 11615accce5bSRoberto Vargas ${Q}${MAKE} --no-print-directory -C ${ROMLIBPATH} clean 11624f6ad66aSAchin Gupta 116336eaaf37SIan Spraycheckcodebase: locate-checkpatch 116436eaaf37SIan Spray @echo " CHECKING STYLE" 116536eaaf37SIan Spray @if test -d .git ; then \ 11661ef35512SPaul Beesley git ls-files | grep -E -v 'libfdt|libc|docs|\.rst' | \ 11671a41e8c1SDan Handley while read GIT_FILE ; \ 11681a41e8c1SDan Handley do ${CHECKPATCH} ${CHECKCODE_ARGS} -f $$GIT_FILE ; \ 11691a41e8c1SDan Handley done ; \ 117036eaaf37SIan Spray else \ 11711a41e8c1SDan Handley find . -type f -not -iwholename "*.git*" \ 11721a41e8c1SDan Handley -not -iwholename "*build*" \ 11731a41e8c1SDan Handley -not -iwholename "*libfdt*" \ 117461f72a34SRoberto Vargas -not -iwholename "*libc*" \ 11751a41e8c1SDan Handley -not -iwholename "*docs*" \ 11761ef35512SPaul Beesley -not -iwholename "*.rst" \ 11771a41e8c1SDan Handley -exec ${CHECKPATCH} ${CHECKCODE_ARGS} -f {} \; ; \ 117836eaaf37SIan Spray fi 117936eaaf37SIan Spray 118036eaaf37SIan Spraycheckpatch: locate-checkpatch 118136eaaf37SIan Spray @echo " CHECKING STYLE" 118202a76d5fSYann Gautier @if test -n "${CHECKPATCH_OPTS}"; then \ 118302a76d5fSYann Gautier echo " with ${CHECKPATCH_OPTS} option(s)"; \ 118402a76d5fSYann Gautier fi 118551d28937SAntonio Nino Diaz ${Q}COMMON_COMMIT=$$(git merge-base HEAD ${BASE_COMMIT}); \ 118651d28937SAntonio Nino Diaz for commit in `git rev-list $$COMMON_COMMIT..HEAD`; do \ 118751d28937SAntonio Nino Diaz printf "\n[*] Checking style of '$$commit'\n\n"; \ 118851d28937SAntonio Nino Diaz git log --format=email "$$commit~..$$commit" \ 118902a76d5fSYann Gautier -- ${CHECK_PATHS} | \ 119002a76d5fSYann Gautier ${CHECKPATCH} ${CHECKPATCH_OPTS} - || true; \ 119151d28937SAntonio Nino Diaz git diff --format=email "$$commit~..$$commit" \ 119202a76d5fSYann Gautier -- ${CHECK_PATHS} | \ 119302a76d5fSYann Gautier ${CHECKPATCH} ${CHECKPATCH_OPTS} - || true; \ 119451d28937SAntonio Nino Diaz done 119536eaaf37SIan Spray 119673c99d4eSJuan Castillocerttool: ${CRTTOOL} 119773c99d4eSJuan Castillo 11986f971622SJuan Castillo.PHONY: ${CRTTOOL} 11996f971622SJuan Castillo${CRTTOOL}: 12003bff910dSSandrine Bailleux ${Q}${MAKE} PLAT=${PLAT} USE_TBBR_DEFS=${USE_TBBR_DEFS} COT=${COT} --no-print-directory -C ${CRTTOOLPATH} 1201f1477d4aSEvan Lloyd @${ECHO_BLANK_LINE} 12026f971622SJuan Castillo @echo "Built $@ successfully" 1203f1477d4aSEvan Lloyd @${ECHO_BLANK_LINE} 12046f971622SJuan Castillo 12056f971622SJuan Castilloifneq (${GENERATE_COT},0) 120673c99d4eSJuan Castillocertificates: ${CRT_DEPS} ${CRTTOOL} 12076f971622SJuan Castillo ${Q}${CRTTOOL} ${CRT_ARGS} 1208f1477d4aSEvan Lloyd @${ECHO_BLANK_LINE} 12096f971622SJuan Castillo @echo "Built $@ successfully" 12106f971622SJuan Castillo @echo "Certificates can be found in ${BUILD_PLAT}" 1211f1477d4aSEvan Lloyd @${ECHO_BLANK_LINE} 121273c99d4eSJuan Castilloendif 121327713fb4SSoby Mathew 121473c99d4eSJuan Castillo${BUILD_PLAT}/${FIP_NAME}: ${FIP_DEPS} ${FIPTOOL} 1215819281eeSdp-arm ${Q}${FIPTOOL} create ${FIP_ARGS} $@ 1216819281eeSdp-arm ${Q}${FIPTOOL} info $@ 1217f1477d4aSEvan Lloyd @${ECHO_BLANK_LINE} 12182f2cef46SJeenu Viswambharan @echo "Built $@ successfully" 1219f1477d4aSEvan Lloyd @${ECHO_BLANK_LINE} 1220f58ad36fSHarry Liebel 12210191262dSYatharth Kocharifneq (${GENERATE_COT},0) 12220191262dSYatharth Kocharfwu_certificates: ${FWU_CRT_DEPS} ${CRTTOOL} 12230191262dSYatharth Kochar ${Q}${CRTTOOL} ${FWU_CRT_ARGS} 1224052ab529SEvan Lloyd @${ECHO_BLANK_LINE} 12250191262dSYatharth Kochar @echo "Built $@ successfully" 12260191262dSYatharth Kochar @echo "FWU certificates can be found in ${BUILD_PLAT}" 1227052ab529SEvan Lloyd @${ECHO_BLANK_LINE} 12280191262dSYatharth Kocharendif 12290191262dSYatharth Kochar 12300191262dSYatharth Kochar${BUILD_PLAT}/${FWU_FIP_NAME}: ${FWU_FIP_DEPS} ${FIPTOOL} 1231819281eeSdp-arm ${Q}${FIPTOOL} create ${FWU_FIP_ARGS} $@ 1232819281eeSdp-arm ${Q}${FIPTOOL} info $@ 1233052ab529SEvan Lloyd @${ECHO_BLANK_LINE} 12340191262dSYatharth Kochar @echo "Built $@ successfully" 1235052ab529SEvan Lloyd @${ECHO_BLANK_LINE} 12360191262dSYatharth Kochar 123773c99d4eSJuan Castillofiptool: ${FIPTOOL} 123873c99d4eSJuan Castillofip: ${BUILD_PLAT}/${FIP_NAME} 12390191262dSYatharth Kocharfwu_fip: ${BUILD_PLAT}/${FWU_FIP_NAME} 124073c99d4eSJuan Castillo 124173c99d4eSJuan Castillo.PHONY: ${FIPTOOL} 124273c99d4eSJuan Castillo${FIPTOOL}: 1243819281eeSdp-arm ${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" --no-print-directory -C ${FIPTOOLPATH} 1244f58ad36fSHarry Liebel 124526010da1SAntonio Nino Diazsptool: ${SPTOOL} 124626010da1SAntonio Nino Diaz.PHONY: ${SPTOOL} 124726010da1SAntonio Nino Diaz${SPTOOL}: 124826010da1SAntonio Nino Diaz ${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" --no-print-directory -C ${SPTOOLPATH} 124926010da1SAntonio Nino Diaz 12505accce5bSRoberto Vargas.PHONY: libraries 12515accce5bSRoberto Vargasromlib.bin: libraries 1252bbb24f61SJohn 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 12535accce5bSRoberto Vargas 1254cfe83910SLouis Mayencourt# Call print_memory_map tool 1255cfe83910SLouis Mayencourtmemmap: all 1256b890b36dSLouis Mayencourt ${Q}${PYTHON} ${PRINT_MEMORY_MAP} ${BUILD_PLAT} ${INVERTED_MEMMAP} 1257cfe83910SLouis Mayencourt 12586de32378SMadhukar Pappireddydoc: 12596de32378SMadhukar Pappireddy @echo " BUILD DOCUMENTATION" 12606de32378SMadhukar Pappireddy ${Q}${MAKE} --no-print-directory -C ${DOCS_PATH} html 12616de32378SMadhukar Pappireddy 126290aa901fSSumit Gargenctool: ${ENCTOOL} 126390aa901fSSumit Garg 126490aa901fSSumit Garg.PHONY: ${ENCTOOL} 126590aa901fSSumit Garg${ENCTOOL}: 126690aa901fSSumit Garg ${Q}${MAKE} PLAT=${PLAT} BUILD_INFO=0 --no-print-directory -C ${ENCTOOLPATH} 126790aa901fSSumit Garg @${ECHO_BLANK_LINE} 126890aa901fSSumit Garg @echo "Built $@ successfully" 126990aa901fSSumit Garg @${ECHO_BLANK_LINE} 127090aa901fSSumit Garg 127135fab8c9SJoakim Bechcscope: 127235fab8c9SJoakim Bech @echo " CSCOPE" 127335fab8c9SJoakim Bech ${Q}find ${CURDIR} -name "*.[chsS]" > cscope.files 127435fab8c9SJoakim Bech ${Q}cscope -b -q -k 127535fab8c9SJoakim Bech 127672ee3314SRyan Harkinhelp: 12777c23126cSJohn Tsichritzis @echo "usage: ${MAKE} [PLAT=<platform>] [OPTIONS] [TARGET]" 127872ee3314SRyan Harkin @echo "" 127972ee3314SRyan Harkin @echo "PLAT is used to specify which platform you wish to build." 128008c7ed0fSSandrine Bailleux @echo "If no platform is specified, PLAT defaults to: ${DEFAULT_PLAT}" 128172ee3314SRyan Harkin @echo "" 12827c23126cSJohn Tsichritzis @echo "platform = ${PLATFORM_LIST}" 12837c23126cSJohn Tsichritzis @echo "" 12841b578596SSandrine Bailleux @echo "Please refer to the User Guide for a list of all supported options." 12851b578596SSandrine Bailleux @echo "Note that the build system doesn't track dependencies for build " 12861b578596SSandrine Bailleux @echo "options. Therefore, if any of the build options are changed " 12871b578596SSandrine Bailleux @echo "from a previous build, a clean build must be performed." 12881b578596SSandrine Bailleux @echo "" 128972ee3314SRyan Harkin @echo "Supported Targets:" 12901b578596SSandrine Bailleux @echo " all Build all individual bootloader binaries" 129136eaaf37SIan Spray @echo " bl1 Build the BL1 binary" 12928aa559c0SJeenu Viswambharan @echo " bl2 Build the BL2 binary" 12939003fa0bSYatharth Kochar @echo " bl2u Build the BL2U binary" 1294d178637dSJuan Castillo @echo " bl31 Build the BL31 binary" 12959d29c227SSoby Mathew @echo " bl32 Build the BL32 binary. If ARCH=aarch32, then " 12969d29c227SSoby Mathew @echo " this builds secure payload specified by AARCH32_SP" 129773c99d4eSJuan Castillo @echo " certificates Build the certificates (requires 'GENERATE_COT=1')" 12981b578596SSandrine Bailleux @echo " fip Build the Firmware Image Package (FIP)" 12990191262dSYatharth Kochar @echo " fwu_fip Build the FWU Firmware Image Package (FIP)" 130036eaaf37SIan Spray @echo " checkcodebase Check the coding style of the entire source tree" 130136eaaf37SIan Spray @echo " checkpatch Check the coding style on changes in the current" 130236eaaf37SIan Spray @echo " branch against BASE_COMMIT (default origin/master)" 130372ee3314SRyan Harkin @echo " clean Clean the build for the selected platform" 130435fab8c9SJoakim Bech @echo " cscope Generate cscope index" 130572ee3314SRyan Harkin @echo " distclean Remove all build artifacts for all platforms" 13066f971622SJuan Castillo @echo " certtool Build the Certificate generation tool" 130790aa901fSSumit Garg @echo " enctool Build the Firmware encryption tool" 1308f58ad36fSHarry Liebel @echo " fiptool Build the Firmware Image Package (FIP) creation tool" 1309ce2b1ec6SManish Pandey @echo " sp Build the Secure Partition Packages" 131026010da1SAntonio Nino Diaz @echo " sptool Build the Secure Partition Package creation tool" 131138c14d88SSoby Mathew @echo " dtbs Build the Device Tree Blobs (if required for the platform)" 1312cfe83910SLouis Mayencourt @echo " memmap Print the memory map of the built binaries" 13136de32378SMadhukar Pappireddy @echo " doc Build html based documentation using Sphinx tool" 131472ee3314SRyan Harkin @echo "" 13151b578596SSandrine Bailleux @echo "Note: most build targets require PLAT to be set to a specific platform." 131672ee3314SRyan Harkin @echo "" 131772ee3314SRyan Harkin @echo "example: build all targets for the FVP platform:" 131872ee3314SRyan Harkin @echo " CROSS_COMPILE=aarch64-none-elf- make PLAT=fvp all" 1319