14f6ad66aSAchin Gupta# 2*01cf14ddSMaksims 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 110fa7fe59Slaurenw-armVERSION_MINOR := 8 12dddf4283Slaurenw-armVERSION := ${VERSION_MAJOR}.${VERSION_MINOR} 13aaa3e722SJuan Castillo 1488154678SJuan Castillo# Default goal is build all images 1588154678SJuan Castillo.DEFAULT_GOAL := all 1688154678SJuan Castillo 1772fc70edSDouglas Raillard# Avoid any implicit propagation of command line variable definitions to 1872fc70edSDouglas Raillard# sub-Makefiles, like CFLAGS that we reserved for the firmware images' 1972fc70edSDouglas Raillard# usage. Other command line options like "-s" are still propagated as usual. 2072fc70edSDouglas RaillardMAKEOVERRIDES = 2172fc70edSDouglas Raillard 22231c1470SEvan LloydMAKE_HELPERS_DIRECTORY := make_helpers/ 23231c1470SEvan Lloydinclude ${MAKE_HELPERS_DIRECTORY}build_macros.mk 24e7f54dbdSEvan Lloydinclude ${MAKE_HELPERS_DIRECTORY}build_env.mk 2573c99d4eSJuan Castillo 2673c99d4eSJuan Castillo################################################################################ 272fae4b1eSJeenu Viswambharan# Default values for build configurations, and their dependencies 2873c99d4eSJuan Castillo################################################################################ 29e35c4045SJeenu Viswambharan 302fae4b1eSJeenu Viswambharaninclude ${MAKE_HELPERS_DIRECTORY}defaults.mk 31872be88aSdp-arm 32cc8b5632SAntonio Nino Diaz# Assertions enabled for DEBUG builds by default 33cc8b5632SAntonio Nino DiazENABLE_ASSERTIONS := ${DEBUG} 342fae4b1eSJeenu ViswambharanENABLE_PMF := ${ENABLE_RUNTIME_INSTRUMENTATION} 352fae4b1eSJeenu ViswambharanPLAT := ${DEFAULT_PLAT} 3673c99d4eSJuan Castillo 3773c99d4eSJuan Castillo################################################################################ 3873c99d4eSJuan Castillo# Checkpatch script options 3973c99d4eSJuan Castillo################################################################################ 4073c99d4eSJuan Castillo 41f607739cSSandrine BailleuxCHECKCODE_ARGS := --no-patch 42f0b489c1SDan Handley# Do not check the coding style on imported library files or documentation files 434501843fSGilad Ben-YossefINC_ARM_DIRS_TO_CHECK := $(sort $(filter-out \ 444501843fSGilad Ben-Yossef include/drivers/arm/cryptocell, \ 454501843fSGilad Ben-Yossef $(wildcard include/drivers/arm/*))) 464501843fSGilad Ben-YossefINC_ARM_DIRS_TO_CHECK += include/drivers/arm/cryptocell/*.h 474501843fSGilad Ben-YossefINC_DRV_DIRS_TO_CHECK := $(sort $(filter-out \ 484501843fSGilad Ben-Yossef include/drivers/arm, \ 494501843fSGilad Ben-Yossef $(wildcard include/drivers/*))) 50f0b489c1SDan HandleyINC_LIB_DIRS_TO_CHECK := $(sort $(filter-out \ 511a41e8c1SDan Handley include/lib/libfdt \ 5261f72a34SRoberto Vargas include/lib/libc, \ 53f0b489c1SDan Handley $(wildcard include/lib/*))) 54f0b489c1SDan HandleyINC_DIRS_TO_CHECK := $(sort $(filter-out \ 554501843fSGilad Ben-Yossef include/lib \ 564501843fSGilad Ben-Yossef include/drivers, \ 57f0b489c1SDan Handley $(wildcard include/*))) 58f0b489c1SDan HandleyLIB_DIRS_TO_CHECK := $(sort $(filter-out \ 59d801fbb0Sdp-arm lib/compiler-rt \ 6055cdcf75SAntonio Nino Diaz lib/libfdt% \ 6161f72a34SRoberto Vargas lib/libc, \ 62a194255dSDaniel Boulby lib/zlib \ 63f0b489c1SDan Handley $(wildcard lib/*))) 64f0b489c1SDan HandleyROOT_DIRS_TO_CHECK := $(sort $(filter-out \ 65f0b489c1SDan Handley lib \ 66f0b489c1SDan Handley include \ 67f0b489c1SDan Handley docs \ 681ef35512SPaul Beesley %.rst, \ 69f0b489c1SDan Handley $(wildcard *))) 70f0b489c1SDan HandleyCHECK_PATHS := ${ROOT_DIRS_TO_CHECK} \ 71f0b489c1SDan Handley ${INC_DIRS_TO_CHECK} \ 72f0b489c1SDan Handley ${INC_LIB_DIRS_TO_CHECK} \ 734501843fSGilad Ben-Yossef ${LIB_DIRS_TO_CHECK} \ 744501843fSGilad Ben-Yossef ${INC_DRV_DIRS_TO_CHECK} \ 754501843fSGilad Ben-Yossef ${INC_ARM_DIRS_TO_CHECK} 7636eaaf37SIan Spray 7773c99d4eSJuan Castillo 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# The cert_create tool cannot generate certificates individually, so we use the 10073c99d4eSJuan Castillo# target 'certificates' to create them all 10173c99d4eSJuan Castilloifneq (${GENERATE_COT},0) 10273c99d4eSJuan Castillo FIP_DEPS += certificates 1030191262dSYatharth Kochar FWU_FIP_DEPS += fwu_certificates 10473c99d4eSJuan Castilloendif 10573c99d4eSJuan Castillo 1069fc59639SAlexei Fedorov# Process BRANCH_PROTECTION value and set 1079fc59639SAlexei Fedorov# Pointer Authentication and Branch Target Identification flags 1089fc59639SAlexei Fedorovifeq (${BRANCH_PROTECTION},0) 1099fc59639SAlexei Fedorov # Default value turns off all types of branch protection 1109fc59639SAlexei Fedorov BP_OPTION := none 1119fc59639SAlexei Fedorovelse ifneq (${ARCH},aarch64) 1129fc59639SAlexei Fedorov $(error BRANCH_PROTECTION requires AArch64) 1139fc59639SAlexei Fedorovelse ifeq (${BRANCH_PROTECTION},1) 1149fc59639SAlexei Fedorov # Enables all types of branch protection features 1159fc59639SAlexei Fedorov BP_OPTION := standard 1169fc59639SAlexei Fedorov ENABLE_BTI := 1 1179fc59639SAlexei Fedorov ENABLE_PAUTH := 1 1189fc59639SAlexei Fedorovelse ifeq (${BRANCH_PROTECTION},2) 1199fc59639SAlexei Fedorov # Return address signing to its standard level 1209fc59639SAlexei Fedorov BP_OPTION := pac-ret 1219fc59639SAlexei Fedorov ENABLE_PAUTH := 1 1229fc59639SAlexei Fedorovelse ifeq (${BRANCH_PROTECTION},3) 1239fc59639SAlexei Fedorov # Extend the signing to include leaf functions 1249fc59639SAlexei Fedorov BP_OPTION := pac-ret+leaf 1259fc59639SAlexei Fedorov ENABLE_PAUTH := 1 1263768fecfSAlexei Fedorovelse ifeq (${BRANCH_PROTECTION},4) 1273768fecfSAlexei Fedorov # Turn on branch target identification mechanism 1283768fecfSAlexei Fedorov BP_OPTION := bti 1293768fecfSAlexei Fedorov ENABLE_BTI := 1 1309fc59639SAlexei Fedorovelse 1319fc59639SAlexei Fedorov $(error Unknown BRANCH_PROTECTION value ${BRANCH_PROTECTION}) 1329fc59639SAlexei Fedorovendif 13373c99d4eSJuan Castillo 1345b18de09SZelalem Aweke# FEAT_RME 1355b18de09SZelalem Awekeifeq (${ENABLE_RME},1) 1365b18de09SZelalem Aweke# RME doesn't support PIE 1375b18de09SZelalem Awekeifneq (${ENABLE_PIE},0) 1385b18de09SZelalem Aweke $(error ENABLE_RME does not support PIE) 1395b18de09SZelalem Awekeendif 140744ad974Sjohpow01# RME doesn't support BRBE 141744ad974Sjohpow01ifneq (${ENABLE_BRBE_FOR_NS},0) 142744ad974Sjohpow01 $(error ENABLE_RME does not support BRBE.) 143744ad974Sjohpow01endif 1445b18de09SZelalem Aweke# RME requires AARCH64 1455b18de09SZelalem Awekeifneq (${ARCH},aarch64) 1465b18de09SZelalem Aweke $(error ENABLE_RME requires AArch64) 1475b18de09SZelalem Awekeendif 1485b18de09SZelalem Aweke# RME requires el2 context to be saved for now. 1495b18de09SZelalem AwekeCTX_INCLUDE_EL2_REGS := 1 1505b18de09SZelalem AwekeCTX_INCLUDE_AARCH32_REGS := 0 1515b18de09SZelalem AwekeARM_ARCH_MAJOR := 8 1527670ddb1SAndre PrzywaraARM_ARCH_MINOR := 5 1537670ddb1SAndre PrzywaraENABLE_FEAT_ECV = 1 1547670ddb1SAndre PrzywaraENABLE_FEAT_FGT = 1 1557670ddb1SAndre Przywara 156*01cf14ddSMaksims Svecovs# RME enables CSV2_2 extension by default. 157*01cf14ddSMaksims SvecovsENABLE_FEAT_CSV2_2 = 1 158*01cf14ddSMaksims Svecovs 1595b18de09SZelalem Awekeendif 1605b18de09SZelalem Aweke 161c97cba4eSSoby Mathew# USE_SPINLOCK_CAS requires AArch64 build 162c97cba4eSSoby Mathewifeq (${USE_SPINLOCK_CAS},1) 163c97cba4eSSoby Mathewifneq (${ARCH},aarch64) 164c97cba4eSSoby Mathew $(error USE_SPINLOCK_CAS requires AArch64) 165c97cba4eSSoby Mathewendif 166c97cba4eSSoby Mathewendif 167c97cba4eSSoby Mathew 1680ca3913dSOlivier Deprez# USE_DEBUGFS experimental feature recommended only in debug builds 1690ca3913dSOlivier Deprezifeq (${USE_DEBUGFS},1) 1700ca3913dSOlivier Deprezifeq (${DEBUG},1) 1710ca3913dSOlivier Deprez $(warning DEBUGFS experimental feature is enabled.) 1720ca3913dSOlivier Deprezelse 1730ca3913dSOlivier Deprez $(warning DEBUGFS experimental, recommended in DEBUG builds ONLY) 1740ca3913dSOlivier Deprezendif 1750ca3913dSOlivier Deprezendif 1760ca3913dSOlivier Deprez 177c6ba9b45SSumit Gargifneq (${DECRYPTION_SUPPORT},none) 178c6ba9b45SSumit GargENC_ARGS += -f ${FW_ENC_STATUS} 179c6ba9b45SSumit GargENC_ARGS += -k ${ENC_KEY} 180c6ba9b45SSumit GargENC_ARGS += -n ${ENC_NONCE} 181c6ba9b45SSumit GargFIP_DEPS += enctool 182c6ba9b45SSumit GargFWU_FIP_DEPS += enctool 183c6ba9b45SSumit Gargendif 184c6ba9b45SSumit Garg 18573c99d4eSJuan Castillo################################################################################ 18673c99d4eSJuan Castillo# Toolchain 18773c99d4eSJuan Castillo################################################################################ 18873c99d4eSJuan Castillo 18972610c41Sdp-armHOSTCC := gcc 19072610c41Sdp-armexport HOSTCC 19172610c41Sdp-arm 19273c99d4eSJuan CastilloCC := ${CROSS_COMPILE}gcc 19373c99d4eSJuan CastilloCPP := ${CROSS_COMPILE}cpp 19473c99d4eSJuan CastilloAS := ${CROSS_COMPILE}gcc 19573c99d4eSJuan CastilloAR := ${CROSS_COMPILE}ar 1962adee763SRoberto VargasLINKER := ${CROSS_COMPILE}ld 19773c99d4eSJuan CastilloOC := ${CROSS_COMPILE}objcopy 19873c99d4eSJuan CastilloOD := ${CROSS_COMPILE}objdump 19973c99d4eSJuan CastilloNM := ${CROSS_COMPILE}nm 20073c99d4eSJuan CastilloPP := ${CROSS_COMPILE}gcc -E 20138c14d88SSoby MathewDTC := dtc 20273c99d4eSJuan Castillo 203b25a577fSJulius Werner# Use ${LD}.bfd instead if it exists (as absolute path or together with $PATH). 204b25a577fSJulius Wernerifneq ($(strip $(wildcard ${LD}.bfd) \ 2052adee763SRoberto Vargas $(foreach dir,$(subst :, ,${PATH}),$(wildcard ${dir}/${LINKER}.bfd))),) 2062adee763SRoberto VargasLINKER := ${LINKER}.bfd 207b25a577fSJulius Wernerendif 208b25a577fSJulius Werner 20926e63c44SEtienne Carriereifeq (${ARM_ARCH_MAJOR},7) 21026e63c44SEtienne Carrieretarget32-directive = -target arm-none-eabi 21126e63c44SEtienne Carriere# Will set march32-directive from platform configuration 21226e63c44SEtienne Carriereelse 21326e63c44SEtienne Carrieretarget32-directive = -target armv8a-none-eabi 214fa6f774bSAlexei Fedorov 215f1821790SAlexei Fedorov# Set the compiler's target architecture profile based on 216f1821790SAlexei Fedorov# ARM_ARCH_MAJOR ARM_ARCH_MINOR options 217fa6f774bSAlexei Fedorovifeq (${ARM_ARCH_MINOR},0) 218f1821790SAlexei Fedorovmarch32-directive = -march=armv${ARM_ARCH_MAJOR}-a 219f1821790SAlexei Fedorovmarch64-directive = -march=armv${ARM_ARCH_MAJOR}-a 220fa6f774bSAlexei Fedorovelse 221f1821790SAlexei Fedorovmarch32-directive = -march=armv${ARM_ARCH_MAJOR}.${ARM_ARCH_MINOR}-a 222f1821790SAlexei Fedorovmarch64-directive = -march=armv${ARM_ARCH_MAJOR}.${ARM_ARCH_MINOR}-a 223fa6f774bSAlexei Fedorovendif 22426e63c44SEtienne Carriereendif 22526e63c44SEtienne Carriere 2267ff088d1SManish V Badarkhe# Memory tagging is supported in architecture Armv8.5-A AArch64 and onwards 2277ff088d1SManish V Badarkheifeq ($(ARCH), aarch64) 2284a565bd8SSami Mujawar# Check if revision is greater than or equal to 8.5 2294a565bd8SSami Mujawarifeq "8.5" "$(word 1, $(sort 8.5 $(ARM_ARCH_MAJOR).$(ARM_ARCH_MINOR)))" 2307ff088d1SManish V Badarkhemem_tag_arch_support = yes 2317ff088d1SManish V Badarkheendif 2327ff088d1SManish V Badarkheendif 2337ff088d1SManish V Badarkhe 234f1821790SAlexei Fedorov# Get architecture feature modifiers 235f1821790SAlexei Fedorovarch-features = ${ARM_ARCH_FEATURE} 236f1821790SAlexei Fedorov 237f1821790SAlexei Fedorov# Enable required options for memory stack tagging. 238f1821790SAlexei Fedorov# Currently, these options are enabled only for clang and armclang compiler. 2397ff088d1SManish V Badarkheifeq (${SUPPORT_STACK_MEMTAG},yes) 2407ff088d1SManish V Badarkheifdef mem_tag_arch_support 241f1821790SAlexei Fedorov# Check for armclang and clang compilers 2427ff088d1SManish V Badarkheifneq ( ,$(filter $(notdir $(CC)),armclang clang)) 243f1821790SAlexei Fedorov# Add "memtag" architecture feature modifier if not specified 244f1821790SAlexei Fedorovifeq ( ,$(findstring memtag,$(arch-features))) 245f1821790SAlexei Fedorovarch-features := $(arch-features)+memtag 246f1821790SAlexei Fedorovendif # memtag 2477ff088d1SManish V Badarkheifeq ($(notdir $(CC)),armclang) 2487ff088d1SManish V BadarkheTF_CFLAGS += -mmemtag-stack 2497ff088d1SManish V Badarkheelse ifeq ($(notdir $(CC)),clang) 2507ff088d1SManish V BadarkheTF_CFLAGS += -fsanitize=memtag 251f1821790SAlexei Fedorovendif # armclang 252f1821790SAlexei Fedorovendif # armclang clang 2537ff088d1SManish V Badarkheelse 2547ff088d1SManish V Badarkhe$(error "Error: stack memory tagging is not supported for architecture \ 2557ff088d1SManish V Badarkhe ${ARCH},armv${ARM_ARCH_MAJOR}.${ARM_ARCH_MINOR}-a") 256f1821790SAlexei Fedorovendif # mem_tag_arch_support 257f1821790SAlexei Fedorovendif # SUPPORT_STACK_MEMTAG 258f1821790SAlexei Fedorov 259f1821790SAlexei Fedorov# Set the compiler's architecture feature modifiers 260f1821790SAlexei Fedorovifneq ($(arch-features), none) 261f1821790SAlexei Fedorov# Strip "none+" from arch-features 262f1821790SAlexei Fedorovarch-features := $(subst none+,,$(arch-features)) 263f1821790SAlexei Fedorovifeq ($(ARCH), aarch32) 264f1821790SAlexei Fedorovmarch32-directive := $(march32-directive)+$(arch-features) 265f1821790SAlexei Fedorovelse 266f1821790SAlexei Fedorovmarch64-directive := $(march64-directive)+$(arch-features) 2677ff088d1SManish V Badarkheendif 268f1821790SAlexei Fedorov# Print features 269f1821790SAlexei Fedorov$(info Arm Architecture Features specified: $(subst +, ,$(arch-features))) 270f1821790SAlexei Fedorovendif # arch-features 2717ff088d1SManish V Badarkhe 27212cd65e0STomas Pilar# Determine if FEAT_RNG is supported 27312cd65e0STomas PilarENABLE_FEAT_RNG = $(if $(findstring rng,${arch-features}),1,0) 27412cd65e0STomas Pilar 2754e04478aSChris Kay# Determine if FEAT_SB is supported 2764e04478aSChris KayENABLE_FEAT_SB = $(if $(findstring sb,${arch-features}),1,0) 2774e04478aSChris Kay 278c8a992fdSoriginifneq ($(findstring clang,$(notdir $(CC))),) 279fd18a8fcSVarun Wadekar ifneq ($(findstring armclang,$(notdir $(CC))),) 280c8a992fdSorigin TF_CFLAGS_aarch32 := -target arm-arm-none-eabi $(march32-directive) 281c8a992fdSorigin TF_CFLAGS_aarch64 := -target aarch64-arm-none-eabi $(march64-directive) 282c8a992fdSorigin LD := $(LINKER) 283c8a992fdSorigin else 28494eb1277SArvind Ram Prakash TF_CFLAGS_aarch32 = $(target32-directive) $(march32-directive) 285c8a992fdSorigin TF_CFLAGS_aarch64 := -target aarch64-elf $(march64-directive) 286c8a992fdSorigin LD := $(shell $(CC) --print-prog-name ld.lld) 287c8a992fdSorigin 288c8a992fdSorigin AR := $(shell $(CC) --print-prog-name llvm-ar) 289c8a992fdSorigin OD := $(shell $(CC) --print-prog-name llvm-objdump) 290c8a992fdSorigin OC := $(shell $(CC) --print-prog-name llvm-objcopy) 291641f16e7SAmbroise Vincent endif 292c8a992fdSorigin 293c8a992fdSorigin CPP := $(CC) -E $(TF_CFLAGS_$(ARCH)) 294c8a992fdSorigin PP := $(CC) -E $(TF_CFLAGS_$(ARCH)) 295c8a992fdSorigin AS := $(CC) -c -x assembler-with-cpp $(TF_CFLAGS_$(ARCH)) 296edbce9aaSzelalem-awekeelse ifneq ($(findstring gcc,$(notdir $(CC))),) 297edbce9aaSzelalem-awekeTF_CFLAGS_aarch32 = $(march32-directive) 298edbce9aaSzelalem-awekeTF_CFLAGS_aarch64 = $(march64-directive) 299edbce9aaSzelalem-awekeifeq ($(ENABLE_LTO),1) 300edbce9aaSzelalem-aweke # Enable LTO only for aarch64 301edbce9aaSzelalem-aweke ifeq (${ARCH},aarch64) 302edbce9aaSzelalem-aweke LTO_CFLAGS = -flto 303edbce9aaSzelalem-aweke # Use gcc as a wrapper for the ld, recommended for LTO 304edbce9aaSzelalem-aweke LINKER := ${CROSS_COMPILE}gcc 305edbce9aaSzelalem-aweke endif 306edbce9aaSzelalem-awekeendif 307edbce9aaSzelalem-awekeLD = $(LINKER) 308d5461857Sdp-armelse 30926e63c44SEtienne CarriereTF_CFLAGS_aarch32 = $(march32-directive) 310fa6f774bSAlexei FedorovTF_CFLAGS_aarch64 = $(march64-directive) 3112adee763SRoberto VargasLD = $(LINKER) 312d5461857Sdp-armendif 313d5461857Sdp-arm 31432b209bfSAhmad Fatoum# Process Debug flag 31532b209bfSAhmad Fatoum$(eval $(call add_define,DEBUG)) 31632b209bfSAhmad Fatoumifneq (${DEBUG}, 0) 31732b209bfSAhmad Fatoum BUILD_TYPE := debug 3184466cf82SDaniel Boulby TF_CFLAGS += -g -gdwarf-4 3194466cf82SDaniel Boulby ASFLAGS += -g -Wa,-gdwarf-4 32032b209bfSAhmad Fatoum 32132b209bfSAhmad Fatoum # Use LOG_LEVEL_INFO by default for debug builds 32232b209bfSAhmad Fatoum LOG_LEVEL := 40 32332b209bfSAhmad Fatoumelse 32432b209bfSAhmad Fatoum BUILD_TYPE := release 32532b209bfSAhmad Fatoum # Use LOG_LEVEL_NOTICE by default for release builds 32632b209bfSAhmad Fatoum LOG_LEVEL := 20 32732b209bfSAhmad Fatoumendif 32832b209bfSAhmad Fatoum 329f1de4c8fSPeiyuan Song# Default build string (git branch and commit) 330f1de4c8fSPeiyuan Songifeq (${BUILD_STRING},) 331f1de4c8fSPeiyuan Song BUILD_STRING := $(shell git describe --always --dirty --tags 2> /dev/null) 332f1de4c8fSPeiyuan Songendif 333dddf4283Slaurenw-armVERSION_STRING := v${VERSION}(${BUILD_TYPE}):${BUILD_STRING} 334f1de4c8fSPeiyuan Song 3358fd9d4d5SAntonio Nino Diazifeq (${AARCH32_INSTRUCTION_SET},A32) 3368fd9d4d5SAntonio Nino DiazTF_CFLAGS_aarch32 += -marm 3378fd9d4d5SAntonio Nino Diazelse ifeq (${AARCH32_INSTRUCTION_SET},T32) 3388fd9d4d5SAntonio Nino DiazTF_CFLAGS_aarch32 += -mthumb 3398fd9d4d5SAntonio Nino Diazelse 3408fd9d4d5SAntonio Nino Diaz$(error Error: Unknown AArch32 instruction set ${AARCH32_INSTRUCTION_SET}) 3418fd9d4d5SAntonio Nino Diazendif 3428fd9d4d5SAntonio Nino Diaz 343a9c4dde3SSandrine BailleuxTF_CFLAGS_aarch32 += -mno-unaligned-access 344d5461857Sdp-armTF_CFLAGS_aarch64 += -mgeneral-regs-only -mstrict-align 3459d29c227SSoby Mathew 3469fc59639SAlexei Fedorovifneq (${BP_OPTION},none) 3479fc59639SAlexei FedorovTF_CFLAGS_aarch64 += -mbranch-protection=${BP_OPTION} 3489fc59639SAlexei Fedorovendif 3499fc59639SAlexei Fedorov 35026e63c44SEtienne CarriereASFLAGS_aarch32 = $(march32-directive) 351fa6f774bSAlexei FedorovASFLAGS_aarch64 = $(march64-directive) 352b86048c4SAntonio Nino Diaz 3539ab81b5eSJustin Chadwell# General warnings 3549ab81b5eSJustin ChadwellWARNINGS := -Wall -Wmissing-include-dirs -Wunused \ 355b7f6525dSJustin Chadwell -Wdisabled-optimization -Wvla -Wshadow \ 356d75a9ecdSBoyan Karatotev -Wredundant-decls 357d75a9ecdSBoyan Karatotev# stricter warnings 358d75a9ecdSBoyan KaratotevWARNINGS += -Wextra -Wno-trigraphs 359d75a9ecdSBoyan Karatotev# too verbose for generic build 360d75a9ecdSBoyan KaratotevWARNINGS += -Wno-missing-field-initializers \ 361d75a9ecdSBoyan Karatotev -Wno-type-limits -Wno-sign-compare \ 362d75a9ecdSBoyan Karatotev# on clang this flag gets reset if -Wextra is set after it. No difference on gcc 363d75a9ecdSBoyan KaratotevWARNINGS += -Wno-unused-parameter 3649ab81b5eSJustin Chadwell 3659ab81b5eSJustin Chadwell# Additional warnings 366d75a9ecdSBoyan Karatotev# Level 1 - infrequent warnings we should have none of 367d75a9ecdSBoyan Karatotev# full -Wextra 368d75a9ecdSBoyan KaratotevWARNING1 += -Wsign-compare 369d75a9ecdSBoyan KaratotevWARNING1 += -Wtype-limits 370d75a9ecdSBoyan KaratotevWARNING1 += -Wmissing-field-initializers 371e7c645b5SYann Gautier 372d75a9ecdSBoyan Karatotev# Level 2 - problematic warnings that we want 373d75a9ecdSBoyan Karatotev# zlib, compiler-rt, coreboot, and mbdedtls blow up with these 374d75a9ecdSBoyan Karatotev# TODO: disable just for them and move into default build 375d75a9ecdSBoyan KaratotevWARNING2 += -Wold-style-definition 376d75a9ecdSBoyan KaratotevWARNING2 += -Wmissing-prototypes 377d75a9ecdSBoyan KaratotevWARNING2 += -Wmissing-format-attribute 378d75a9ecdSBoyan Karatotev# TF-A aims to comply with this eventually. Effort too large at present 379d75a9ecdSBoyan KaratotevWARNING2 += -Wundef 380d141e638SBoyan Karatotev# currently very involved and many platforms set this off 381d141e638SBoyan KaratotevWARNING2 += -Wunused-const-variable=2 382e7c645b5SYann Gautier 383d75a9ecdSBoyan Karatotev# Level 3 - very pedantic, frequently ignored 384e7c645b5SYann GautierWARNING3 := -Wbad-function-cast 385d75a9ecdSBoyan KaratotevWARNING3 += -Waggregate-return 386d75a9ecdSBoyan KaratotevWARNING3 += -Wnested-externs 387d75a9ecdSBoyan KaratotevWARNING3 += -Wcast-align 388e7c645b5SYann GautierWARNING3 += -Wcast-qual 389e7c645b5SYann GautierWARNING3 += -Wconversion 390e7c645b5SYann GautierWARNING3 += -Wpacked 391e7c645b5SYann GautierWARNING3 += -Wpointer-arith 392e7c645b5SYann GautierWARNING3 += -Wswitch-default 393e7c645b5SYann Gautier 394d75a9ecdSBoyan Karatotev# Setting W is quite verbose and most warnings will be pre-existing issues 395d75a9ecdSBoyan Karatotev# outside of the contributor's control. Don't fail the build on them so warnings 396d75a9ecdSBoyan Karatotev# can be seen and hopefully addressed 397d75a9ecdSBoyan Karatotevifdef W 398d75a9ecdSBoyan Karatotevifneq (${W},0) 399d75a9ecdSBoyan KaratotevE ?= 0 400d75a9ecdSBoyan Karatotevendif 401d75a9ecdSBoyan Karatotevendif 402d75a9ecdSBoyan Karatotev 403e7c645b5SYann Gautierifeq (${W},1) 4049ab81b5eSJustin ChadwellWARNINGS += $(WARNING1) 405e7c645b5SYann Gautierelse ifeq (${W},2) 4069ab81b5eSJustin ChadwellWARNINGS += $(WARNING1) $(WARNING2) 407e7c645b5SYann Gautierelse ifeq (${W},3) 4089ab81b5eSJustin ChadwellWARNINGS += $(WARNING1) $(WARNING2) $(WARNING3) 409e7c645b5SYann Gautierendif 410e7c645b5SYann Gautier 4119ab81b5eSJustin Chadwell# Compiler specific warnings 41200296576SAmbroise Vincentifeq ($(findstring clang,$(notdir $(CC))),) 41393c690ebSJustin Chadwell# not using clang 414d7b4cd41SJustin ChadwellWARNINGS += -Wunused-but-set-variable -Wmaybe-uninitialized \ 415d7b4cd41SJustin Chadwell -Wpacked-bitfield-compat -Wshift-overflow=2 \ 416d7b4cd41SJustin Chadwell -Wlogical-op 41793c690ebSJustin Chadwellelse 41893c690ebSJustin Chadwell# using clang 419d7b4cd41SJustin ChadwellWARNINGS += -Wshift-overflow -Wshift-sign-overflow \ 420d7b4cd41SJustin Chadwell -Wlogical-op-parentheses 42100296576SAmbroise Vincentendif 42200296576SAmbroise Vincent 4236336b07aSYann Gautierifneq (${E},0) 4246336b07aSYann GautierERRORS := -Werror 4256336b07aSYann Gautierendif 4266336b07aSYann Gautier 427ea7a57a3SRoberto VargasCPPFLAGS = ${DEFINES} ${INCLUDES} ${MBEDTLS_INC} -nostdinc \ 4289ab81b5eSJustin Chadwell $(ERRORS) $(WARNINGS) 42959de5096SMasahiro YamadaASFLAGS += $(CPPFLAGS) $(ASFLAGS_$(ARCH)) \ 430d5dfdeb6SJulius Werner -ffreestanding -Wa,--fatal-warnings 43159de5096SMasahiro YamadaTF_CFLAGS += $(CPPFLAGS) $(TF_CFLAGS_$(ARCH)) \ 432ebd6efaeSSamuel Holland -ffunction-sections -fdata-sections \ 433ebd6efaeSSamuel Holland -ffreestanding -fno-builtin -fno-common \ 434ebd6efaeSSamuel Holland -Os -std=gnu99 43573c99d4eSJuan Castillo 436bebcf27fSMark Brown$(eval $(call add_define,SVE_VECTOR_LEN)) 437bebcf27fSMark Brown 4381f461979SJustin Chadwellifeq (${SANITIZE_UB},on) 4391f461979SJustin ChadwellTF_CFLAGS += -fsanitize=undefined -fno-sanitize-recover 4401f461979SJustin Chadwellendif 4411f461979SJustin Chadwellifeq (${SANITIZE_UB},trap) 4421f461979SJustin ChadwellTF_CFLAGS += -fsanitize=undefined -fno-sanitize-recover \ 4431f461979SJustin Chadwell -fsanitize-undefined-trap-on-error 4441f461979SJustin Chadwellendif 4451f461979SJustin Chadwell 446f7ec31dbSdavid cunadoGCC_V_OUTPUT := $(shell $(CC) -v 2>&1) 447f7ec31dbSdavid cunado 448641f16e7SAmbroise Vincent# LD = armlink 449c2ad38ceSVarun Wadekarifneq ($(findstring armlink,$(notdir $(LD))),) 450c2ad38ceSVarun WadekarTF_LDFLAGS += --diag_error=warning --lto_level=O1 451c2ad38ceSVarun WadekarTF_LDFLAGS += --remove --info=unused,unusedsymbols 452edbce9aaSzelalem-awekeTF_LDFLAGS += $(TF_LDFLAGS_$(ARCH)) 453641f16e7SAmbroise Vincent 454641f16e7SAmbroise Vincent# LD = gcc (used when GCC LTO is enabled) 455edbce9aaSzelalem-awekeelse ifneq ($(findstring gcc,$(notdir $(LD))),) 456edbce9aaSzelalem-aweke# Pass ld options with Wl or Xlinker switches 457edbce9aaSzelalem-awekeTF_LDFLAGS += -Wl,--fatal-warnings -O1 458edbce9aaSzelalem-awekeTF_LDFLAGS += -Wl,--gc-sections 459edbce9aaSzelalem-awekeifeq ($(ENABLE_LTO),1) 460edbce9aaSzelalem-aweke ifeq (${ARCH},aarch64) 461edbce9aaSzelalem-aweke TF_LDFLAGS += -flto -fuse-linker-plugin 462edbce9aaSzelalem-aweke endif 463edbce9aaSzelalem-awekeendif 464edbce9aaSzelalem-aweke# GCC automatically adds fix-cortex-a53-843419 flag when used to link 465edbce9aaSzelalem-aweke# which breaks some builds, so disable if errata fix is not explicitly enabled 466edbce9aaSzelalem-awekeifneq (${ERRATA_A53_843419},1) 467edbce9aaSzelalem-aweke TF_LDFLAGS += -mno-fix-cortex-a53-843419 468edbce9aaSzelalem-awekeendif 469edbce9aaSzelalem-awekeTF_LDFLAGS += -nostdlib 470edbce9aaSzelalem-awekeTF_LDFLAGS += $(subst --,-Xlinker --,$(TF_LDFLAGS_$(ARCH))) 471641f16e7SAmbroise Vincent 472641f16e7SAmbroise Vincent# LD = gcc-ld (ld) or llvm-ld (ld.lld) or other 473c2ad38ceSVarun Wadekarelse 474c2b8806fSDouglas RaillardTF_LDFLAGS += --fatal-warnings -O1 475c2b8806fSDouglas RaillardTF_LDFLAGS += --gc-sections 476641f16e7SAmbroise Vincent# ld.lld doesn't recognize the errata flags, 477641f16e7SAmbroise Vincent# therefore don't add those in that case 478641f16e7SAmbroise Vincentifeq ($(findstring ld.lld,$(notdir $(LD))),) 479c2b8806fSDouglas RaillardTF_LDFLAGS += $(TF_LDFLAGS_$(ARCH)) 480edbce9aaSzelalem-awekeendif 481641f16e7SAmbroise Vincentendif 48273c99d4eSJuan Castillo 48303b397a8SNishanth MenonDTC_FLAGS += -I dts -O dtb 484a6de824fSLouis MayencourtDTC_CPPFLAGS += -P -nostdinc -Iinclude -Ifdts -undef \ 485a6de824fSLouis Mayencourt -x assembler-with-cpp $(DEFINES) 48603b397a8SNishanth Menon 48773c99d4eSJuan Castillo################################################################################ 48873c99d4eSJuan Castillo# Common sources and include directories 48973c99d4eSJuan Castillo################################################################################ 4906a0da736SJayanth Dodderi Chidanandinclude ${MAKE_HELPERS_DIRECTORY}arch_features.mk 491d801fbb0Sdp-arminclude lib/compiler-rt/compiler-rt.mk 49273c99d4eSJuan Castillo 49373c99d4eSJuan CastilloBL_COMMON_SOURCES += common/bl_common.c \ 4947f56e9a3SSoby Mathew common/tf_log.c \ 4959d29c227SSoby Mathew common/${ARCH}/debug.S \ 49691b48c9fSJulius Werner drivers/console/multi_console.c \ 4979d29c227SSoby Mathew lib/${ARCH}/cache_helpers.S \ 4989d29c227SSoby Mathew lib/${ARCH}/misc_helpers.S \ 499566034fcSSoby Mathew plat/common/plat_bl_common.c \ 5007f56e9a3SSoby Mathew plat/common/plat_log_common.c \ 50175311203Sdp-arm plat/common/${ARCH}/plat_common.c \ 5029d29c227SSoby Mathew plat/common/${ARCH}/platform_helpers.S \ 50361f72a34SRoberto Vargas ${COMPILER_RT_SRCS} 504d7a6b0f8SRyan Harkin 5058422a840SAntonio Nino Diazifeq ($(notdir $(CC)),armclang) 5068422a840SAntonio Nino DiazBL_COMMON_SOURCES += lib/${ARCH}/armclang_printf.S 5078422a840SAntonio Nino Diazendif 5088422a840SAntonio Nino Diaz 5091f461979SJustin Chadwellifeq (${SANITIZE_UB},on) 5101f461979SJustin ChadwellBL_COMMON_SOURCES += plat/common/ubsan.c 5111f461979SJustin Chadwellendif 5121f461979SJustin Chadwell 51301d237cbSYann GautierINCLUDES += -Iinclude \ 514f5478dedSAntonio Nino Diaz -Iinclude/arch/${ARCH} \ 51509d40e0eSAntonio Nino Diaz -Iinclude/lib/cpus/${ARCH} \ 51609d40e0eSAntonio Nino Diaz -Iinclude/lib/el3_runtime/${ARCH} \ 51709d40e0eSAntonio Nino Diaz ${PLAT_INCLUDES} \ 51809d40e0eSAntonio Nino Diaz ${SPD_INCLUDES} 51909d40e0eSAntonio Nino Diaz 5209c6d1c50SAntonio Nino Diazinclude common/backtrace/backtrace.mk 5219c6d1c50SAntonio Nino Diaz 52273c99d4eSJuan Castillo################################################################################ 52373c99d4eSJuan Castillo# Generic definitions 52473c99d4eSJuan Castillo################################################################################ 52573c99d4eSJuan Castillo 526231c1470SEvan Lloydinclude ${MAKE_HELPERS_DIRECTORY}plat_helpers.mk 527231c1470SEvan Lloyd 52829214e95SGrant Likelyifeq (${BUILD_BASE},) 52973c99d4eSJuan Castillo BUILD_BASE := ./build 53029214e95SGrant Likelyendif 53129214e95SGrant LikelyBUILD_PLAT := $(abspath ${BUILD_BASE})/${PLAT}/${BUILD_TYPE} 53273c99d4eSJuan Castillo 533231c1470SEvan LloydSPDS := $(sort $(filter-out none, $(patsubst services/spd/%,%,$(wildcard services/spd/*)))) 53473c99d4eSJuan Castillo 53573c99d4eSJuan Castillo# Platforms providing their own TBB makefile may override this value 53673c99d4eSJuan CastilloINCLUDE_TBBR_MK := 1 53773c99d4eSJuan Castillo 53873c99d4eSJuan Castillo 53973c99d4eSJuan Castillo################################################################################ 54073c99d4eSJuan Castillo# Include SPD Makefile if one has been specified 54173c99d4eSJuan Castillo################################################################################ 54273c99d4eSJuan Castillo 54373c99d4eSJuan Castilloifneq (${SPD},none) 5449d29c227SSoby Mathew ifeq (${ARCH},aarch32) 5459d29c227SSoby Mathew $(error "Error: SPD is incompatible with AArch32.") 5469d29c227SSoby Mathew endif 54728f39f02SMax Shvetsov 5484c117f6cSSandrine Bailleux ifdef EL3_PAYLOAD_BASE 5494c117f6cSSandrine Bailleux $(warning "SPD and EL3_PAYLOAD_BASE are incompatible build options.") 5504c117f6cSSandrine Bailleux $(warning "The SPD and its BL32 companion will be present but ignored.") 5514c117f6cSSandrine Bailleux endif 55228f39f02SMax Shvetsov 553c3fb00d9SAchin Gupta ifeq (${SPD},spmd) 554c3fb00d9SAchin Gupta # SPMD is located in std_svc directory 555c3fb00d9SAchin Gupta SPD_DIR := std_svc 55628f39f02SMax Shvetsov 557033039f8SMax Shvetsov ifeq ($(SPMD_SPM_AT_SEL2),1) 558f1910cc1SGovindraj Raja CTX_INCLUDE_EL2_REGS := 1 5591d63ae4dSMarc Bonnici ifeq ($(SPMC_AT_EL3),1) 5601d63ae4dSMarc Bonnici $(error SPM cannot be enabled in both S-EL2 and EL3.) 5611d63ae4dSMarc Bonnici endif 56228f39f02SMax Shvetsov endif 563db1ef41aSOlivier Deprez 564db1ef41aSOlivier Deprez ifeq ($(findstring optee_sp,$(ARM_SPMC_MANIFEST_DTS)),optee_sp) 565db1ef41aSOlivier Deprez DTC_CPPFLAGS += -DOPTEE_SP_FW_CONFIG 566db1ef41aSOlivier Deprez endif 567ca932481SDavidson K 568ca932481SDavidson K ifeq ($(TS_SP_FW_CONFIG),1) 569ca932481SDavidson K DTC_CPPFLAGS += -DTS_SP_FW_CONFIG 570ca932481SDavidson K endif 57133993a37SBalint Dobszay 57233993a37SBalint Dobszay ifneq ($(ARM_BL2_SP_LIST_DTS),) 57333993a37SBalint Dobszay DTC_CPPFLAGS += -DARM_BL2_SP_LIST_DTS=$(ARM_BL2_SP_LIST_DTS) 57433993a37SBalint Dobszay endif 57546789a7cSBalint Dobszay 57646789a7cSBalint Dobszay ifneq ($(SP_LAYOUT_FILE),) 57746789a7cSBalint Dobszay BL2_ENABLE_SP_LOAD := 1 57846789a7cSBalint Dobszay endif 579c3fb00d9SAchin Gupta else 580c3fb00d9SAchin Gupta # All other SPDs in spd directory 581c3fb00d9SAchin Gupta SPD_DIR := spd 582c3fb00d9SAchin Gupta endif 583c3fb00d9SAchin Gupta 58473c99d4eSJuan Castillo # We expect to locate an spd.mk under the specified SPD directory 585c3fb00d9SAchin Gupta SPD_MAKE := $(wildcard services/${SPD_DIR}/${SPD}/${SPD}.mk) 586c3fb00d9SAchin Gupta 58773c99d4eSJuan Castillo ifeq (${SPD_MAKE},) 588c3fb00d9SAchin Gupta $(error Error: No services/${SPD_DIR}/${SPD}/${SPD}.mk located) 58973c99d4eSJuan Castillo endif 59073c99d4eSJuan Castillo $(info Including ${SPD_MAKE}) 59173c99d4eSJuan Castillo include ${SPD_MAKE} 59273c99d4eSJuan Castillo 59370d1fc53SJuan Castillo # If there's BL32 companion for the chosen SPD, we expect that the SPD's 59470d1fc53SJuan Castillo # Makefile would set NEED_BL32 to "yes". In this case, the build system 59570d1fc53SJuan Castillo # supports two mutually exclusive options: 59670d1fc53SJuan Castillo # * BL32 is built from source: then BL32_SOURCES must contain the list 59770d1fc53SJuan Castillo # of source files to build BL32 59870d1fc53SJuan Castillo # * BL32 is a prebuilt binary: then BL32 must point to the image file 59970d1fc53SJuan Castillo # that will be included in the FIP 60070d1fc53SJuan Castillo # If both BL32_SOURCES and BL32 are defined, the binary takes precedence 60170d1fc53SJuan Castillo # over the sources. 602e35c4045SJeenu Viswambharanendif 603e35c4045SJeenu Viswambharan 604f1910cc1SGovindraj Rajaifeq (${CTX_INCLUDE_EL2_REGS}, 1) 605f1910cc1SGovindraj Rajaifeq (${SPD},none) 606f1910cc1SGovindraj Rajaifeq (${ENABLE_RME},0) 607f1910cc1SGovindraj Raja $(error CTX_INCLUDE_EL2_REGS is available only when SPD or RME is enabled) 608f1910cc1SGovindraj Rajaendif 609f1910cc1SGovindraj Rajaendif 610f1910cc1SGovindraj Rajaendif 611f1910cc1SGovindraj Raja 61251faada7SDouglas Raillard################################################################################ 6135b18de09SZelalem Aweke# Include rmmd Makefile if RME is enabled 6145b18de09SZelalem Aweke################################################################################ 6155b18de09SZelalem Aweke 6165b18de09SZelalem Awekeifneq (${ENABLE_RME},0) 6175b18de09SZelalem Awekeifneq (${ARCH},aarch64) 6185b18de09SZelalem Aweke $(error ENABLE_RME requires AArch64) 6195b18de09SZelalem Awekeendif 6201d63ae4dSMarc Bonniciifeq ($(SPMC_AT_EL3),1) 6211d63ae4dSMarc Bonnici $(error SPMC_AT_EL3 and ENABLE_RME cannot both be enabled.) 6221d63ae4dSMarc Bonniciendif 6235b18de09SZelalem Awekeinclude services/std_svc/rmmd/rmmd.mk 6245b18de09SZelalem Aweke$(warning "RME is an experimental feature") 6255b18de09SZelalem Awekeendif 6265b18de09SZelalem Aweke 6275b18de09SZelalem Aweke################################################################################ 62873c99d4eSJuan Castillo# Include the platform specific Makefile after the SPD Makefile (the platform 62973c99d4eSJuan Castillo# makefile may use all previous definitions in this file) 63073c99d4eSJuan Castillo################################################################################ 6312da8d8bfSJeenu Viswambharan 63273c99d4eSJuan Castilloinclude ${PLAT_MAKEFILE_FULL} 6330f21c547SJuan Castillo 6348012cc5cSMasahiro Yamada$(eval $(call MAKE_PREREQ_DIR,${BUILD_PLAT})) 6358012cc5cSMasahiro Yamada 63626e63c44SEtienne Carriereifeq (${ARM_ARCH_MAJOR},7) 63726e63c44SEtienne Carriereinclude make_helpers/armv7-a-cpus.mk 63826e63c44SEtienne Carriereendif 63926e63c44SEtienne Carriere 6403bd17c0fSSoby MathewPIE_FOUND := $(findstring --enable-default-pie,${GCC_V_OUTPUT}) 6413bd17c0fSSoby Mathewifneq ($(PIE_FOUND),) 6423bd17c0fSSoby Mathew TF_CFLAGS += -fno-PIE 6437b592418SSamuel Hollandifneq ($(findstring gcc,$(notdir $(LD))),) 6447b592418SSamuel Holland TF_LDFLAGS += -no-pie 6457b592418SSamuel Hollandendif 6463bd17c0fSSoby Mathewendif 647320920c1SMasahiro Yamada 648320920c1SMasahiro Yamadaifneq ($(findstring gcc,$(notdir $(LD))),) 649320920c1SMasahiro Yamada PIE_LDFLAGS += -Wl,-pie -Wl,--no-dynamic-linker 650320920c1SMasahiro Yamadaelse 651320920c1SMasahiro Yamada PIE_LDFLAGS += -pie --no-dynamic-linker 652320920c1SMasahiro Yamadaendif 653320920c1SMasahiro Yamada 654320920c1SMasahiro Yamadaifeq ($(ENABLE_PIE),1) 65569af7fcfSMasahiro Yamadaifeq ($(BL2_AT_EL3),1) 65669af7fcfSMasahiro Yamadaifneq ($(BL2_IN_XIP_MEM),1) 65769af7fcfSMasahiro Yamada BL2_CFLAGS += -fpie 65869af7fcfSMasahiro Yamada BL2_LDFLAGS += $(PIE_LDFLAGS) 65969af7fcfSMasahiro Yamadaendif 66069af7fcfSMasahiro Yamadaendif 661320920c1SMasahiro Yamada BL31_CFLAGS += -fpie 662320920c1SMasahiro Yamada BL31_LDFLAGS += $(PIE_LDFLAGS) 663d974301dSMasahiro Yamada BL32_CFLAGS += -fpie 664d974301dSMasahiro Yamada BL32_LDFLAGS += $(PIE_LDFLAGS) 665d974301dSMasahiro Yamadaendif 6663bd17c0fSSoby Mathew 667d5e97a1dSMasahiro Yamadaifeq (${ARCH},aarch64) 6689cefb4b1SMasahiro YamadaBL1_CPPFLAGS += -DIMAGE_AT_EL3 669d5e97a1dSMasahiro Yamadaifeq ($(BL2_AT_EL3),1) 6709cefb4b1SMasahiro YamadaBL2_CPPFLAGS += -DIMAGE_AT_EL3 671d5e97a1dSMasahiro Yamadaelse 6729cefb4b1SMasahiro YamadaBL2_CPPFLAGS += -DIMAGE_AT_EL1 673d5e97a1dSMasahiro Yamadaendif 6749cefb4b1SMasahiro YamadaBL2U_CPPFLAGS += -DIMAGE_AT_EL1 6759cefb4b1SMasahiro YamadaBL31_CPPFLAGS += -DIMAGE_AT_EL3 6769cefb4b1SMasahiro YamadaBL32_CPPFLAGS += -DIMAGE_AT_EL1 677d5e97a1dSMasahiro Yamadaendif 678d5e97a1dSMasahiro Yamada 67954035fc4SSandrine Bailleux# Include the CPU specific operations makefile, which provides default 68054035fc4SSandrine Bailleux# values for all CPU errata workarounds and CPU specific optimisations. 68154035fc4SSandrine Bailleux# This can be overridden by the platform. 68273c99d4eSJuan Castilloinclude lib/cpus/cpu-ops.mk 6834f6ad66aSAchin Gupta 684a4409008Sdp-armifeq (${ARCH},aarch32) 685a4409008Sdp-armNEED_BL32 := yes 686a4409008Sdp-arm 687a4409008Sdp-arm################################################################################ 688a4409008Sdp-arm# Build `AARCH32_SP` as BL32 image for AArch32 689a4409008Sdp-arm################################################################################ 690a4409008Sdp-armifneq (${AARCH32_SP},none) 691a4409008Sdp-arm# We expect to locate an sp.mk under the specified AARCH32_SP directory 692a4409008Sdp-armAARCH32_SP_MAKE := $(wildcard bl32/${AARCH32_SP}/${AARCH32_SP}.mk) 693a4409008Sdp-arm 694a4409008Sdp-armifeq (${AARCH32_SP_MAKE},) 695a4409008Sdp-arm $(error Error: No bl32/${AARCH32_SP}/${AARCH32_SP}.mk located) 696a4409008Sdp-armendif 697a4409008Sdp-arm 698a4409008Sdp-arm$(info Including ${AARCH32_SP_MAKE}) 699a4409008Sdp-arminclude ${AARCH32_SP_MAKE} 700a4409008Sdp-armendif 701a4409008Sdp-arm 702a4409008Sdp-armendif 7034f6ad66aSAchin Gupta 70473c99d4eSJuan Castillo################################################################################ 70577f1f7a1SVarun Wadekar# Include libc if not overridden 70677f1f7a1SVarun Wadekar################################################################################ 70777f1f7a1SVarun Wadekarifeq (${OVERRIDE_LIBC},0) 70877f1f7a1SVarun Wadekarinclude lib/libc/libc.mk 70977f1f7a1SVarun Wadekarendif 71077f1f7a1SVarun Wadekar 71177f1f7a1SVarun Wadekar################################################################################ 712cf2c8a33SAntonio Nino Diaz# Check incompatible options 713cf2c8a33SAntonio Nino Diaz################################################################################ 714cf2c8a33SAntonio Nino Diaz 715cf2c8a33SAntonio Nino Diazifdef EL3_PAYLOAD_BASE 71668450a6dSAntonio Nino Diaz ifdef PRELOADED_BL33_BASE 71768450a6dSAntonio Nino Diaz $(warning "PRELOADED_BL33_BASE and EL3_PAYLOAD_BASE are \ 71868450a6dSAntonio Nino Diaz incompatible build options. EL3_PAYLOAD_BASE has priority.") 719cf2c8a33SAntonio Nino Diaz endif 72076580f3dSQixiang Xu ifneq (${GENERATE_COT},0) 72176580f3dSQixiang Xu $(error "GENERATE_COT and EL3_PAYLOAD_BASE are incompatible build options.") 72276580f3dSQixiang Xu endif 72376580f3dSQixiang Xu ifneq (${TRUSTED_BOARD_BOOT},0) 72476580f3dSQixiang Xu $(error "TRUSTED_BOARD_BOOT and EL3_PAYLOAD_BASE are incompatible build options.") 72576580f3dSQixiang Xu endif 726cf2c8a33SAntonio Nino Diazendif 727cf2c8a33SAntonio Nino Diaz 728cf2c8a33SAntonio Nino Diazifeq (${NEED_BL33},yes) 729cf2c8a33SAntonio Nino Diaz ifdef EL3_PAYLOAD_BASE 730cf2c8a33SAntonio Nino Diaz $(warning "BL33 image is not needed when option \ 731cf2c8a33SAntonio Nino Diaz BL33_PAYLOAD_BASE is used and won't be added to the FIP file.") 732cf2c8a33SAntonio Nino Diaz endif 73368450a6dSAntonio Nino Diaz ifdef PRELOADED_BL33_BASE 73468450a6dSAntonio Nino Diaz $(warning "BL33 image is not needed when option \ 73568450a6dSAntonio Nino Diaz PRELOADED_BL33_BASE is used and won't be added to the FIP \ 73668450a6dSAntonio Nino Diaz file.") 737cf2c8a33SAntonio Nino Diaz endif 738cf2c8a33SAntonio Nino Diazendif 739cf2c8a33SAntonio Nino Diaz 740d4593e47SJeenu Viswambharan# When building for systems with hardware-assisted coherency, there's no need to 741d4593e47SJeenu Viswambharan# use USE_COHERENT_MEM. Require that USE_COHERENT_MEM must be set to 0 too. 742d4593e47SJeenu Viswambharanifeq ($(HW_ASSISTED_COHERENCY)-$(USE_COHERENT_MEM),1-1) 743d4593e47SJeenu Viswambharan$(error USE_COHERENT_MEM cannot be enabled with HW_ASSISTED_COHERENCY) 744d4593e47SJeenu Viswambharanendif 7451a0a3f06SYatharth Kochar 7467d173fc5SJiafei Pan#For now, BL2_IN_XIP_MEM is only supported when BL2_AT_EL3 is 1. 7477d173fc5SJiafei Panifeq ($(BL2_AT_EL3)-$(BL2_IN_XIP_MEM),0-1) 7487d173fc5SJiafei Pan$(error "BL2_IN_XIP_MEM is only supported when BL2_AT_EL3 is enabled") 7497d173fc5SJiafei Panendif 7507d173fc5SJiafei Pan 75114c6016aSJeenu Viswambharan# For RAS_EXTENSION, require that EAs are handled in EL3 first 75214c6016aSJeenu Viswambharanifeq ($(RAS_EXTENSION),1) 75346cc41d5SManish Pandey ifneq ($(HANDLE_EA_EL3_FIRST_NS),1) 75446cc41d5SManish Pandey $(error For RAS_EXTENSION, HANDLE_EA_EL3_FIRST_NS must also be 1) 75514c6016aSJeenu Viswambharan endif 75614c6016aSJeenu Viswambharanendif 75714c6016aSJeenu Viswambharan 7581a7c1cfeSJeenu Viswambharan# When FAULT_INJECTION_SUPPORT is used, require that RAS_EXTENSION is enabled 7591a7c1cfeSJeenu Viswambharanifeq ($(FAULT_INJECTION_SUPPORT),1) 7601a7c1cfeSJeenu Viswambharan ifneq ($(RAS_EXTENSION),1) 7611a7c1cfeSJeenu Viswambharan $(error For FAULT_INJECTION_SUPPORT, RAS_EXTENSION must also be 1) 7621a7c1cfeSJeenu Viswambharan endif 7631a7c1cfeSJeenu Viswambharanendif 7641a7c1cfeSJeenu Viswambharan 765ed51b51fSRoberto Vargas# DYN_DISABLE_AUTH can be set only when TRUSTED_BOARD_BOOT=1 766209a60ccSSoby Mathewifeq ($(DYN_DISABLE_AUTH), 1) 767209a60ccSSoby Mathew ifeq (${TRUSTED_BOARD_BOOT}, 0) 768209a60ccSSoby Mathew $(error "TRUSTED_BOARD_BOOT must be enabled for DYN_DISABLE_AUTH to be set.") 769209a60ccSSoby Mathew endif 770209a60ccSSoby Mathewendif 771209a60ccSSoby Mathew 7722bf4f27fSManish V Badarkheifeq ($(MEASURED_BOOT)-$(TRUSTED_BOARD_BOOT),1-1) 7732bf4f27fSManish V Badarkhe# Support authentication verification and hash calculation 7742bf4f27fSManish V Badarkhe CRYPTO_SUPPORT := 3 7752bf4f27fSManish V Badarkheelse ifeq ($(DRTM_SUPPORT)-$(TRUSTED_BOARD_BOOT),1-1) 7762bf4f27fSManish V Badarkhe# Support authentication verification and hash calculation 7772bf4f27fSManish V Badarkhe CRYPTO_SUPPORT := 3 7782bf4f27fSManish V Badarkheelse ifneq ($(filter 1,${MEASURED_BOOT} ${DRTM_SUPPORT}),) 7792bf4f27fSManish V Badarkhe# Support hash calculation only 7802bf4f27fSManish V Badarkhe CRYPTO_SUPPORT := 2 7812bf4f27fSManish V Badarkheelse ifeq (${TRUSTED_BOARD_BOOT},1) 7822bf4f27fSManish V Badarkhe# Support authentication verification only 783c9c56f6eSManish V Badarkhe CRYPTO_SUPPORT := 1 784c9c56f6eSManish V Badarkheelse 785c9c56f6eSManish V Badarkhe CRYPTO_SUPPORT := 0 786c9c56f6eSManish V Badarkheendif 787c9c56f6eSManish V Badarkhe 788cbf9e84aSBalint Dobszay# SDEI_IN_FCONF is only supported when SDEI_SUPPORT is enabled. 789cbf9e84aSBalint Dobszayifeq ($(SDEI_SUPPORT)-$(SDEI_IN_FCONF),0-1) 790700e7685SManish Pandey$(error "SDEI_IN_FCONF is only supported when SDEI_SUPPORT is enabled") 79184ef9cd8SManish V Badarkheendif 79284ef9cd8SManish V Badarkhe 793b86048c4SAntonio Nino Diaz# If pointer authentication is used in the firmware, make sure that all the 7949fc59639SAlexei Fedorov# registers associated to it are also saved and restored. 7959fc59639SAlexei Fedorov# Not doing it would leak the value of the keys used by EL3 to EL1 and S-EL1. 796b86048c4SAntonio Nino Diazifeq ($(ENABLE_PAUTH),1) 7979fc59639SAlexei Fedorov ifeq ($(CTX_INCLUDE_PAUTH_REGS),0) 7989fc59639SAlexei Fedorov $(error Pointer Authentication requires CTX_INCLUDE_PAUTH_REGS=1) 79906715f85SAlexei Fedorov endif 8009fc59639SAlexei Fedorovendif 8019fc59639SAlexei Fedorov 80206715f85SAlexei Fedorovifeq ($(CTX_INCLUDE_PAUTH_REGS),1) 8039fc59639SAlexei Fedorov ifneq (${ARCH},aarch64) 8049fc59639SAlexei Fedorov $(error CTX_INCLUDE_PAUTH_REGS requires AArch64) 805b86048c4SAntonio Nino Diaz endif 806b86048c4SAntonio Nino Diazendif 8079fc59639SAlexei Fedorov 8089dd94382SJustin Chadwellifeq ($(CTX_INCLUDE_MTE_REGS),1) 8099dd94382SJustin Chadwell ifneq (${ARCH},aarch64) 8109dd94382SJustin Chadwell $(error CTX_INCLUDE_MTE_REGS requires AArch64) 8119dd94382SJustin Chadwell endif 8129dd94382SJustin Chadwellendif 8139dd94382SJustin Chadwell 814396b339dSManish V Badarkheifeq ($(PSA_FWU_SUPPORT),1) 815396b339dSManish V Badarkhe $(info PSA_FWU_SUPPORT is an experimental feature) 816396b339dSManish V Badarkheendif 817396b339dSManish V Badarkhe 8186a0da736SJayanth Dodderi Chidanandifeq ($(FEATURE_DETECTION),1) 8196a0da736SJayanth Dodderi Chidanand $(info FEATURE_DETECTION is an experimental feature) 8206a0da736SJayanth Dodderi Chidanandendif 8216a0da736SJayanth Dodderi Chidanand 82260e8f3cfSPetre-Ionut Tudorifeq (${ARM_XLAT_TABLES_LIB_V1}, 1) 82360e8f3cfSPetre-Ionut Tudor ifeq (${ALLOW_RO_XLAT_TABLES}, 1) 82460e8f3cfSPetre-Ionut Tudor $(error "ALLOW_RO_XLAT_TABLES requires translation tables library v2") 82560e8f3cfSPetre-Ionut Tudor endif 82660e8f3cfSPetre-Ionut Tudorendif 82760e8f3cfSPetre-Ionut Tudor 8287cda17bbSSumit Gargifneq (${DECRYPTION_SUPPORT},none) 8297cda17bbSSumit Garg ifeq (${TRUSTED_BOARD_BOOT}, 0) 8307cda17bbSSumit Garg $(error TRUSTED_BOARD_BOOT must be enabled for DECRYPTION_SUPPORT to be set) 8317cda17bbSSumit Garg endif 8327cda17bbSSumit Gargendif 8337cda17bbSSumit Garg 834744ad974Sjohpow01# Ensure that no Aarch64-only features are enabled in Aarch32 build 835dc78e62dSjohpow01ifeq (${ARCH},aarch32) 836744ad974Sjohpow01 837744ad974Sjohpow01 # SME/SVE only supported on AArch64 838dc78e62dSjohpow01 ifeq (${ENABLE_SME_FOR_NS},1) 839dc78e62dSjohpow01 $(error "ENABLE_SME_FOR_NS cannot be used with ARCH=aarch32") 840dc78e62dSjohpow01 endif 841dc78e62dSjohpow01 ifeq (${ENABLE_SVE_FOR_NS},1) 842dc78e62dSjohpow01 # Warning instead of error due to CI dependency on this 84324ab2c0aSYann Gautier $(error "ENABLE_SVE_FOR_NS cannot be used with ARCH=aarch32") 844dc78e62dSjohpow01 endif 845744ad974Sjohpow01 846ff86e0b4SJuan Pablo Conde # BRBE is not supported in AArch32 847744ad974Sjohpow01 ifeq (${ENABLE_BRBE_FOR_NS},1) 848744ad974Sjohpow01 $(error "ENABLE_BRBE_FOR_NS cannot be used with ARCH=aarch32") 849744ad974Sjohpow01 endif 850744ad974Sjohpow01 851ff86e0b4SJuan Pablo Conde # FEAT_RNG_TRAP is not supported in AArch32 852ff86e0b4SJuan Pablo Conde ifeq (${ENABLE_FEAT_RNG_TRAP},1) 853ff86e0b4SJuan Pablo Conde $(error "ENABLE_FEAT_RNG_TRAP cannot be used with ARCH=aarch32") 854ff86e0b4SJuan Pablo Conde endif 855dc78e62dSjohpow01endif 856dc78e62dSjohpow01 857dc78e62dSjohpow01# Ensure ENABLE_RME is not used with SME 858dc78e62dSjohpow01ifeq (${ENABLE_RME},1) 859dc78e62dSjohpow01 ifeq (${ENABLE_SME_FOR_NS},1) 860dc78e62dSjohpow01 $(error "ENABLE_SME_FOR_NS cannot be used with ENABLE_RME") 861dc78e62dSjohpow01 endif 862dc78e62dSjohpow01endif 863dc78e62dSjohpow01 864dc78e62dSjohpow01# Secure SME/SVE requires the non-secure component as well 865dc78e62dSjohpow01ifeq (${ENABLE_SME_FOR_SWD},1) 866dc78e62dSjohpow01 ifeq (${ENABLE_SME_FOR_NS},0) 867dc78e62dSjohpow01 $(error "ENABLE_SME_FOR_SWD requires ENABLE_SME_FOR_NS") 868dc78e62dSjohpow01 endif 869dc78e62dSjohpow01endif 870dc78e62dSjohpow01ifeq (${ENABLE_SVE_FOR_SWD},1) 871dc78e62dSjohpow01 ifeq (${ENABLE_SVE_FOR_NS},0) 872dc78e62dSjohpow01 $(error "ENABLE_SVE_FOR_SWD requires ENABLE_SVE_FOR_NS") 873dc78e62dSjohpow01 endif 874dc78e62dSjohpow01endif 875dc78e62dSjohpow01 876dc78e62dSjohpow01# SVE and SME cannot be used with CTX_INCLUDE_FPREGS since secure manager does 877dc78e62dSjohpow01# its own context management including FPU registers. 878dc78e62dSjohpow01ifeq (${CTX_INCLUDE_FPREGS},1) 879dc78e62dSjohpow01 ifeq (${ENABLE_SME_FOR_NS},1) 880dc78e62dSjohpow01 $(error "ENABLE_SME_FOR_NS cannot be used with CTX_INCLUDE_FPREGS") 881dc78e62dSjohpow01 endif 882dc78e62dSjohpow01 ifeq (${ENABLE_SVE_FOR_NS},1) 883dc78e62dSjohpow01 # Warning instead of error due to CI dependency on this 884dc78e62dSjohpow01 $(warning "ENABLE_SVE_FOR_NS cannot be used with CTX_INCLUDE_FPREGS") 885dc78e62dSjohpow01 $(warning "Forced ENABLE_SVE_FOR_NS=0") 886dc78e62dSjohpow01 override ENABLE_SVE_FOR_NS := 0 887dc78e62dSjohpow01 endif 888dc78e62dSjohpow01endif 889dc78e62dSjohpow01 89000e28874SManish V Badarkheifeq ($(DRTM_SUPPORT),1) 89100e28874SManish V Badarkhe $(info DRTM_SUPPORT is an experimental feature) 89200e28874SManish V Badarkheendif 89300e28874SManish V Badarkhe 894274a69e7SChris Kayifeq (${ENABLE_RME},1) 895274a69e7SChris Kay ifneq (${SEPARATE_CODE_AND_RODATA},1) 896274a69e7SChris Kay $(error `ENABLE_RME=1` requires `SEPARATE_CODE_AND_RODATA=1`) 897274a69e7SChris Kay endif 898274a69e7SChris Kayendif 899274a69e7SChris Kay 900cf2c8a33SAntonio Nino Diaz################################################################################ 90173c99d4eSJuan Castillo# Process platform overrideable behaviour 90273c99d4eSJuan Castillo################################################################################ 9034f6ad66aSAchin Gupta 9045f24ce96SManish Pandeyifdef BL1_SOURCES 9055f24ce96SManish PandeyNEED_BL1 := yes 9065f24ce96SManish Pandeyendif 9075f24ce96SManish Pandey 9085f24ce96SManish Pandeyifdef BL2_SOURCES 9095f24ce96SManish Pandey NEED_BL2 := yes 9105f24ce96SManish Pandey 911bd97f83aSJohn Tsichritzis # Using BL2 implies that a BL33 image also needs to be supplied for the FIP and 912bd97f83aSJohn Tsichritzis # Certificate generation tools. This flag can be overridden by the platform. 913cf2c8a33SAntonio Nino Diaz ifdef EL3_PAYLOAD_BASE 914cf2c8a33SAntonio Nino Diaz # If booting an EL3 payload there is no need for a BL33 image 915cf2c8a33SAntonio Nino Diaz # in the FIP file. 9164c117f6cSSandrine Bailleux NEED_BL33 := no 917cf2c8a33SAntonio Nino Diaz else 91868450a6dSAntonio Nino Diaz ifdef PRELOADED_BL33_BASE 919cf2c8a33SAntonio Nino Diaz # If booting a BL33 preloaded image there is no need of 920cf2c8a33SAntonio Nino Diaz # another one in the FIP file. 921cf2c8a33SAntonio Nino Diaz NEED_BL33 := no 922cf2c8a33SAntonio Nino Diaz else 923cf2c8a33SAntonio Nino Diaz NEED_BL33 ?= yes 924cf2c8a33SAntonio Nino Diaz endif 9254c117f6cSSandrine Bailleux endif 92673c99d4eSJuan Castilloendif 9276f971622SJuan Castillo 9285f24ce96SManish Pandeyifdef BL2U_SOURCES 9295f24ce96SManish PandeyNEED_BL2U := yes 9305f24ce96SManish Pandeyendif 9315f24ce96SManish Pandey 9324d045d0eSMasahiro Yamada# If SCP_BL2 is given, we always want FIP to include it. 9334d045d0eSMasahiro Yamadaifdef SCP_BL2 9344d045d0eSMasahiro Yamada NEED_SCP_BL2 := yes 9354d045d0eSMasahiro Yamadaendif 9364d045d0eSMasahiro Yamada 9375744e874SSoby Mathew# For AArch32, BL31 is not currently supported. 9385744e874SSoby Mathewifneq (${ARCH},aarch32) 9395744e874SSoby Mathew ifdef BL31_SOURCES 9405744e874SSoby Mathew # When booting an EL3 payload, there is no need to compile the BL31 image nor 9415744e874SSoby Mathew # put it in the FIP. 9425744e874SSoby Mathew ifndef EL3_PAYLOAD_BASE 9435744e874SSoby Mathew NEED_BL31 := yes 9445744e874SSoby Mathew endif 9455744e874SSoby Mathew endif 9465744e874SSoby Mathewendif 9475744e874SSoby Mathew 94873c99d4eSJuan Castillo# Process TBB related flags 9496f971622SJuan Castilloifneq (${GENERATE_COT},0) 95073c99d4eSJuan Castillo # Common cert_create options 9516f971622SJuan Castillo ifneq (${CREATE_KEYS},0) 9526f971622SJuan Castillo $(eval CRT_ARGS += -n) 9530191262dSYatharth Kochar $(eval FWU_CRT_ARGS += -n) 954fd34e7baSJuan Castillo ifneq (${SAVE_KEYS},0) 955fd34e7baSJuan Castillo $(eval CRT_ARGS += -k) 9560191262dSYatharth Kochar $(eval FWU_CRT_ARGS += -k) 957fd34e7baSJuan Castillo endif 9586f971622SJuan Castillo endif 95973c99d4eSJuan Castillo # Include TBBR makefile (unless the platform indicates otherwise) 96073c99d4eSJuan Castillo ifeq (${INCLUDE_TBBR_MK},1) 96173c99d4eSJuan Castillo include make_helpers/tbbr/tbbr_tools.mk 96273c99d4eSJuan Castillo endif 9636f971622SJuan Castilloendif 9646f971622SJuan Castillo 9651c75d5dfSMasahiro Yamadaifneq (${FIP_ALIGN},0) 9661c75d5dfSMasahiro YamadaFIP_ARGS += --align ${FIP_ALIGN} 9671c75d5dfSMasahiro Yamadaendif 9681c75d5dfSMasahiro Yamada 9695f24ce96SManish Pandeyifdef FDT_SOURCES 9705f24ce96SManish PandeyNEED_FDT := yes 9715f24ce96SManish Pandeyendif 9725f24ce96SManish Pandey 97373c99d4eSJuan Castillo################################################################################ 97446e5e035SMichalis Pappas# Include libraries' Makefile that are used in all BL 97546e5e035SMichalis Pappas################################################################################ 97646e5e035SMichalis Pappas 97746e5e035SMichalis Pappasinclude lib/stack_protector/stack_protector.mk 97846e5e035SMichalis Pappas 97946e5e035SMichalis Pappas################################################################################ 980819281eeSdp-arm# Auxiliary tools (fiptool, cert_create, etc) 98173c99d4eSJuan Castillo################################################################################ 98273c99d4eSJuan Castillo 98373c99d4eSJuan Castillo# Variables for use with Certificate Generation Tool 98473c99d4eSJuan CastilloCRTTOOLPATH ?= tools/cert_create 98542a45b51SEvan LloydCRTTOOL ?= ${CRTTOOLPATH}/cert_create${BIN_EXT} 98673c99d4eSJuan Castillo 98790aa901fSSumit Garg# Variables for use with Firmware Encryption Tool 98890aa901fSSumit GargENCTOOLPATH ?= tools/encrypt_fw 98990aa901fSSumit GargENCTOOL ?= ${ENCTOOLPATH}/encrypt_fw${BIN_EXT} 99090aa901fSSumit Garg 99173c99d4eSJuan Castillo# Variables for use with Firmware Image Package 992819281eeSdp-armFIPTOOLPATH ?= tools/fiptool 993819281eeSdp-armFIPTOOL ?= ${FIPTOOLPATH}/fiptool${BIN_EXT} 99473c99d4eSJuan Castillo 99526010da1SAntonio Nino Diaz# Variables for use with sptool 99626010da1SAntonio Nino DiazSPTOOLPATH ?= tools/sptool 997822c7279SJ-AlvesSPTOOL ?= ${SPTOOLPATH}/sptool.py 998ce2b1ec6SManish PandeySP_MK_GEN ?= ${SPTOOLPATH}/sp_mk_generator.py 99926010da1SAntonio Nino Diaz 10005accce5bSRoberto Vargas# Variables for use with ROMLIB 10015accce5bSRoberto VargasROMLIBPATH ?= lib/romlib 10025accce5bSRoberto Vargas 1003cfe83910SLouis Mayencourt# Variable for use with Python 1004cfe83910SLouis MayencourtPYTHON ?= python3 1005cfe83910SLouis Mayencourt 1006cfe83910SLouis Mayencourt# Variables for use with PRINT_MEMORY_MAP 1007cfe83910SLouis MayencourtPRINT_MEMORY_MAP_PATH ?= tools/memory 1008cfe83910SLouis MayencourtPRINT_MEMORY_MAP ?= ${PRINT_MEMORY_MAP_PATH}/print_memory_map.py 1009cfe83910SLouis Mayencourt 10106de32378SMadhukar Pappireddy# Variables for use with documentation build using Sphinx tool 10116de32378SMadhukar PappireddyDOCS_PATH ?= docs 10126de32378SMadhukar Pappireddy 10131f1c0206SAbdul Halim, Muhammad Hadi Asyrafi# Defination of SIMICS flag 10141f1c0206SAbdul Halim, Muhammad Hadi AsyrafiSIMICS_BUILD ?= 0 10151f1c0206SAbdul Halim, Muhammad Hadi Asyrafi 10168a86052dSSoby Mathew################################################################################ 10178a86052dSSoby Mathew# Include BL specific makefiles 10188a86052dSSoby Mathew################################################################################ 10195f24ce96SManish Pandey 10205f24ce96SManish Pandeyifeq (${NEED_BL1},yes) 10218a86052dSSoby Mathewinclude bl1/bl1.mk 10228a86052dSSoby Mathewendif 10238a86052dSSoby Mathew 10245f24ce96SManish Pandeyifeq (${NEED_BL2},yes) 10258a86052dSSoby Mathewinclude bl2/bl2.mk 10268a86052dSSoby Mathewendif 10278a86052dSSoby Mathew 10285f24ce96SManish Pandeyifeq (${NEED_BL2U},yes) 10298a86052dSSoby Mathewinclude bl2u/bl2u.mk 10308a86052dSSoby Mathewendif 10318a86052dSSoby Mathew 10325744e874SSoby Mathewifeq (${NEED_BL31},yes) 10338a86052dSSoby Mathewinclude bl31/bl31.mk 10348a86052dSSoby Mathewendif 103503b397a8SNishanth Menon 103673c99d4eSJuan Castillo################################################################################ 103773c99d4eSJuan Castillo# Build options checks 103873c99d4eSJuan Castillo################################################################################ 103973c99d4eSJuan Castillo 1040327131c4SLeonardo Sandoval$(eval $(call assert_booleans,\ 1041327131c4SLeonardo Sandoval $(sort \ 1042327131c4SLeonardo Sandoval ALLOW_RO_XLAT_TABLES \ 104346789a7cSBalint Dobszay BL2_ENABLE_SP_LOAD \ 1044327131c4SLeonardo Sandoval COLD_BOOT_SINGLE_CPU \ 1045327131c4SLeonardo Sandoval CREATE_KEYS \ 1046327131c4SLeonardo Sandoval CTX_INCLUDE_AARCH32_REGS \ 1047327131c4SLeonardo Sandoval CTX_INCLUDE_FPREGS \ 1048327131c4SLeonardo Sandoval CTX_INCLUDE_EL2_REGS \ 1049327131c4SLeonardo Sandoval DEBUG \ 10500063dd17SJavier Almansa Sobrino DISABLE_MTPMU \ 1051327131c4SLeonardo Sandoval DYN_DISABLE_AUTH \ 1052327131c4SLeonardo Sandoval EL3_EXCEPTION_HANDLING \ 1053327131c4SLeonardo Sandoval ENABLE_AMU \ 10541fd685a7SChris Kay ENABLE_AMU_AUXILIARY_COUNTERS \ 1055742ca230SChris Kay ENABLE_AMU_FCONF \ 1056873d4241Sjohpow01 AMU_RESTRICT_COUNTERS \ 1057327131c4SLeonardo Sandoval ENABLE_ASSERTIONS \ 1058327131c4SLeonardo Sandoval ENABLE_PIE \ 1059327131c4SLeonardo Sandoval ENABLE_PMF \ 1060327131c4SLeonardo Sandoval ENABLE_PSCI_STAT \ 1061327131c4SLeonardo Sandoval ENABLE_RUNTIME_INSTRUMENTATION \ 1062dc78e62dSjohpow01 ENABLE_SME_FOR_NS \ 1063dc78e62dSjohpow01 ENABLE_SME_FOR_SWD \ 1064327131c4SLeonardo Sandoval ENABLE_SPE_FOR_LOWER_ELS \ 1065327131c4SLeonardo Sandoval ENABLE_SVE_FOR_NS \ 10660c5e7d1cSMax Shvetsov ENABLE_SVE_FOR_SWD \ 1067327131c4SLeonardo Sandoval ERROR_DEPRECATED \ 1068327131c4SLeonardo Sandoval FAULT_INJECTION_SUPPORT \ 1069327131c4SLeonardo Sandoval GENERATE_COT \ 1070327131c4SLeonardo Sandoval GICV2_G0_FOR_EL3 \ 107146cc41d5SManish Pandey HANDLE_EA_EL3_FIRST_NS \ 1072327131c4SLeonardo Sandoval HW_ASSISTED_COHERENCY \ 1073327131c4SLeonardo Sandoval INVERTED_MEMMAP \ 1074327131c4SLeonardo Sandoval MEASURED_BOOT \ 107500e28874SManish V Badarkhe DRTM_SUPPORT \ 1076327131c4SLeonardo Sandoval NS_TIMER_SWITCH \ 1077327131c4SLeonardo Sandoval OVERRIDE_LIBC \ 1078327131c4SLeonardo Sandoval PL011_GENERIC_UART \ 10790ce2072dSTamas Ban PLAT_RSS_NOT_SUPPORTED \ 1080327131c4SLeonardo Sandoval PROGRAMMABLE_RESET_ADDRESS \ 1081327131c4SLeonardo Sandoval PSCI_EXTENDED_STATE_ID \ 1082327131c4SLeonardo Sandoval RESET_TO_BL31 \ 108325844ff7SJorge Ramirez-Ortiz RESET_TO_BL31_WITH_PARAMS \ 1084327131c4SLeonardo Sandoval SAVE_KEYS \ 1085327131c4SLeonardo Sandoval SEPARATE_CODE_AND_RODATA \ 108696a8ed14SJiafei Pan SEPARATE_BL2_NOLOAD_REGION \ 1087327131c4SLeonardo Sandoval SEPARATE_NOBITS_REGION \ 1088327131c4SLeonardo Sandoval SPIN_ON_BL1_EXIT \ 1089327131c4SLeonardo Sandoval SPM_MM \ 10901d63ae4dSMarc Bonnici SPMC_AT_EL3 \ 1091327131c4SLeonardo Sandoval SPMD_SPM_AT_SEL2 \ 1092327131c4SLeonardo Sandoval TRUSTED_BOARD_BOOT \ 1093327131c4SLeonardo Sandoval USE_COHERENT_MEM \ 1094327131c4SLeonardo Sandoval USE_DEBUGFS \ 1095327131c4SLeonardo Sandoval ARM_IO_IN_DTB \ 1096327131c4SLeonardo Sandoval SDEI_IN_FCONF \ 1097327131c4SLeonardo Sandoval SEC_INT_DESC_IN_FCONF \ 1098327131c4SLeonardo Sandoval USE_ROMLIB \ 1099327131c4SLeonardo Sandoval USE_TBBR_DEFS \ 1100327131c4SLeonardo Sandoval WARMBOOT_ENABLE_DCACHE_EARLY \ 1101327131c4SLeonardo Sandoval BL2_AT_EL3 \ 1102327131c4SLeonardo Sandoval BL2_IN_XIP_MEM \ 1103327131c4SLeonardo Sandoval BL2_INV_DCACHE \ 1104327131c4SLeonardo Sandoval USE_SPINLOCK_CAS \ 1105327131c4SLeonardo Sandoval ENCRYPT_BL31 \ 1106327131c4SLeonardo Sandoval ENCRYPT_BL32 \ 1107327131c4SLeonardo Sandoval ERRATA_SPECULATIVE_AT \ 110800e8f79cSManish Pandey RAS_TRAP_NS_ERR_REC_ACCESS \ 1109327131c4SLeonardo Sandoval COT_DESC_IN_DTB \ 1110327131c4SLeonardo Sandoval USE_SP804_TIMER \ 1111396b339dSManish V Badarkhe PSA_FWU_SUPPORT \ 1112d4582d30SManish V Badarkhe ENABLE_SYS_REG_TRACE_FOR_NS \ 111368120783SChris Kay ENABLE_MPMM \ 111468120783SChris Kay ENABLE_MPMM_FCONF \ 11151f1c0206SAbdul Halim, Muhammad Hadi Asyrafi SIMICS_BUILD \ 11166a0da736SJayanth Dodderi Chidanand FEATURE_DETECTION \ 11170b22e591SJayanth Dodderi Chidanand TRNG_SUPPORT \ 111804c7303bSOkash Khawaja CONDITIONAL_CMO \ 1119327131c4SLeonardo Sandoval))) 112073c99d4eSJuan Castillo 1121327131c4SLeonardo Sandoval$(eval $(call assert_numerics,\ 1122327131c4SLeonardo Sandoval $(sort \ 1123327131c4SLeonardo Sandoval ARM_ARCH_MAJOR \ 1124327131c4SLeonardo Sandoval ARM_ARCH_MINOR \ 1125327131c4SLeonardo Sandoval BRANCH_PROTECTION \ 11266a0da736SJayanth Dodderi Chidanand CTX_INCLUDE_PAUTH_REGS \ 11276a0da736SJayanth Dodderi Chidanand CTX_INCLUDE_MTE_REGS \ 11286a0da736SJayanth Dodderi Chidanand CTX_INCLUDE_NEVE_REGS \ 11292bf4f27fSManish V Badarkhe CRYPTO_SUPPORT \ 11301298f2f1SJayanth Dodderi Chidanand ENABLE_BRBE_FOR_NS \ 113147c681b7SJayanth Dodderi Chidanand ENABLE_TRBE_FOR_NS \ 11326a0da736SJayanth Dodderi Chidanand ENABLE_BTI \ 11336a0da736SJayanth Dodderi Chidanand ENABLE_PAUTH \ 11346a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_AMUv1 \ 11356a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_AMUv1p1 \ 11366a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_CSV2_2 \ 11376a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_DIT \ 11386a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_ECV \ 11396a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_FGT \ 11406a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_HCX \ 11416a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_PAN \ 11426a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_RNG \ 1143ff86e0b4SJuan Pablo Conde ENABLE_FEAT_RNG_TRAP \ 11446a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_SB \ 11456a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_SEL2 \ 11466a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_VHE \ 11476a0da736SJayanth Dodderi Chidanand ENABLE_MPAM_FOR_LOWER_ELS \ 11486a0da736SJayanth Dodderi Chidanand ENABLE_RME \ 11496a0da736SJayanth Dodderi Chidanand ENABLE_TRF_FOR_NS \ 1150327131c4SLeonardo Sandoval FW_ENC_STATUS \ 11515357f83dSManish V Badarkhe NR_OF_FW_BANKS \ 11525357f83dSManish V Badarkhe NR_OF_IMAGES_IN_FW_BANK \ 11536a0da736SJayanth Dodderi Chidanand RAS_EXTENSION \ 1154781d07a4SJayanth Dodderi Chidanand TWED_DELAY \ 1155781d07a4SJayanth Dodderi Chidanand ENABLE_FEAT_TWED \ 1156bebcf27fSMark Brown SVE_VECTOR_LEN \ 1157327131c4SLeonardo Sandoval))) 1158c877b414SJeenu Viswambharan 1159aacff749SJustin Chadwellifdef KEY_SIZE 1160aacff749SJustin Chadwell $(eval $(call assert_numeric,KEY_SIZE)) 1161aacff749SJustin Chadwellendif 1162aacff749SJustin Chadwell 11631f461979SJustin Chadwellifeq ($(filter $(SANITIZE_UB), on off trap),) 11641f461979SJustin Chadwell $(error "Invalid value for SANITIZE_UB: can be one of on, off, trap") 11651f461979SJustin Chadwellendif 11661f461979SJustin Chadwell 116773c99d4eSJuan Castillo################################################################################ 116873c99d4eSJuan Castillo# Add definitions to the cpp preprocessor based on the current build options. 116973c99d4eSJuan Castillo# This is done after including the platform specific makefile to allow the 117073c99d4eSJuan Castillo# platform to overwrite the default options 117173c99d4eSJuan Castillo################################################################################ 117273c99d4eSJuan Castillo 1173327131c4SLeonardo Sandoval$(eval $(call add_defines,\ 1174327131c4SLeonardo Sandoval $(sort \ 1175327131c4SLeonardo Sandoval ALLOW_RO_XLAT_TABLES \ 1176327131c4SLeonardo Sandoval ARM_ARCH_MAJOR \ 1177327131c4SLeonardo Sandoval ARM_ARCH_MINOR \ 117846789a7cSBalint Dobszay BL2_ENABLE_SP_LOAD \ 1179327131c4SLeonardo Sandoval COLD_BOOT_SINGLE_CPU \ 1180327131c4SLeonardo Sandoval CTX_INCLUDE_AARCH32_REGS \ 1181327131c4SLeonardo Sandoval CTX_INCLUDE_FPREGS \ 1182327131c4SLeonardo Sandoval CTX_INCLUDE_PAUTH_REGS \ 1183327131c4SLeonardo Sandoval EL3_EXCEPTION_HANDLING \ 1184327131c4SLeonardo Sandoval CTX_INCLUDE_MTE_REGS \ 1185327131c4SLeonardo Sandoval CTX_INCLUDE_EL2_REGS \ 1186062f8aafSArunachalam Ganapathy CTX_INCLUDE_NEVE_REGS \ 1187327131c4SLeonardo Sandoval DECRYPTION_SUPPORT_${DECRYPTION_SUPPORT} \ 11880063dd17SJavier Almansa Sobrino DISABLE_MTPMU \ 1189327131c4SLeonardo Sandoval ENABLE_AMU \ 11901fd685a7SChris Kay ENABLE_AMU_AUXILIARY_COUNTERS \ 1191742ca230SChris Kay ENABLE_AMU_FCONF \ 1192873d4241Sjohpow01 AMU_RESTRICT_COUNTERS \ 1193327131c4SLeonardo Sandoval ENABLE_ASSERTIONS \ 1194327131c4SLeonardo Sandoval ENABLE_BTI \ 1195327131c4SLeonardo Sandoval ENABLE_MPAM_FOR_LOWER_ELS \ 1196327131c4SLeonardo Sandoval ENABLE_PAUTH \ 1197327131c4SLeonardo Sandoval ENABLE_PIE \ 1198327131c4SLeonardo Sandoval ENABLE_PMF \ 1199327131c4SLeonardo Sandoval ENABLE_PSCI_STAT \ 12005b18de09SZelalem Aweke ENABLE_RME \ 1201327131c4SLeonardo Sandoval ENABLE_RUNTIME_INSTRUMENTATION \ 1202dc78e62dSjohpow01 ENABLE_SME_FOR_NS \ 1203dc78e62dSjohpow01 ENABLE_SME_FOR_SWD \ 1204327131c4SLeonardo Sandoval ENABLE_SPE_FOR_LOWER_ELS \ 1205327131c4SLeonardo Sandoval ENABLE_SVE_FOR_NS \ 12060c5e7d1cSMax Shvetsov ENABLE_SVE_FOR_SWD \ 1207327131c4SLeonardo Sandoval ENCRYPT_BL31 \ 1208327131c4SLeonardo Sandoval ENCRYPT_BL32 \ 1209327131c4SLeonardo Sandoval ERROR_DEPRECATED \ 1210327131c4SLeonardo Sandoval FAULT_INJECTION_SUPPORT \ 1211327131c4SLeonardo Sandoval GICV2_G0_FOR_EL3 \ 121246cc41d5SManish Pandey HANDLE_EA_EL3_FIRST_NS \ 1213327131c4SLeonardo Sandoval HW_ASSISTED_COHERENCY \ 1214327131c4SLeonardo Sandoval LOG_LEVEL \ 1215327131c4SLeonardo Sandoval MEASURED_BOOT \ 121600e28874SManish V Badarkhe DRTM_SUPPORT \ 1217327131c4SLeonardo Sandoval NS_TIMER_SWITCH \ 1218327131c4SLeonardo Sandoval PL011_GENERIC_UART \ 1219327131c4SLeonardo Sandoval PLAT_${PLAT} \ 12200ce2072dSTamas Ban PLAT_RSS_NOT_SUPPORTED \ 1221327131c4SLeonardo Sandoval PROGRAMMABLE_RESET_ADDRESS \ 1222327131c4SLeonardo Sandoval PSCI_EXTENDED_STATE_ID \ 1223327131c4SLeonardo Sandoval RAS_EXTENSION \ 1224327131c4SLeonardo Sandoval RESET_TO_BL31 \ 122525844ff7SJorge Ramirez-Ortiz RESET_TO_BL31_WITH_PARAMS \ 1226327131c4SLeonardo Sandoval SEPARATE_CODE_AND_RODATA \ 122796a8ed14SJiafei Pan SEPARATE_BL2_NOLOAD_REGION \ 1228327131c4SLeonardo Sandoval SEPARATE_NOBITS_REGION \ 1229327131c4SLeonardo Sandoval RECLAIM_INIT_CODE \ 1230327131c4SLeonardo Sandoval SPD_${SPD} \ 1231327131c4SLeonardo Sandoval SPIN_ON_BL1_EXIT \ 1232327131c4SLeonardo Sandoval SPM_MM \ 12331d63ae4dSMarc Bonnici SPMC_AT_EL3 \ 1234327131c4SLeonardo Sandoval SPMD_SPM_AT_SEL2 \ 1235327131c4SLeonardo Sandoval TRUSTED_BOARD_BOOT \ 1236c9c56f6eSManish V Badarkhe CRYPTO_SUPPORT \ 12377dfb9911SJimmy Brisson TRNG_SUPPORT \ 1238327131c4SLeonardo Sandoval USE_COHERENT_MEM \ 1239327131c4SLeonardo Sandoval USE_DEBUGFS \ 1240327131c4SLeonardo Sandoval ARM_IO_IN_DTB \ 1241327131c4SLeonardo Sandoval SDEI_IN_FCONF \ 1242327131c4SLeonardo Sandoval SEC_INT_DESC_IN_FCONF \ 1243327131c4SLeonardo Sandoval USE_ROMLIB \ 1244327131c4SLeonardo Sandoval USE_TBBR_DEFS \ 1245327131c4SLeonardo Sandoval WARMBOOT_ENABLE_DCACHE_EARLY \ 1246327131c4SLeonardo Sandoval BL2_AT_EL3 \ 1247327131c4SLeonardo Sandoval BL2_IN_XIP_MEM \ 1248327131c4SLeonardo Sandoval BL2_INV_DCACHE \ 1249327131c4SLeonardo Sandoval USE_SPINLOCK_CAS \ 1250327131c4SLeonardo Sandoval ERRATA_SPECULATIVE_AT \ 125100e8f79cSManish Pandey RAS_TRAP_NS_ERR_REC_ACCESS \ 1252327131c4SLeonardo Sandoval COT_DESC_IN_DTB \ 1253327131c4SLeonardo Sandoval USE_SP804_TIMER \ 125412cd65e0STomas Pilar ENABLE_FEAT_RNG \ 1255ff86e0b4SJuan Pablo Conde ENABLE_FEAT_RNG_TRAP \ 12564e04478aSChris Kay ENABLE_FEAT_SB \ 12577d33ffe4SDaniel Boulby ENABLE_FEAT_DIT \ 12585357f83dSManish V Badarkhe NR_OF_FW_BANKS \ 12595357f83dSManish V Badarkhe NR_OF_IMAGES_IN_FW_BANK \ 1260396b339dSManish V Badarkhe PSA_FWU_SUPPORT \ 1261744ad974Sjohpow01 ENABLE_BRBE_FOR_NS \ 1262813524eaSManish V Badarkhe ENABLE_TRBE_FOR_NS \ 1263d4582d30SManish V Badarkhe ENABLE_SYS_REG_TRACE_FOR_NS \ 12648fcd3d96SManish V Badarkhe ENABLE_TRF_FOR_NS \ 1265cb4ec47bSjohpow01 ENABLE_FEAT_HCX \ 126668120783SChris Kay ENABLE_MPMM \ 126768120783SChris Kay ENABLE_MPMM_FCONF \ 1268f74cb0beSJayanth Dodderi Chidanand ENABLE_FEAT_FGT \ 1269f74cb0beSJayanth Dodderi Chidanand ENABLE_FEAT_AMUv1 \ 1270f74cb0beSJayanth Dodderi Chidanand ENABLE_FEAT_ECV \ 12711f1c0206SAbdul Halim, Muhammad Hadi Asyrafi SIMICS_BUILD \ 12726a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_AMUv1p1 \ 12736a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_SEL2 \ 12746a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_VHE \ 12756a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_CSV2_2 \ 12766a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_PAN \ 12776a0da736SJayanth Dodderi Chidanand FEATURE_DETECTION \ 1278781d07a4SJayanth Dodderi Chidanand TWED_DELAY \ 1279781d07a4SJayanth Dodderi Chidanand ENABLE_FEAT_TWED \ 128004c7303bSOkash Khawaja CONDITIONAL_CMO \ 1281327131c4SLeonardo Sandoval))) 12822fae4b1eSJeenu Viswambharan 12831f461979SJustin Chadwellifeq (${SANITIZE_UB},trap) 12841f461979SJustin Chadwell $(eval $(call add_define,MONITOR_TRAPS)) 12851f461979SJustin Chadwellendif 12861f461979SJustin Chadwell 12874c117f6cSSandrine Bailleux# Define the EL3_PAYLOAD_BASE flag only if it is provided. 12884c117f6cSSandrine Bailleuxifdef EL3_PAYLOAD_BASE 12894c117f6cSSandrine Bailleux $(eval $(call add_define,EL3_PAYLOAD_BASE)) 1290cf2c8a33SAntonio Nino Diazelse 129168450a6dSAntonio Nino Diaz # Define the PRELOADED_BL33_BASE flag only if it is provided and 129268450a6dSAntonio Nino Diaz # EL3_PAYLOAD_BASE is not defined, as it has priority. 129368450a6dSAntonio Nino Diaz ifdef PRELOADED_BL33_BASE 129468450a6dSAntonio Nino Diaz $(eval $(call add_define,PRELOADED_BL33_BASE)) 12954c117f6cSSandrine Bailleux endif 1296cf2c8a33SAntonio Nino Diazendif 129773c99d4eSJuan Castillo 1298209a60ccSSoby Mathew# Define the DYN_DISABLE_AUTH flag only if set. 1299209a60ccSSoby Mathewifeq (${DYN_DISABLE_AUTH},1) 1300209a60ccSSoby Mathew$(eval $(call add_define,DYN_DISABLE_AUTH)) 1301209a60ccSSoby Mathewendif 1302209a60ccSSoby Mathew 1303c2ad38ceSVarun Wadekarifneq ($(findstring armlink,$(notdir $(LD))),) 1304c2ad38ceSVarun Wadekar$(eval $(call add_define,USE_ARM_LINK)) 1305c2ad38ceSVarun Wadekarendif 1306c2ad38ceSVarun Wadekar 1307ce2b1ec6SManish Pandey# Generate and include sp_gen.mk if SPD is spmd and SP_LAYOUT_FILE is defined 1308ce2b1ec6SManish Pandeyifeq (${SPD},spmd) 1309c33ff198SOlivier Deprezifdef SP_LAYOUT_FILE 1310ce2b1ec6SManish Pandey -include $(BUILD_PLAT)/sp_gen.mk 1311ce2b1ec6SManish Pandey FIP_DEPS += sp 131207c44475SManish Pandey CRT_DEPS += sp 1313ce2b1ec6SManish Pandey NEED_SP_PKG := yes 1314ce2b1ec6SManish Pandeyelse 1315c33ff198SOlivier Deprez ifeq (${SPMD_SPM_AT_SEL2},1) 1316c33ff198SOlivier Deprez $(error "SPMD with SPM at S-EL2 require SP_LAYOUT_FILE") 1317c33ff198SOlivier Deprez endif 1318ce2b1ec6SManish Pandeyendif 1319ce2b1ec6SManish Pandeyendif 1320ce2b1ec6SManish Pandey 132173c99d4eSJuan Castillo################################################################################ 132273c99d4eSJuan Castillo# Build targets 132373c99d4eSJuan Castillo################################################################################ 132473c99d4eSJuan Castillo 132590aa901fSSumit Garg.PHONY: all msg_start clean realclean distclean cscope locate-checkpatch checkcodebase checkpatch fiptool sptool fip sp fwu_fip certtool dtbs memmap doc enctool 132673c99d4eSJuan Castillo.SUFFIXES: 132773c99d4eSJuan Castillo 132873c99d4eSJuan Castilloall: msg_start 132973c99d4eSJuan Castillo 133073c99d4eSJuan Castillomsg_start: 133173c99d4eSJuan Castillo @echo "Building ${PLAT}" 133273c99d4eSJuan Castillo 13337a24cba5SSoby Mathewifeq (${ERROR_DEPRECATED},0) 1334d5dfdeb6SJulius Werner# Check if deprecated declarations and cpp warnings should be treated as error or not. 1335c2ad38ceSVarun Wadekarifneq ($(findstring clang,$(notdir $(CC))),) 1336c2ad38ceSVarun Wadekar CPPFLAGS += -Wno-error=deprecated-declarations 1337c2ad38ceSVarun Wadekarelse 1338bc1a03c7SDan Handley CPPFLAGS += -Wno-error=deprecated-declarations -Wno-error=cpp 13397a24cba5SSoby Mathewendif 1340d5dfdeb6SJulius Wernerendif # !ERROR_DEPRECATED 13417a24cba5SSoby Mathew 13425accce5bSRoberto Vargas$(eval $(call MAKE_LIB_DIRS)) 134361f72a34SRoberto Vargas$(eval $(call MAKE_LIB,c)) 13445fee0287SRoberto Vargas 134573c99d4eSJuan Castillo# Expand build macros for the different images 134673c99d4eSJuan Castilloifeq (${NEED_BL1},yes) 1347b34635a0SChris KayBL1_SOURCES := $(sort ${BL1_SOURCES}) 1348b34635a0SChris Kay 1349434d0491SZelalem Aweke$(eval $(call MAKE_BL,bl1)) 135073c99d4eSJuan Castilloendif 135173c99d4eSJuan Castillo 135273c99d4eSJuan Castilloifeq (${NEED_BL2},yes) 1353c9b31ae8SRoberto Vargasifeq (${BL2_AT_EL3}, 0) 1354c9b31ae8SRoberto VargasFIP_BL2_ARGS := tb-fw 1355c9b31ae8SRoberto Vargasendif 1356c9b31ae8SRoberto Vargas 1357eb1acfb6SChris KayBL2_SOURCES := $(sort ${BL2_SOURCES}) 1358eb1acfb6SChris Kay 135933950dd8SMasahiro Yamada$(if ${BL2}, $(eval $(call TOOL_ADD_IMG,bl2,--${FIP_BL2_ARGS})),\ 1360434d0491SZelalem Aweke $(eval $(call MAKE_BL,bl2,${FIP_BL2_ARGS}))) 136173c99d4eSJuan Castilloendif 136273c99d4eSJuan Castillo 13634d045d0eSMasahiro Yamadaifeq (${NEED_SCP_BL2},yes) 136433950dd8SMasahiro Yamada$(eval $(call TOOL_ADD_IMG,scp_bl2,--scp-fw)) 13654d045d0eSMasahiro Yamadaendif 13664d045d0eSMasahiro Yamada 136773c99d4eSJuan Castilloifeq (${NEED_BL31},yes) 136873c99d4eSJuan CastilloBL31_SOURCES += ${SPD_SOURCES} 136926d1e0c3SMadhukar Pappireddy# Sort BL31 source files to remove duplicates 137026d1e0c3SMadhukar PappireddyBL31_SOURCES := $(sort ${BL31_SOURCES}) 1371c6ba9b45SSumit Gargifneq (${DECRYPTION_SUPPORT},none) 1372c6ba9b45SSumit Garg$(if ${BL31}, $(eval $(call TOOL_ADD_IMG,bl31,--soc-fw,,$(ENCRYPT_BL31))),\ 1373434d0491SZelalem Aweke $(eval $(call MAKE_BL,bl31,soc-fw,,$(ENCRYPT_BL31)))) 1374c6ba9b45SSumit Gargelse 137533950dd8SMasahiro Yamada$(if ${BL31}, $(eval $(call TOOL_ADD_IMG,bl31,--soc-fw)),\ 1376434d0491SZelalem Aweke $(eval $(call MAKE_BL,bl31,soc-fw))) 137773c99d4eSJuan Castilloendif 1378c6ba9b45SSumit Gargendif 137973c99d4eSJuan Castillo 138070d1fc53SJuan Castillo# If a BL32 image is needed but neither BL32 nor BL32_SOURCES is defined, the 1381c939d13aSMasahiro Yamada# build system will call TOOL_ADD_IMG to print a warning message and abort the 138270d1fc53SJuan Castillo# process. Note that the dependency on BL32 applies to the FIP only. 138373c99d4eSJuan Castilloifeq (${NEED_BL32},yes) 138426d1e0c3SMadhukar Pappireddy# Sort BL32 source files to remove duplicates 138526d1e0c3SMadhukar PappireddyBL32_SOURCES := $(sort ${BL32_SOURCES}) 13869cd15239SMasahiro YamadaBUILD_BL32 := $(if $(BL32),,$(if $(BL32_SOURCES),1)) 13879cd15239SMasahiro Yamada 1388c6ba9b45SSumit Gargifneq (${DECRYPTION_SUPPORT},none) 1389434d0491SZelalem Aweke$(if ${BUILD_BL32}, $(eval $(call MAKE_BL,bl32,tos-fw,,$(ENCRYPT_BL32))),\ 1390c6ba9b45SSumit Garg $(eval $(call TOOL_ADD_IMG,bl32,--tos-fw,,$(ENCRYPT_BL32)))) 1391c6ba9b45SSumit Gargelse 1392434d0491SZelalem Aweke$(if ${BUILD_BL32}, $(eval $(call MAKE_BL,bl32,tos-fw)),\ 139333950dd8SMasahiro Yamada $(eval $(call TOOL_ADD_IMG,bl32,--tos-fw))) 139473c99d4eSJuan Castilloendif 1395c6ba9b45SSumit Gargendif 139673c99d4eSJuan Castillo 13975b18de09SZelalem Aweke# If RMM image is needed but RMM is not defined, Test Realm Payload (TRP) 13985b18de09SZelalem Aweke# needs to be built from RMM_SOURCES. 13995b18de09SZelalem Awekeifeq (${NEED_RMM},yes) 14005b18de09SZelalem Aweke# Sort RMM source files to remove duplicates 14015b18de09SZelalem AwekeRMM_SOURCES := $(sort ${RMM_SOURCES}) 14025b18de09SZelalem AwekeBUILD_RMM := $(if $(RMM),,$(if $(RMM_SOURCES),1)) 14035b18de09SZelalem Aweke 14045b18de09SZelalem Aweke$(if ${BUILD_RMM}, $(eval $(call MAKE_BL,rmm,rmm-fw)),\ 14055b18de09SZelalem Aweke $(eval $(call TOOL_ADD_IMG,rmm,--rmm-fw))) 14065b18de09SZelalem Awekeendif 14075b18de09SZelalem Aweke 140873c99d4eSJuan Castillo# Add the BL33 image if required by the platform 140973c99d4eSJuan Castilloifeq (${NEED_BL33},yes) 141033950dd8SMasahiro Yamada$(eval $(call TOOL_ADD_IMG,bl33,--nt-fw)) 1411db6071c9SJuan Castilloendif 1412db6071c9SJuan Castillo 14139003fa0bSYatharth Kocharifeq (${NEED_BL2U},yes) 141433950dd8SMasahiro Yamada$(if ${BL2U}, $(eval $(call TOOL_ADD_IMG,bl2u,--ap-fwu-cfg,FWU_)),\ 1415434d0491SZelalem Aweke $(eval $(call MAKE_BL,bl2u,ap-fwu-cfg,FWU_))) 14169003fa0bSYatharth Kocharendif 14179003fa0bSYatharth Kochar 141803b397a8SNishanth Menon# Expand build macros for the different images 141903b397a8SNishanth Menonifeq (${NEED_FDT},yes) 142003b397a8SNishanth Menon $(eval $(call MAKE_DTBS,$(BUILD_PLAT)/fdts,$(FDT_SOURCES))) 142103b397a8SNishanth Menonendif 142203b397a8SNishanth Menon 1423ce2b1ec6SManish Pandey# Add Secure Partition packages 1424ce2b1ec6SManish Pandeyifeq (${NEED_SP_PKG},yes) 1425ce2b1ec6SManish Pandey$(BUILD_PLAT)/sp_gen.mk: ${SP_MK_GEN} ${SP_LAYOUT_FILE} | ${BUILD_PLAT} 14261e7528ecSRuari Phipps ${Q}${PYTHON} "$<" "$@" $(filter-out $<,$^) $(BUILD_PLAT) ${COT} 1427822c7279SJ-Alvessp: $(DTBS) $(BUILD_PLAT)/sp_gen.mk $(SP_PKGS) 1428ce2b1ec6SManish Pandey @${ECHO_BLANK_LINE} 1429ce2b1ec6SManish Pandey @echo "Built SP Images successfully" 1430ce2b1ec6SManish Pandey @${ECHO_BLANK_LINE} 1431ce2b1ec6SManish Pandeyendif 1432ce2b1ec6SManish Pandey 143336eaaf37SIan Spraylocate-checkpatch: 143436eaaf37SIan Sprayifndef CHECKPATCH 143566079b04SEtienne Carriere $(error "Please set CHECKPATCH to point to the Linux checkpatch.pl file, eg: CHECKPATCH=../linux/scripts/checkpatch.pl") 143636eaaf37SIan Sprayelse 143736eaaf37SIan Sprayifeq (,$(wildcard ${CHECKPATCH})) 143866079b04SEtienne Carriere $(error "The file CHECKPATCH points to cannot be found, use eg: CHECKPATCH=../linux/scripts/checkpatch.pl") 143936eaaf37SIan Sprayendif 144036eaaf37SIan Sprayendif 144136eaaf37SIan Spray 14424f6ad66aSAchin Guptaclean: 14434f6ad66aSAchin Gupta @echo " CLEAN" 1444f1477d4aSEvan Lloyd $(call SHELL_REMOVE_DIR,${BUILD_PLAT}) 144588a1cf1eSSami Mujawarifdef UNIX_MK 14462f2cef46SJeenu Viswambharan ${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean 144788a1cf1eSSami Mujawarelse 144888a1cf1eSSami Mujawar# Clear the MAKEFLAGS as we do not want 144988a1cf1eSSami Mujawar# to pass the gnumake flags to nmake. 145088a1cf1eSSami Mujawar ${Q}set MAKEFLAGS= && ${MSVC_NMAKE} /nologo /f ${FIPTOOLPATH}/Makefile.msvc FIPTOOLPATH=$(subst /,\,$(FIPTOOLPATH)) FIPTOOL=$(subst /,\,$(FIPTOOL)) clean 145188a1cf1eSSami Mujawarendif 14526f971622SJuan Castillo ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} clean 145390aa901fSSumit Garg ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${ENCTOOLPATH} clean 14545accce5bSRoberto Vargas ${Q}${MAKE} --no-print-directory -C ${ROMLIBPATH} clean 14554f6ad66aSAchin Gupta 1456eaaeece2SJames Morrisseyrealclean distclean: 1457eaaeece2SJames Morrissey @echo " REALCLEAN" 1458f1477d4aSEvan Lloyd $(call SHELL_REMOVE_DIR,${BUILD_BASE}) 1459f1477d4aSEvan Lloyd $(call SHELL_DELETE_ALL, ${CURDIR}/cscope.*) 146088a1cf1eSSami Mujawarifdef UNIX_MK 14612f2cef46SJeenu Viswambharan ${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean 146288a1cf1eSSami Mujawarelse 146388a1cf1eSSami Mujawar# Clear the MAKEFLAGS as we do not want 146488a1cf1eSSami Mujawar# to pass the gnumake flags to nmake. 146588a1cf1eSSami Mujawar ${Q}set MAKEFLAGS= && ${MSVC_NMAKE} /nologo /f ${FIPTOOLPATH}/Makefile.msvc FIPTOOLPATH=$(subst /,\,$(FIPTOOLPATH)) FIPTOOL=$(subst /,\,$(FIPTOOL)) realclean 146688a1cf1eSSami Mujawarendif 1467e15591aaSNicolas Boulenguez ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} realclean 146890aa901fSSumit Garg ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${ENCTOOLPATH} realclean 14695accce5bSRoberto Vargas ${Q}${MAKE} --no-print-directory -C ${ROMLIBPATH} clean 14704f6ad66aSAchin Gupta 147136eaaf37SIan Spraycheckcodebase: locate-checkpatch 147236eaaf37SIan Spray @echo " CHECKING STYLE" 147336eaaf37SIan Spray @if test -d .git ; then \ 14741ef35512SPaul Beesley git ls-files | grep -E -v 'libfdt|libc|docs|\.rst' | \ 14751a41e8c1SDan Handley while read GIT_FILE ; \ 14761a41e8c1SDan Handley do ${CHECKPATCH} ${CHECKCODE_ARGS} -f $$GIT_FILE ; \ 14771a41e8c1SDan Handley done ; \ 147836eaaf37SIan Spray else \ 14791a41e8c1SDan Handley find . -type f -not -iwholename "*.git*" \ 14801a41e8c1SDan Handley -not -iwholename "*build*" \ 14811a41e8c1SDan Handley -not -iwholename "*libfdt*" \ 148261f72a34SRoberto Vargas -not -iwholename "*libc*" \ 14831a41e8c1SDan Handley -not -iwholename "*docs*" \ 14841ef35512SPaul Beesley -not -iwholename "*.rst" \ 14851a41e8c1SDan Handley -exec ${CHECKPATCH} ${CHECKCODE_ARGS} -f {} \; ; \ 148636eaaf37SIan Spray fi 148736eaaf37SIan Spray 148836eaaf37SIan Spraycheckpatch: locate-checkpatch 148936eaaf37SIan Spray @echo " CHECKING STYLE" 149002a76d5fSYann Gautier @if test -n "${CHECKPATCH_OPTS}"; then \ 149102a76d5fSYann Gautier echo " with ${CHECKPATCH_OPTS} option(s)"; \ 149202a76d5fSYann Gautier fi 149351d28937SAntonio Nino Diaz ${Q}COMMON_COMMIT=$$(git merge-base HEAD ${BASE_COMMIT}); \ 149477a0a7f1SYann Gautier for commit in `git rev-list --no-merges $$COMMON_COMMIT..HEAD`; \ 149577a0a7f1SYann Gautier do \ 149651d28937SAntonio Nino Diaz printf "\n[*] Checking style of '$$commit'\n\n"; \ 149751d28937SAntonio Nino Diaz git log --format=email "$$commit~..$$commit" \ 149802a76d5fSYann Gautier -- ${CHECK_PATHS} | \ 149902a76d5fSYann Gautier ${CHECKPATCH} ${CHECKPATCH_OPTS} - || true; \ 150051d28937SAntonio Nino Diaz git diff --format=email "$$commit~..$$commit" \ 150102a76d5fSYann Gautier -- ${CHECK_PATHS} | \ 150202a76d5fSYann Gautier ${CHECKPATCH} ${CHECKPATCH_OPTS} - || true; \ 150351d28937SAntonio Nino Diaz done 150436eaaf37SIan Spray 150573c99d4eSJuan Castillocerttool: ${CRTTOOL} 150673c99d4eSJuan Castillo 1507a9812206SPali Rohár${CRTTOOL}: FORCE 1508598b166bSLionel 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 1509f1477d4aSEvan Lloyd @${ECHO_BLANK_LINE} 15106f971622SJuan Castillo @echo "Built $@ successfully" 1511f1477d4aSEvan Lloyd @${ECHO_BLANK_LINE} 15126f971622SJuan Castillo 15136f971622SJuan Castilloifneq (${GENERATE_COT},0) 151473c99d4eSJuan Castillocertificates: ${CRT_DEPS} ${CRTTOOL} 15156f971622SJuan Castillo ${Q}${CRTTOOL} ${CRT_ARGS} 1516f1477d4aSEvan Lloyd @${ECHO_BLANK_LINE} 15176f971622SJuan Castillo @echo "Built $@ successfully" 15186f971622SJuan Castillo @echo "Certificates can be found in ${BUILD_PLAT}" 1519f1477d4aSEvan Lloyd @${ECHO_BLANK_LINE} 152073c99d4eSJuan Castilloendif 152127713fb4SSoby Mathew 152273c99d4eSJuan Castillo${BUILD_PLAT}/${FIP_NAME}: ${FIP_DEPS} ${FIPTOOL} 15234727fd13SPali Rohár $(eval ${CHECK_FIP_CMD}) 1524819281eeSdp-arm ${Q}${FIPTOOL} create ${FIP_ARGS} $@ 1525819281eeSdp-arm ${Q}${FIPTOOL} info $@ 1526f1477d4aSEvan Lloyd @${ECHO_BLANK_LINE} 15272f2cef46SJeenu Viswambharan @echo "Built $@ successfully" 1528f1477d4aSEvan Lloyd @${ECHO_BLANK_LINE} 1529f58ad36fSHarry Liebel 15300191262dSYatharth Kocharifneq (${GENERATE_COT},0) 15310191262dSYatharth Kocharfwu_certificates: ${FWU_CRT_DEPS} ${CRTTOOL} 15320191262dSYatharth Kochar ${Q}${CRTTOOL} ${FWU_CRT_ARGS} 1533052ab529SEvan Lloyd @${ECHO_BLANK_LINE} 15340191262dSYatharth Kochar @echo "Built $@ successfully" 15350191262dSYatharth Kochar @echo "FWU certificates can be found in ${BUILD_PLAT}" 1536052ab529SEvan Lloyd @${ECHO_BLANK_LINE} 15370191262dSYatharth Kocharendif 15380191262dSYatharth Kochar 15390191262dSYatharth Kochar${BUILD_PLAT}/${FWU_FIP_NAME}: ${FWU_FIP_DEPS} ${FIPTOOL} 15404727fd13SPali Rohár $(eval ${CHECK_FWU_FIP_CMD}) 1541819281eeSdp-arm ${Q}${FIPTOOL} create ${FWU_FIP_ARGS} $@ 1542819281eeSdp-arm ${Q}${FIPTOOL} info $@ 1543052ab529SEvan Lloyd @${ECHO_BLANK_LINE} 15440191262dSYatharth Kochar @echo "Built $@ successfully" 1545052ab529SEvan Lloyd @${ECHO_BLANK_LINE} 15460191262dSYatharth Kochar 154773c99d4eSJuan Castillofiptool: ${FIPTOOL} 154873c99d4eSJuan Castillofip: ${BUILD_PLAT}/${FIP_NAME} 15490191262dSYatharth Kocharfwu_fip: ${BUILD_PLAT}/${FWU_FIP_NAME} 155073c99d4eSJuan Castillo 1551a9812206SPali Rohár${FIPTOOL}: FORCE 155288a1cf1eSSami Mujawarifdef UNIX_MK 1553598b166bSLionel Debieve ${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" FIPTOOL=${FIPTOOL} OPENSSL_DIR=${OPENSSL_DIR} DEBUG=${DEBUG} V=${V} --no-print-directory -C ${FIPTOOLPATH} all 155488a1cf1eSSami Mujawarelse 155588a1cf1eSSami Mujawar# Clear the MAKEFLAGS as we do not want 155688a1cf1eSSami Mujawar# to pass the gnumake flags to nmake. 155788a1cf1eSSami Mujawar ${Q}set MAKEFLAGS= && ${MSVC_NMAKE} /nologo /f ${FIPTOOLPATH}/Makefile.msvc FIPTOOLPATH=$(subst /,\,$(FIPTOOLPATH)) FIPTOOL=$(subst /,\,$(FIPTOOL)) 155888a1cf1eSSami Mujawarendif 1559f58ad36fSHarry Liebel 1560a9812206SPali Rohárromlib.bin: libraries FORCE 1561bbb24f61SJohn 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 15625accce5bSRoberto Vargas 1563cfe83910SLouis Mayencourt# Call print_memory_map tool 1564cfe83910SLouis Mayencourtmemmap: all 1565b890b36dSLouis Mayencourt ${Q}${PYTHON} ${PRINT_MEMORY_MAP} ${BUILD_PLAT} ${INVERTED_MEMMAP} 1566cfe83910SLouis Mayencourt 15676de32378SMadhukar Pappireddydoc: 15686de32378SMadhukar Pappireddy @echo " BUILD DOCUMENTATION" 15696de32378SMadhukar Pappireddy ${Q}${MAKE} --no-print-directory -C ${DOCS_PATH} html 15706de32378SMadhukar Pappireddy 157190aa901fSSumit Gargenctool: ${ENCTOOL} 157290aa901fSSumit Garg 1573a9812206SPali Rohár${ENCTOOL}: FORCE 1574598b166bSLionel Debieve ${Q}${MAKE} PLAT=${PLAT} BUILD_INFO=0 OPENSSL_DIR=${OPENSSL_DIR} ENCTOOL=${ENCTOOL} DEBUG=${DEBUG} V=${V} --no-print-directory -C ${ENCTOOLPATH} all 157590aa901fSSumit Garg @${ECHO_BLANK_LINE} 157690aa901fSSumit Garg @echo "Built $@ successfully" 157790aa901fSSumit Garg @${ECHO_BLANK_LINE} 157890aa901fSSumit Garg 157935fab8c9SJoakim Bechcscope: 158035fab8c9SJoakim Bech @echo " CSCOPE" 158135fab8c9SJoakim Bech ${Q}find ${CURDIR} -name "*.[chsS]" > cscope.files 158235fab8c9SJoakim Bech ${Q}cscope -b -q -k 158335fab8c9SJoakim Bech 158472ee3314SRyan Harkinhelp: 15857c23126cSJohn Tsichritzis @echo "usage: ${MAKE} [PLAT=<platform>] [OPTIONS] [TARGET]" 158672ee3314SRyan Harkin @echo "" 158772ee3314SRyan Harkin @echo "PLAT is used to specify which platform you wish to build." 158808c7ed0fSSandrine Bailleux @echo "If no platform is specified, PLAT defaults to: ${DEFAULT_PLAT}" 158972ee3314SRyan Harkin @echo "" 15907c23126cSJohn Tsichritzis @echo "platform = ${PLATFORM_LIST}" 15917c23126cSJohn Tsichritzis @echo "" 15921b578596SSandrine Bailleux @echo "Please refer to the User Guide for a list of all supported options." 15931b578596SSandrine Bailleux @echo "Note that the build system doesn't track dependencies for build " 15941b578596SSandrine Bailleux @echo "options. Therefore, if any of the build options are changed " 15951b578596SSandrine Bailleux @echo "from a previous build, a clean build must be performed." 15961b578596SSandrine Bailleux @echo "" 159772ee3314SRyan Harkin @echo "Supported Targets:" 15981b578596SSandrine Bailleux @echo " all Build all individual bootloader binaries" 159936eaaf37SIan Spray @echo " bl1 Build the BL1 binary" 16008aa559c0SJeenu Viswambharan @echo " bl2 Build the BL2 binary" 16019003fa0bSYatharth Kochar @echo " bl2u Build the BL2U binary" 1602d178637dSJuan Castillo @echo " bl31 Build the BL31 binary" 16039d29c227SSoby Mathew @echo " bl32 Build the BL32 binary. If ARCH=aarch32, then " 16049d29c227SSoby Mathew @echo " this builds secure payload specified by AARCH32_SP" 160573c99d4eSJuan Castillo @echo " certificates Build the certificates (requires 'GENERATE_COT=1')" 16061b578596SSandrine Bailleux @echo " fip Build the Firmware Image Package (FIP)" 16070191262dSYatharth Kochar @echo " fwu_fip Build the FWU Firmware Image Package (FIP)" 160836eaaf37SIan Spray @echo " checkcodebase Check the coding style of the entire source tree" 160936eaaf37SIan Spray @echo " checkpatch Check the coding style on changes in the current" 161036eaaf37SIan Spray @echo " branch against BASE_COMMIT (default origin/master)" 161172ee3314SRyan Harkin @echo " clean Clean the build for the selected platform" 161235fab8c9SJoakim Bech @echo " cscope Generate cscope index" 161372ee3314SRyan Harkin @echo " distclean Remove all build artifacts for all platforms" 16146f971622SJuan Castillo @echo " certtool Build the Certificate generation tool" 161590aa901fSSumit Garg @echo " enctool Build the Firmware encryption tool" 1616f58ad36fSHarry Liebel @echo " fiptool Build the Firmware Image Package (FIP) creation tool" 1617ce2b1ec6SManish Pandey @echo " sp Build the Secure Partition Packages" 161826010da1SAntonio Nino Diaz @echo " sptool Build the Secure Partition Package creation tool" 161938c14d88SSoby Mathew @echo " dtbs Build the Device Tree Blobs (if required for the platform)" 1620cfe83910SLouis Mayencourt @echo " memmap Print the memory map of the built binaries" 16216de32378SMadhukar Pappireddy @echo " doc Build html based documentation using Sphinx tool" 162272ee3314SRyan Harkin @echo "" 16231b578596SSandrine Bailleux @echo "Note: most build targets require PLAT to be set to a specific platform." 162472ee3314SRyan Harkin @echo "" 162572ee3314SRyan Harkin @echo "example: build all targets for the FVP platform:" 162672ee3314SRyan Harkin @echo " CROSS_COMPILE=aarch64-none-elf- make PLAT=fvp all" 1627a9812206SPali Rohár 1628a9812206SPali Rohár.PHONY: FORCE 1629a9812206SPali RohárFORCE:; 1630