14f6ad66aSAchin Gupta# 201cf14ddSMaksims Svecovs# Copyright (c) 2013-2023, Arm Limited and Contributors. All rights reserved. 34f6ad66aSAchin Gupta# 482cb2c1aSdp-arm# SPDX-License-Identifier: BSD-3-Clause 54f6ad66aSAchin Gupta# 64f6ad66aSAchin Gupta 7e35c4045SJeenu Viswambharan# 8aaa3e722SJuan Castillo# Trusted Firmware Version 9aaa3e722SJuan Castillo# 101a0f1121SSoby MathewVERSION_MAJOR := 2 11*b78ad00eSJuan Pablo CondeVERSION_MINOR := 9 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 15601cf14ddSMaksims Svecovs# RME enables CSV2_2 extension by default. 15701cf14ddSMaksims SvecovsENABLE_FEAT_CSV2_2 = 1 15801cf14ddSMaksims 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 417dea23e24SGovindraj Raja 418dea23e24SGovindraj Raja# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105523 419dea23e24SGovindraj RajaTF_CFLAGS += $(call cc_option, --param=min-pagesize=0) 420dea23e24SGovindraj Raja 42193c690ebSJustin Chadwellelse 42293c690ebSJustin Chadwell# using clang 423d7b4cd41SJustin ChadwellWARNINGS += -Wshift-overflow -Wshift-sign-overflow \ 424d7b4cd41SJustin Chadwell -Wlogical-op-parentheses 42500296576SAmbroise Vincentendif 42600296576SAmbroise Vincent 4276336b07aSYann Gautierifneq (${E},0) 4286336b07aSYann GautierERRORS := -Werror 4296336b07aSYann Gautierendif 4306336b07aSYann Gautier 431ea7a57a3SRoberto VargasCPPFLAGS = ${DEFINES} ${INCLUDES} ${MBEDTLS_INC} -nostdinc \ 4329ab81b5eSJustin Chadwell $(ERRORS) $(WARNINGS) 43359de5096SMasahiro YamadaASFLAGS += $(CPPFLAGS) $(ASFLAGS_$(ARCH)) \ 434d5dfdeb6SJulius Werner -ffreestanding -Wa,--fatal-warnings 43559de5096SMasahiro YamadaTF_CFLAGS += $(CPPFLAGS) $(TF_CFLAGS_$(ARCH)) \ 436ebd6efaeSSamuel Holland -ffunction-sections -fdata-sections \ 437ebd6efaeSSamuel Holland -ffreestanding -fno-builtin -fno-common \ 438ebd6efaeSSamuel Holland -Os -std=gnu99 43973c99d4eSJuan Castillo 440bebcf27fSMark Brown$(eval $(call add_define,SVE_VECTOR_LEN)) 441bebcf27fSMark Brown 4421f461979SJustin Chadwellifeq (${SANITIZE_UB},on) 4431f461979SJustin ChadwellTF_CFLAGS += -fsanitize=undefined -fno-sanitize-recover 4441f461979SJustin Chadwellendif 4451f461979SJustin Chadwellifeq (${SANITIZE_UB},trap) 4461f461979SJustin ChadwellTF_CFLAGS += -fsanitize=undefined -fno-sanitize-recover \ 4471f461979SJustin Chadwell -fsanitize-undefined-trap-on-error 4481f461979SJustin Chadwellendif 4491f461979SJustin Chadwell 450f7ec31dbSdavid cunadoGCC_V_OUTPUT := $(shell $(CC) -v 2>&1) 451f7ec31dbSdavid cunado 4521f49db5fSMarco FelschTF_LDFLAGS += -z noexecstack 4531f49db5fSMarco Felsch 454641f16e7SAmbroise Vincent# LD = armlink 455c2ad38ceSVarun Wadekarifneq ($(findstring armlink,$(notdir $(LD))),) 456c2ad38ceSVarun WadekarTF_LDFLAGS += --diag_error=warning --lto_level=O1 457c2ad38ceSVarun WadekarTF_LDFLAGS += --remove --info=unused,unusedsymbols 458edbce9aaSzelalem-awekeTF_LDFLAGS += $(TF_LDFLAGS_$(ARCH)) 459641f16e7SAmbroise Vincent 460641f16e7SAmbroise Vincent# LD = gcc (used when GCC LTO is enabled) 461edbce9aaSzelalem-awekeelse ifneq ($(findstring gcc,$(notdir $(LD))),) 462edbce9aaSzelalem-aweke# Pass ld options with Wl or Xlinker switches 463edbce9aaSzelalem-awekeTF_LDFLAGS += -Wl,--fatal-warnings -O1 464edbce9aaSzelalem-awekeTF_LDFLAGS += -Wl,--gc-sections 465ac98b82aSChris Kay 466ac98b82aSChris KayTF_LDFLAGS += -Wl,-z,common-page-size=4096 # Configure page size constants 467ac98b82aSChris KayTF_LDFLAGS += -Wl,-z,max-page-size=4096 468ac98b82aSChris Kay 469edbce9aaSzelalem-awekeifeq ($(ENABLE_LTO),1) 470edbce9aaSzelalem-aweke ifeq (${ARCH},aarch64) 471edbce9aaSzelalem-aweke TF_LDFLAGS += -flto -fuse-linker-plugin 472edbce9aaSzelalem-aweke endif 473edbce9aaSzelalem-awekeendif 474edbce9aaSzelalem-aweke# GCC automatically adds fix-cortex-a53-843419 flag when used to link 475edbce9aaSzelalem-aweke# which breaks some builds, so disable if errata fix is not explicitly enabled 476edbce9aaSzelalem-awekeifneq (${ERRATA_A53_843419},1) 477edbce9aaSzelalem-aweke TF_LDFLAGS += -mno-fix-cortex-a53-843419 478edbce9aaSzelalem-awekeendif 479edbce9aaSzelalem-awekeTF_LDFLAGS += -nostdlib 480edbce9aaSzelalem-awekeTF_LDFLAGS += $(subst --,-Xlinker --,$(TF_LDFLAGS_$(ARCH))) 481641f16e7SAmbroise Vincent 482641f16e7SAmbroise Vincent# LD = gcc-ld (ld) or llvm-ld (ld.lld) or other 483c2ad38ceSVarun Wadekarelse 4841f49db5fSMarco Felsch# With ld.bfd version 2.39 and newer new warnings are added. Skip those since we 4851f49db5fSMarco Felsch# are not loaded by a elf loader. 4861f49db5fSMarco FelschTF_LDFLAGS += $(call ld_option, --no-warn-rwx-segments) 487ebac6922SYabin CuiTF_LDFLAGS += -O1 488c2b8806fSDouglas RaillardTF_LDFLAGS += --gc-sections 489ac98b82aSChris Kay 490ac98b82aSChris KayTF_LDFLAGS += -z common-page-size=4096 # Configure page size constants 491ac98b82aSChris KayTF_LDFLAGS += -z max-page-size=4096 492ac98b82aSChris Kay 493641f16e7SAmbroise Vincent# ld.lld doesn't recognize the errata flags, 494ebac6922SYabin Cui# therefore don't add those in that case. 495ebac6922SYabin Cui# ld.lld reports section type mismatch warnings, 496ebac6922SYabin Cui# therefore don't add --fatal-warnings to it. 497641f16e7SAmbroise Vincentifeq ($(findstring ld.lld,$(notdir $(LD))),) 498ebac6922SYabin CuiTF_LDFLAGS += $(TF_LDFLAGS_$(ARCH)) --fatal-warnings 499edbce9aaSzelalem-awekeendif 500641f16e7SAmbroise Vincentendif 50173c99d4eSJuan Castillo 50203b397a8SNishanth MenonDTC_FLAGS += -I dts -O dtb 503a6de824fSLouis MayencourtDTC_CPPFLAGS += -P -nostdinc -Iinclude -Ifdts -undef \ 504a6de824fSLouis Mayencourt -x assembler-with-cpp $(DEFINES) 50503b397a8SNishanth Menon 50673c99d4eSJuan Castillo################################################################################ 50773c99d4eSJuan Castillo# Common sources and include directories 50873c99d4eSJuan Castillo################################################################################ 5096a0da736SJayanth Dodderi Chidanandinclude ${MAKE_HELPERS_DIRECTORY}arch_features.mk 510d801fbb0Sdp-arminclude lib/compiler-rt/compiler-rt.mk 51173c99d4eSJuan Castillo 51273c99d4eSJuan CastilloBL_COMMON_SOURCES += common/bl_common.c \ 5137f56e9a3SSoby Mathew common/tf_log.c \ 5149d29c227SSoby Mathew common/${ARCH}/debug.S \ 51591b48c9fSJulius Werner drivers/console/multi_console.c \ 5169d29c227SSoby Mathew lib/${ARCH}/cache_helpers.S \ 5179d29c227SSoby Mathew lib/${ARCH}/misc_helpers.S \ 518566034fcSSoby Mathew plat/common/plat_bl_common.c \ 5197f56e9a3SSoby Mathew plat/common/plat_log_common.c \ 52075311203Sdp-arm plat/common/${ARCH}/plat_common.c \ 5219d29c227SSoby Mathew plat/common/${ARCH}/platform_helpers.S \ 52261f72a34SRoberto Vargas ${COMPILER_RT_SRCS} 523d7a6b0f8SRyan Harkin 52490ce8b87SBoyan Karatotev# Pointer Authentication sources 52590ce8b87SBoyan Karatotevifeq (${ENABLE_PAUTH}, 1) 52690ce8b87SBoyan Karatotev# arm/common/aarch64/arm_pauth.c contains a sample platform hook to complete the 52790ce8b87SBoyan Karatotev# Pauth support. As it's not secure, it must be reimplemented for real platforms 52890ce8b87SBoyan KaratotevBL_COMMON_SOURCES += lib/extensions/pauth/pauth_helpers.S 52990ce8b87SBoyan Karatotevendif 53090ce8b87SBoyan Karatotev 5318422a840SAntonio Nino Diazifeq ($(notdir $(CC)),armclang) 5328422a840SAntonio Nino DiazBL_COMMON_SOURCES += lib/${ARCH}/armclang_printf.S 5338422a840SAntonio Nino Diazendif 5348422a840SAntonio Nino Diaz 5351f461979SJustin Chadwellifeq (${SANITIZE_UB},on) 5361f461979SJustin ChadwellBL_COMMON_SOURCES += plat/common/ubsan.c 5371f461979SJustin Chadwellendif 5381f461979SJustin Chadwell 53901d237cbSYann GautierINCLUDES += -Iinclude \ 540f5478dedSAntonio Nino Diaz -Iinclude/arch/${ARCH} \ 54109d40e0eSAntonio Nino Diaz -Iinclude/lib/cpus/${ARCH} \ 54209d40e0eSAntonio Nino Diaz -Iinclude/lib/el3_runtime/${ARCH} \ 54309d40e0eSAntonio Nino Diaz ${PLAT_INCLUDES} \ 54409d40e0eSAntonio Nino Diaz ${SPD_INCLUDES} 54509d40e0eSAntonio Nino Diaz 5469c6d1c50SAntonio Nino Diazinclude common/backtrace/backtrace.mk 5479c6d1c50SAntonio Nino Diaz 54873c99d4eSJuan Castillo################################################################################ 54973c99d4eSJuan Castillo# Generic definitions 55073c99d4eSJuan Castillo################################################################################ 55173c99d4eSJuan Castillo 552231c1470SEvan Lloydinclude ${MAKE_HELPERS_DIRECTORY}plat_helpers.mk 553231c1470SEvan Lloyd 55429214e95SGrant Likelyifeq (${BUILD_BASE},) 55573c99d4eSJuan Castillo BUILD_BASE := ./build 55629214e95SGrant Likelyendif 55729214e95SGrant LikelyBUILD_PLAT := $(abspath ${BUILD_BASE})/${PLAT}/${BUILD_TYPE} 55873c99d4eSJuan Castillo 559231c1470SEvan LloydSPDS := $(sort $(filter-out none, $(patsubst services/spd/%,%,$(wildcard services/spd/*)))) 56073c99d4eSJuan Castillo 56173c99d4eSJuan Castillo# Platforms providing their own TBB makefile may override this value 56273c99d4eSJuan CastilloINCLUDE_TBBR_MK := 1 56373c99d4eSJuan Castillo 56473c99d4eSJuan Castillo 56573c99d4eSJuan Castillo################################################################################ 56673c99d4eSJuan Castillo# Include SPD Makefile if one has been specified 56773c99d4eSJuan Castillo################################################################################ 56873c99d4eSJuan Castillo 56973c99d4eSJuan Castilloifneq (${SPD},none) 5709d29c227SSoby Mathew ifeq (${ARCH},aarch32) 5719d29c227SSoby Mathew $(error "Error: SPD is incompatible with AArch32.") 5729d29c227SSoby Mathew endif 57328f39f02SMax Shvetsov 5744c117f6cSSandrine Bailleux ifdef EL3_PAYLOAD_BASE 5754c117f6cSSandrine Bailleux $(warning "SPD and EL3_PAYLOAD_BASE are incompatible build options.") 5764c117f6cSSandrine Bailleux $(warning "The SPD and its BL32 companion will be present but ignored.") 5774c117f6cSSandrine Bailleux endif 57828f39f02SMax Shvetsov 579c3fb00d9SAchin Gupta ifeq (${SPD},spmd) 580c3fb00d9SAchin Gupta # SPMD is located in std_svc directory 581c3fb00d9SAchin Gupta SPD_DIR := std_svc 58228f39f02SMax Shvetsov 583033039f8SMax Shvetsov ifeq ($(SPMD_SPM_AT_SEL2),1) 584f1910cc1SGovindraj Raja CTX_INCLUDE_EL2_REGS := 1 5851d63ae4dSMarc Bonnici ifeq ($(SPMC_AT_EL3),1) 5861d63ae4dSMarc Bonnici $(error SPM cannot be enabled in both S-EL2 and EL3.) 5871d63ae4dSMarc Bonnici endif 58828f39f02SMax Shvetsov endif 589db1ef41aSOlivier Deprez 590db1ef41aSOlivier Deprez ifeq ($(findstring optee_sp,$(ARM_SPMC_MANIFEST_DTS)),optee_sp) 591db1ef41aSOlivier Deprez DTC_CPPFLAGS += -DOPTEE_SP_FW_CONFIG 592db1ef41aSOlivier Deprez endif 593ca932481SDavidson K 594ca932481SDavidson K ifeq ($(TS_SP_FW_CONFIG),1) 595ca932481SDavidson K DTC_CPPFLAGS += -DTS_SP_FW_CONFIG 596ca932481SDavidson K endif 59733993a37SBalint Dobszay 59833993a37SBalint Dobszay ifneq ($(ARM_BL2_SP_LIST_DTS),) 59933993a37SBalint Dobszay DTC_CPPFLAGS += -DARM_BL2_SP_LIST_DTS=$(ARM_BL2_SP_LIST_DTS) 60033993a37SBalint Dobszay endif 60146789a7cSBalint Dobszay 60246789a7cSBalint Dobszay ifneq ($(SP_LAYOUT_FILE),) 60346789a7cSBalint Dobszay BL2_ENABLE_SP_LOAD := 1 60446789a7cSBalint Dobszay endif 605c3fb00d9SAchin Gupta else 606c3fb00d9SAchin Gupta # All other SPDs in spd directory 607c3fb00d9SAchin Gupta SPD_DIR := spd 608c3fb00d9SAchin Gupta endif 609c3fb00d9SAchin Gupta 61073c99d4eSJuan Castillo # We expect to locate an spd.mk under the specified SPD directory 611c3fb00d9SAchin Gupta SPD_MAKE := $(wildcard services/${SPD_DIR}/${SPD}/${SPD}.mk) 612c3fb00d9SAchin Gupta 61373c99d4eSJuan Castillo ifeq (${SPD_MAKE},) 614c3fb00d9SAchin Gupta $(error Error: No services/${SPD_DIR}/${SPD}/${SPD}.mk located) 61573c99d4eSJuan Castillo endif 61673c99d4eSJuan Castillo $(info Including ${SPD_MAKE}) 61773c99d4eSJuan Castillo include ${SPD_MAKE} 61873c99d4eSJuan Castillo 61970d1fc53SJuan Castillo # If there's BL32 companion for the chosen SPD, we expect that the SPD's 62070d1fc53SJuan Castillo # Makefile would set NEED_BL32 to "yes". In this case, the build system 62170d1fc53SJuan Castillo # supports two mutually exclusive options: 62270d1fc53SJuan Castillo # * BL32 is built from source: then BL32_SOURCES must contain the list 62370d1fc53SJuan Castillo # of source files to build BL32 62470d1fc53SJuan Castillo # * BL32 is a prebuilt binary: then BL32 must point to the image file 62570d1fc53SJuan Castillo # that will be included in the FIP 62670d1fc53SJuan Castillo # If both BL32_SOURCES and BL32 are defined, the binary takes precedence 62770d1fc53SJuan Castillo # over the sources. 628e35c4045SJeenu Viswambharanendif 629e35c4045SJeenu Viswambharan 630f1910cc1SGovindraj Rajaifeq (${CTX_INCLUDE_EL2_REGS}, 1) 631f1910cc1SGovindraj Rajaifeq (${SPD},none) 632f1910cc1SGovindraj Rajaifeq (${ENABLE_RME},0) 633f1910cc1SGovindraj Raja $(error CTX_INCLUDE_EL2_REGS is available only when SPD or RME is enabled) 634f1910cc1SGovindraj Rajaendif 635f1910cc1SGovindraj Rajaendif 636f1910cc1SGovindraj Rajaendif 637f1910cc1SGovindraj Raja 63851faada7SDouglas Raillard################################################################################ 6395b18de09SZelalem Aweke# Include rmmd Makefile if RME is enabled 6405b18de09SZelalem Aweke################################################################################ 6415b18de09SZelalem Aweke 6425b18de09SZelalem Awekeifneq (${ENABLE_RME},0) 6435b18de09SZelalem Awekeifneq (${ARCH},aarch64) 6445b18de09SZelalem Aweke $(error ENABLE_RME requires AArch64) 6455b18de09SZelalem Awekeendif 6461d63ae4dSMarc Bonniciifeq ($(SPMC_AT_EL3),1) 6471d63ae4dSMarc Bonnici $(error SPMC_AT_EL3 and ENABLE_RME cannot both be enabled.) 6481d63ae4dSMarc Bonniciendif 6495b18de09SZelalem Awekeinclude services/std_svc/rmmd/rmmd.mk 6505b18de09SZelalem Aweke$(warning "RME is an experimental feature") 6515b18de09SZelalem Awekeendif 6525b18de09SZelalem Aweke 6535b18de09SZelalem Aweke################################################################################ 65473c99d4eSJuan Castillo# Include the platform specific Makefile after the SPD Makefile (the platform 65573c99d4eSJuan Castillo# makefile may use all previous definitions in this file) 65673c99d4eSJuan Castillo################################################################################ 6572da8d8bfSJeenu Viswambharan 65873c99d4eSJuan Castilloinclude ${PLAT_MAKEFILE_FULL} 6590f21c547SJuan Castillo 66042d4d3baSArvind Ram Prakash# This internal flag is common option which is set to 1 for scenarios 66142d4d3baSArvind Ram Prakash# when the BL2 is running in EL3 level. This occurs in two scenarios - 66242d4d3baSArvind Ram Prakash# 4 world system running BL2 at EL3 and two world system without BL1 running 66342d4d3baSArvind Ram Prakash# BL2 in EL3 66442d4d3baSArvind Ram Prakash 66542d4d3baSArvind Ram Prakashifeq (${RESET_TO_BL2},1) 66642d4d3baSArvind Ram Prakash BL2_RUNS_AT_EL3 := 1 66742d4d3baSArvind Ram Prakash ifeq (${ENABLE_RME},1) 66842d4d3baSArvind Ram Prakash $(error RESET_TO_BL2=1 and ENABLE_RME=1 configuration is not supported at the moment.) 66942d4d3baSArvind Ram Prakash endif 67042d4d3baSArvind Ram Prakashelse ifeq (${ENABLE_RME},1) 67142d4d3baSArvind Ram Prakash BL2_RUNS_AT_EL3 := 1 67242d4d3baSArvind Ram Prakashelse 67342d4d3baSArvind Ram Prakash BL2_RUNS_AT_EL3 := 0 67442d4d3baSArvind Ram Prakashendif 67542d4d3baSArvind Ram Prakash 6768012cc5cSMasahiro Yamada$(eval $(call MAKE_PREREQ_DIR,${BUILD_PLAT})) 6778012cc5cSMasahiro Yamada 67826e63c44SEtienne Carriereifeq (${ARM_ARCH_MAJOR},7) 67926e63c44SEtienne Carriereinclude make_helpers/armv7-a-cpus.mk 68026e63c44SEtienne Carriereendif 68126e63c44SEtienne Carriere 6823bd17c0fSSoby MathewPIE_FOUND := $(findstring --enable-default-pie,${GCC_V_OUTPUT}) 6833bd17c0fSSoby Mathewifneq ($(PIE_FOUND),) 6843bd17c0fSSoby Mathew TF_CFLAGS += -fno-PIE 6857b592418SSamuel Hollandifneq ($(findstring gcc,$(notdir $(LD))),) 6867b592418SSamuel Holland TF_LDFLAGS += -no-pie 6877b592418SSamuel Hollandendif 6883bd17c0fSSoby Mathewendif 689320920c1SMasahiro Yamada 690320920c1SMasahiro Yamadaifneq ($(findstring gcc,$(notdir $(LD))),) 691320920c1SMasahiro Yamada PIE_LDFLAGS += -Wl,-pie -Wl,--no-dynamic-linker 692320920c1SMasahiro Yamadaelse 693320920c1SMasahiro Yamada PIE_LDFLAGS += -pie --no-dynamic-linker 694320920c1SMasahiro Yamadaendif 695320920c1SMasahiro Yamada 696320920c1SMasahiro Yamadaifeq ($(ENABLE_PIE),1) 69742d4d3baSArvind Ram Prakashifeq ($(RESET_TO_BL2),1) 69869af7fcfSMasahiro Yamadaifneq ($(BL2_IN_XIP_MEM),1) 699966660ecSChris Kay BL2_CPPFLAGS += -fpie 70069af7fcfSMasahiro Yamada BL2_CFLAGS += -fpie 70169af7fcfSMasahiro Yamada BL2_LDFLAGS += $(PIE_LDFLAGS) 70269af7fcfSMasahiro Yamadaendif 70369af7fcfSMasahiro Yamadaendif 704966660ecSChris Kay BL31_CPPFLAGS += -fpie 705320920c1SMasahiro Yamada BL31_CFLAGS += -fpie 706320920c1SMasahiro Yamada BL31_LDFLAGS += $(PIE_LDFLAGS) 707966660ecSChris Kay 708966660ecSChris Kay BL32_CPPFLAGS += -fpie 709d974301dSMasahiro Yamada BL32_CFLAGS += -fpie 710d974301dSMasahiro Yamada BL32_LDFLAGS += $(PIE_LDFLAGS) 711d974301dSMasahiro Yamadaendif 7123bd17c0fSSoby Mathew 713d5e97a1dSMasahiro Yamadaifeq (${ARCH},aarch64) 7149cefb4b1SMasahiro YamadaBL1_CPPFLAGS += -DIMAGE_AT_EL3 71542d4d3baSArvind Ram Prakashifeq ($(RESET_TO_BL2),1) 7169cefb4b1SMasahiro YamadaBL2_CPPFLAGS += -DIMAGE_AT_EL3 717d5e97a1dSMasahiro Yamadaelse 7189cefb4b1SMasahiro YamadaBL2_CPPFLAGS += -DIMAGE_AT_EL1 719d5e97a1dSMasahiro Yamadaendif 7209cefb4b1SMasahiro YamadaBL2U_CPPFLAGS += -DIMAGE_AT_EL1 7219cefb4b1SMasahiro YamadaBL31_CPPFLAGS += -DIMAGE_AT_EL3 7229cefb4b1SMasahiro YamadaBL32_CPPFLAGS += -DIMAGE_AT_EL1 723d5e97a1dSMasahiro Yamadaendif 724d5e97a1dSMasahiro Yamada 72554035fc4SSandrine Bailleux# Include the CPU specific operations makefile, which provides default 72654035fc4SSandrine Bailleux# values for all CPU errata workarounds and CPU specific optimisations. 72754035fc4SSandrine Bailleux# This can be overridden by the platform. 72873c99d4eSJuan Castilloinclude lib/cpus/cpu-ops.mk 7294f6ad66aSAchin Gupta 730a4409008Sdp-armifeq (${ARCH},aarch32) 731a4409008Sdp-armNEED_BL32 := yes 732a4409008Sdp-arm 733a4409008Sdp-arm################################################################################ 734a4409008Sdp-arm# Build `AARCH32_SP` as BL32 image for AArch32 735a4409008Sdp-arm################################################################################ 736a4409008Sdp-armifneq (${AARCH32_SP},none) 737a4409008Sdp-arm# We expect to locate an sp.mk under the specified AARCH32_SP directory 738a4409008Sdp-armAARCH32_SP_MAKE := $(wildcard bl32/${AARCH32_SP}/${AARCH32_SP}.mk) 739a4409008Sdp-arm 740a4409008Sdp-armifeq (${AARCH32_SP_MAKE},) 741a4409008Sdp-arm $(error Error: No bl32/${AARCH32_SP}/${AARCH32_SP}.mk located) 742a4409008Sdp-armendif 743a4409008Sdp-arm 744a4409008Sdp-arm$(info Including ${AARCH32_SP_MAKE}) 745a4409008Sdp-arminclude ${AARCH32_SP_MAKE} 746a4409008Sdp-armendif 747a4409008Sdp-arm 748a4409008Sdp-armendif 7494f6ad66aSAchin Gupta 75073c99d4eSJuan Castillo################################################################################ 75177f1f7a1SVarun Wadekar# Include libc if not overridden 75277f1f7a1SVarun Wadekar################################################################################ 75377f1f7a1SVarun Wadekarifeq (${OVERRIDE_LIBC},0) 75477f1f7a1SVarun Wadekarinclude lib/libc/libc.mk 75577f1f7a1SVarun Wadekarendif 75677f1f7a1SVarun Wadekar 75777f1f7a1SVarun Wadekar################################################################################ 758cf2c8a33SAntonio Nino Diaz# Check incompatible options 759cf2c8a33SAntonio Nino Diaz################################################################################ 760cf2c8a33SAntonio Nino Diaz 761cf2c8a33SAntonio Nino Diazifdef EL3_PAYLOAD_BASE 76268450a6dSAntonio Nino Diaz ifdef PRELOADED_BL33_BASE 76368450a6dSAntonio Nino Diaz $(warning "PRELOADED_BL33_BASE and EL3_PAYLOAD_BASE are \ 76468450a6dSAntonio Nino Diaz incompatible build options. EL3_PAYLOAD_BASE has priority.") 765cf2c8a33SAntonio Nino Diaz endif 76676580f3dSQixiang Xu ifneq (${GENERATE_COT},0) 76776580f3dSQixiang Xu $(error "GENERATE_COT and EL3_PAYLOAD_BASE are incompatible build options.") 76876580f3dSQixiang Xu endif 76976580f3dSQixiang Xu ifneq (${TRUSTED_BOARD_BOOT},0) 77076580f3dSQixiang Xu $(error "TRUSTED_BOARD_BOOT and EL3_PAYLOAD_BASE are incompatible build options.") 77176580f3dSQixiang Xu endif 772cf2c8a33SAntonio Nino Diazendif 773cf2c8a33SAntonio Nino Diaz 774cf2c8a33SAntonio Nino Diazifeq (${NEED_BL33},yes) 775cf2c8a33SAntonio Nino Diaz ifdef EL3_PAYLOAD_BASE 776cf2c8a33SAntonio Nino Diaz $(warning "BL33 image is not needed when option \ 777cf2c8a33SAntonio Nino Diaz BL33_PAYLOAD_BASE is used and won't be added to the FIP file.") 778cf2c8a33SAntonio Nino Diaz endif 77968450a6dSAntonio Nino Diaz ifdef PRELOADED_BL33_BASE 78068450a6dSAntonio Nino Diaz $(warning "BL33 image is not needed when option \ 78168450a6dSAntonio Nino Diaz PRELOADED_BL33_BASE is used and won't be added to the FIP \ 78268450a6dSAntonio Nino Diaz file.") 783cf2c8a33SAntonio Nino Diaz endif 784cf2c8a33SAntonio Nino Diazendif 785cf2c8a33SAntonio Nino Diaz 786d4593e47SJeenu Viswambharan# When building for systems with hardware-assisted coherency, there's no need to 787d4593e47SJeenu Viswambharan# use USE_COHERENT_MEM. Require that USE_COHERENT_MEM must be set to 0 too. 788d4593e47SJeenu Viswambharanifeq ($(HW_ASSISTED_COHERENCY)-$(USE_COHERENT_MEM),1-1) 789d4593e47SJeenu Viswambharan$(error USE_COHERENT_MEM cannot be enabled with HW_ASSISTED_COHERENCY) 790d4593e47SJeenu Viswambharanendif 7911a0a3f06SYatharth Kochar 79242d4d3baSArvind Ram Prakash#For now, BL2_IN_XIP_MEM is only supported when RESET_TO_BL2 is 1. 79342d4d3baSArvind Ram Prakashifeq ($(RESET_TO_BL2)-$(BL2_IN_XIP_MEM),0-1) 79442d4d3baSArvind Ram Prakash$(error "BL2_IN_XIP_MEM is only supported when RESET_TO_BL2 is enabled") 7957d173fc5SJiafei Panendif 7967d173fc5SJiafei Pan 7979202d519SManish Pandey# RAS_EXTENSION is deprecated, provide alternate build options 79814c6016aSJeenu Viswambharanifeq ($(RAS_EXTENSION),1) 7999202d519SManish Pandey $(error "RAS_EXTENSION is now deprecated, please use ENABLE_FEAT_RAS and RAS_FFH_SUPPORT instead") 8009202d519SManish Pandeyendif 8019202d519SManish Pandey# RAS firmware first handling requires that EAs are handled in EL3 first 8029202d519SManish Pandeyifeq ($(RAS_FFH_SUPPORT),1) 8039202d519SManish Pandey ifneq ($(ENABLE_FEAT_RAS),1) 8049202d519SManish Pandey $(error For RAS_FFH_SUPPORT, ENABLE_FEAT_RAS must also be 1) 8059202d519SManish Pandey endif 80646cc41d5SManish Pandey ifneq ($(HANDLE_EA_EL3_FIRST_NS),1) 8079202d519SManish Pandey $(error For RAS_FFH_SUPPORT, HANDLE_EA_EL3_FIRST_NS must also be 1) 80814c6016aSJeenu Viswambharan endif 80914c6016aSJeenu Viswambharanendif 8109202d519SManish Pandey# When FAULT_INJECTION_SUPPORT is used, require that FEAT_RAS is enabled 8111a7c1cfeSJeenu Viswambharanifeq ($(FAULT_INJECTION_SUPPORT),1) 8126503ff29SAndre Przywara ifeq ($(ENABLE_FEAT_RAS),0) 8136503ff29SAndre Przywara $(error For FAULT_INJECTION_SUPPORT, ENABLE_FEAT_RAS must not be 0) 8141a7c1cfeSJeenu Viswambharan endif 8151a7c1cfeSJeenu Viswambharanendif 8161a7c1cfeSJeenu Viswambharan 817ed51b51fSRoberto Vargas# DYN_DISABLE_AUTH can be set only when TRUSTED_BOARD_BOOT=1 818209a60ccSSoby Mathewifeq ($(DYN_DISABLE_AUTH), 1) 819209a60ccSSoby Mathew ifeq (${TRUSTED_BOARD_BOOT}, 0) 820209a60ccSSoby Mathew $(error "TRUSTED_BOARD_BOOT must be enabled for DYN_DISABLE_AUTH to be set.") 821209a60ccSSoby Mathew endif 822209a60ccSSoby Mathewendif 823209a60ccSSoby Mathew 8242bf4f27fSManish V Badarkheifeq ($(MEASURED_BOOT)-$(TRUSTED_BOARD_BOOT),1-1) 8252bf4f27fSManish V Badarkhe# Support authentication verification and hash calculation 8262bf4f27fSManish V Badarkhe CRYPTO_SUPPORT := 3 8272bf4f27fSManish V Badarkheelse ifeq ($(DRTM_SUPPORT)-$(TRUSTED_BOARD_BOOT),1-1) 8282bf4f27fSManish V Badarkhe# Support authentication verification and hash calculation 8292bf4f27fSManish V Badarkhe CRYPTO_SUPPORT := 3 8302bf4f27fSManish V Badarkheelse ifneq ($(filter 1,${MEASURED_BOOT} ${DRTM_SUPPORT}),) 8312bf4f27fSManish V Badarkhe# Support hash calculation only 8322bf4f27fSManish V Badarkhe CRYPTO_SUPPORT := 2 8332bf4f27fSManish V Badarkheelse ifeq (${TRUSTED_BOARD_BOOT},1) 8342bf4f27fSManish V Badarkhe# Support authentication verification only 835c9c56f6eSManish V Badarkhe CRYPTO_SUPPORT := 1 836c9c56f6eSManish V Badarkheelse 837c9c56f6eSManish V Badarkhe CRYPTO_SUPPORT := 0 838c9c56f6eSManish V Badarkheendif 839c9c56f6eSManish V Badarkhe 840cbf9e84aSBalint Dobszay# SDEI_IN_FCONF is only supported when SDEI_SUPPORT is enabled. 841cbf9e84aSBalint Dobszayifeq ($(SDEI_SUPPORT)-$(SDEI_IN_FCONF),0-1) 842700e7685SManish Pandey$(error "SDEI_IN_FCONF is only supported when SDEI_SUPPORT is enabled") 84384ef9cd8SManish V Badarkheendif 84484ef9cd8SManish V Badarkhe 845b86048c4SAntonio Nino Diaz# If pointer authentication is used in the firmware, make sure that all the 8469fc59639SAlexei Fedorov# registers associated to it are also saved and restored. 8479fc59639SAlexei Fedorov# Not doing it would leak the value of the keys used by EL3 to EL1 and S-EL1. 848b86048c4SAntonio Nino Diazifeq ($(ENABLE_PAUTH),1) 8499fc59639SAlexei Fedorov ifeq ($(CTX_INCLUDE_PAUTH_REGS),0) 8509fc59639SAlexei Fedorov $(error Pointer Authentication requires CTX_INCLUDE_PAUTH_REGS=1) 85106715f85SAlexei Fedorov endif 8529fc59639SAlexei Fedorovendif 8539fc59639SAlexei Fedorov 85406715f85SAlexei Fedorovifeq ($(CTX_INCLUDE_PAUTH_REGS),1) 8559fc59639SAlexei Fedorov ifneq (${ARCH},aarch64) 8569fc59639SAlexei Fedorov $(error CTX_INCLUDE_PAUTH_REGS requires AArch64) 857b86048c4SAntonio Nino Diaz endif 858b86048c4SAntonio Nino Diazendif 8599fc59639SAlexei Fedorov 8609dd94382SJustin Chadwellifeq ($(CTX_INCLUDE_MTE_REGS),1) 8619dd94382SJustin Chadwell ifneq (${ARCH},aarch64) 8629dd94382SJustin Chadwell $(error CTX_INCLUDE_MTE_REGS requires AArch64) 8639dd94382SJustin Chadwell endif 8649dd94382SJustin Chadwellendif 8659dd94382SJustin Chadwell 866396b339dSManish V Badarkheifeq ($(PSA_FWU_SUPPORT),1) 867396b339dSManish V Badarkhe $(info PSA_FWU_SUPPORT is an experimental feature) 868396b339dSManish V Badarkheendif 869396b339dSManish V Badarkhe 8706a0da736SJayanth Dodderi Chidanandifeq ($(FEATURE_DETECTION),1) 8716a0da736SJayanth Dodderi Chidanand $(info FEATURE_DETECTION is an experimental feature) 8726a0da736SJayanth Dodderi Chidanandendif 8736a0da736SJayanth Dodderi Chidanand 87403d3c0d7SJayanth Dodderi Chidanandifneq ($(ENABLE_SME2_FOR_NS), 0) 87503d3c0d7SJayanth Dodderi Chidanand ifeq (${ENABLE_SME_FOR_NS}, 0) 87603d3c0d7SJayanth Dodderi Chidanand $(warning "ENABLE_SME2_FOR_NS requires ENABLE_SME_FOR_NS also to be set") 87703d3c0d7SJayanth Dodderi Chidanand $(warning "Forced ENABLE_SME_FOR_NS=1") 87803d3c0d7SJayanth Dodderi Chidanand override ENABLE_SME_FOR_NS := 1 87903d3c0d7SJayanth Dodderi Chidanand endif 88045007acdSJayanth Dodderi Chidanandendif 88145007acdSJayanth Dodderi Chidanand 88260e8f3cfSPetre-Ionut Tudorifeq (${ARM_XLAT_TABLES_LIB_V1}, 1) 88360e8f3cfSPetre-Ionut Tudor ifeq (${ALLOW_RO_XLAT_TABLES}, 1) 88460e8f3cfSPetre-Ionut Tudor $(error "ALLOW_RO_XLAT_TABLES requires translation tables library v2") 88560e8f3cfSPetre-Ionut Tudor endif 88660e8f3cfSPetre-Ionut Tudorendif 88760e8f3cfSPetre-Ionut Tudor 8887cda17bbSSumit Gargifneq (${DECRYPTION_SUPPORT},none) 8897cda17bbSSumit Garg ifeq (${TRUSTED_BOARD_BOOT}, 0) 8907cda17bbSSumit Garg $(error TRUSTED_BOARD_BOOT must be enabled for DECRYPTION_SUPPORT to be set) 8917cda17bbSSumit Garg endif 8927cda17bbSSumit Gargendif 8937cda17bbSSumit Garg 894744ad974Sjohpow01# Ensure that no Aarch64-only features are enabled in Aarch32 build 895dc78e62dSjohpow01ifeq (${ARCH},aarch32) 896744ad974Sjohpow01 897744ad974Sjohpow01 # SME/SVE only supported on AArch64 89845007acdSJayanth Dodderi Chidanand ifneq (${ENABLE_SME_FOR_NS},0) 899dc78e62dSjohpow01 $(error "ENABLE_SME_FOR_NS cannot be used with ARCH=aarch32") 900dc78e62dSjohpow01 endif 90103d3c0d7SJayanth Dodderi Chidanand 902dc78e62dSjohpow01 ifeq (${ENABLE_SVE_FOR_NS},1) 903dc78e62dSjohpow01 # Warning instead of error due to CI dependency on this 90424ab2c0aSYann Gautier $(error "ENABLE_SVE_FOR_NS cannot be used with ARCH=aarch32") 905dc78e62dSjohpow01 endif 906744ad974Sjohpow01 907ff86e0b4SJuan Pablo Conde # BRBE is not supported in AArch32 908744ad974Sjohpow01 ifeq (${ENABLE_BRBE_FOR_NS},1) 909744ad974Sjohpow01 $(error "ENABLE_BRBE_FOR_NS cannot be used with ARCH=aarch32") 910744ad974Sjohpow01 endif 911744ad974Sjohpow01 912ff86e0b4SJuan Pablo Conde # FEAT_RNG_TRAP is not supported in AArch32 913ff86e0b4SJuan Pablo Conde ifeq (${ENABLE_FEAT_RNG_TRAP},1) 914ff86e0b4SJuan Pablo Conde $(error "ENABLE_FEAT_RNG_TRAP cannot be used with ARCH=aarch32") 915ff86e0b4SJuan Pablo Conde endif 916dc78e62dSjohpow01endif 917dc78e62dSjohpow01 918dc78e62dSjohpow01# Ensure ENABLE_RME is not used with SME 919dc78e62dSjohpow01ifeq (${ENABLE_RME},1) 92045007acdSJayanth Dodderi Chidanand ifneq (${ENABLE_SME_FOR_NS},0) 921dc78e62dSjohpow01 $(error "ENABLE_SME_FOR_NS cannot be used with ENABLE_RME") 922dc78e62dSjohpow01 endif 923dc78e62dSjohpow01endif 924dc78e62dSjohpow01 9250d122947SBoyan Karatotevifneq (${ENABLE_SME_FOR_NS},0) 9260d122947SBoyan Karatotev ifeq (${ENABLE_SVE_FOR_NS},0) 9270d122947SBoyan Karatotev $(error "ENABLE_SME_FOR_NS requires ENABLE_SVE_FOR_NS") 9280d122947SBoyan Karatotev endif 9290d122947SBoyan Karatotevendif 9300d122947SBoyan Karatotev 931dc78e62dSjohpow01# Secure SME/SVE requires the non-secure component as well 932dc78e62dSjohpow01ifeq (${ENABLE_SME_FOR_SWD},1) 933dc78e62dSjohpow01 ifeq (${ENABLE_SME_FOR_NS},0) 934dc78e62dSjohpow01 $(error "ENABLE_SME_FOR_SWD requires ENABLE_SME_FOR_NS") 935dc78e62dSjohpow01 endif 9360d122947SBoyan Karatotev ifeq (${ENABLE_SVE_FOR_SWD},0) 9370d122947SBoyan Karatotev $(error "ENABLE_SME_FOR_SWD requires ENABLE_SVE_FOR_SWD") 9380d122947SBoyan Karatotev endif 939dc78e62dSjohpow01endif 940dc78e62dSjohpow01ifeq (${ENABLE_SVE_FOR_SWD},1) 941dc78e62dSjohpow01 ifeq (${ENABLE_SVE_FOR_NS},0) 942dc78e62dSjohpow01 $(error "ENABLE_SVE_FOR_SWD requires ENABLE_SVE_FOR_NS") 943dc78e62dSjohpow01 endif 944dc78e62dSjohpow01endif 945dc78e62dSjohpow01 946dc78e62dSjohpow01# SVE and SME cannot be used with CTX_INCLUDE_FPREGS since secure manager does 947dc78e62dSjohpow01# its own context management including FPU registers. 948dc78e62dSjohpow01ifeq (${CTX_INCLUDE_FPREGS},1) 94945007acdSJayanth Dodderi Chidanand ifneq (${ENABLE_SME_FOR_NS},0) 950dc78e62dSjohpow01 $(error "ENABLE_SME_FOR_NS cannot be used with CTX_INCLUDE_FPREGS") 951dc78e62dSjohpow01 endif 95203d3c0d7SJayanth Dodderi Chidanand 953dc78e62dSjohpow01 ifeq (${ENABLE_SVE_FOR_NS},1) 954dc78e62dSjohpow01 # Warning instead of error due to CI dependency on this 955dc78e62dSjohpow01 $(warning "ENABLE_SVE_FOR_NS cannot be used with CTX_INCLUDE_FPREGS") 956dc78e62dSjohpow01 $(warning "Forced ENABLE_SVE_FOR_NS=0") 957dc78e62dSjohpow01 override ENABLE_SVE_FOR_NS := 0 958dc78e62dSjohpow01 endif 959dc78e62dSjohpow01endif 960dc78e62dSjohpow01 96100e28874SManish V Badarkheifeq ($(DRTM_SUPPORT),1) 96200e28874SManish V Badarkhe $(info DRTM_SUPPORT is an experimental feature) 96300e28874SManish V Badarkheendif 96400e28874SManish V Badarkhe 965274a69e7SChris Kayifeq (${ENABLE_RME},1) 966274a69e7SChris Kay ifneq (${SEPARATE_CODE_AND_RODATA},1) 967274a69e7SChris Kay $(error `ENABLE_RME=1` requires `SEPARATE_CODE_AND_RODATA=1`) 968274a69e7SChris Kay endif 969274a69e7SChris Kayendif 970274a69e7SChris Kay 971cf2c8a33SAntonio Nino Diaz################################################################################ 97273c99d4eSJuan Castillo# Process platform overrideable behaviour 97373c99d4eSJuan Castillo################################################################################ 9744f6ad66aSAchin Gupta 9755f24ce96SManish Pandeyifdef BL1_SOURCES 9765f24ce96SManish PandeyNEED_BL1 := yes 9775f24ce96SManish Pandeyendif 9785f24ce96SManish Pandey 9795f24ce96SManish Pandeyifdef BL2_SOURCES 9805f24ce96SManish Pandey NEED_BL2 := yes 9815f24ce96SManish Pandey 982bd97f83aSJohn Tsichritzis # Using BL2 implies that a BL33 image also needs to be supplied for the FIP and 983bd97f83aSJohn Tsichritzis # Certificate generation tools. This flag can be overridden by the platform. 984cf2c8a33SAntonio Nino Diaz ifdef EL3_PAYLOAD_BASE 985cf2c8a33SAntonio Nino Diaz # If booting an EL3 payload there is no need for a BL33 image 986cf2c8a33SAntonio Nino Diaz # in the FIP file. 9874c117f6cSSandrine Bailleux NEED_BL33 := no 988cf2c8a33SAntonio Nino Diaz else 98968450a6dSAntonio Nino Diaz ifdef PRELOADED_BL33_BASE 990cf2c8a33SAntonio Nino Diaz # If booting a BL33 preloaded image there is no need of 991cf2c8a33SAntonio Nino Diaz # another one in the FIP file. 992cf2c8a33SAntonio Nino Diaz NEED_BL33 := no 993cf2c8a33SAntonio Nino Diaz else 994cf2c8a33SAntonio Nino Diaz NEED_BL33 ?= yes 995cf2c8a33SAntonio Nino Diaz endif 9964c117f6cSSandrine Bailleux endif 99773c99d4eSJuan Castilloendif 9986f971622SJuan Castillo 9995f24ce96SManish Pandeyifdef BL2U_SOURCES 10005f24ce96SManish PandeyNEED_BL2U := yes 10015f24ce96SManish Pandeyendif 10025f24ce96SManish Pandey 10034d045d0eSMasahiro Yamada# If SCP_BL2 is given, we always want FIP to include it. 10044d045d0eSMasahiro Yamadaifdef SCP_BL2 10054d045d0eSMasahiro Yamada NEED_SCP_BL2 := yes 10064d045d0eSMasahiro Yamadaendif 10074d045d0eSMasahiro Yamada 10085744e874SSoby Mathew# For AArch32, BL31 is not currently supported. 10095744e874SSoby Mathewifneq (${ARCH},aarch32) 10105744e874SSoby Mathew ifdef BL31_SOURCES 10115744e874SSoby Mathew # When booting an EL3 payload, there is no need to compile the BL31 image nor 10125744e874SSoby Mathew # put it in the FIP. 10135744e874SSoby Mathew ifndef EL3_PAYLOAD_BASE 10145744e874SSoby Mathew NEED_BL31 := yes 10155744e874SSoby Mathew endif 10165744e874SSoby Mathew endif 10175744e874SSoby Mathewendif 10185744e874SSoby Mathew 101973c99d4eSJuan Castillo# Process TBB related flags 10206f971622SJuan Castilloifneq (${GENERATE_COT},0) 102173c99d4eSJuan Castillo # Common cert_create options 10226f971622SJuan Castillo ifneq (${CREATE_KEYS},0) 10236f971622SJuan Castillo $(eval CRT_ARGS += -n) 10240191262dSYatharth Kochar $(eval FWU_CRT_ARGS += -n) 1025fd34e7baSJuan Castillo ifneq (${SAVE_KEYS},0) 1026fd34e7baSJuan Castillo $(eval CRT_ARGS += -k) 10270191262dSYatharth Kochar $(eval FWU_CRT_ARGS += -k) 1028fd34e7baSJuan Castillo endif 10296f971622SJuan Castillo endif 103073c99d4eSJuan Castillo # Include TBBR makefile (unless the platform indicates otherwise) 103173c99d4eSJuan Castillo ifeq (${INCLUDE_TBBR_MK},1) 103273c99d4eSJuan Castillo include make_helpers/tbbr/tbbr_tools.mk 103373c99d4eSJuan Castillo endif 10346f971622SJuan Castilloendif 10356f971622SJuan Castillo 10361c75d5dfSMasahiro Yamadaifneq (${FIP_ALIGN},0) 10371c75d5dfSMasahiro YamadaFIP_ARGS += --align ${FIP_ALIGN} 10381c75d5dfSMasahiro Yamadaendif 10391c75d5dfSMasahiro Yamada 10405f24ce96SManish Pandeyifdef FDT_SOURCES 10415f24ce96SManish PandeyNEED_FDT := yes 10425f24ce96SManish Pandeyendif 10435f24ce96SManish Pandey 104473c99d4eSJuan Castillo################################################################################ 104546e5e035SMichalis Pappas# Include libraries' Makefile that are used in all BL 104646e5e035SMichalis Pappas################################################################################ 104746e5e035SMichalis Pappas 104846e5e035SMichalis Pappasinclude lib/stack_protector/stack_protector.mk 104946e5e035SMichalis Pappas 105046e5e035SMichalis Pappas################################################################################ 1051819281eeSdp-arm# Auxiliary tools (fiptool, cert_create, etc) 105273c99d4eSJuan Castillo################################################################################ 105373c99d4eSJuan Castillo 105473c99d4eSJuan Castillo# Variables for use with Certificate Generation Tool 105573c99d4eSJuan CastilloCRTTOOLPATH ?= tools/cert_create 105642a45b51SEvan LloydCRTTOOL ?= ${CRTTOOLPATH}/cert_create${BIN_EXT} 105773c99d4eSJuan Castillo 105890aa901fSSumit Garg# Variables for use with Firmware Encryption Tool 105990aa901fSSumit GargENCTOOLPATH ?= tools/encrypt_fw 106090aa901fSSumit GargENCTOOL ?= ${ENCTOOLPATH}/encrypt_fw${BIN_EXT} 106190aa901fSSumit Garg 106273c99d4eSJuan Castillo# Variables for use with Firmware Image Package 1063819281eeSdp-armFIPTOOLPATH ?= tools/fiptool 1064819281eeSdp-armFIPTOOL ?= ${FIPTOOLPATH}/fiptool${BIN_EXT} 106573c99d4eSJuan Castillo 106626010da1SAntonio Nino Diaz# Variables for use with sptool 106726010da1SAntonio Nino DiazSPTOOLPATH ?= tools/sptool 1068822c7279SJ-AlvesSPTOOL ?= ${SPTOOLPATH}/sptool.py 1069ce2b1ec6SManish PandeySP_MK_GEN ?= ${SPTOOLPATH}/sp_mk_generator.py 107026010da1SAntonio Nino Diaz 10715accce5bSRoberto Vargas# Variables for use with ROMLIB 10725accce5bSRoberto VargasROMLIBPATH ?= lib/romlib 10735accce5bSRoberto Vargas 1074cfe83910SLouis Mayencourt# Variable for use with Python 1075cfe83910SLouis MayencourtPYTHON ?= python3 1076cfe83910SLouis Mayencourt 1077cfe83910SLouis Mayencourt# Variables for use with PRINT_MEMORY_MAP 1078cfe83910SLouis MayencourtPRINT_MEMORY_MAP_PATH ?= tools/memory 1079cfe83910SLouis MayencourtPRINT_MEMORY_MAP ?= ${PRINT_MEMORY_MAP_PATH}/print_memory_map.py 10804d32f913SYann GautierINVERTED_MEMMAP ?= 0 1081cfe83910SLouis Mayencourt 10826de32378SMadhukar Pappireddy# Variables for use with documentation build using Sphinx tool 10836de32378SMadhukar PappireddyDOCS_PATH ?= docs 10846de32378SMadhukar Pappireddy 10851f1c0206SAbdul Halim, Muhammad Hadi Asyrafi# Defination of SIMICS flag 10861f1c0206SAbdul Halim, Muhammad Hadi AsyrafiSIMICS_BUILD ?= 0 10871f1c0206SAbdul Halim, Muhammad Hadi Asyrafi 10888a86052dSSoby Mathew################################################################################ 10898a86052dSSoby Mathew# Include BL specific makefiles 10908a86052dSSoby Mathew################################################################################ 10915f24ce96SManish Pandey 10925f24ce96SManish Pandeyifeq (${NEED_BL1},yes) 10938a86052dSSoby Mathewinclude bl1/bl1.mk 10948a86052dSSoby Mathewendif 10958a86052dSSoby Mathew 10965f24ce96SManish Pandeyifeq (${NEED_BL2},yes) 10978a86052dSSoby Mathewinclude bl2/bl2.mk 10988a86052dSSoby Mathewendif 10998a86052dSSoby Mathew 11005f24ce96SManish Pandeyifeq (${NEED_BL2U},yes) 11018a86052dSSoby Mathewinclude bl2u/bl2u.mk 11028a86052dSSoby Mathewendif 11038a86052dSSoby Mathew 11045744e874SSoby Mathewifeq (${NEED_BL31},yes) 11058a86052dSSoby Mathewinclude bl31/bl31.mk 11068a86052dSSoby Mathewendif 110703b397a8SNishanth Menon 110873c99d4eSJuan Castillo################################################################################ 110973c99d4eSJuan Castillo# Build options checks 111073c99d4eSJuan Castillo################################################################################ 111173c99d4eSJuan Castillo 1112327131c4SLeonardo Sandoval$(eval $(call assert_booleans,\ 1113327131c4SLeonardo Sandoval $(sort \ 1114327131c4SLeonardo Sandoval ALLOW_RO_XLAT_TABLES \ 111546789a7cSBalint Dobszay BL2_ENABLE_SP_LOAD \ 1116327131c4SLeonardo Sandoval COLD_BOOT_SINGLE_CPU \ 1117327131c4SLeonardo Sandoval CREATE_KEYS \ 1118327131c4SLeonardo Sandoval CTX_INCLUDE_AARCH32_REGS \ 1119327131c4SLeonardo Sandoval CTX_INCLUDE_FPREGS \ 1120327131c4SLeonardo Sandoval CTX_INCLUDE_EL2_REGS \ 1121327131c4SLeonardo Sandoval DEBUG \ 11220063dd17SJavier Almansa Sobrino DISABLE_MTPMU \ 1123327131c4SLeonardo Sandoval DYN_DISABLE_AUTH \ 1124327131c4SLeonardo Sandoval EL3_EXCEPTION_HANDLING \ 11251fd685a7SChris Kay ENABLE_AMU_AUXILIARY_COUNTERS \ 1126742ca230SChris Kay ENABLE_AMU_FCONF \ 1127873d4241Sjohpow01 AMU_RESTRICT_COUNTERS \ 1128327131c4SLeonardo Sandoval ENABLE_ASSERTIONS \ 112924077098SAndre Przywara ENABLE_FEAT_SB \ 1130327131c4SLeonardo Sandoval ENABLE_PIE \ 1131327131c4SLeonardo Sandoval ENABLE_PMF \ 1132327131c4SLeonardo Sandoval ENABLE_PSCI_STAT \ 1133327131c4SLeonardo Sandoval ENABLE_RUNTIME_INSTRUMENTATION \ 1134dc78e62dSjohpow01 ENABLE_SME_FOR_SWD \ 11350c5e7d1cSMax Shvetsov ENABLE_SVE_FOR_SWD \ 1136327131c4SLeonardo Sandoval ERROR_DEPRECATED \ 1137327131c4SLeonardo Sandoval FAULT_INJECTION_SUPPORT \ 1138327131c4SLeonardo Sandoval GENERATE_COT \ 1139327131c4SLeonardo Sandoval GICV2_G0_FOR_EL3 \ 114046cc41d5SManish Pandey HANDLE_EA_EL3_FIRST_NS \ 1141327131c4SLeonardo Sandoval HW_ASSISTED_COHERENCY \ 1142327131c4SLeonardo Sandoval INVERTED_MEMMAP \ 1143327131c4SLeonardo Sandoval MEASURED_BOOT \ 114400e28874SManish V Badarkhe DRTM_SUPPORT \ 1145327131c4SLeonardo Sandoval NS_TIMER_SWITCH \ 1146327131c4SLeonardo Sandoval OVERRIDE_LIBC \ 1147327131c4SLeonardo Sandoval PL011_GENERIC_UART \ 11480ce2072dSTamas Ban PLAT_RSS_NOT_SUPPORTED \ 1149327131c4SLeonardo Sandoval PROGRAMMABLE_RESET_ADDRESS \ 1150327131c4SLeonardo Sandoval PSCI_EXTENDED_STATE_ID \ 115164b4710bSWing Li PSCI_OS_INIT_MODE \ 1152327131c4SLeonardo Sandoval RESET_TO_BL31 \ 1153327131c4SLeonardo Sandoval SAVE_KEYS \ 1154327131c4SLeonardo Sandoval SEPARATE_CODE_AND_RODATA \ 115596a8ed14SJiafei Pan SEPARATE_BL2_NOLOAD_REGION \ 1156327131c4SLeonardo Sandoval SEPARATE_NOBITS_REGION \ 1157327131c4SLeonardo Sandoval SPIN_ON_BL1_EXIT \ 1158327131c4SLeonardo Sandoval SPM_MM \ 11591d63ae4dSMarc Bonnici SPMC_AT_EL3 \ 1160327131c4SLeonardo Sandoval SPMD_SPM_AT_SEL2 \ 1161327131c4SLeonardo Sandoval TRUSTED_BOARD_BOOT \ 1162327131c4SLeonardo Sandoval USE_COHERENT_MEM \ 1163327131c4SLeonardo Sandoval USE_DEBUGFS \ 1164327131c4SLeonardo Sandoval ARM_IO_IN_DTB \ 1165327131c4SLeonardo Sandoval SDEI_IN_FCONF \ 1166327131c4SLeonardo Sandoval SEC_INT_DESC_IN_FCONF \ 1167327131c4SLeonardo Sandoval USE_ROMLIB \ 1168327131c4SLeonardo Sandoval USE_TBBR_DEFS \ 1169327131c4SLeonardo Sandoval WARMBOOT_ENABLE_DCACHE_EARLY \ 117042d4d3baSArvind Ram Prakash RESET_TO_BL2 \ 1171327131c4SLeonardo Sandoval BL2_IN_XIP_MEM \ 1172327131c4SLeonardo Sandoval BL2_INV_DCACHE \ 1173327131c4SLeonardo Sandoval USE_SPINLOCK_CAS \ 1174327131c4SLeonardo Sandoval ENCRYPT_BL31 \ 1175327131c4SLeonardo Sandoval ENCRYPT_BL32 \ 1176327131c4SLeonardo Sandoval ERRATA_SPECULATIVE_AT \ 117700e8f79cSManish Pandey RAS_TRAP_NS_ERR_REC_ACCESS \ 1178327131c4SLeonardo Sandoval COT_DESC_IN_DTB \ 1179327131c4SLeonardo Sandoval USE_SP804_TIMER \ 1180396b339dSManish V Badarkhe PSA_FWU_SUPPORT \ 118168120783SChris Kay ENABLE_MPMM \ 118268120783SChris Kay ENABLE_MPMM_FCONF \ 11831f1c0206SAbdul Halim, Muhammad Hadi Asyrafi SIMICS_BUILD \ 11846a0da736SJayanth Dodderi Chidanand FEATURE_DETECTION \ 11850b22e591SJayanth Dodderi Chidanand TRNG_SUPPORT \ 1186ffea3844SSona Mathew ERRATA_ABI_SUPPORT \ 1187ef63f5beSSona Mathew ERRATA_NON_ARM_INTERCONNECT \ 118804c7303bSOkash Khawaja CONDITIONAL_CMO \ 11899202d519SManish Pandey RAS_FFH_SUPPORT \ 1190327131c4SLeonardo Sandoval))) 119173c99d4eSJuan Castillo 1192327131c4SLeonardo Sandoval$(eval $(call assert_numerics,\ 1193327131c4SLeonardo Sandoval $(sort \ 1194327131c4SLeonardo Sandoval ARM_ARCH_MAJOR \ 1195327131c4SLeonardo Sandoval ARM_ARCH_MINOR \ 1196327131c4SLeonardo Sandoval BRANCH_PROTECTION \ 11976a0da736SJayanth Dodderi Chidanand CTX_INCLUDE_PAUTH_REGS \ 11986a0da736SJayanth Dodderi Chidanand CTX_INCLUDE_MTE_REGS \ 11996a0da736SJayanth Dodderi Chidanand CTX_INCLUDE_NEVE_REGS \ 12002bf4f27fSManish V Badarkhe CRYPTO_SUPPORT \ 12011298f2f1SJayanth Dodderi Chidanand ENABLE_BRBE_FOR_NS \ 120247c681b7SJayanth Dodderi Chidanand ENABLE_TRBE_FOR_NS \ 12036a0da736SJayanth Dodderi Chidanand ENABLE_BTI \ 12046a0da736SJayanth Dodderi Chidanand ENABLE_PAUTH \ 1205d23acc9eSAndre Przywara ENABLE_FEAT_AMU \ 12066a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_AMUv1p1 \ 12076a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_CSV2_2 \ 12089202d519SManish Pandey ENABLE_FEAT_RAS \ 12096a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_DIT \ 12106a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_ECV \ 12116a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_FGT \ 12126a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_HCX \ 12136a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_PAN \ 12146a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_RNG \ 1215ff86e0b4SJuan Pablo Conde ENABLE_FEAT_RNG_TRAP \ 12166a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_SEL2 \ 1217d3331603SMark Brown ENABLE_FEAT_TCR2 \ 1218062b6c6bSMark Brown ENABLE_FEAT_S2PIE \ 1219062b6c6bSMark Brown ENABLE_FEAT_S1PIE \ 1220062b6c6bSMark Brown ENABLE_FEAT_S2POE \ 1221062b6c6bSMark Brown ENABLE_FEAT_S1POE \ 1222688ab57bSMark Brown ENABLE_FEAT_GCS \ 12236a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_VHE \ 12246a0da736SJayanth Dodderi Chidanand ENABLE_MPAM_FOR_LOWER_ELS \ 12256a0da736SJayanth Dodderi Chidanand ENABLE_RME \ 12266437a09aSAndre Przywara ENABLE_SPE_FOR_NS \ 1227603a0c6fSAndre Przywara ENABLE_SYS_REG_TRACE_FOR_NS \ 122845007acdSJayanth Dodderi Chidanand ENABLE_SME_FOR_NS \ 122903d3c0d7SJayanth Dodderi Chidanand ENABLE_SME2_FOR_NS \ 12302b0bc4e0SJayanth Dodderi Chidanand ENABLE_SVE_FOR_NS \ 12316a0da736SJayanth Dodderi Chidanand ENABLE_TRF_FOR_NS \ 1232327131c4SLeonardo Sandoval FW_ENC_STATUS \ 12335357f83dSManish V Badarkhe NR_OF_FW_BANKS \ 12345357f83dSManish V Badarkhe NR_OF_IMAGES_IN_FW_BANK \ 1235781d07a4SJayanth Dodderi Chidanand TWED_DELAY \ 1236781d07a4SJayanth Dodderi Chidanand ENABLE_FEAT_TWED \ 1237bebcf27fSMark Brown SVE_VECTOR_LEN \ 12380ed3be6fSVarun Wadekar IMPDEF_SYSREG_TRAP \ 1239327131c4SLeonardo Sandoval))) 1240c877b414SJeenu Viswambharan 1241aacff749SJustin Chadwellifdef KEY_SIZE 1242aacff749SJustin Chadwell $(eval $(call assert_numeric,KEY_SIZE)) 1243aacff749SJustin Chadwellendif 1244aacff749SJustin Chadwell 12451f461979SJustin Chadwellifeq ($(filter $(SANITIZE_UB), on off trap),) 12461f461979SJustin Chadwell $(error "Invalid value for SANITIZE_UB: can be one of on, off, trap") 12471f461979SJustin Chadwellendif 12481f461979SJustin Chadwell 124973c99d4eSJuan Castillo################################################################################ 125073c99d4eSJuan Castillo# Add definitions to the cpp preprocessor based on the current build options. 125173c99d4eSJuan Castillo# This is done after including the platform specific makefile to allow the 125273c99d4eSJuan Castillo# platform to overwrite the default options 125373c99d4eSJuan Castillo################################################################################ 125473c99d4eSJuan Castillo 1255327131c4SLeonardo Sandoval$(eval $(call add_defines,\ 1256327131c4SLeonardo Sandoval $(sort \ 1257327131c4SLeonardo Sandoval ALLOW_RO_XLAT_TABLES \ 1258327131c4SLeonardo Sandoval ARM_ARCH_MAJOR \ 1259327131c4SLeonardo Sandoval ARM_ARCH_MINOR \ 126046789a7cSBalint Dobszay BL2_ENABLE_SP_LOAD \ 1261327131c4SLeonardo Sandoval COLD_BOOT_SINGLE_CPU \ 1262327131c4SLeonardo Sandoval CTX_INCLUDE_AARCH32_REGS \ 1263327131c4SLeonardo Sandoval CTX_INCLUDE_FPREGS \ 1264327131c4SLeonardo Sandoval CTX_INCLUDE_PAUTH_REGS \ 1265327131c4SLeonardo Sandoval EL3_EXCEPTION_HANDLING \ 1266327131c4SLeonardo Sandoval CTX_INCLUDE_MTE_REGS \ 1267327131c4SLeonardo Sandoval CTX_INCLUDE_EL2_REGS \ 1268062f8aafSArunachalam Ganapathy CTX_INCLUDE_NEVE_REGS \ 1269327131c4SLeonardo Sandoval DECRYPTION_SUPPORT_${DECRYPTION_SUPPORT} \ 12700063dd17SJavier Almansa Sobrino DISABLE_MTPMU \ 1271d23acc9eSAndre Przywara ENABLE_FEAT_AMU \ 12721fd685a7SChris Kay ENABLE_AMU_AUXILIARY_COUNTERS \ 1273742ca230SChris Kay ENABLE_AMU_FCONF \ 1274873d4241Sjohpow01 AMU_RESTRICT_COUNTERS \ 1275327131c4SLeonardo Sandoval ENABLE_ASSERTIONS \ 1276327131c4SLeonardo Sandoval ENABLE_BTI \ 1277327131c4SLeonardo Sandoval ENABLE_MPAM_FOR_LOWER_ELS \ 1278327131c4SLeonardo Sandoval ENABLE_PAUTH \ 1279327131c4SLeonardo Sandoval ENABLE_PIE \ 1280327131c4SLeonardo Sandoval ENABLE_PMF \ 1281327131c4SLeonardo Sandoval ENABLE_PSCI_STAT \ 12825b18de09SZelalem Aweke ENABLE_RME \ 1283327131c4SLeonardo Sandoval ENABLE_RUNTIME_INSTRUMENTATION \ 1284dc78e62dSjohpow01 ENABLE_SME_FOR_NS \ 128503d3c0d7SJayanth Dodderi Chidanand ENABLE_SME2_FOR_NS \ 1286dc78e62dSjohpow01 ENABLE_SME_FOR_SWD \ 128790118bb5SAndre Przywara ENABLE_SPE_FOR_NS \ 1288327131c4SLeonardo Sandoval ENABLE_SVE_FOR_NS \ 12890c5e7d1cSMax Shvetsov ENABLE_SVE_FOR_SWD \ 1290327131c4SLeonardo Sandoval ENCRYPT_BL31 \ 1291327131c4SLeonardo Sandoval ENCRYPT_BL32 \ 1292327131c4SLeonardo Sandoval ERROR_DEPRECATED \ 1293327131c4SLeonardo Sandoval FAULT_INJECTION_SUPPORT \ 1294327131c4SLeonardo Sandoval GICV2_G0_FOR_EL3 \ 129546cc41d5SManish Pandey HANDLE_EA_EL3_FIRST_NS \ 1296327131c4SLeonardo Sandoval HW_ASSISTED_COHERENCY \ 1297327131c4SLeonardo Sandoval LOG_LEVEL \ 1298327131c4SLeonardo Sandoval MEASURED_BOOT \ 129900e28874SManish V Badarkhe DRTM_SUPPORT \ 1300327131c4SLeonardo Sandoval NS_TIMER_SWITCH \ 1301327131c4SLeonardo Sandoval PL011_GENERIC_UART \ 1302327131c4SLeonardo Sandoval PLAT_${PLAT} \ 13030ce2072dSTamas Ban PLAT_RSS_NOT_SUPPORTED \ 1304327131c4SLeonardo Sandoval PROGRAMMABLE_RESET_ADDRESS \ 1305327131c4SLeonardo Sandoval PSCI_EXTENDED_STATE_ID \ 130664b4710bSWing Li PSCI_OS_INIT_MODE \ 13079202d519SManish Pandey ENABLE_FEAT_RAS \ 13089202d519SManish Pandey RAS_FFH_SUPPORT \ 1309327131c4SLeonardo Sandoval RESET_TO_BL31 \ 1310327131c4SLeonardo Sandoval SEPARATE_CODE_AND_RODATA \ 131196a8ed14SJiafei Pan SEPARATE_BL2_NOLOAD_REGION \ 1312327131c4SLeonardo Sandoval SEPARATE_NOBITS_REGION \ 1313327131c4SLeonardo Sandoval RECLAIM_INIT_CODE \ 1314327131c4SLeonardo Sandoval SPD_${SPD} \ 1315327131c4SLeonardo Sandoval SPIN_ON_BL1_EXIT \ 1316327131c4SLeonardo Sandoval SPM_MM \ 13171d63ae4dSMarc Bonnici SPMC_AT_EL3 \ 1318327131c4SLeonardo Sandoval SPMD_SPM_AT_SEL2 \ 1319327131c4SLeonardo Sandoval TRUSTED_BOARD_BOOT \ 1320c9c56f6eSManish V Badarkhe CRYPTO_SUPPORT \ 13217dfb9911SJimmy Brisson TRNG_SUPPORT \ 1322ffea3844SSona Mathew ERRATA_ABI_SUPPORT \ 1323ef63f5beSSona Mathew ERRATA_NON_ARM_INTERCONNECT \ 1324327131c4SLeonardo Sandoval USE_COHERENT_MEM \ 1325327131c4SLeonardo Sandoval USE_DEBUGFS \ 1326327131c4SLeonardo Sandoval ARM_IO_IN_DTB \ 1327327131c4SLeonardo Sandoval SDEI_IN_FCONF \ 1328327131c4SLeonardo Sandoval SEC_INT_DESC_IN_FCONF \ 1329327131c4SLeonardo Sandoval USE_ROMLIB \ 1330327131c4SLeonardo Sandoval USE_TBBR_DEFS \ 1331327131c4SLeonardo Sandoval WARMBOOT_ENABLE_DCACHE_EARLY \ 133242d4d3baSArvind Ram Prakash RESET_TO_BL2 \ 133342d4d3baSArvind Ram Prakash BL2_RUNS_AT_EL3 \ 1334327131c4SLeonardo Sandoval BL2_IN_XIP_MEM \ 1335327131c4SLeonardo Sandoval BL2_INV_DCACHE \ 1336327131c4SLeonardo Sandoval USE_SPINLOCK_CAS \ 1337327131c4SLeonardo Sandoval ERRATA_SPECULATIVE_AT \ 133800e8f79cSManish Pandey RAS_TRAP_NS_ERR_REC_ACCESS \ 1339327131c4SLeonardo Sandoval COT_DESC_IN_DTB \ 1340327131c4SLeonardo Sandoval USE_SP804_TIMER \ 134112cd65e0STomas Pilar ENABLE_FEAT_RNG \ 1342ff86e0b4SJuan Pablo Conde ENABLE_FEAT_RNG_TRAP \ 13434e04478aSChris Kay ENABLE_FEAT_SB \ 13447d33ffe4SDaniel Boulby ENABLE_FEAT_DIT \ 13455357f83dSManish V Badarkhe NR_OF_FW_BANKS \ 13465357f83dSManish V Badarkhe NR_OF_IMAGES_IN_FW_BANK \ 1347396b339dSManish V Badarkhe PSA_FWU_SUPPORT \ 1348744ad974Sjohpow01 ENABLE_BRBE_FOR_NS \ 1349813524eaSManish V Badarkhe ENABLE_TRBE_FOR_NS \ 1350d4582d30SManish V Badarkhe ENABLE_SYS_REG_TRACE_FOR_NS \ 13518fcd3d96SManish V Badarkhe ENABLE_TRF_FOR_NS \ 1352cb4ec47bSjohpow01 ENABLE_FEAT_HCX \ 135368120783SChris Kay ENABLE_MPMM \ 135468120783SChris Kay ENABLE_MPMM_FCONF \ 1355f74cb0beSJayanth Dodderi Chidanand ENABLE_FEAT_FGT \ 1356f74cb0beSJayanth Dodderi Chidanand ENABLE_FEAT_ECV \ 13571f1c0206SAbdul Halim, Muhammad Hadi Asyrafi SIMICS_BUILD \ 13586a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_AMUv1p1 \ 13596a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_SEL2 \ 13606a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_VHE \ 13616a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_CSV2_2 \ 13626a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_PAN \ 1363d3331603SMark Brown ENABLE_FEAT_TCR2 \ 1364062b6c6bSMark Brown ENABLE_FEAT_S2PIE \ 1365062b6c6bSMark Brown ENABLE_FEAT_S1PIE \ 1366062b6c6bSMark Brown ENABLE_FEAT_S2POE \ 1367062b6c6bSMark Brown ENABLE_FEAT_S1POE \ 1368688ab57bSMark Brown ENABLE_FEAT_GCS \ 13696a0da736SJayanth Dodderi Chidanand FEATURE_DETECTION \ 1370781d07a4SJayanth Dodderi Chidanand TWED_DELAY \ 1371781d07a4SJayanth Dodderi Chidanand ENABLE_FEAT_TWED \ 137204c7303bSOkash Khawaja CONDITIONAL_CMO \ 13730ed3be6fSVarun Wadekar IMPDEF_SYSREG_TRAP \ 1374327131c4SLeonardo Sandoval))) 13752fae4b1eSJeenu Viswambharan 13761f461979SJustin Chadwellifeq (${SANITIZE_UB},trap) 13771f461979SJustin Chadwell $(eval $(call add_define,MONITOR_TRAPS)) 13781f461979SJustin Chadwellendif 13791f461979SJustin Chadwell 13804c117f6cSSandrine Bailleux# Define the EL3_PAYLOAD_BASE flag only if it is provided. 13814c117f6cSSandrine Bailleuxifdef EL3_PAYLOAD_BASE 13824c117f6cSSandrine Bailleux $(eval $(call add_define,EL3_PAYLOAD_BASE)) 1383cf2c8a33SAntonio Nino Diazelse 138468450a6dSAntonio Nino Diaz # Define the PRELOADED_BL33_BASE flag only if it is provided and 138568450a6dSAntonio Nino Diaz # EL3_PAYLOAD_BASE is not defined, as it has priority. 138668450a6dSAntonio Nino Diaz ifdef PRELOADED_BL33_BASE 138768450a6dSAntonio Nino Diaz $(eval $(call add_define,PRELOADED_BL33_BASE)) 13884c117f6cSSandrine Bailleux endif 1389cf2c8a33SAntonio Nino Diazendif 139073c99d4eSJuan Castillo 1391209a60ccSSoby Mathew# Define the DYN_DISABLE_AUTH flag only if set. 1392209a60ccSSoby Mathewifeq (${DYN_DISABLE_AUTH},1) 1393209a60ccSSoby Mathew$(eval $(call add_define,DYN_DISABLE_AUTH)) 1394209a60ccSSoby Mathewendif 1395209a60ccSSoby Mathew 1396c2ad38ceSVarun Wadekarifneq ($(findstring armlink,$(notdir $(LD))),) 1397c2ad38ceSVarun Wadekar$(eval $(call add_define,USE_ARM_LINK)) 1398c2ad38ceSVarun Wadekarendif 1399c2ad38ceSVarun Wadekar 1400ce2b1ec6SManish Pandey# Generate and include sp_gen.mk if SPD is spmd and SP_LAYOUT_FILE is defined 1401ce2b1ec6SManish Pandeyifeq (${SPD},spmd) 1402c33ff198SOlivier Deprezifdef SP_LAYOUT_FILE 1403ce2b1ec6SManish Pandey -include $(BUILD_PLAT)/sp_gen.mk 1404ce2b1ec6SManish Pandey FIP_DEPS += sp 140507c44475SManish Pandey CRT_DEPS += sp 1406ce2b1ec6SManish Pandey NEED_SP_PKG := yes 1407ce2b1ec6SManish Pandeyelse 1408c33ff198SOlivier Deprez ifeq (${SPMD_SPM_AT_SEL2},1) 1409c33ff198SOlivier Deprez $(error "SPMD with SPM at S-EL2 require SP_LAYOUT_FILE") 1410c33ff198SOlivier Deprez endif 1411ce2b1ec6SManish Pandeyendif 1412ce2b1ec6SManish Pandeyendif 1413ce2b1ec6SManish Pandey 141473c99d4eSJuan Castillo################################################################################ 141573c99d4eSJuan Castillo# Build targets 141673c99d4eSJuan Castillo################################################################################ 141773c99d4eSJuan Castillo 141890aa901fSSumit Garg.PHONY: all msg_start clean realclean distclean cscope locate-checkpatch checkcodebase checkpatch fiptool sptool fip sp fwu_fip certtool dtbs memmap doc enctool 141973c99d4eSJuan Castillo.SUFFIXES: 142073c99d4eSJuan Castillo 142173c99d4eSJuan Castilloall: msg_start 142273c99d4eSJuan Castillo 142373c99d4eSJuan Castillomsg_start: 142473c99d4eSJuan Castillo @echo "Building ${PLAT}" 142573c99d4eSJuan Castillo 14267a24cba5SSoby Mathewifeq (${ERROR_DEPRECATED},0) 1427d5dfdeb6SJulius Werner# Check if deprecated declarations and cpp warnings should be treated as error or not. 1428c2ad38ceSVarun Wadekarifneq ($(findstring clang,$(notdir $(CC))),) 1429c2ad38ceSVarun Wadekar CPPFLAGS += -Wno-error=deprecated-declarations 1430c2ad38ceSVarun Wadekarelse 1431bc1a03c7SDan Handley CPPFLAGS += -Wno-error=deprecated-declarations -Wno-error=cpp 14327a24cba5SSoby Mathewendif 1433d5dfdeb6SJulius Wernerendif # !ERROR_DEPRECATED 14347a24cba5SSoby Mathew 14355accce5bSRoberto Vargas$(eval $(call MAKE_LIB_DIRS)) 143661f72a34SRoberto Vargas$(eval $(call MAKE_LIB,c)) 14375fee0287SRoberto Vargas 143873c99d4eSJuan Castillo# Expand build macros for the different images 143973c99d4eSJuan Castilloifeq (${NEED_BL1},yes) 1440b34635a0SChris KayBL1_SOURCES := $(sort ${BL1_SOURCES}) 1441b34635a0SChris Kay 1442434d0491SZelalem Aweke$(eval $(call MAKE_BL,bl1)) 144373c99d4eSJuan Castilloendif 144473c99d4eSJuan Castillo 144573c99d4eSJuan Castilloifeq (${NEED_BL2},yes) 144642d4d3baSArvind Ram Prakashifeq (${RESET_TO_BL2}, 0) 1447c9b31ae8SRoberto VargasFIP_BL2_ARGS := tb-fw 1448c9b31ae8SRoberto Vargasendif 1449c9b31ae8SRoberto Vargas 1450eb1acfb6SChris KayBL2_SOURCES := $(sort ${BL2_SOURCES}) 1451eb1acfb6SChris Kay 145233950dd8SMasahiro Yamada$(if ${BL2}, $(eval $(call TOOL_ADD_IMG,bl2,--${FIP_BL2_ARGS})),\ 1453434d0491SZelalem Aweke $(eval $(call MAKE_BL,bl2,${FIP_BL2_ARGS}))) 145473c99d4eSJuan Castilloendif 145573c99d4eSJuan Castillo 14564d045d0eSMasahiro Yamadaifeq (${NEED_SCP_BL2},yes) 145733950dd8SMasahiro Yamada$(eval $(call TOOL_ADD_IMG,scp_bl2,--scp-fw)) 14584d045d0eSMasahiro Yamadaendif 14594d045d0eSMasahiro Yamada 146073c99d4eSJuan Castilloifeq (${NEED_BL31},yes) 146173c99d4eSJuan CastilloBL31_SOURCES += ${SPD_SOURCES} 146226d1e0c3SMadhukar Pappireddy# Sort BL31 source files to remove duplicates 146326d1e0c3SMadhukar PappireddyBL31_SOURCES := $(sort ${BL31_SOURCES}) 1464c6ba9b45SSumit Gargifneq (${DECRYPTION_SUPPORT},none) 1465c6ba9b45SSumit Garg$(if ${BL31}, $(eval $(call TOOL_ADD_IMG,bl31,--soc-fw,,$(ENCRYPT_BL31))),\ 1466434d0491SZelalem Aweke $(eval $(call MAKE_BL,bl31,soc-fw,,$(ENCRYPT_BL31)))) 1467c6ba9b45SSumit Gargelse 146833950dd8SMasahiro Yamada$(if ${BL31}, $(eval $(call TOOL_ADD_IMG,bl31,--soc-fw)),\ 1469434d0491SZelalem Aweke $(eval $(call MAKE_BL,bl31,soc-fw))) 147073c99d4eSJuan Castilloendif 1471c6ba9b45SSumit Gargendif 147273c99d4eSJuan Castillo 147370d1fc53SJuan Castillo# If a BL32 image is needed but neither BL32 nor BL32_SOURCES is defined, the 1474c939d13aSMasahiro Yamada# build system will call TOOL_ADD_IMG to print a warning message and abort the 147570d1fc53SJuan Castillo# process. Note that the dependency on BL32 applies to the FIP only. 147673c99d4eSJuan Castilloifeq (${NEED_BL32},yes) 147726d1e0c3SMadhukar Pappireddy# Sort BL32 source files to remove duplicates 147826d1e0c3SMadhukar PappireddyBL32_SOURCES := $(sort ${BL32_SOURCES}) 14799cd15239SMasahiro YamadaBUILD_BL32 := $(if $(BL32),,$(if $(BL32_SOURCES),1)) 14809cd15239SMasahiro Yamada 1481c6ba9b45SSumit Gargifneq (${DECRYPTION_SUPPORT},none) 1482434d0491SZelalem Aweke$(if ${BUILD_BL32}, $(eval $(call MAKE_BL,bl32,tos-fw,,$(ENCRYPT_BL32))),\ 1483c6ba9b45SSumit Garg $(eval $(call TOOL_ADD_IMG,bl32,--tos-fw,,$(ENCRYPT_BL32)))) 1484c6ba9b45SSumit Gargelse 1485434d0491SZelalem Aweke$(if ${BUILD_BL32}, $(eval $(call MAKE_BL,bl32,tos-fw)),\ 148633950dd8SMasahiro Yamada $(eval $(call TOOL_ADD_IMG,bl32,--tos-fw))) 148773c99d4eSJuan Castilloendif 1488c6ba9b45SSumit Gargendif 148973c99d4eSJuan Castillo 14905b18de09SZelalem Aweke# If RMM image is needed but RMM is not defined, Test Realm Payload (TRP) 14915b18de09SZelalem Aweke# needs to be built from RMM_SOURCES. 14925b18de09SZelalem Awekeifeq (${NEED_RMM},yes) 14935b18de09SZelalem Aweke# Sort RMM source files to remove duplicates 14945b18de09SZelalem AwekeRMM_SOURCES := $(sort ${RMM_SOURCES}) 14955b18de09SZelalem AwekeBUILD_RMM := $(if $(RMM),,$(if $(RMM_SOURCES),1)) 14965b18de09SZelalem Aweke 14975b18de09SZelalem Aweke$(if ${BUILD_RMM}, $(eval $(call MAKE_BL,rmm,rmm-fw)),\ 14985b18de09SZelalem Aweke $(eval $(call TOOL_ADD_IMG,rmm,--rmm-fw))) 14995b18de09SZelalem Awekeendif 15005b18de09SZelalem Aweke 150173c99d4eSJuan Castillo# Add the BL33 image if required by the platform 150273c99d4eSJuan Castilloifeq (${NEED_BL33},yes) 150333950dd8SMasahiro Yamada$(eval $(call TOOL_ADD_IMG,bl33,--nt-fw)) 1504db6071c9SJuan Castilloendif 1505db6071c9SJuan Castillo 15069003fa0bSYatharth Kocharifeq (${NEED_BL2U},yes) 150733950dd8SMasahiro Yamada$(if ${BL2U}, $(eval $(call TOOL_ADD_IMG,bl2u,--ap-fwu-cfg,FWU_)),\ 1508434d0491SZelalem Aweke $(eval $(call MAKE_BL,bl2u,ap-fwu-cfg,FWU_))) 15099003fa0bSYatharth Kocharendif 15109003fa0bSYatharth Kochar 151103b397a8SNishanth Menon# Expand build macros for the different images 151203b397a8SNishanth Menonifeq (${NEED_FDT},yes) 151303b397a8SNishanth Menon $(eval $(call MAKE_DTBS,$(BUILD_PLAT)/fdts,$(FDT_SOURCES))) 151403b397a8SNishanth Menonendif 151503b397a8SNishanth Menon 1516ce2b1ec6SManish Pandey# Add Secure Partition packages 1517ce2b1ec6SManish Pandeyifeq (${NEED_SP_PKG},yes) 1518ce2b1ec6SManish Pandey$(BUILD_PLAT)/sp_gen.mk: ${SP_MK_GEN} ${SP_LAYOUT_FILE} | ${BUILD_PLAT} 15191e7528ecSRuari Phipps ${Q}${PYTHON} "$<" "$@" $(filter-out $<,$^) $(BUILD_PLAT) ${COT} 1520822c7279SJ-Alvessp: $(DTBS) $(BUILD_PLAT)/sp_gen.mk $(SP_PKGS) 1521ce2b1ec6SManish Pandey @${ECHO_BLANK_LINE} 1522ce2b1ec6SManish Pandey @echo "Built SP Images successfully" 1523ce2b1ec6SManish Pandey @${ECHO_BLANK_LINE} 1524ce2b1ec6SManish Pandeyendif 1525ce2b1ec6SManish Pandey 152636eaaf37SIan Spraylocate-checkpatch: 152736eaaf37SIan Sprayifndef CHECKPATCH 152866079b04SEtienne Carriere $(error "Please set CHECKPATCH to point to the Linux checkpatch.pl file, eg: CHECKPATCH=../linux/scripts/checkpatch.pl") 152936eaaf37SIan Sprayelse 153036eaaf37SIan Sprayifeq (,$(wildcard ${CHECKPATCH})) 153166079b04SEtienne Carriere $(error "The file CHECKPATCH points to cannot be found, use eg: CHECKPATCH=../linux/scripts/checkpatch.pl") 153236eaaf37SIan Sprayendif 153336eaaf37SIan Sprayendif 153436eaaf37SIan Spray 15354f6ad66aSAchin Guptaclean: 15364f6ad66aSAchin Gupta @echo " CLEAN" 1537f1477d4aSEvan Lloyd $(call SHELL_REMOVE_DIR,${BUILD_PLAT}) 153888a1cf1eSSami Mujawarifdef UNIX_MK 15392f2cef46SJeenu Viswambharan ${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean 154088a1cf1eSSami Mujawarelse 154188a1cf1eSSami Mujawar# Clear the MAKEFLAGS as we do not want 154288a1cf1eSSami Mujawar# to pass the gnumake flags to nmake. 154388a1cf1eSSami Mujawar ${Q}set MAKEFLAGS= && ${MSVC_NMAKE} /nologo /f ${FIPTOOLPATH}/Makefile.msvc FIPTOOLPATH=$(subst /,\,$(FIPTOOLPATH)) FIPTOOL=$(subst /,\,$(FIPTOOL)) clean 154488a1cf1eSSami Mujawarendif 15456f971622SJuan Castillo ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} clean 154690aa901fSSumit Garg ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${ENCTOOLPATH} clean 15475accce5bSRoberto Vargas ${Q}${MAKE} --no-print-directory -C ${ROMLIBPATH} clean 15484f6ad66aSAchin Gupta 1549eaaeece2SJames Morrisseyrealclean distclean: 1550eaaeece2SJames Morrissey @echo " REALCLEAN" 1551f1477d4aSEvan Lloyd $(call SHELL_REMOVE_DIR,${BUILD_BASE}) 1552f1477d4aSEvan Lloyd $(call SHELL_DELETE_ALL, ${CURDIR}/cscope.*) 155388a1cf1eSSami Mujawarifdef UNIX_MK 15542f2cef46SJeenu Viswambharan ${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean 155588a1cf1eSSami Mujawarelse 155688a1cf1eSSami Mujawar# Clear the MAKEFLAGS as we do not want 155788a1cf1eSSami Mujawar# to pass the gnumake flags to nmake. 155888a1cf1eSSami Mujawar ${Q}set MAKEFLAGS= && ${MSVC_NMAKE} /nologo /f ${FIPTOOLPATH}/Makefile.msvc FIPTOOLPATH=$(subst /,\,$(FIPTOOLPATH)) FIPTOOL=$(subst /,\,$(FIPTOOL)) realclean 155988a1cf1eSSami Mujawarendif 1560e15591aaSNicolas Boulenguez ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} realclean 156190aa901fSSumit Garg ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${ENCTOOLPATH} realclean 15625accce5bSRoberto Vargas ${Q}${MAKE} --no-print-directory -C ${ROMLIBPATH} clean 15634f6ad66aSAchin Gupta 156436eaaf37SIan Spraycheckcodebase: locate-checkpatch 156536eaaf37SIan Spray @echo " CHECKING STYLE" 156636eaaf37SIan Spray @if test -d .git ; then \ 15671ef35512SPaul Beesley git ls-files | grep -E -v 'libfdt|libc|docs|\.rst' | \ 15681a41e8c1SDan Handley while read GIT_FILE ; \ 15691a41e8c1SDan Handley do ${CHECKPATCH} ${CHECKCODE_ARGS} -f $$GIT_FILE ; \ 15701a41e8c1SDan Handley done ; \ 157136eaaf37SIan Spray else \ 15721a41e8c1SDan Handley find . -type f -not -iwholename "*.git*" \ 15731a41e8c1SDan Handley -not -iwholename "*build*" \ 15741a41e8c1SDan Handley -not -iwholename "*libfdt*" \ 157561f72a34SRoberto Vargas -not -iwholename "*libc*" \ 15761a41e8c1SDan Handley -not -iwholename "*docs*" \ 15771ef35512SPaul Beesley -not -iwholename "*.rst" \ 15781a41e8c1SDan Handley -exec ${CHECKPATCH} ${CHECKCODE_ARGS} -f {} \; ; \ 157936eaaf37SIan Spray fi 158036eaaf37SIan Spray 158136eaaf37SIan Spraycheckpatch: locate-checkpatch 158236eaaf37SIan Spray @echo " CHECKING STYLE" 158302a76d5fSYann Gautier @if test -n "${CHECKPATCH_OPTS}"; then \ 158402a76d5fSYann Gautier echo " with ${CHECKPATCH_OPTS} option(s)"; \ 158502a76d5fSYann Gautier fi 158651d28937SAntonio Nino Diaz ${Q}COMMON_COMMIT=$$(git merge-base HEAD ${BASE_COMMIT}); \ 158777a0a7f1SYann Gautier for commit in `git rev-list --no-merges $$COMMON_COMMIT..HEAD`; \ 158877a0a7f1SYann Gautier do \ 158951d28937SAntonio Nino Diaz printf "\n[*] Checking style of '$$commit'\n\n"; \ 159051d28937SAntonio Nino Diaz git log --format=email "$$commit~..$$commit" \ 159102a76d5fSYann Gautier -- ${CHECK_PATHS} | \ 159202a76d5fSYann Gautier ${CHECKPATCH} ${CHECKPATCH_OPTS} - || true; \ 159351d28937SAntonio Nino Diaz git diff --format=email "$$commit~..$$commit" \ 159402a76d5fSYann Gautier -- ${CHECK_PATHS} | \ 159502a76d5fSYann Gautier ${CHECKPATCH} ${CHECKPATCH_OPTS} - || true; \ 159651d28937SAntonio Nino Diaz done 159736eaaf37SIan Spray 159873c99d4eSJuan Castillocerttool: ${CRTTOOL} 159973c99d4eSJuan Castillo 1600a9812206SPali Rohár${CRTTOOL}: FORCE 1601598b166bSLionel 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 1602f1477d4aSEvan Lloyd @${ECHO_BLANK_LINE} 16036f971622SJuan Castillo @echo "Built $@ successfully" 1604f1477d4aSEvan Lloyd @${ECHO_BLANK_LINE} 16056f971622SJuan Castillo 16066f971622SJuan Castilloifneq (${GENERATE_COT},0) 160773c99d4eSJuan Castillocertificates: ${CRT_DEPS} ${CRTTOOL} 16086f971622SJuan Castillo ${Q}${CRTTOOL} ${CRT_ARGS} 1609f1477d4aSEvan Lloyd @${ECHO_BLANK_LINE} 16106f971622SJuan Castillo @echo "Built $@ successfully" 16116f971622SJuan Castillo @echo "Certificates can be found in ${BUILD_PLAT}" 1612f1477d4aSEvan Lloyd @${ECHO_BLANK_LINE} 161373c99d4eSJuan Castilloendif 161427713fb4SSoby Mathew 161573c99d4eSJuan Castillo${BUILD_PLAT}/${FIP_NAME}: ${FIP_DEPS} ${FIPTOOL} 16164727fd13SPali Rohár $(eval ${CHECK_FIP_CMD}) 1617819281eeSdp-arm ${Q}${FIPTOOL} create ${FIP_ARGS} $@ 1618819281eeSdp-arm ${Q}${FIPTOOL} info $@ 1619f1477d4aSEvan Lloyd @${ECHO_BLANK_LINE} 16202f2cef46SJeenu Viswambharan @echo "Built $@ successfully" 1621f1477d4aSEvan Lloyd @${ECHO_BLANK_LINE} 1622f58ad36fSHarry Liebel 16230191262dSYatharth Kocharifneq (${GENERATE_COT},0) 16240191262dSYatharth Kocharfwu_certificates: ${FWU_CRT_DEPS} ${CRTTOOL} 16250191262dSYatharth Kochar ${Q}${CRTTOOL} ${FWU_CRT_ARGS} 1626052ab529SEvan Lloyd @${ECHO_BLANK_LINE} 16270191262dSYatharth Kochar @echo "Built $@ successfully" 16280191262dSYatharth Kochar @echo "FWU certificates can be found in ${BUILD_PLAT}" 1629052ab529SEvan Lloyd @${ECHO_BLANK_LINE} 16300191262dSYatharth Kocharendif 16310191262dSYatharth Kochar 16320191262dSYatharth Kochar${BUILD_PLAT}/${FWU_FIP_NAME}: ${FWU_FIP_DEPS} ${FIPTOOL} 16334727fd13SPali Rohár $(eval ${CHECK_FWU_FIP_CMD}) 1634819281eeSdp-arm ${Q}${FIPTOOL} create ${FWU_FIP_ARGS} $@ 1635819281eeSdp-arm ${Q}${FIPTOOL} info $@ 1636052ab529SEvan Lloyd @${ECHO_BLANK_LINE} 16370191262dSYatharth Kochar @echo "Built $@ successfully" 1638052ab529SEvan Lloyd @${ECHO_BLANK_LINE} 16390191262dSYatharth Kochar 164073c99d4eSJuan Castillofiptool: ${FIPTOOL} 164173c99d4eSJuan Castillofip: ${BUILD_PLAT}/${FIP_NAME} 16420191262dSYatharth Kocharfwu_fip: ${BUILD_PLAT}/${FWU_FIP_NAME} 164373c99d4eSJuan Castillo 1644a9812206SPali Rohár${FIPTOOL}: FORCE 164588a1cf1eSSami Mujawarifdef UNIX_MK 1646598b166bSLionel Debieve ${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" FIPTOOL=${FIPTOOL} OPENSSL_DIR=${OPENSSL_DIR} DEBUG=${DEBUG} V=${V} --no-print-directory -C ${FIPTOOLPATH} all 164788a1cf1eSSami Mujawarelse 164888a1cf1eSSami Mujawar# Clear the MAKEFLAGS as we do not want 164988a1cf1eSSami Mujawar# to pass the gnumake flags to nmake. 165088a1cf1eSSami Mujawar ${Q}set MAKEFLAGS= && ${MSVC_NMAKE} /nologo /f ${FIPTOOLPATH}/Makefile.msvc FIPTOOLPATH=$(subst /,\,$(FIPTOOLPATH)) FIPTOOL=$(subst /,\,$(FIPTOOL)) 165188a1cf1eSSami Mujawarendif 1652f58ad36fSHarry Liebel 1653a9812206SPali Rohárromlib.bin: libraries FORCE 1654bbb24f61SJohn 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 16555accce5bSRoberto Vargas 1656cfe83910SLouis Mayencourt# Call print_memory_map tool 1657cfe83910SLouis Mayencourtmemmap: all 1658b890b36dSLouis Mayencourt ${Q}${PYTHON} ${PRINT_MEMORY_MAP} ${BUILD_PLAT} ${INVERTED_MEMMAP} 1659cfe83910SLouis Mayencourt 16606de32378SMadhukar Pappireddydoc: 16616de32378SMadhukar Pappireddy @echo " BUILD DOCUMENTATION" 16626de32378SMadhukar Pappireddy ${Q}${MAKE} --no-print-directory -C ${DOCS_PATH} html 16636de32378SMadhukar Pappireddy 166490aa901fSSumit Gargenctool: ${ENCTOOL} 166590aa901fSSumit Garg 1666a9812206SPali Rohár${ENCTOOL}: FORCE 1667598b166bSLionel Debieve ${Q}${MAKE} PLAT=${PLAT} BUILD_INFO=0 OPENSSL_DIR=${OPENSSL_DIR} ENCTOOL=${ENCTOOL} DEBUG=${DEBUG} V=${V} --no-print-directory -C ${ENCTOOLPATH} all 166890aa901fSSumit Garg @${ECHO_BLANK_LINE} 166990aa901fSSumit Garg @echo "Built $@ successfully" 167090aa901fSSumit Garg @${ECHO_BLANK_LINE} 167190aa901fSSumit Garg 167235fab8c9SJoakim Bechcscope: 167335fab8c9SJoakim Bech @echo " CSCOPE" 167435fab8c9SJoakim Bech ${Q}find ${CURDIR} -name "*.[chsS]" > cscope.files 167535fab8c9SJoakim Bech ${Q}cscope -b -q -k 167635fab8c9SJoakim Bech 167772ee3314SRyan Harkinhelp: 16787c23126cSJohn Tsichritzis @echo "usage: ${MAKE} [PLAT=<platform>] [OPTIONS] [TARGET]" 167972ee3314SRyan Harkin @echo "" 168072ee3314SRyan Harkin @echo "PLAT is used to specify which platform you wish to build." 168108c7ed0fSSandrine Bailleux @echo "If no platform is specified, PLAT defaults to: ${DEFAULT_PLAT}" 168272ee3314SRyan Harkin @echo "" 16837c23126cSJohn Tsichritzis @echo "platform = ${PLATFORM_LIST}" 16847c23126cSJohn Tsichritzis @echo "" 16851b578596SSandrine Bailleux @echo "Please refer to the User Guide for a list of all supported options." 16861b578596SSandrine Bailleux @echo "Note that the build system doesn't track dependencies for build " 16871b578596SSandrine Bailleux @echo "options. Therefore, if any of the build options are changed " 16881b578596SSandrine Bailleux @echo "from a previous build, a clean build must be performed." 16891b578596SSandrine Bailleux @echo "" 169072ee3314SRyan Harkin @echo "Supported Targets:" 16911b578596SSandrine Bailleux @echo " all Build all individual bootloader binaries" 169236eaaf37SIan Spray @echo " bl1 Build the BL1 binary" 16938aa559c0SJeenu Viswambharan @echo " bl2 Build the BL2 binary" 16949003fa0bSYatharth Kochar @echo " bl2u Build the BL2U binary" 1695d178637dSJuan Castillo @echo " bl31 Build the BL31 binary" 16969d29c227SSoby Mathew @echo " bl32 Build the BL32 binary. If ARCH=aarch32, then " 16979d29c227SSoby Mathew @echo " this builds secure payload specified by AARCH32_SP" 169873c99d4eSJuan Castillo @echo " certificates Build the certificates (requires 'GENERATE_COT=1')" 16991b578596SSandrine Bailleux @echo " fip Build the Firmware Image Package (FIP)" 17000191262dSYatharth Kochar @echo " fwu_fip Build the FWU Firmware Image Package (FIP)" 170136eaaf37SIan Spray @echo " checkcodebase Check the coding style of the entire source tree" 170236eaaf37SIan Spray @echo " checkpatch Check the coding style on changes in the current" 170336eaaf37SIan Spray @echo " branch against BASE_COMMIT (default origin/master)" 170472ee3314SRyan Harkin @echo " clean Clean the build for the selected platform" 170535fab8c9SJoakim Bech @echo " cscope Generate cscope index" 170672ee3314SRyan Harkin @echo " distclean Remove all build artifacts for all platforms" 17076f971622SJuan Castillo @echo " certtool Build the Certificate generation tool" 170890aa901fSSumit Garg @echo " enctool Build the Firmware encryption tool" 1709f58ad36fSHarry Liebel @echo " fiptool Build the Firmware Image Package (FIP) creation tool" 1710ce2b1ec6SManish Pandey @echo " sp Build the Secure Partition Packages" 171126010da1SAntonio Nino Diaz @echo " sptool Build the Secure Partition Package creation tool" 171238c14d88SSoby Mathew @echo " dtbs Build the Device Tree Blobs (if required for the platform)" 1713cfe83910SLouis Mayencourt @echo " memmap Print the memory map of the built binaries" 17146de32378SMadhukar Pappireddy @echo " doc Build html based documentation using Sphinx tool" 171572ee3314SRyan Harkin @echo "" 17161b578596SSandrine Bailleux @echo "Note: most build targets require PLAT to be set to a specific platform." 171772ee3314SRyan Harkin @echo "" 171872ee3314SRyan Harkin @echo "example: build all targets for the FVP platform:" 171972ee3314SRyan Harkin @echo " CROSS_COMPILE=aarch64-none-elf- make PLAT=fvp all" 1720a9812206SPali Rohár 1721a9812206SPali Rohár.PHONY: FORCE 1722a9812206SPali RohárFORCE:; 1723