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 110fa7fe59Slaurenw-armVERSION_MINOR := 8 12dddf4283Slaurenw-armVERSION := ${VERSION_MAJOR}.${VERSION_MINOR} 13aaa3e722SJuan Castillo 1488154678SJuan Castillo# Default goal is build all images 1588154678SJuan Castillo.DEFAULT_GOAL := all 1688154678SJuan Castillo 1772fc70edSDouglas Raillard# Avoid any implicit propagation of command line variable definitions to 1872fc70edSDouglas Raillard# sub-Makefiles, like CFLAGS that we reserved for the firmware images' 1972fc70edSDouglas Raillard# usage. Other command line options like "-s" are still propagated as usual. 2072fc70edSDouglas RaillardMAKEOVERRIDES = 2172fc70edSDouglas Raillard 22231c1470SEvan LloydMAKE_HELPERS_DIRECTORY := make_helpers/ 23231c1470SEvan Lloydinclude ${MAKE_HELPERS_DIRECTORY}build_macros.mk 24e7f54dbdSEvan Lloydinclude ${MAKE_HELPERS_DIRECTORY}build_env.mk 2573c99d4eSJuan Castillo 2673c99d4eSJuan Castillo################################################################################ 272fae4b1eSJeenu Viswambharan# Default values for build configurations, and their dependencies 2873c99d4eSJuan Castillo################################################################################ 29e35c4045SJeenu Viswambharan 302fae4b1eSJeenu Viswambharaninclude ${MAKE_HELPERS_DIRECTORY}defaults.mk 31872be88aSdp-arm 32cc8b5632SAntonio Nino Diaz# Assertions enabled for DEBUG builds by default 33cc8b5632SAntonio Nino DiazENABLE_ASSERTIONS := ${DEBUG} 342fae4b1eSJeenu ViswambharanENABLE_PMF := ${ENABLE_RUNTIME_INSTRUMENTATION} 352fae4b1eSJeenu ViswambharanPLAT := ${DEFAULT_PLAT} 3673c99d4eSJuan Castillo 3773c99d4eSJuan Castillo################################################################################ 3873c99d4eSJuan Castillo# Checkpatch script options 3973c99d4eSJuan Castillo################################################################################ 4073c99d4eSJuan Castillo 41f607739cSSandrine BailleuxCHECKCODE_ARGS := --no-patch 42f0b489c1SDan Handley# Do not check the coding style on imported library files or documentation files 434501843fSGilad Ben-YossefINC_ARM_DIRS_TO_CHECK := $(sort $(filter-out \ 444501843fSGilad Ben-Yossef include/drivers/arm/cryptocell, \ 454501843fSGilad Ben-Yossef $(wildcard include/drivers/arm/*))) 464501843fSGilad Ben-YossefINC_ARM_DIRS_TO_CHECK += include/drivers/arm/cryptocell/*.h 474501843fSGilad Ben-YossefINC_DRV_DIRS_TO_CHECK := $(sort $(filter-out \ 484501843fSGilad Ben-Yossef include/drivers/arm, \ 494501843fSGilad Ben-Yossef $(wildcard include/drivers/*))) 50f0b489c1SDan HandleyINC_LIB_DIRS_TO_CHECK := $(sort $(filter-out \ 511a41e8c1SDan Handley include/lib/libfdt \ 5261f72a34SRoberto Vargas include/lib/libc, \ 53f0b489c1SDan Handley $(wildcard include/lib/*))) 54f0b489c1SDan HandleyINC_DIRS_TO_CHECK := $(sort $(filter-out \ 554501843fSGilad Ben-Yossef include/lib \ 564501843fSGilad Ben-Yossef include/drivers, \ 57f0b489c1SDan Handley $(wildcard include/*))) 58f0b489c1SDan HandleyLIB_DIRS_TO_CHECK := $(sort $(filter-out \ 59d801fbb0Sdp-arm lib/compiler-rt \ 6055cdcf75SAntonio Nino Diaz lib/libfdt% \ 6161f72a34SRoberto Vargas lib/libc, \ 62a194255dSDaniel Boulby lib/zlib \ 63f0b489c1SDan Handley $(wildcard lib/*))) 64f0b489c1SDan HandleyROOT_DIRS_TO_CHECK := $(sort $(filter-out \ 65f0b489c1SDan Handley lib \ 66f0b489c1SDan Handley include \ 67f0b489c1SDan Handley docs \ 681ef35512SPaul Beesley %.rst, \ 69f0b489c1SDan Handley $(wildcard *))) 70f0b489c1SDan HandleyCHECK_PATHS := ${ROOT_DIRS_TO_CHECK} \ 71f0b489c1SDan Handley ${INC_DIRS_TO_CHECK} \ 72f0b489c1SDan Handley ${INC_LIB_DIRS_TO_CHECK} \ 734501843fSGilad Ben-Yossef ${LIB_DIRS_TO_CHECK} \ 744501843fSGilad Ben-Yossef ${INC_DRV_DIRS_TO_CHECK} \ 754501843fSGilad Ben-Yossef ${INC_ARM_DIRS_TO_CHECK} 7636eaaf37SIan Spray 7773c99d4eSJuan Castillo 7873c99d4eSJuan Castillo################################################################################ 7973c99d4eSJuan Castillo# Process build options 8073c99d4eSJuan Castillo################################################################################ 8173c99d4eSJuan Castillo 8273c99d4eSJuan Castillo# Verbose flag 83e35c4045SJeenu Viswambharanifeq (${V},0) 84b169f6a9SEvan Lloyd Q:=@ 85ee1ba6d4SAndre Przywara ECHO:=@echo 8636eaaf37SIan Spray CHECKCODE_ARGS += --no-summary --terse 874f6ad66aSAchin Guptaelse 88b169f6a9SEvan Lloyd Q:= 89b5a0f4bdSAntonio Nino Diaz ECHO:=$(ECHO_QUIET) 904f6ad66aSAchin Guptaendif 91ee1ba6d4SAndre Przywara 92ee1ba6d4SAndre Przywaraifneq ($(findstring s,$(filter-out --%,$(MAKEFLAGS))),) 93ee1ba6d4SAndre Przywara Q:=@ 94b5a0f4bdSAntonio Nino Diaz ECHO:=$(ECHO_QUIET) 95ee1ba6d4SAndre Przywaraendif 96ee1ba6d4SAndre Przywara 97ee1ba6d4SAndre Przywaraexport Q ECHO 982f2cef46SJeenu Viswambharan 9973c99d4eSJuan Castillo# The cert_create tool cannot generate certificates individually, so we use the 10073c99d4eSJuan Castillo# target 'certificates' to create them all 10173c99d4eSJuan Castilloifneq (${GENERATE_COT},0) 10273c99d4eSJuan Castillo FIP_DEPS += certificates 1030191262dSYatharth Kochar FWU_FIP_DEPS += fwu_certificates 10473c99d4eSJuan Castilloendif 10573c99d4eSJuan Castillo 1069fc59639SAlexei Fedorov# Process BRANCH_PROTECTION value and set 1079fc59639SAlexei Fedorov# Pointer Authentication and Branch Target Identification flags 1089fc59639SAlexei Fedorovifeq (${BRANCH_PROTECTION},0) 1099fc59639SAlexei Fedorov # Default value turns off all types of branch protection 1109fc59639SAlexei Fedorov BP_OPTION := none 1119fc59639SAlexei Fedorovelse ifneq (${ARCH},aarch64) 1129fc59639SAlexei Fedorov $(error BRANCH_PROTECTION requires AArch64) 1139fc59639SAlexei Fedorovelse ifeq (${BRANCH_PROTECTION},1) 1149fc59639SAlexei Fedorov # Enables all types of branch protection features 1159fc59639SAlexei Fedorov BP_OPTION := standard 1169fc59639SAlexei Fedorov ENABLE_BTI := 1 1179fc59639SAlexei Fedorov ENABLE_PAUTH := 1 1189fc59639SAlexei Fedorovelse ifeq (${BRANCH_PROTECTION},2) 1199fc59639SAlexei Fedorov # Return address signing to its standard level 1209fc59639SAlexei Fedorov BP_OPTION := pac-ret 1219fc59639SAlexei Fedorov ENABLE_PAUTH := 1 1229fc59639SAlexei Fedorovelse ifeq (${BRANCH_PROTECTION},3) 1239fc59639SAlexei Fedorov # Extend the signing to include leaf functions 1249fc59639SAlexei Fedorov BP_OPTION := pac-ret+leaf 1259fc59639SAlexei Fedorov ENABLE_PAUTH := 1 1263768fecfSAlexei Fedorovelse ifeq (${BRANCH_PROTECTION},4) 1273768fecfSAlexei Fedorov # Turn on branch target identification mechanism 1283768fecfSAlexei Fedorov BP_OPTION := bti 1293768fecfSAlexei Fedorov ENABLE_BTI := 1 1309fc59639SAlexei Fedorovelse 1319fc59639SAlexei Fedorov $(error Unknown BRANCH_PROTECTION value ${BRANCH_PROTECTION}) 1329fc59639SAlexei Fedorovendif 13373c99d4eSJuan Castillo 1345b18de09SZelalem Aweke# FEAT_RME 1355b18de09SZelalem Awekeifeq (${ENABLE_RME},1) 1365b18de09SZelalem Aweke# RME doesn't support PIE 1375b18de09SZelalem Awekeifneq (${ENABLE_PIE},0) 1385b18de09SZelalem Aweke $(error ENABLE_RME does not support PIE) 1395b18de09SZelalem Awekeendif 140744ad974Sjohpow01# RME doesn't support BRBE 141744ad974Sjohpow01ifneq (${ENABLE_BRBE_FOR_NS},0) 142744ad974Sjohpow01 $(error ENABLE_RME does not support BRBE.) 143744ad974Sjohpow01endif 1445b18de09SZelalem Aweke# RME requires AARCH64 1455b18de09SZelalem Awekeifneq (${ARCH},aarch64) 1465b18de09SZelalem Aweke $(error ENABLE_RME requires AArch64) 1475b18de09SZelalem Awekeendif 1485b18de09SZelalem Aweke# RME requires el2 context to be saved for now. 1495b18de09SZelalem AwekeCTX_INCLUDE_EL2_REGS := 1 1505b18de09SZelalem AwekeCTX_INCLUDE_AARCH32_REGS := 0 1515b18de09SZelalem AwekeARM_ARCH_MAJOR := 8 1527670ddb1SAndre PrzywaraARM_ARCH_MINOR := 5 1537670ddb1SAndre PrzywaraENABLE_FEAT_ECV = 1 1547670ddb1SAndre PrzywaraENABLE_FEAT_FGT = 1 1557670ddb1SAndre Przywara 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 41793c690ebSJustin Chadwellelse 41893c690ebSJustin Chadwell# using clang 419d7b4cd41SJustin ChadwellWARNINGS += -Wshift-overflow -Wshift-sign-overflow \ 420d7b4cd41SJustin Chadwell -Wlogical-op-parentheses 42100296576SAmbroise Vincentendif 42200296576SAmbroise Vincent 4236336b07aSYann Gautierifneq (${E},0) 4246336b07aSYann GautierERRORS := -Werror 4256336b07aSYann Gautierendif 4266336b07aSYann Gautier 427ea7a57a3SRoberto VargasCPPFLAGS = ${DEFINES} ${INCLUDES} ${MBEDTLS_INC} -nostdinc \ 4289ab81b5eSJustin Chadwell $(ERRORS) $(WARNINGS) 42959de5096SMasahiro YamadaASFLAGS += $(CPPFLAGS) $(ASFLAGS_$(ARCH)) \ 430d5dfdeb6SJulius Werner -ffreestanding -Wa,--fatal-warnings 43159de5096SMasahiro YamadaTF_CFLAGS += $(CPPFLAGS) $(TF_CFLAGS_$(ARCH)) \ 432ebd6efaeSSamuel Holland -ffunction-sections -fdata-sections \ 433ebd6efaeSSamuel Holland -ffreestanding -fno-builtin -fno-common \ 434ebd6efaeSSamuel Holland -Os -std=gnu99 43573c99d4eSJuan Castillo 436bebcf27fSMark Brown$(eval $(call add_define,SVE_VECTOR_LEN)) 437bebcf27fSMark Brown 4381f461979SJustin Chadwellifeq (${SANITIZE_UB},on) 4391f461979SJustin ChadwellTF_CFLAGS += -fsanitize=undefined -fno-sanitize-recover 4401f461979SJustin Chadwellendif 4411f461979SJustin Chadwellifeq (${SANITIZE_UB},trap) 4421f461979SJustin ChadwellTF_CFLAGS += -fsanitize=undefined -fno-sanitize-recover \ 4431f461979SJustin Chadwell -fsanitize-undefined-trap-on-error 4441f461979SJustin Chadwellendif 4451f461979SJustin Chadwell 446f7ec31dbSdavid cunadoGCC_V_OUTPUT := $(shell $(CC) -v 2>&1) 447f7ec31dbSdavid cunado 4481f49db5fSMarco FelschTF_LDFLAGS += -z noexecstack 4491f49db5fSMarco Felsch 450641f16e7SAmbroise Vincent# LD = armlink 451c2ad38ceSVarun Wadekarifneq ($(findstring armlink,$(notdir $(LD))),) 452c2ad38ceSVarun WadekarTF_LDFLAGS += --diag_error=warning --lto_level=O1 453c2ad38ceSVarun WadekarTF_LDFLAGS += --remove --info=unused,unusedsymbols 454edbce9aaSzelalem-awekeTF_LDFLAGS += $(TF_LDFLAGS_$(ARCH)) 455641f16e7SAmbroise Vincent 456641f16e7SAmbroise Vincent# LD = gcc (used when GCC LTO is enabled) 457edbce9aaSzelalem-awekeelse ifneq ($(findstring gcc,$(notdir $(LD))),) 458edbce9aaSzelalem-aweke# Pass ld options with Wl or Xlinker switches 459edbce9aaSzelalem-awekeTF_LDFLAGS += -Wl,--fatal-warnings -O1 460edbce9aaSzelalem-awekeTF_LDFLAGS += -Wl,--gc-sections 461ac98b82aSChris Kay 462ac98b82aSChris KayTF_LDFLAGS += -Wl,-z,common-page-size=4096 # Configure page size constants 463ac98b82aSChris KayTF_LDFLAGS += -Wl,-z,max-page-size=4096 464ac98b82aSChris Kay 465edbce9aaSzelalem-awekeifeq ($(ENABLE_LTO),1) 466edbce9aaSzelalem-aweke ifeq (${ARCH},aarch64) 467edbce9aaSzelalem-aweke TF_LDFLAGS += -flto -fuse-linker-plugin 468edbce9aaSzelalem-aweke endif 469edbce9aaSzelalem-awekeendif 470edbce9aaSzelalem-aweke# GCC automatically adds fix-cortex-a53-843419 flag when used to link 471edbce9aaSzelalem-aweke# which breaks some builds, so disable if errata fix is not explicitly enabled 472edbce9aaSzelalem-awekeifneq (${ERRATA_A53_843419},1) 473edbce9aaSzelalem-aweke TF_LDFLAGS += -mno-fix-cortex-a53-843419 474edbce9aaSzelalem-awekeendif 475edbce9aaSzelalem-awekeTF_LDFLAGS += -nostdlib 476edbce9aaSzelalem-awekeTF_LDFLAGS += $(subst --,-Xlinker --,$(TF_LDFLAGS_$(ARCH))) 477641f16e7SAmbroise Vincent 478641f16e7SAmbroise Vincent# LD = gcc-ld (ld) or llvm-ld (ld.lld) or other 479c2ad38ceSVarun Wadekarelse 4801f49db5fSMarco Felsch# With ld.bfd version 2.39 and newer new warnings are added. Skip those since we 4811f49db5fSMarco Felsch# are not loaded by a elf loader. 4821f49db5fSMarco FelschTF_LDFLAGS += $(call ld_option, --no-warn-rwx-segments) 483ebac6922SYabin CuiTF_LDFLAGS += -O1 484c2b8806fSDouglas RaillardTF_LDFLAGS += --gc-sections 485ac98b82aSChris Kay 486ac98b82aSChris KayTF_LDFLAGS += -z common-page-size=4096 # Configure page size constants 487ac98b82aSChris KayTF_LDFLAGS += -z max-page-size=4096 488ac98b82aSChris Kay 489641f16e7SAmbroise Vincent# ld.lld doesn't recognize the errata flags, 490ebac6922SYabin Cui# therefore don't add those in that case. 491ebac6922SYabin Cui# ld.lld reports section type mismatch warnings, 492ebac6922SYabin Cui# therefore don't add --fatal-warnings to it. 493641f16e7SAmbroise Vincentifeq ($(findstring ld.lld,$(notdir $(LD))),) 494ebac6922SYabin CuiTF_LDFLAGS += $(TF_LDFLAGS_$(ARCH)) --fatal-warnings 495edbce9aaSzelalem-awekeendif 496641f16e7SAmbroise Vincentendif 49773c99d4eSJuan Castillo 49803b397a8SNishanth MenonDTC_FLAGS += -I dts -O dtb 499a6de824fSLouis MayencourtDTC_CPPFLAGS += -P -nostdinc -Iinclude -Ifdts -undef \ 500a6de824fSLouis Mayencourt -x assembler-with-cpp $(DEFINES) 50103b397a8SNishanth Menon 50273c99d4eSJuan Castillo################################################################################ 50373c99d4eSJuan Castillo# Common sources and include directories 50473c99d4eSJuan Castillo################################################################################ 5056a0da736SJayanth Dodderi Chidanandinclude ${MAKE_HELPERS_DIRECTORY}arch_features.mk 506d801fbb0Sdp-arminclude lib/compiler-rt/compiler-rt.mk 50773c99d4eSJuan Castillo 50873c99d4eSJuan CastilloBL_COMMON_SOURCES += common/bl_common.c \ 5097f56e9a3SSoby Mathew common/tf_log.c \ 5109d29c227SSoby Mathew common/${ARCH}/debug.S \ 51191b48c9fSJulius Werner drivers/console/multi_console.c \ 5129d29c227SSoby Mathew lib/${ARCH}/cache_helpers.S \ 5139d29c227SSoby Mathew lib/${ARCH}/misc_helpers.S \ 514566034fcSSoby Mathew plat/common/plat_bl_common.c \ 5157f56e9a3SSoby Mathew plat/common/plat_log_common.c \ 51675311203Sdp-arm plat/common/${ARCH}/plat_common.c \ 5179d29c227SSoby Mathew plat/common/${ARCH}/platform_helpers.S \ 51861f72a34SRoberto Vargas ${COMPILER_RT_SRCS} 519d7a6b0f8SRyan Harkin 52090ce8b87SBoyan Karatotev# Pointer Authentication sources 52190ce8b87SBoyan Karatotevifeq (${ENABLE_PAUTH}, 1) 52290ce8b87SBoyan Karatotev# arm/common/aarch64/arm_pauth.c contains a sample platform hook to complete the 52390ce8b87SBoyan Karatotev# Pauth support. As it's not secure, it must be reimplemented for real platforms 52490ce8b87SBoyan KaratotevBL_COMMON_SOURCES += lib/extensions/pauth/pauth_helpers.S 52590ce8b87SBoyan Karatotevendif 52690ce8b87SBoyan Karatotev 5278422a840SAntonio Nino Diazifeq ($(notdir $(CC)),armclang) 5288422a840SAntonio Nino DiazBL_COMMON_SOURCES += lib/${ARCH}/armclang_printf.S 5298422a840SAntonio Nino Diazendif 5308422a840SAntonio Nino Diaz 5311f461979SJustin Chadwellifeq (${SANITIZE_UB},on) 5321f461979SJustin ChadwellBL_COMMON_SOURCES += plat/common/ubsan.c 5331f461979SJustin Chadwellendif 5341f461979SJustin Chadwell 53501d237cbSYann GautierINCLUDES += -Iinclude \ 536f5478dedSAntonio Nino Diaz -Iinclude/arch/${ARCH} \ 53709d40e0eSAntonio Nino Diaz -Iinclude/lib/cpus/${ARCH} \ 53809d40e0eSAntonio Nino Diaz -Iinclude/lib/el3_runtime/${ARCH} \ 53909d40e0eSAntonio Nino Diaz ${PLAT_INCLUDES} \ 54009d40e0eSAntonio Nino Diaz ${SPD_INCLUDES} 54109d40e0eSAntonio Nino Diaz 5429c6d1c50SAntonio Nino Diazinclude common/backtrace/backtrace.mk 5439c6d1c50SAntonio Nino Diaz 54473c99d4eSJuan Castillo################################################################################ 54573c99d4eSJuan Castillo# Generic definitions 54673c99d4eSJuan Castillo################################################################################ 54773c99d4eSJuan Castillo 548231c1470SEvan Lloydinclude ${MAKE_HELPERS_DIRECTORY}plat_helpers.mk 549231c1470SEvan Lloyd 55029214e95SGrant Likelyifeq (${BUILD_BASE},) 55173c99d4eSJuan Castillo BUILD_BASE := ./build 55229214e95SGrant Likelyendif 55329214e95SGrant LikelyBUILD_PLAT := $(abspath ${BUILD_BASE})/${PLAT}/${BUILD_TYPE} 55473c99d4eSJuan Castillo 555231c1470SEvan LloydSPDS := $(sort $(filter-out none, $(patsubst services/spd/%,%,$(wildcard services/spd/*)))) 55673c99d4eSJuan Castillo 55773c99d4eSJuan Castillo# Platforms providing their own TBB makefile may override this value 55873c99d4eSJuan CastilloINCLUDE_TBBR_MK := 1 55973c99d4eSJuan Castillo 56073c99d4eSJuan Castillo 56173c99d4eSJuan Castillo################################################################################ 56273c99d4eSJuan Castillo# Include SPD Makefile if one has been specified 56373c99d4eSJuan Castillo################################################################################ 56473c99d4eSJuan Castillo 56573c99d4eSJuan Castilloifneq (${SPD},none) 5669d29c227SSoby Mathew ifeq (${ARCH},aarch32) 5679d29c227SSoby Mathew $(error "Error: SPD is incompatible with AArch32.") 5689d29c227SSoby Mathew endif 56928f39f02SMax Shvetsov 5704c117f6cSSandrine Bailleux ifdef EL3_PAYLOAD_BASE 5714c117f6cSSandrine Bailleux $(warning "SPD and EL3_PAYLOAD_BASE are incompatible build options.") 5724c117f6cSSandrine Bailleux $(warning "The SPD and its BL32 companion will be present but ignored.") 5734c117f6cSSandrine Bailleux endif 57428f39f02SMax Shvetsov 575c3fb00d9SAchin Gupta ifeq (${SPD},spmd) 576c3fb00d9SAchin Gupta # SPMD is located in std_svc directory 577c3fb00d9SAchin Gupta SPD_DIR := std_svc 57828f39f02SMax Shvetsov 579033039f8SMax Shvetsov ifeq ($(SPMD_SPM_AT_SEL2),1) 580f1910cc1SGovindraj Raja CTX_INCLUDE_EL2_REGS := 1 5811d63ae4dSMarc Bonnici ifeq ($(SPMC_AT_EL3),1) 5821d63ae4dSMarc Bonnici $(error SPM cannot be enabled in both S-EL2 and EL3.) 5831d63ae4dSMarc Bonnici endif 58428f39f02SMax Shvetsov endif 585db1ef41aSOlivier Deprez 586db1ef41aSOlivier Deprez ifeq ($(findstring optee_sp,$(ARM_SPMC_MANIFEST_DTS)),optee_sp) 587db1ef41aSOlivier Deprez DTC_CPPFLAGS += -DOPTEE_SP_FW_CONFIG 588db1ef41aSOlivier Deprez endif 589ca932481SDavidson K 590ca932481SDavidson K ifeq ($(TS_SP_FW_CONFIG),1) 591ca932481SDavidson K DTC_CPPFLAGS += -DTS_SP_FW_CONFIG 592ca932481SDavidson K endif 59333993a37SBalint Dobszay 59433993a37SBalint Dobszay ifneq ($(ARM_BL2_SP_LIST_DTS),) 59533993a37SBalint Dobszay DTC_CPPFLAGS += -DARM_BL2_SP_LIST_DTS=$(ARM_BL2_SP_LIST_DTS) 59633993a37SBalint Dobszay endif 59746789a7cSBalint Dobszay 59846789a7cSBalint Dobszay ifneq ($(SP_LAYOUT_FILE),) 59946789a7cSBalint Dobszay BL2_ENABLE_SP_LOAD := 1 60046789a7cSBalint Dobszay endif 601c3fb00d9SAchin Gupta else 602c3fb00d9SAchin Gupta # All other SPDs in spd directory 603c3fb00d9SAchin Gupta SPD_DIR := spd 604c3fb00d9SAchin Gupta endif 605c3fb00d9SAchin Gupta 60673c99d4eSJuan Castillo # We expect to locate an spd.mk under the specified SPD directory 607c3fb00d9SAchin Gupta SPD_MAKE := $(wildcard services/${SPD_DIR}/${SPD}/${SPD}.mk) 608c3fb00d9SAchin Gupta 60973c99d4eSJuan Castillo ifeq (${SPD_MAKE},) 610c3fb00d9SAchin Gupta $(error Error: No services/${SPD_DIR}/${SPD}/${SPD}.mk located) 61173c99d4eSJuan Castillo endif 61273c99d4eSJuan Castillo $(info Including ${SPD_MAKE}) 61373c99d4eSJuan Castillo include ${SPD_MAKE} 61473c99d4eSJuan Castillo 61570d1fc53SJuan Castillo # If there's BL32 companion for the chosen SPD, we expect that the SPD's 61670d1fc53SJuan Castillo # Makefile would set NEED_BL32 to "yes". In this case, the build system 61770d1fc53SJuan Castillo # supports two mutually exclusive options: 61870d1fc53SJuan Castillo # * BL32 is built from source: then BL32_SOURCES must contain the list 61970d1fc53SJuan Castillo # of source files to build BL32 62070d1fc53SJuan Castillo # * BL32 is a prebuilt binary: then BL32 must point to the image file 62170d1fc53SJuan Castillo # that will be included in the FIP 62270d1fc53SJuan Castillo # If both BL32_SOURCES and BL32 are defined, the binary takes precedence 62370d1fc53SJuan Castillo # over the sources. 624e35c4045SJeenu Viswambharanendif 625e35c4045SJeenu Viswambharan 626f1910cc1SGovindraj Rajaifeq (${CTX_INCLUDE_EL2_REGS}, 1) 627f1910cc1SGovindraj Rajaifeq (${SPD},none) 628f1910cc1SGovindraj Rajaifeq (${ENABLE_RME},0) 629f1910cc1SGovindraj Raja $(error CTX_INCLUDE_EL2_REGS is available only when SPD or RME is enabled) 630f1910cc1SGovindraj Rajaendif 631f1910cc1SGovindraj Rajaendif 632f1910cc1SGovindraj Rajaendif 633f1910cc1SGovindraj Raja 63451faada7SDouglas Raillard################################################################################ 6355b18de09SZelalem Aweke# Include rmmd Makefile if RME is enabled 6365b18de09SZelalem Aweke################################################################################ 6375b18de09SZelalem Aweke 6385b18de09SZelalem Awekeifneq (${ENABLE_RME},0) 6395b18de09SZelalem Awekeifneq (${ARCH},aarch64) 6405b18de09SZelalem Aweke $(error ENABLE_RME requires AArch64) 6415b18de09SZelalem Awekeendif 6421d63ae4dSMarc Bonniciifeq ($(SPMC_AT_EL3),1) 6431d63ae4dSMarc Bonnici $(error SPMC_AT_EL3 and ENABLE_RME cannot both be enabled.) 6441d63ae4dSMarc Bonniciendif 6455b18de09SZelalem Awekeinclude services/std_svc/rmmd/rmmd.mk 6465b18de09SZelalem Aweke$(warning "RME is an experimental feature") 6475b18de09SZelalem Awekeendif 6485b18de09SZelalem Aweke 6495b18de09SZelalem Aweke################################################################################ 65073c99d4eSJuan Castillo# Include the platform specific Makefile after the SPD Makefile (the platform 65173c99d4eSJuan Castillo# makefile may use all previous definitions in this file) 65273c99d4eSJuan Castillo################################################################################ 6532da8d8bfSJeenu Viswambharan 65473c99d4eSJuan Castilloinclude ${PLAT_MAKEFILE_FULL} 6550f21c547SJuan Castillo 65642d4d3baSArvind Ram Prakash# This internal flag is common option which is set to 1 for scenarios 65742d4d3baSArvind Ram Prakash# when the BL2 is running in EL3 level. This occurs in two scenarios - 65842d4d3baSArvind Ram Prakash# 4 world system running BL2 at EL3 and two world system without BL1 running 65942d4d3baSArvind Ram Prakash# BL2 in EL3 66042d4d3baSArvind Ram Prakash 66142d4d3baSArvind Ram Prakashifeq (${RESET_TO_BL2},1) 66242d4d3baSArvind Ram Prakash BL2_RUNS_AT_EL3 := 1 66342d4d3baSArvind Ram Prakash ifeq (${ENABLE_RME},1) 66442d4d3baSArvind Ram Prakash $(error RESET_TO_BL2=1 and ENABLE_RME=1 configuration is not supported at the moment.) 66542d4d3baSArvind Ram Prakash endif 66642d4d3baSArvind Ram Prakashelse ifeq (${ENABLE_RME},1) 66742d4d3baSArvind Ram Prakash BL2_RUNS_AT_EL3 := 1 66842d4d3baSArvind Ram Prakashelse 66942d4d3baSArvind Ram Prakash BL2_RUNS_AT_EL3 := 0 67042d4d3baSArvind Ram Prakashendif 67142d4d3baSArvind Ram Prakash 6728012cc5cSMasahiro Yamada$(eval $(call MAKE_PREREQ_DIR,${BUILD_PLAT})) 6738012cc5cSMasahiro Yamada 67426e63c44SEtienne Carriereifeq (${ARM_ARCH_MAJOR},7) 67526e63c44SEtienne Carriereinclude make_helpers/armv7-a-cpus.mk 67626e63c44SEtienne Carriereendif 67726e63c44SEtienne Carriere 6783bd17c0fSSoby MathewPIE_FOUND := $(findstring --enable-default-pie,${GCC_V_OUTPUT}) 6793bd17c0fSSoby Mathewifneq ($(PIE_FOUND),) 6803bd17c0fSSoby Mathew TF_CFLAGS += -fno-PIE 6817b592418SSamuel Hollandifneq ($(findstring gcc,$(notdir $(LD))),) 6827b592418SSamuel Holland TF_LDFLAGS += -no-pie 6837b592418SSamuel Hollandendif 6843bd17c0fSSoby Mathewendif 685320920c1SMasahiro Yamada 686320920c1SMasahiro Yamadaifneq ($(findstring gcc,$(notdir $(LD))),) 687320920c1SMasahiro Yamada PIE_LDFLAGS += -Wl,-pie -Wl,--no-dynamic-linker 688320920c1SMasahiro Yamadaelse 689320920c1SMasahiro Yamada PIE_LDFLAGS += -pie --no-dynamic-linker 690320920c1SMasahiro Yamadaendif 691320920c1SMasahiro Yamada 692320920c1SMasahiro Yamadaifeq ($(ENABLE_PIE),1) 69342d4d3baSArvind Ram Prakashifeq ($(RESET_TO_BL2),1) 69469af7fcfSMasahiro Yamadaifneq ($(BL2_IN_XIP_MEM),1) 695966660ecSChris Kay BL2_CPPFLAGS += -fpie 69669af7fcfSMasahiro Yamada BL2_CFLAGS += -fpie 69769af7fcfSMasahiro Yamada BL2_LDFLAGS += $(PIE_LDFLAGS) 69869af7fcfSMasahiro Yamadaendif 69969af7fcfSMasahiro Yamadaendif 700966660ecSChris Kay BL31_CPPFLAGS += -fpie 701320920c1SMasahiro Yamada BL31_CFLAGS += -fpie 702320920c1SMasahiro Yamada BL31_LDFLAGS += $(PIE_LDFLAGS) 703966660ecSChris Kay 704966660ecSChris Kay BL32_CPPFLAGS += -fpie 705d974301dSMasahiro Yamada BL32_CFLAGS += -fpie 706d974301dSMasahiro Yamada BL32_LDFLAGS += $(PIE_LDFLAGS) 707d974301dSMasahiro Yamadaendif 7083bd17c0fSSoby Mathew 709d5e97a1dSMasahiro Yamadaifeq (${ARCH},aarch64) 7109cefb4b1SMasahiro YamadaBL1_CPPFLAGS += -DIMAGE_AT_EL3 71142d4d3baSArvind Ram Prakashifeq ($(RESET_TO_BL2),1) 7129cefb4b1SMasahiro YamadaBL2_CPPFLAGS += -DIMAGE_AT_EL3 713d5e97a1dSMasahiro Yamadaelse 7149cefb4b1SMasahiro YamadaBL2_CPPFLAGS += -DIMAGE_AT_EL1 715d5e97a1dSMasahiro Yamadaendif 7169cefb4b1SMasahiro YamadaBL2U_CPPFLAGS += -DIMAGE_AT_EL1 7179cefb4b1SMasahiro YamadaBL31_CPPFLAGS += -DIMAGE_AT_EL3 7189cefb4b1SMasahiro YamadaBL32_CPPFLAGS += -DIMAGE_AT_EL1 719d5e97a1dSMasahiro Yamadaendif 720d5e97a1dSMasahiro Yamada 72154035fc4SSandrine Bailleux# Include the CPU specific operations makefile, which provides default 72254035fc4SSandrine Bailleux# values for all CPU errata workarounds and CPU specific optimisations. 72354035fc4SSandrine Bailleux# This can be overridden by the platform. 72473c99d4eSJuan Castilloinclude lib/cpus/cpu-ops.mk 7254f6ad66aSAchin Gupta 726a4409008Sdp-armifeq (${ARCH},aarch32) 727a4409008Sdp-armNEED_BL32 := yes 728a4409008Sdp-arm 729a4409008Sdp-arm################################################################################ 730a4409008Sdp-arm# Build `AARCH32_SP` as BL32 image for AArch32 731a4409008Sdp-arm################################################################################ 732a4409008Sdp-armifneq (${AARCH32_SP},none) 733a4409008Sdp-arm# We expect to locate an sp.mk under the specified AARCH32_SP directory 734a4409008Sdp-armAARCH32_SP_MAKE := $(wildcard bl32/${AARCH32_SP}/${AARCH32_SP}.mk) 735a4409008Sdp-arm 736a4409008Sdp-armifeq (${AARCH32_SP_MAKE},) 737a4409008Sdp-arm $(error Error: No bl32/${AARCH32_SP}/${AARCH32_SP}.mk located) 738a4409008Sdp-armendif 739a4409008Sdp-arm 740a4409008Sdp-arm$(info Including ${AARCH32_SP_MAKE}) 741a4409008Sdp-arminclude ${AARCH32_SP_MAKE} 742a4409008Sdp-armendif 743a4409008Sdp-arm 744a4409008Sdp-armendif 7454f6ad66aSAchin Gupta 74673c99d4eSJuan Castillo################################################################################ 74777f1f7a1SVarun Wadekar# Include libc if not overridden 74877f1f7a1SVarun Wadekar################################################################################ 74977f1f7a1SVarun Wadekarifeq (${OVERRIDE_LIBC},0) 75077f1f7a1SVarun Wadekarinclude lib/libc/libc.mk 75177f1f7a1SVarun Wadekarendif 75277f1f7a1SVarun Wadekar 75377f1f7a1SVarun Wadekar################################################################################ 754cf2c8a33SAntonio Nino Diaz# Check incompatible options 755cf2c8a33SAntonio Nino Diaz################################################################################ 756cf2c8a33SAntonio Nino Diaz 757cf2c8a33SAntonio Nino Diazifdef EL3_PAYLOAD_BASE 75868450a6dSAntonio Nino Diaz ifdef PRELOADED_BL33_BASE 75968450a6dSAntonio Nino Diaz $(warning "PRELOADED_BL33_BASE and EL3_PAYLOAD_BASE are \ 76068450a6dSAntonio Nino Diaz incompatible build options. EL3_PAYLOAD_BASE has priority.") 761cf2c8a33SAntonio Nino Diaz endif 76276580f3dSQixiang Xu ifneq (${GENERATE_COT},0) 76376580f3dSQixiang Xu $(error "GENERATE_COT and EL3_PAYLOAD_BASE are incompatible build options.") 76476580f3dSQixiang Xu endif 76576580f3dSQixiang Xu ifneq (${TRUSTED_BOARD_BOOT},0) 76676580f3dSQixiang Xu $(error "TRUSTED_BOARD_BOOT and EL3_PAYLOAD_BASE are incompatible build options.") 76776580f3dSQixiang Xu endif 768cf2c8a33SAntonio Nino Diazendif 769cf2c8a33SAntonio Nino Diaz 770cf2c8a33SAntonio Nino Diazifeq (${NEED_BL33},yes) 771cf2c8a33SAntonio Nino Diaz ifdef EL3_PAYLOAD_BASE 772cf2c8a33SAntonio Nino Diaz $(warning "BL33 image is not needed when option \ 773cf2c8a33SAntonio Nino Diaz BL33_PAYLOAD_BASE is used and won't be added to the FIP file.") 774cf2c8a33SAntonio Nino Diaz endif 77568450a6dSAntonio Nino Diaz ifdef PRELOADED_BL33_BASE 77668450a6dSAntonio Nino Diaz $(warning "BL33 image is not needed when option \ 77768450a6dSAntonio Nino Diaz PRELOADED_BL33_BASE is used and won't be added to the FIP \ 77868450a6dSAntonio Nino Diaz file.") 779cf2c8a33SAntonio Nino Diaz endif 780cf2c8a33SAntonio Nino Diazendif 781cf2c8a33SAntonio Nino Diaz 782d4593e47SJeenu Viswambharan# When building for systems with hardware-assisted coherency, there's no need to 783d4593e47SJeenu Viswambharan# use USE_COHERENT_MEM. Require that USE_COHERENT_MEM must be set to 0 too. 784d4593e47SJeenu Viswambharanifeq ($(HW_ASSISTED_COHERENCY)-$(USE_COHERENT_MEM),1-1) 785d4593e47SJeenu Viswambharan$(error USE_COHERENT_MEM cannot be enabled with HW_ASSISTED_COHERENCY) 786d4593e47SJeenu Viswambharanendif 7871a0a3f06SYatharth Kochar 78842d4d3baSArvind Ram Prakash#For now, BL2_IN_XIP_MEM is only supported when RESET_TO_BL2 is 1. 78942d4d3baSArvind Ram Prakashifeq ($(RESET_TO_BL2)-$(BL2_IN_XIP_MEM),0-1) 79042d4d3baSArvind Ram Prakash$(error "BL2_IN_XIP_MEM is only supported when RESET_TO_BL2 is enabled") 7917d173fc5SJiafei Panendif 7927d173fc5SJiafei Pan 79314c6016aSJeenu Viswambharan# For RAS_EXTENSION, require that EAs are handled in EL3 first 79414c6016aSJeenu Viswambharanifeq ($(RAS_EXTENSION),1) 79546cc41d5SManish Pandey ifneq ($(HANDLE_EA_EL3_FIRST_NS),1) 79646cc41d5SManish Pandey $(error For RAS_EXTENSION, HANDLE_EA_EL3_FIRST_NS must also be 1) 79714c6016aSJeenu Viswambharan endif 79814c6016aSJeenu Viswambharanendif 79914c6016aSJeenu Viswambharan 8001a7c1cfeSJeenu Viswambharan# When FAULT_INJECTION_SUPPORT is used, require that RAS_EXTENSION is enabled 8011a7c1cfeSJeenu Viswambharanifeq ($(FAULT_INJECTION_SUPPORT),1) 8021a7c1cfeSJeenu Viswambharan ifneq ($(RAS_EXTENSION),1) 8031a7c1cfeSJeenu Viswambharan $(error For FAULT_INJECTION_SUPPORT, RAS_EXTENSION must also be 1) 8041a7c1cfeSJeenu Viswambharan endif 8051a7c1cfeSJeenu Viswambharanendif 8061a7c1cfeSJeenu Viswambharan 807ed51b51fSRoberto Vargas# DYN_DISABLE_AUTH can be set only when TRUSTED_BOARD_BOOT=1 808209a60ccSSoby Mathewifeq ($(DYN_DISABLE_AUTH), 1) 809209a60ccSSoby Mathew ifeq (${TRUSTED_BOARD_BOOT}, 0) 810209a60ccSSoby Mathew $(error "TRUSTED_BOARD_BOOT must be enabled for DYN_DISABLE_AUTH to be set.") 811209a60ccSSoby Mathew endif 812209a60ccSSoby Mathewendif 813209a60ccSSoby Mathew 8142bf4f27fSManish V Badarkheifeq ($(MEASURED_BOOT)-$(TRUSTED_BOARD_BOOT),1-1) 8152bf4f27fSManish V Badarkhe# Support authentication verification and hash calculation 8162bf4f27fSManish V Badarkhe CRYPTO_SUPPORT := 3 8172bf4f27fSManish V Badarkheelse ifeq ($(DRTM_SUPPORT)-$(TRUSTED_BOARD_BOOT),1-1) 8182bf4f27fSManish V Badarkhe# Support authentication verification and hash calculation 8192bf4f27fSManish V Badarkhe CRYPTO_SUPPORT := 3 8202bf4f27fSManish V Badarkheelse ifneq ($(filter 1,${MEASURED_BOOT} ${DRTM_SUPPORT}),) 8212bf4f27fSManish V Badarkhe# Support hash calculation only 8222bf4f27fSManish V Badarkhe CRYPTO_SUPPORT := 2 8232bf4f27fSManish V Badarkheelse ifeq (${TRUSTED_BOARD_BOOT},1) 8242bf4f27fSManish V Badarkhe# Support authentication verification only 825c9c56f6eSManish V Badarkhe CRYPTO_SUPPORT := 1 826c9c56f6eSManish V Badarkheelse 827c9c56f6eSManish V Badarkhe CRYPTO_SUPPORT := 0 828c9c56f6eSManish V Badarkheendif 829c9c56f6eSManish V Badarkhe 830cbf9e84aSBalint Dobszay# SDEI_IN_FCONF is only supported when SDEI_SUPPORT is enabled. 831cbf9e84aSBalint Dobszayifeq ($(SDEI_SUPPORT)-$(SDEI_IN_FCONF),0-1) 832700e7685SManish Pandey$(error "SDEI_IN_FCONF is only supported when SDEI_SUPPORT is enabled") 83384ef9cd8SManish V Badarkheendif 83484ef9cd8SManish V Badarkhe 835b86048c4SAntonio Nino Diaz# If pointer authentication is used in the firmware, make sure that all the 8369fc59639SAlexei Fedorov# registers associated to it are also saved and restored. 8379fc59639SAlexei Fedorov# Not doing it would leak the value of the keys used by EL3 to EL1 and S-EL1. 838b86048c4SAntonio Nino Diazifeq ($(ENABLE_PAUTH),1) 8399fc59639SAlexei Fedorov ifeq ($(CTX_INCLUDE_PAUTH_REGS),0) 8409fc59639SAlexei Fedorov $(error Pointer Authentication requires CTX_INCLUDE_PAUTH_REGS=1) 84106715f85SAlexei Fedorov endif 8429fc59639SAlexei Fedorovendif 8439fc59639SAlexei Fedorov 84406715f85SAlexei Fedorovifeq ($(CTX_INCLUDE_PAUTH_REGS),1) 8459fc59639SAlexei Fedorov ifneq (${ARCH},aarch64) 8469fc59639SAlexei Fedorov $(error CTX_INCLUDE_PAUTH_REGS requires AArch64) 847b86048c4SAntonio Nino Diaz endif 848b86048c4SAntonio Nino Diazendif 8499fc59639SAlexei Fedorov 8509dd94382SJustin Chadwellifeq ($(CTX_INCLUDE_MTE_REGS),1) 8519dd94382SJustin Chadwell ifneq (${ARCH},aarch64) 8529dd94382SJustin Chadwell $(error CTX_INCLUDE_MTE_REGS requires AArch64) 8539dd94382SJustin Chadwell endif 8549dd94382SJustin Chadwellendif 8559dd94382SJustin Chadwell 856396b339dSManish V Badarkheifeq ($(PSA_FWU_SUPPORT),1) 857396b339dSManish V Badarkhe $(info PSA_FWU_SUPPORT is an experimental feature) 858396b339dSManish V Badarkheendif 859396b339dSManish V Badarkhe 8606a0da736SJayanth Dodderi Chidanandifeq ($(FEATURE_DETECTION),1) 8616a0da736SJayanth Dodderi Chidanand $(info FEATURE_DETECTION is an experimental feature) 8626a0da736SJayanth Dodderi Chidanandendif 8636a0da736SJayanth Dodderi Chidanand 86403d3c0d7SJayanth Dodderi Chidanandifneq ($(ENABLE_SME2_FOR_NS), 0) 86503d3c0d7SJayanth Dodderi Chidanand ifeq (${ENABLE_SME_FOR_NS}, 0) 86603d3c0d7SJayanth Dodderi Chidanand $(warning "ENABLE_SME2_FOR_NS requires ENABLE_SME_FOR_NS also to be set") 86703d3c0d7SJayanth Dodderi Chidanand $(warning "Forced ENABLE_SME_FOR_NS=1") 86803d3c0d7SJayanth Dodderi Chidanand override ENABLE_SME_FOR_NS := 1 86903d3c0d7SJayanth Dodderi Chidanand endif 87045007acdSJayanth Dodderi Chidanandendif 87145007acdSJayanth Dodderi Chidanand 87260e8f3cfSPetre-Ionut Tudorifeq (${ARM_XLAT_TABLES_LIB_V1}, 1) 87360e8f3cfSPetre-Ionut Tudor ifeq (${ALLOW_RO_XLAT_TABLES}, 1) 87460e8f3cfSPetre-Ionut Tudor $(error "ALLOW_RO_XLAT_TABLES requires translation tables library v2") 87560e8f3cfSPetre-Ionut Tudor endif 87660e8f3cfSPetre-Ionut Tudorendif 87760e8f3cfSPetre-Ionut Tudor 8787cda17bbSSumit Gargifneq (${DECRYPTION_SUPPORT},none) 8797cda17bbSSumit Garg ifeq (${TRUSTED_BOARD_BOOT}, 0) 8807cda17bbSSumit Garg $(error TRUSTED_BOARD_BOOT must be enabled for DECRYPTION_SUPPORT to be set) 8817cda17bbSSumit Garg endif 8827cda17bbSSumit Gargendif 8837cda17bbSSumit Garg 884744ad974Sjohpow01# Ensure that no Aarch64-only features are enabled in Aarch32 build 885dc78e62dSjohpow01ifeq (${ARCH},aarch32) 886744ad974Sjohpow01 887744ad974Sjohpow01 # SME/SVE only supported on AArch64 88845007acdSJayanth Dodderi Chidanand ifneq (${ENABLE_SME_FOR_NS},0) 889dc78e62dSjohpow01 $(error "ENABLE_SME_FOR_NS cannot be used with ARCH=aarch32") 890dc78e62dSjohpow01 endif 89103d3c0d7SJayanth Dodderi Chidanand 892dc78e62dSjohpow01 ifeq (${ENABLE_SVE_FOR_NS},1) 893dc78e62dSjohpow01 # Warning instead of error due to CI dependency on this 89424ab2c0aSYann Gautier $(error "ENABLE_SVE_FOR_NS cannot be used with ARCH=aarch32") 895dc78e62dSjohpow01 endif 896744ad974Sjohpow01 897ff86e0b4SJuan Pablo Conde # BRBE is not supported in AArch32 898744ad974Sjohpow01 ifeq (${ENABLE_BRBE_FOR_NS},1) 899744ad974Sjohpow01 $(error "ENABLE_BRBE_FOR_NS cannot be used with ARCH=aarch32") 900744ad974Sjohpow01 endif 901744ad974Sjohpow01 902ff86e0b4SJuan Pablo Conde # FEAT_RNG_TRAP is not supported in AArch32 903ff86e0b4SJuan Pablo Conde ifeq (${ENABLE_FEAT_RNG_TRAP},1) 904ff86e0b4SJuan Pablo Conde $(error "ENABLE_FEAT_RNG_TRAP cannot be used with ARCH=aarch32") 905ff86e0b4SJuan Pablo Conde endif 906dc78e62dSjohpow01endif 907dc78e62dSjohpow01 908dc78e62dSjohpow01# Ensure ENABLE_RME is not used with SME 909dc78e62dSjohpow01ifeq (${ENABLE_RME},1) 91045007acdSJayanth Dodderi Chidanand ifneq (${ENABLE_SME_FOR_NS},0) 911dc78e62dSjohpow01 $(error "ENABLE_SME_FOR_NS cannot be used with ENABLE_RME") 912dc78e62dSjohpow01 endif 913dc78e62dSjohpow01endif 914dc78e62dSjohpow01 915dc78e62dSjohpow01# Secure SME/SVE requires the non-secure component as well 916dc78e62dSjohpow01ifeq (${ENABLE_SME_FOR_SWD},1) 917dc78e62dSjohpow01 ifeq (${ENABLE_SME_FOR_NS},0) 918dc78e62dSjohpow01 $(error "ENABLE_SME_FOR_SWD requires ENABLE_SME_FOR_NS") 919dc78e62dSjohpow01 endif 920dc78e62dSjohpow01endif 921dc78e62dSjohpow01ifeq (${ENABLE_SVE_FOR_SWD},1) 922dc78e62dSjohpow01 ifeq (${ENABLE_SVE_FOR_NS},0) 923dc78e62dSjohpow01 $(error "ENABLE_SVE_FOR_SWD requires ENABLE_SVE_FOR_NS") 924dc78e62dSjohpow01 endif 925dc78e62dSjohpow01endif 926dc78e62dSjohpow01 927dc78e62dSjohpow01# SVE and SME cannot be used with CTX_INCLUDE_FPREGS since secure manager does 928dc78e62dSjohpow01# its own context management including FPU registers. 929dc78e62dSjohpow01ifeq (${CTX_INCLUDE_FPREGS},1) 93045007acdSJayanth Dodderi Chidanand ifneq (${ENABLE_SME_FOR_NS},0) 931dc78e62dSjohpow01 $(error "ENABLE_SME_FOR_NS cannot be used with CTX_INCLUDE_FPREGS") 932dc78e62dSjohpow01 endif 93303d3c0d7SJayanth Dodderi Chidanand 934dc78e62dSjohpow01 ifeq (${ENABLE_SVE_FOR_NS},1) 935dc78e62dSjohpow01 # Warning instead of error due to CI dependency on this 936dc78e62dSjohpow01 $(warning "ENABLE_SVE_FOR_NS cannot be used with CTX_INCLUDE_FPREGS") 937dc78e62dSjohpow01 $(warning "Forced ENABLE_SVE_FOR_NS=0") 938dc78e62dSjohpow01 override ENABLE_SVE_FOR_NS := 0 939dc78e62dSjohpow01 endif 940dc78e62dSjohpow01endif 941dc78e62dSjohpow01 94200e28874SManish V Badarkheifeq ($(DRTM_SUPPORT),1) 94300e28874SManish V Badarkhe $(info DRTM_SUPPORT is an experimental feature) 94400e28874SManish V Badarkheendif 94500e28874SManish V Badarkhe 946274a69e7SChris Kayifeq (${ENABLE_RME},1) 947274a69e7SChris Kay ifneq (${SEPARATE_CODE_AND_RODATA},1) 948274a69e7SChris Kay $(error `ENABLE_RME=1` requires `SEPARATE_CODE_AND_RODATA=1`) 949274a69e7SChris Kay endif 950274a69e7SChris Kayendif 951274a69e7SChris Kay 952cf2c8a33SAntonio Nino Diaz################################################################################ 95373c99d4eSJuan Castillo# Process platform overrideable behaviour 95473c99d4eSJuan Castillo################################################################################ 9554f6ad66aSAchin Gupta 9565f24ce96SManish Pandeyifdef BL1_SOURCES 9575f24ce96SManish PandeyNEED_BL1 := yes 9585f24ce96SManish Pandeyendif 9595f24ce96SManish Pandey 9605f24ce96SManish Pandeyifdef BL2_SOURCES 9615f24ce96SManish Pandey NEED_BL2 := yes 9625f24ce96SManish Pandey 963bd97f83aSJohn Tsichritzis # Using BL2 implies that a BL33 image also needs to be supplied for the FIP and 964bd97f83aSJohn Tsichritzis # Certificate generation tools. This flag can be overridden by the platform. 965cf2c8a33SAntonio Nino Diaz ifdef EL3_PAYLOAD_BASE 966cf2c8a33SAntonio Nino Diaz # If booting an EL3 payload there is no need for a BL33 image 967cf2c8a33SAntonio Nino Diaz # in the FIP file. 9684c117f6cSSandrine Bailleux NEED_BL33 := no 969cf2c8a33SAntonio Nino Diaz else 97068450a6dSAntonio Nino Diaz ifdef PRELOADED_BL33_BASE 971cf2c8a33SAntonio Nino Diaz # If booting a BL33 preloaded image there is no need of 972cf2c8a33SAntonio Nino Diaz # another one in the FIP file. 973cf2c8a33SAntonio Nino Diaz NEED_BL33 := no 974cf2c8a33SAntonio Nino Diaz else 975cf2c8a33SAntonio Nino Diaz NEED_BL33 ?= yes 976cf2c8a33SAntonio Nino Diaz endif 9774c117f6cSSandrine Bailleux endif 97873c99d4eSJuan Castilloendif 9796f971622SJuan Castillo 9805f24ce96SManish Pandeyifdef BL2U_SOURCES 9815f24ce96SManish PandeyNEED_BL2U := yes 9825f24ce96SManish Pandeyendif 9835f24ce96SManish Pandey 9844d045d0eSMasahiro Yamada# If SCP_BL2 is given, we always want FIP to include it. 9854d045d0eSMasahiro Yamadaifdef SCP_BL2 9864d045d0eSMasahiro Yamada NEED_SCP_BL2 := yes 9874d045d0eSMasahiro Yamadaendif 9884d045d0eSMasahiro Yamada 9895744e874SSoby Mathew# For AArch32, BL31 is not currently supported. 9905744e874SSoby Mathewifneq (${ARCH},aarch32) 9915744e874SSoby Mathew ifdef BL31_SOURCES 9925744e874SSoby Mathew # When booting an EL3 payload, there is no need to compile the BL31 image nor 9935744e874SSoby Mathew # put it in the FIP. 9945744e874SSoby Mathew ifndef EL3_PAYLOAD_BASE 9955744e874SSoby Mathew NEED_BL31 := yes 9965744e874SSoby Mathew endif 9975744e874SSoby Mathew endif 9985744e874SSoby Mathewendif 9995744e874SSoby Mathew 100073c99d4eSJuan Castillo# Process TBB related flags 10016f971622SJuan Castilloifneq (${GENERATE_COT},0) 100273c99d4eSJuan Castillo # Common cert_create options 10036f971622SJuan Castillo ifneq (${CREATE_KEYS},0) 10046f971622SJuan Castillo $(eval CRT_ARGS += -n) 10050191262dSYatharth Kochar $(eval FWU_CRT_ARGS += -n) 1006fd34e7baSJuan Castillo ifneq (${SAVE_KEYS},0) 1007fd34e7baSJuan Castillo $(eval CRT_ARGS += -k) 10080191262dSYatharth Kochar $(eval FWU_CRT_ARGS += -k) 1009fd34e7baSJuan Castillo endif 10106f971622SJuan Castillo endif 101173c99d4eSJuan Castillo # Include TBBR makefile (unless the platform indicates otherwise) 101273c99d4eSJuan Castillo ifeq (${INCLUDE_TBBR_MK},1) 101373c99d4eSJuan Castillo include make_helpers/tbbr/tbbr_tools.mk 101473c99d4eSJuan Castillo endif 10156f971622SJuan Castilloendif 10166f971622SJuan Castillo 10171c75d5dfSMasahiro Yamadaifneq (${FIP_ALIGN},0) 10181c75d5dfSMasahiro YamadaFIP_ARGS += --align ${FIP_ALIGN} 10191c75d5dfSMasahiro Yamadaendif 10201c75d5dfSMasahiro Yamada 10215f24ce96SManish Pandeyifdef FDT_SOURCES 10225f24ce96SManish PandeyNEED_FDT := yes 10235f24ce96SManish Pandeyendif 10245f24ce96SManish Pandey 102573c99d4eSJuan Castillo################################################################################ 102646e5e035SMichalis Pappas# Include libraries' Makefile that are used in all BL 102746e5e035SMichalis Pappas################################################################################ 102846e5e035SMichalis Pappas 102946e5e035SMichalis Pappasinclude lib/stack_protector/stack_protector.mk 103046e5e035SMichalis Pappas 103146e5e035SMichalis Pappas################################################################################ 1032819281eeSdp-arm# Auxiliary tools (fiptool, cert_create, etc) 103373c99d4eSJuan Castillo################################################################################ 103473c99d4eSJuan Castillo 103573c99d4eSJuan Castillo# Variables for use with Certificate Generation Tool 103673c99d4eSJuan CastilloCRTTOOLPATH ?= tools/cert_create 103742a45b51SEvan LloydCRTTOOL ?= ${CRTTOOLPATH}/cert_create${BIN_EXT} 103873c99d4eSJuan Castillo 103990aa901fSSumit Garg# Variables for use with Firmware Encryption Tool 104090aa901fSSumit GargENCTOOLPATH ?= tools/encrypt_fw 104190aa901fSSumit GargENCTOOL ?= ${ENCTOOLPATH}/encrypt_fw${BIN_EXT} 104290aa901fSSumit Garg 104373c99d4eSJuan Castillo# Variables for use with Firmware Image Package 1044819281eeSdp-armFIPTOOLPATH ?= tools/fiptool 1045819281eeSdp-armFIPTOOL ?= ${FIPTOOLPATH}/fiptool${BIN_EXT} 104673c99d4eSJuan Castillo 104726010da1SAntonio Nino Diaz# Variables for use with sptool 104826010da1SAntonio Nino DiazSPTOOLPATH ?= tools/sptool 1049822c7279SJ-AlvesSPTOOL ?= ${SPTOOLPATH}/sptool.py 1050ce2b1ec6SManish PandeySP_MK_GEN ?= ${SPTOOLPATH}/sp_mk_generator.py 105126010da1SAntonio Nino Diaz 10525accce5bSRoberto Vargas# Variables for use with ROMLIB 10535accce5bSRoberto VargasROMLIBPATH ?= lib/romlib 10545accce5bSRoberto Vargas 1055cfe83910SLouis Mayencourt# Variable for use with Python 1056cfe83910SLouis MayencourtPYTHON ?= python3 1057cfe83910SLouis Mayencourt 1058cfe83910SLouis Mayencourt# Variables for use with PRINT_MEMORY_MAP 1059cfe83910SLouis MayencourtPRINT_MEMORY_MAP_PATH ?= tools/memory 1060cfe83910SLouis MayencourtPRINT_MEMORY_MAP ?= ${PRINT_MEMORY_MAP_PATH}/print_memory_map.py 1061cfe83910SLouis Mayencourt 10626de32378SMadhukar Pappireddy# Variables for use with documentation build using Sphinx tool 10636de32378SMadhukar PappireddyDOCS_PATH ?= docs 10646de32378SMadhukar Pappireddy 10651f1c0206SAbdul Halim, Muhammad Hadi Asyrafi# Defination of SIMICS flag 10661f1c0206SAbdul Halim, Muhammad Hadi AsyrafiSIMICS_BUILD ?= 0 10671f1c0206SAbdul Halim, Muhammad Hadi Asyrafi 10688a86052dSSoby Mathew################################################################################ 10698a86052dSSoby Mathew# Include BL specific makefiles 10708a86052dSSoby Mathew################################################################################ 10715f24ce96SManish Pandey 10725f24ce96SManish Pandeyifeq (${NEED_BL1},yes) 10738a86052dSSoby Mathewinclude bl1/bl1.mk 10748a86052dSSoby Mathewendif 10758a86052dSSoby Mathew 10765f24ce96SManish Pandeyifeq (${NEED_BL2},yes) 10778a86052dSSoby Mathewinclude bl2/bl2.mk 10788a86052dSSoby Mathewendif 10798a86052dSSoby Mathew 10805f24ce96SManish Pandeyifeq (${NEED_BL2U},yes) 10818a86052dSSoby Mathewinclude bl2u/bl2u.mk 10828a86052dSSoby Mathewendif 10838a86052dSSoby Mathew 10845744e874SSoby Mathewifeq (${NEED_BL31},yes) 10858a86052dSSoby Mathewinclude bl31/bl31.mk 10868a86052dSSoby Mathewendif 108703b397a8SNishanth Menon 108873c99d4eSJuan Castillo################################################################################ 108973c99d4eSJuan Castillo# Build options checks 109073c99d4eSJuan Castillo################################################################################ 109173c99d4eSJuan Castillo 1092327131c4SLeonardo Sandoval$(eval $(call assert_booleans,\ 1093327131c4SLeonardo Sandoval $(sort \ 1094327131c4SLeonardo Sandoval ALLOW_RO_XLAT_TABLES \ 109546789a7cSBalint Dobszay BL2_ENABLE_SP_LOAD \ 1096327131c4SLeonardo Sandoval COLD_BOOT_SINGLE_CPU \ 1097327131c4SLeonardo Sandoval CREATE_KEYS \ 1098327131c4SLeonardo Sandoval CTX_INCLUDE_AARCH32_REGS \ 1099327131c4SLeonardo Sandoval CTX_INCLUDE_FPREGS \ 1100327131c4SLeonardo Sandoval CTX_INCLUDE_EL2_REGS \ 1101327131c4SLeonardo Sandoval DEBUG \ 11020063dd17SJavier Almansa Sobrino DISABLE_MTPMU \ 1103327131c4SLeonardo Sandoval DYN_DISABLE_AUTH \ 1104327131c4SLeonardo Sandoval EL3_EXCEPTION_HANDLING \ 11051fd685a7SChris Kay ENABLE_AMU_AUXILIARY_COUNTERS \ 1106742ca230SChris Kay ENABLE_AMU_FCONF \ 1107873d4241Sjohpow01 AMU_RESTRICT_COUNTERS \ 1108327131c4SLeonardo Sandoval ENABLE_ASSERTIONS \ 110924077098SAndre Przywara ENABLE_FEAT_SB \ 1110327131c4SLeonardo Sandoval ENABLE_PIE \ 1111327131c4SLeonardo Sandoval ENABLE_PMF \ 1112327131c4SLeonardo Sandoval ENABLE_PSCI_STAT \ 1113327131c4SLeonardo Sandoval ENABLE_RUNTIME_INSTRUMENTATION \ 1114dc78e62dSjohpow01 ENABLE_SME_FOR_SWD \ 11150c5e7d1cSMax Shvetsov ENABLE_SVE_FOR_SWD \ 1116327131c4SLeonardo Sandoval ERROR_DEPRECATED \ 1117327131c4SLeonardo Sandoval FAULT_INJECTION_SUPPORT \ 1118327131c4SLeonardo Sandoval GENERATE_COT \ 1119327131c4SLeonardo Sandoval GICV2_G0_FOR_EL3 \ 112046cc41d5SManish Pandey HANDLE_EA_EL3_FIRST_NS \ 1121327131c4SLeonardo Sandoval HW_ASSISTED_COHERENCY \ 1122327131c4SLeonardo Sandoval INVERTED_MEMMAP \ 1123327131c4SLeonardo Sandoval MEASURED_BOOT \ 112400e28874SManish V Badarkhe DRTM_SUPPORT \ 1125327131c4SLeonardo Sandoval NS_TIMER_SWITCH \ 1126327131c4SLeonardo Sandoval OVERRIDE_LIBC \ 1127327131c4SLeonardo Sandoval PL011_GENERIC_UART \ 11280ce2072dSTamas Ban PLAT_RSS_NOT_SUPPORTED \ 1129327131c4SLeonardo Sandoval PROGRAMMABLE_RESET_ADDRESS \ 1130327131c4SLeonardo Sandoval PSCI_EXTENDED_STATE_ID \ 113164b4710bSWing Li PSCI_OS_INIT_MODE \ 1132327131c4SLeonardo Sandoval RESET_TO_BL31 \ 1133327131c4SLeonardo Sandoval SAVE_KEYS \ 1134327131c4SLeonardo Sandoval SEPARATE_CODE_AND_RODATA \ 113596a8ed14SJiafei Pan SEPARATE_BL2_NOLOAD_REGION \ 1136327131c4SLeonardo Sandoval SEPARATE_NOBITS_REGION \ 1137327131c4SLeonardo Sandoval SPIN_ON_BL1_EXIT \ 1138327131c4SLeonardo Sandoval SPM_MM \ 11391d63ae4dSMarc Bonnici SPMC_AT_EL3 \ 1140327131c4SLeonardo Sandoval SPMD_SPM_AT_SEL2 \ 1141327131c4SLeonardo Sandoval TRUSTED_BOARD_BOOT \ 1142327131c4SLeonardo Sandoval USE_COHERENT_MEM \ 1143327131c4SLeonardo Sandoval USE_DEBUGFS \ 1144327131c4SLeonardo Sandoval ARM_IO_IN_DTB \ 1145327131c4SLeonardo Sandoval SDEI_IN_FCONF \ 1146327131c4SLeonardo Sandoval SEC_INT_DESC_IN_FCONF \ 1147327131c4SLeonardo Sandoval USE_ROMLIB \ 1148327131c4SLeonardo Sandoval USE_TBBR_DEFS \ 1149327131c4SLeonardo Sandoval WARMBOOT_ENABLE_DCACHE_EARLY \ 115042d4d3baSArvind Ram Prakash RESET_TO_BL2 \ 1151327131c4SLeonardo Sandoval BL2_IN_XIP_MEM \ 1152327131c4SLeonardo Sandoval BL2_INV_DCACHE \ 1153327131c4SLeonardo Sandoval USE_SPINLOCK_CAS \ 1154327131c4SLeonardo Sandoval ENCRYPT_BL31 \ 1155327131c4SLeonardo Sandoval ENCRYPT_BL32 \ 1156327131c4SLeonardo Sandoval ERRATA_SPECULATIVE_AT \ 115700e8f79cSManish Pandey RAS_TRAP_NS_ERR_REC_ACCESS \ 1158327131c4SLeonardo Sandoval COT_DESC_IN_DTB \ 1159327131c4SLeonardo Sandoval USE_SP804_TIMER \ 1160396b339dSManish V Badarkhe PSA_FWU_SUPPORT \ 116168120783SChris Kay ENABLE_MPMM \ 116268120783SChris Kay ENABLE_MPMM_FCONF \ 11631f1c0206SAbdul Halim, Muhammad Hadi Asyrafi SIMICS_BUILD \ 11646a0da736SJayanth Dodderi Chidanand FEATURE_DETECTION \ 11650b22e591SJayanth Dodderi Chidanand TRNG_SUPPORT \ 1166*ffea3844SSona Mathew ERRATA_ABI_SUPPORT \ 116704c7303bSOkash Khawaja CONDITIONAL_CMO \ 1168327131c4SLeonardo Sandoval))) 116973c99d4eSJuan Castillo 1170327131c4SLeonardo Sandoval$(eval $(call assert_numerics,\ 1171327131c4SLeonardo Sandoval $(sort \ 1172327131c4SLeonardo Sandoval ARM_ARCH_MAJOR \ 1173327131c4SLeonardo Sandoval ARM_ARCH_MINOR \ 1174327131c4SLeonardo Sandoval BRANCH_PROTECTION \ 11756a0da736SJayanth Dodderi Chidanand CTX_INCLUDE_PAUTH_REGS \ 11766a0da736SJayanth Dodderi Chidanand CTX_INCLUDE_MTE_REGS \ 11776a0da736SJayanth Dodderi Chidanand CTX_INCLUDE_NEVE_REGS \ 11782bf4f27fSManish V Badarkhe CRYPTO_SUPPORT \ 11791298f2f1SJayanth Dodderi Chidanand ENABLE_BRBE_FOR_NS \ 118047c681b7SJayanth Dodderi Chidanand ENABLE_TRBE_FOR_NS \ 11816a0da736SJayanth Dodderi Chidanand ENABLE_BTI \ 11826a0da736SJayanth Dodderi Chidanand ENABLE_PAUTH \ 1183d23acc9eSAndre Przywara ENABLE_FEAT_AMU \ 11846a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_AMUv1p1 \ 11856a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_CSV2_2 \ 11866a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_DIT \ 11876a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_ECV \ 11886a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_FGT \ 11896a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_HCX \ 11906a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_PAN \ 11916a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_RNG \ 1192ff86e0b4SJuan Pablo Conde ENABLE_FEAT_RNG_TRAP \ 11936a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_SEL2 \ 1194d3331603SMark Brown ENABLE_FEAT_TCR2 \ 1195062b6c6bSMark Brown ENABLE_FEAT_S2PIE \ 1196062b6c6bSMark Brown ENABLE_FEAT_S1PIE \ 1197062b6c6bSMark Brown ENABLE_FEAT_S2POE \ 1198062b6c6bSMark Brown ENABLE_FEAT_S1POE \ 1199688ab57bSMark Brown ENABLE_FEAT_GCS \ 12006a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_VHE \ 12016a0da736SJayanth Dodderi Chidanand ENABLE_MPAM_FOR_LOWER_ELS \ 12026a0da736SJayanth Dodderi Chidanand ENABLE_RME \ 12036437a09aSAndre Przywara ENABLE_SPE_FOR_NS \ 1204603a0c6fSAndre Przywara ENABLE_SYS_REG_TRACE_FOR_NS \ 120545007acdSJayanth Dodderi Chidanand ENABLE_SME_FOR_NS \ 120603d3c0d7SJayanth Dodderi Chidanand ENABLE_SME2_FOR_NS \ 12072b0bc4e0SJayanth Dodderi Chidanand ENABLE_SVE_FOR_NS \ 12086a0da736SJayanth Dodderi Chidanand ENABLE_TRF_FOR_NS \ 1209327131c4SLeonardo Sandoval FW_ENC_STATUS \ 12105357f83dSManish V Badarkhe NR_OF_FW_BANKS \ 12115357f83dSManish V Badarkhe NR_OF_IMAGES_IN_FW_BANK \ 12126a0da736SJayanth Dodderi Chidanand RAS_EXTENSION \ 1213781d07a4SJayanth Dodderi Chidanand TWED_DELAY \ 1214781d07a4SJayanth Dodderi Chidanand ENABLE_FEAT_TWED \ 1215bebcf27fSMark Brown SVE_VECTOR_LEN \ 12160ed3be6fSVarun Wadekar IMPDEF_SYSREG_TRAP \ 1217327131c4SLeonardo Sandoval))) 1218c877b414SJeenu Viswambharan 1219aacff749SJustin Chadwellifdef KEY_SIZE 1220aacff749SJustin Chadwell $(eval $(call assert_numeric,KEY_SIZE)) 1221aacff749SJustin Chadwellendif 1222aacff749SJustin Chadwell 12231f461979SJustin Chadwellifeq ($(filter $(SANITIZE_UB), on off trap),) 12241f461979SJustin Chadwell $(error "Invalid value for SANITIZE_UB: can be one of on, off, trap") 12251f461979SJustin Chadwellendif 12261f461979SJustin Chadwell 122773c99d4eSJuan Castillo################################################################################ 122873c99d4eSJuan Castillo# Add definitions to the cpp preprocessor based on the current build options. 122973c99d4eSJuan Castillo# This is done after including the platform specific makefile to allow the 123073c99d4eSJuan Castillo# platform to overwrite the default options 123173c99d4eSJuan Castillo################################################################################ 123273c99d4eSJuan Castillo 1233327131c4SLeonardo Sandoval$(eval $(call add_defines,\ 1234327131c4SLeonardo Sandoval $(sort \ 1235327131c4SLeonardo Sandoval ALLOW_RO_XLAT_TABLES \ 1236327131c4SLeonardo Sandoval ARM_ARCH_MAJOR \ 1237327131c4SLeonardo Sandoval ARM_ARCH_MINOR \ 123846789a7cSBalint Dobszay BL2_ENABLE_SP_LOAD \ 1239327131c4SLeonardo Sandoval COLD_BOOT_SINGLE_CPU \ 1240327131c4SLeonardo Sandoval CTX_INCLUDE_AARCH32_REGS \ 1241327131c4SLeonardo Sandoval CTX_INCLUDE_FPREGS \ 1242327131c4SLeonardo Sandoval CTX_INCLUDE_PAUTH_REGS \ 1243327131c4SLeonardo Sandoval EL3_EXCEPTION_HANDLING \ 1244327131c4SLeonardo Sandoval CTX_INCLUDE_MTE_REGS \ 1245327131c4SLeonardo Sandoval CTX_INCLUDE_EL2_REGS \ 1246062f8aafSArunachalam Ganapathy CTX_INCLUDE_NEVE_REGS \ 1247327131c4SLeonardo Sandoval DECRYPTION_SUPPORT_${DECRYPTION_SUPPORT} \ 12480063dd17SJavier Almansa Sobrino DISABLE_MTPMU \ 1249d23acc9eSAndre Przywara ENABLE_FEAT_AMU \ 12501fd685a7SChris Kay ENABLE_AMU_AUXILIARY_COUNTERS \ 1251742ca230SChris Kay ENABLE_AMU_FCONF \ 1252873d4241Sjohpow01 AMU_RESTRICT_COUNTERS \ 1253327131c4SLeonardo Sandoval ENABLE_ASSERTIONS \ 1254327131c4SLeonardo Sandoval ENABLE_BTI \ 1255327131c4SLeonardo Sandoval ENABLE_MPAM_FOR_LOWER_ELS \ 1256327131c4SLeonardo Sandoval ENABLE_PAUTH \ 1257327131c4SLeonardo Sandoval ENABLE_PIE \ 1258327131c4SLeonardo Sandoval ENABLE_PMF \ 1259327131c4SLeonardo Sandoval ENABLE_PSCI_STAT \ 12605b18de09SZelalem Aweke ENABLE_RME \ 1261327131c4SLeonardo Sandoval ENABLE_RUNTIME_INSTRUMENTATION \ 1262dc78e62dSjohpow01 ENABLE_SME_FOR_NS \ 126303d3c0d7SJayanth Dodderi Chidanand ENABLE_SME2_FOR_NS \ 1264dc78e62dSjohpow01 ENABLE_SME_FOR_SWD \ 126590118bb5SAndre Przywara ENABLE_SPE_FOR_NS \ 1266327131c4SLeonardo Sandoval ENABLE_SVE_FOR_NS \ 12670c5e7d1cSMax Shvetsov ENABLE_SVE_FOR_SWD \ 1268327131c4SLeonardo Sandoval ENCRYPT_BL31 \ 1269327131c4SLeonardo Sandoval ENCRYPT_BL32 \ 1270327131c4SLeonardo Sandoval ERROR_DEPRECATED \ 1271327131c4SLeonardo Sandoval FAULT_INJECTION_SUPPORT \ 1272327131c4SLeonardo Sandoval GICV2_G0_FOR_EL3 \ 127346cc41d5SManish Pandey HANDLE_EA_EL3_FIRST_NS \ 1274327131c4SLeonardo Sandoval HW_ASSISTED_COHERENCY \ 1275327131c4SLeonardo Sandoval LOG_LEVEL \ 1276327131c4SLeonardo Sandoval MEASURED_BOOT \ 127700e28874SManish V Badarkhe DRTM_SUPPORT \ 1278327131c4SLeonardo Sandoval NS_TIMER_SWITCH \ 1279327131c4SLeonardo Sandoval PL011_GENERIC_UART \ 1280327131c4SLeonardo Sandoval PLAT_${PLAT} \ 12810ce2072dSTamas Ban PLAT_RSS_NOT_SUPPORTED \ 1282327131c4SLeonardo Sandoval PROGRAMMABLE_RESET_ADDRESS \ 1283327131c4SLeonardo Sandoval PSCI_EXTENDED_STATE_ID \ 128464b4710bSWing Li PSCI_OS_INIT_MODE \ 1285327131c4SLeonardo Sandoval RAS_EXTENSION \ 1286327131c4SLeonardo Sandoval RESET_TO_BL31 \ 1287327131c4SLeonardo Sandoval SEPARATE_CODE_AND_RODATA \ 128896a8ed14SJiafei Pan SEPARATE_BL2_NOLOAD_REGION \ 1289327131c4SLeonardo Sandoval SEPARATE_NOBITS_REGION \ 1290327131c4SLeonardo Sandoval RECLAIM_INIT_CODE \ 1291327131c4SLeonardo Sandoval SPD_${SPD} \ 1292327131c4SLeonardo Sandoval SPIN_ON_BL1_EXIT \ 1293327131c4SLeonardo Sandoval SPM_MM \ 12941d63ae4dSMarc Bonnici SPMC_AT_EL3 \ 1295327131c4SLeonardo Sandoval SPMD_SPM_AT_SEL2 \ 1296327131c4SLeonardo Sandoval TRUSTED_BOARD_BOOT \ 1297c9c56f6eSManish V Badarkhe CRYPTO_SUPPORT \ 12987dfb9911SJimmy Brisson TRNG_SUPPORT \ 1299*ffea3844SSona Mathew ERRATA_ABI_SUPPORT \ 1300327131c4SLeonardo Sandoval USE_COHERENT_MEM \ 1301327131c4SLeonardo Sandoval USE_DEBUGFS \ 1302327131c4SLeonardo Sandoval ARM_IO_IN_DTB \ 1303327131c4SLeonardo Sandoval SDEI_IN_FCONF \ 1304327131c4SLeonardo Sandoval SEC_INT_DESC_IN_FCONF \ 1305327131c4SLeonardo Sandoval USE_ROMLIB \ 1306327131c4SLeonardo Sandoval USE_TBBR_DEFS \ 1307327131c4SLeonardo Sandoval WARMBOOT_ENABLE_DCACHE_EARLY \ 130842d4d3baSArvind Ram Prakash RESET_TO_BL2 \ 130942d4d3baSArvind Ram Prakash BL2_RUNS_AT_EL3 \ 1310327131c4SLeonardo Sandoval BL2_IN_XIP_MEM \ 1311327131c4SLeonardo Sandoval BL2_INV_DCACHE \ 1312327131c4SLeonardo Sandoval USE_SPINLOCK_CAS \ 1313327131c4SLeonardo Sandoval ERRATA_SPECULATIVE_AT \ 131400e8f79cSManish Pandey RAS_TRAP_NS_ERR_REC_ACCESS \ 1315327131c4SLeonardo Sandoval COT_DESC_IN_DTB \ 1316327131c4SLeonardo Sandoval USE_SP804_TIMER \ 131712cd65e0STomas Pilar ENABLE_FEAT_RNG \ 1318ff86e0b4SJuan Pablo Conde ENABLE_FEAT_RNG_TRAP \ 13194e04478aSChris Kay ENABLE_FEAT_SB \ 13207d33ffe4SDaniel Boulby ENABLE_FEAT_DIT \ 13215357f83dSManish V Badarkhe NR_OF_FW_BANKS \ 13225357f83dSManish V Badarkhe NR_OF_IMAGES_IN_FW_BANK \ 1323396b339dSManish V Badarkhe PSA_FWU_SUPPORT \ 1324744ad974Sjohpow01 ENABLE_BRBE_FOR_NS \ 1325813524eaSManish V Badarkhe ENABLE_TRBE_FOR_NS \ 1326d4582d30SManish V Badarkhe ENABLE_SYS_REG_TRACE_FOR_NS \ 13278fcd3d96SManish V Badarkhe ENABLE_TRF_FOR_NS \ 1328cb4ec47bSjohpow01 ENABLE_FEAT_HCX \ 132968120783SChris Kay ENABLE_MPMM \ 133068120783SChris Kay ENABLE_MPMM_FCONF \ 1331f74cb0beSJayanth Dodderi Chidanand ENABLE_FEAT_FGT \ 1332f74cb0beSJayanth Dodderi Chidanand ENABLE_FEAT_ECV \ 13331f1c0206SAbdul Halim, Muhammad Hadi Asyrafi SIMICS_BUILD \ 13346a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_AMUv1p1 \ 13356a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_SEL2 \ 13366a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_VHE \ 13376a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_CSV2_2 \ 13386a0da736SJayanth Dodderi Chidanand ENABLE_FEAT_PAN \ 1339d3331603SMark Brown ENABLE_FEAT_TCR2 \ 1340062b6c6bSMark Brown ENABLE_FEAT_S2PIE \ 1341062b6c6bSMark Brown ENABLE_FEAT_S1PIE \ 1342062b6c6bSMark Brown ENABLE_FEAT_S2POE \ 1343062b6c6bSMark Brown ENABLE_FEAT_S1POE \ 1344688ab57bSMark Brown ENABLE_FEAT_GCS \ 13456a0da736SJayanth Dodderi Chidanand FEATURE_DETECTION \ 1346781d07a4SJayanth Dodderi Chidanand TWED_DELAY \ 1347781d07a4SJayanth Dodderi Chidanand ENABLE_FEAT_TWED \ 134804c7303bSOkash Khawaja CONDITIONAL_CMO \ 13490ed3be6fSVarun Wadekar IMPDEF_SYSREG_TRAP \ 1350327131c4SLeonardo Sandoval))) 13512fae4b1eSJeenu Viswambharan 13521f461979SJustin Chadwellifeq (${SANITIZE_UB},trap) 13531f461979SJustin Chadwell $(eval $(call add_define,MONITOR_TRAPS)) 13541f461979SJustin Chadwellendif 13551f461979SJustin Chadwell 13564c117f6cSSandrine Bailleux# Define the EL3_PAYLOAD_BASE flag only if it is provided. 13574c117f6cSSandrine Bailleuxifdef EL3_PAYLOAD_BASE 13584c117f6cSSandrine Bailleux $(eval $(call add_define,EL3_PAYLOAD_BASE)) 1359cf2c8a33SAntonio Nino Diazelse 136068450a6dSAntonio Nino Diaz # Define the PRELOADED_BL33_BASE flag only if it is provided and 136168450a6dSAntonio Nino Diaz # EL3_PAYLOAD_BASE is not defined, as it has priority. 136268450a6dSAntonio Nino Diaz ifdef PRELOADED_BL33_BASE 136368450a6dSAntonio Nino Diaz $(eval $(call add_define,PRELOADED_BL33_BASE)) 13644c117f6cSSandrine Bailleux endif 1365cf2c8a33SAntonio Nino Diazendif 136673c99d4eSJuan Castillo 1367209a60ccSSoby Mathew# Define the DYN_DISABLE_AUTH flag only if set. 1368209a60ccSSoby Mathewifeq (${DYN_DISABLE_AUTH},1) 1369209a60ccSSoby Mathew$(eval $(call add_define,DYN_DISABLE_AUTH)) 1370209a60ccSSoby Mathewendif 1371209a60ccSSoby Mathew 1372c2ad38ceSVarun Wadekarifneq ($(findstring armlink,$(notdir $(LD))),) 1373c2ad38ceSVarun Wadekar$(eval $(call add_define,USE_ARM_LINK)) 1374c2ad38ceSVarun Wadekarendif 1375c2ad38ceSVarun Wadekar 1376ce2b1ec6SManish Pandey# Generate and include sp_gen.mk if SPD is spmd and SP_LAYOUT_FILE is defined 1377ce2b1ec6SManish Pandeyifeq (${SPD},spmd) 1378c33ff198SOlivier Deprezifdef SP_LAYOUT_FILE 1379ce2b1ec6SManish Pandey -include $(BUILD_PLAT)/sp_gen.mk 1380ce2b1ec6SManish Pandey FIP_DEPS += sp 138107c44475SManish Pandey CRT_DEPS += sp 1382ce2b1ec6SManish Pandey NEED_SP_PKG := yes 1383ce2b1ec6SManish Pandeyelse 1384c33ff198SOlivier Deprez ifeq (${SPMD_SPM_AT_SEL2},1) 1385c33ff198SOlivier Deprez $(error "SPMD with SPM at S-EL2 require SP_LAYOUT_FILE") 1386c33ff198SOlivier Deprez endif 1387ce2b1ec6SManish Pandeyendif 1388ce2b1ec6SManish Pandeyendif 1389ce2b1ec6SManish Pandey 139073c99d4eSJuan Castillo################################################################################ 139173c99d4eSJuan Castillo# Build targets 139273c99d4eSJuan Castillo################################################################################ 139373c99d4eSJuan Castillo 139490aa901fSSumit Garg.PHONY: all msg_start clean realclean distclean cscope locate-checkpatch checkcodebase checkpatch fiptool sptool fip sp fwu_fip certtool dtbs memmap doc enctool 139573c99d4eSJuan Castillo.SUFFIXES: 139673c99d4eSJuan Castillo 139773c99d4eSJuan Castilloall: msg_start 139873c99d4eSJuan Castillo 139973c99d4eSJuan Castillomsg_start: 140073c99d4eSJuan Castillo @echo "Building ${PLAT}" 140173c99d4eSJuan Castillo 14027a24cba5SSoby Mathewifeq (${ERROR_DEPRECATED},0) 1403d5dfdeb6SJulius Werner# Check if deprecated declarations and cpp warnings should be treated as error or not. 1404c2ad38ceSVarun Wadekarifneq ($(findstring clang,$(notdir $(CC))),) 1405c2ad38ceSVarun Wadekar CPPFLAGS += -Wno-error=deprecated-declarations 1406c2ad38ceSVarun Wadekarelse 1407bc1a03c7SDan Handley CPPFLAGS += -Wno-error=deprecated-declarations -Wno-error=cpp 14087a24cba5SSoby Mathewendif 1409d5dfdeb6SJulius Wernerendif # !ERROR_DEPRECATED 14107a24cba5SSoby Mathew 14115accce5bSRoberto Vargas$(eval $(call MAKE_LIB_DIRS)) 141261f72a34SRoberto Vargas$(eval $(call MAKE_LIB,c)) 14135fee0287SRoberto Vargas 141473c99d4eSJuan Castillo# Expand build macros for the different images 141573c99d4eSJuan Castilloifeq (${NEED_BL1},yes) 1416b34635a0SChris KayBL1_SOURCES := $(sort ${BL1_SOURCES}) 1417b34635a0SChris Kay 1418434d0491SZelalem Aweke$(eval $(call MAKE_BL,bl1)) 141973c99d4eSJuan Castilloendif 142073c99d4eSJuan Castillo 142173c99d4eSJuan Castilloifeq (${NEED_BL2},yes) 142242d4d3baSArvind Ram Prakashifeq (${RESET_TO_BL2}, 0) 1423c9b31ae8SRoberto VargasFIP_BL2_ARGS := tb-fw 1424c9b31ae8SRoberto Vargasendif 1425c9b31ae8SRoberto Vargas 1426eb1acfb6SChris KayBL2_SOURCES := $(sort ${BL2_SOURCES}) 1427eb1acfb6SChris Kay 142833950dd8SMasahiro Yamada$(if ${BL2}, $(eval $(call TOOL_ADD_IMG,bl2,--${FIP_BL2_ARGS})),\ 1429434d0491SZelalem Aweke $(eval $(call MAKE_BL,bl2,${FIP_BL2_ARGS}))) 143073c99d4eSJuan Castilloendif 143173c99d4eSJuan Castillo 14324d045d0eSMasahiro Yamadaifeq (${NEED_SCP_BL2},yes) 143333950dd8SMasahiro Yamada$(eval $(call TOOL_ADD_IMG,scp_bl2,--scp-fw)) 14344d045d0eSMasahiro Yamadaendif 14354d045d0eSMasahiro Yamada 143673c99d4eSJuan Castilloifeq (${NEED_BL31},yes) 143773c99d4eSJuan CastilloBL31_SOURCES += ${SPD_SOURCES} 143826d1e0c3SMadhukar Pappireddy# Sort BL31 source files to remove duplicates 143926d1e0c3SMadhukar PappireddyBL31_SOURCES := $(sort ${BL31_SOURCES}) 1440c6ba9b45SSumit Gargifneq (${DECRYPTION_SUPPORT},none) 1441c6ba9b45SSumit Garg$(if ${BL31}, $(eval $(call TOOL_ADD_IMG,bl31,--soc-fw,,$(ENCRYPT_BL31))),\ 1442434d0491SZelalem Aweke $(eval $(call MAKE_BL,bl31,soc-fw,,$(ENCRYPT_BL31)))) 1443c6ba9b45SSumit Gargelse 144433950dd8SMasahiro Yamada$(if ${BL31}, $(eval $(call TOOL_ADD_IMG,bl31,--soc-fw)),\ 1445434d0491SZelalem Aweke $(eval $(call MAKE_BL,bl31,soc-fw))) 144673c99d4eSJuan Castilloendif 1447c6ba9b45SSumit Gargendif 144873c99d4eSJuan Castillo 144970d1fc53SJuan Castillo# If a BL32 image is needed but neither BL32 nor BL32_SOURCES is defined, the 1450c939d13aSMasahiro Yamada# build system will call TOOL_ADD_IMG to print a warning message and abort the 145170d1fc53SJuan Castillo# process. Note that the dependency on BL32 applies to the FIP only. 145273c99d4eSJuan Castilloifeq (${NEED_BL32},yes) 145326d1e0c3SMadhukar Pappireddy# Sort BL32 source files to remove duplicates 145426d1e0c3SMadhukar PappireddyBL32_SOURCES := $(sort ${BL32_SOURCES}) 14559cd15239SMasahiro YamadaBUILD_BL32 := $(if $(BL32),,$(if $(BL32_SOURCES),1)) 14569cd15239SMasahiro Yamada 1457c6ba9b45SSumit Gargifneq (${DECRYPTION_SUPPORT},none) 1458434d0491SZelalem Aweke$(if ${BUILD_BL32}, $(eval $(call MAKE_BL,bl32,tos-fw,,$(ENCRYPT_BL32))),\ 1459c6ba9b45SSumit Garg $(eval $(call TOOL_ADD_IMG,bl32,--tos-fw,,$(ENCRYPT_BL32)))) 1460c6ba9b45SSumit Gargelse 1461434d0491SZelalem Aweke$(if ${BUILD_BL32}, $(eval $(call MAKE_BL,bl32,tos-fw)),\ 146233950dd8SMasahiro Yamada $(eval $(call TOOL_ADD_IMG,bl32,--tos-fw))) 146373c99d4eSJuan Castilloendif 1464c6ba9b45SSumit Gargendif 146573c99d4eSJuan Castillo 14665b18de09SZelalem Aweke# If RMM image is needed but RMM is not defined, Test Realm Payload (TRP) 14675b18de09SZelalem Aweke# needs to be built from RMM_SOURCES. 14685b18de09SZelalem Awekeifeq (${NEED_RMM},yes) 14695b18de09SZelalem Aweke# Sort RMM source files to remove duplicates 14705b18de09SZelalem AwekeRMM_SOURCES := $(sort ${RMM_SOURCES}) 14715b18de09SZelalem AwekeBUILD_RMM := $(if $(RMM),,$(if $(RMM_SOURCES),1)) 14725b18de09SZelalem Aweke 14735b18de09SZelalem Aweke$(if ${BUILD_RMM}, $(eval $(call MAKE_BL,rmm,rmm-fw)),\ 14745b18de09SZelalem Aweke $(eval $(call TOOL_ADD_IMG,rmm,--rmm-fw))) 14755b18de09SZelalem Awekeendif 14765b18de09SZelalem Aweke 147773c99d4eSJuan Castillo# Add the BL33 image if required by the platform 147873c99d4eSJuan Castilloifeq (${NEED_BL33},yes) 147933950dd8SMasahiro Yamada$(eval $(call TOOL_ADD_IMG,bl33,--nt-fw)) 1480db6071c9SJuan Castilloendif 1481db6071c9SJuan Castillo 14829003fa0bSYatharth Kocharifeq (${NEED_BL2U},yes) 148333950dd8SMasahiro Yamada$(if ${BL2U}, $(eval $(call TOOL_ADD_IMG,bl2u,--ap-fwu-cfg,FWU_)),\ 1484434d0491SZelalem Aweke $(eval $(call MAKE_BL,bl2u,ap-fwu-cfg,FWU_))) 14859003fa0bSYatharth Kocharendif 14869003fa0bSYatharth Kochar 148703b397a8SNishanth Menon# Expand build macros for the different images 148803b397a8SNishanth Menonifeq (${NEED_FDT},yes) 148903b397a8SNishanth Menon $(eval $(call MAKE_DTBS,$(BUILD_PLAT)/fdts,$(FDT_SOURCES))) 149003b397a8SNishanth Menonendif 149103b397a8SNishanth Menon 1492ce2b1ec6SManish Pandey# Add Secure Partition packages 1493ce2b1ec6SManish Pandeyifeq (${NEED_SP_PKG},yes) 1494ce2b1ec6SManish Pandey$(BUILD_PLAT)/sp_gen.mk: ${SP_MK_GEN} ${SP_LAYOUT_FILE} | ${BUILD_PLAT} 14951e7528ecSRuari Phipps ${Q}${PYTHON} "$<" "$@" $(filter-out $<,$^) $(BUILD_PLAT) ${COT} 1496822c7279SJ-Alvessp: $(DTBS) $(BUILD_PLAT)/sp_gen.mk $(SP_PKGS) 1497ce2b1ec6SManish Pandey @${ECHO_BLANK_LINE} 1498ce2b1ec6SManish Pandey @echo "Built SP Images successfully" 1499ce2b1ec6SManish Pandey @${ECHO_BLANK_LINE} 1500ce2b1ec6SManish Pandeyendif 1501ce2b1ec6SManish Pandey 150236eaaf37SIan Spraylocate-checkpatch: 150336eaaf37SIan Sprayifndef CHECKPATCH 150466079b04SEtienne Carriere $(error "Please set CHECKPATCH to point to the Linux checkpatch.pl file, eg: CHECKPATCH=../linux/scripts/checkpatch.pl") 150536eaaf37SIan Sprayelse 150636eaaf37SIan Sprayifeq (,$(wildcard ${CHECKPATCH})) 150766079b04SEtienne Carriere $(error "The file CHECKPATCH points to cannot be found, use eg: CHECKPATCH=../linux/scripts/checkpatch.pl") 150836eaaf37SIan Sprayendif 150936eaaf37SIan Sprayendif 151036eaaf37SIan Spray 15114f6ad66aSAchin Guptaclean: 15124f6ad66aSAchin Gupta @echo " CLEAN" 1513f1477d4aSEvan Lloyd $(call SHELL_REMOVE_DIR,${BUILD_PLAT}) 151488a1cf1eSSami Mujawarifdef UNIX_MK 15152f2cef46SJeenu Viswambharan ${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean 151688a1cf1eSSami Mujawarelse 151788a1cf1eSSami Mujawar# Clear the MAKEFLAGS as we do not want 151888a1cf1eSSami Mujawar# to pass the gnumake flags to nmake. 151988a1cf1eSSami Mujawar ${Q}set MAKEFLAGS= && ${MSVC_NMAKE} /nologo /f ${FIPTOOLPATH}/Makefile.msvc FIPTOOLPATH=$(subst /,\,$(FIPTOOLPATH)) FIPTOOL=$(subst /,\,$(FIPTOOL)) clean 152088a1cf1eSSami Mujawarendif 15216f971622SJuan Castillo ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} clean 152290aa901fSSumit Garg ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${ENCTOOLPATH} clean 15235accce5bSRoberto Vargas ${Q}${MAKE} --no-print-directory -C ${ROMLIBPATH} clean 15244f6ad66aSAchin Gupta 1525eaaeece2SJames Morrisseyrealclean distclean: 1526eaaeece2SJames Morrissey @echo " REALCLEAN" 1527f1477d4aSEvan Lloyd $(call SHELL_REMOVE_DIR,${BUILD_BASE}) 1528f1477d4aSEvan Lloyd $(call SHELL_DELETE_ALL, ${CURDIR}/cscope.*) 152988a1cf1eSSami Mujawarifdef UNIX_MK 15302f2cef46SJeenu Viswambharan ${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean 153188a1cf1eSSami Mujawarelse 153288a1cf1eSSami Mujawar# Clear the MAKEFLAGS as we do not want 153388a1cf1eSSami Mujawar# to pass the gnumake flags to nmake. 153488a1cf1eSSami Mujawar ${Q}set MAKEFLAGS= && ${MSVC_NMAKE} /nologo /f ${FIPTOOLPATH}/Makefile.msvc FIPTOOLPATH=$(subst /,\,$(FIPTOOLPATH)) FIPTOOL=$(subst /,\,$(FIPTOOL)) realclean 153588a1cf1eSSami Mujawarendif 1536e15591aaSNicolas Boulenguez ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} realclean 153790aa901fSSumit Garg ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${ENCTOOLPATH} realclean 15385accce5bSRoberto Vargas ${Q}${MAKE} --no-print-directory -C ${ROMLIBPATH} clean 15394f6ad66aSAchin Gupta 154036eaaf37SIan Spraycheckcodebase: locate-checkpatch 154136eaaf37SIan Spray @echo " CHECKING STYLE" 154236eaaf37SIan Spray @if test -d .git ; then \ 15431ef35512SPaul Beesley git ls-files | grep -E -v 'libfdt|libc|docs|\.rst' | \ 15441a41e8c1SDan Handley while read GIT_FILE ; \ 15451a41e8c1SDan Handley do ${CHECKPATCH} ${CHECKCODE_ARGS} -f $$GIT_FILE ; \ 15461a41e8c1SDan Handley done ; \ 154736eaaf37SIan Spray else \ 15481a41e8c1SDan Handley find . -type f -not -iwholename "*.git*" \ 15491a41e8c1SDan Handley -not -iwholename "*build*" \ 15501a41e8c1SDan Handley -not -iwholename "*libfdt*" \ 155161f72a34SRoberto Vargas -not -iwholename "*libc*" \ 15521a41e8c1SDan Handley -not -iwholename "*docs*" \ 15531ef35512SPaul Beesley -not -iwholename "*.rst" \ 15541a41e8c1SDan Handley -exec ${CHECKPATCH} ${CHECKCODE_ARGS} -f {} \; ; \ 155536eaaf37SIan Spray fi 155636eaaf37SIan Spray 155736eaaf37SIan Spraycheckpatch: locate-checkpatch 155836eaaf37SIan Spray @echo " CHECKING STYLE" 155902a76d5fSYann Gautier @if test -n "${CHECKPATCH_OPTS}"; then \ 156002a76d5fSYann Gautier echo " with ${CHECKPATCH_OPTS} option(s)"; \ 156102a76d5fSYann Gautier fi 156251d28937SAntonio Nino Diaz ${Q}COMMON_COMMIT=$$(git merge-base HEAD ${BASE_COMMIT}); \ 156377a0a7f1SYann Gautier for commit in `git rev-list --no-merges $$COMMON_COMMIT..HEAD`; \ 156477a0a7f1SYann Gautier do \ 156551d28937SAntonio Nino Diaz printf "\n[*] Checking style of '$$commit'\n\n"; \ 156651d28937SAntonio Nino Diaz git log --format=email "$$commit~..$$commit" \ 156702a76d5fSYann Gautier -- ${CHECK_PATHS} | \ 156802a76d5fSYann Gautier ${CHECKPATCH} ${CHECKPATCH_OPTS} - || true; \ 156951d28937SAntonio Nino Diaz git diff --format=email "$$commit~..$$commit" \ 157002a76d5fSYann Gautier -- ${CHECK_PATHS} | \ 157102a76d5fSYann Gautier ${CHECKPATCH} ${CHECKPATCH_OPTS} - || true; \ 157251d28937SAntonio Nino Diaz done 157336eaaf37SIan Spray 157473c99d4eSJuan Castillocerttool: ${CRTTOOL} 157573c99d4eSJuan Castillo 1576a9812206SPali Rohár${CRTTOOL}: FORCE 1577598b166bSLionel 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 1578f1477d4aSEvan Lloyd @${ECHO_BLANK_LINE} 15796f971622SJuan Castillo @echo "Built $@ successfully" 1580f1477d4aSEvan Lloyd @${ECHO_BLANK_LINE} 15816f971622SJuan Castillo 15826f971622SJuan Castilloifneq (${GENERATE_COT},0) 158373c99d4eSJuan Castillocertificates: ${CRT_DEPS} ${CRTTOOL} 15846f971622SJuan Castillo ${Q}${CRTTOOL} ${CRT_ARGS} 1585f1477d4aSEvan Lloyd @${ECHO_BLANK_LINE} 15866f971622SJuan Castillo @echo "Built $@ successfully" 15876f971622SJuan Castillo @echo "Certificates can be found in ${BUILD_PLAT}" 1588f1477d4aSEvan Lloyd @${ECHO_BLANK_LINE} 158973c99d4eSJuan Castilloendif 159027713fb4SSoby Mathew 159173c99d4eSJuan Castillo${BUILD_PLAT}/${FIP_NAME}: ${FIP_DEPS} ${FIPTOOL} 15924727fd13SPali Rohár $(eval ${CHECK_FIP_CMD}) 1593819281eeSdp-arm ${Q}${FIPTOOL} create ${FIP_ARGS} $@ 1594819281eeSdp-arm ${Q}${FIPTOOL} info $@ 1595f1477d4aSEvan Lloyd @${ECHO_BLANK_LINE} 15962f2cef46SJeenu Viswambharan @echo "Built $@ successfully" 1597f1477d4aSEvan Lloyd @${ECHO_BLANK_LINE} 1598f58ad36fSHarry Liebel 15990191262dSYatharth Kocharifneq (${GENERATE_COT},0) 16000191262dSYatharth Kocharfwu_certificates: ${FWU_CRT_DEPS} ${CRTTOOL} 16010191262dSYatharth Kochar ${Q}${CRTTOOL} ${FWU_CRT_ARGS} 1602052ab529SEvan Lloyd @${ECHO_BLANK_LINE} 16030191262dSYatharth Kochar @echo "Built $@ successfully" 16040191262dSYatharth Kochar @echo "FWU certificates can be found in ${BUILD_PLAT}" 1605052ab529SEvan Lloyd @${ECHO_BLANK_LINE} 16060191262dSYatharth Kocharendif 16070191262dSYatharth Kochar 16080191262dSYatharth Kochar${BUILD_PLAT}/${FWU_FIP_NAME}: ${FWU_FIP_DEPS} ${FIPTOOL} 16094727fd13SPali Rohár $(eval ${CHECK_FWU_FIP_CMD}) 1610819281eeSdp-arm ${Q}${FIPTOOL} create ${FWU_FIP_ARGS} $@ 1611819281eeSdp-arm ${Q}${FIPTOOL} info $@ 1612052ab529SEvan Lloyd @${ECHO_BLANK_LINE} 16130191262dSYatharth Kochar @echo "Built $@ successfully" 1614052ab529SEvan Lloyd @${ECHO_BLANK_LINE} 16150191262dSYatharth Kochar 161673c99d4eSJuan Castillofiptool: ${FIPTOOL} 161773c99d4eSJuan Castillofip: ${BUILD_PLAT}/${FIP_NAME} 16180191262dSYatharth Kocharfwu_fip: ${BUILD_PLAT}/${FWU_FIP_NAME} 161973c99d4eSJuan Castillo 1620a9812206SPali Rohár${FIPTOOL}: FORCE 162188a1cf1eSSami Mujawarifdef UNIX_MK 1622598b166bSLionel Debieve ${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" FIPTOOL=${FIPTOOL} OPENSSL_DIR=${OPENSSL_DIR} DEBUG=${DEBUG} V=${V} --no-print-directory -C ${FIPTOOLPATH} all 162388a1cf1eSSami Mujawarelse 162488a1cf1eSSami Mujawar# Clear the MAKEFLAGS as we do not want 162588a1cf1eSSami Mujawar# to pass the gnumake flags to nmake. 162688a1cf1eSSami Mujawar ${Q}set MAKEFLAGS= && ${MSVC_NMAKE} /nologo /f ${FIPTOOLPATH}/Makefile.msvc FIPTOOLPATH=$(subst /,\,$(FIPTOOLPATH)) FIPTOOL=$(subst /,\,$(FIPTOOL)) 162788a1cf1eSSami Mujawarendif 1628f58ad36fSHarry Liebel 1629a9812206SPali Rohárromlib.bin: libraries FORCE 1630bbb24f61SJohn 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 16315accce5bSRoberto Vargas 1632cfe83910SLouis Mayencourt# Call print_memory_map tool 1633cfe83910SLouis Mayencourtmemmap: all 1634b890b36dSLouis Mayencourt ${Q}${PYTHON} ${PRINT_MEMORY_MAP} ${BUILD_PLAT} ${INVERTED_MEMMAP} 1635cfe83910SLouis Mayencourt 16366de32378SMadhukar Pappireddydoc: 16376de32378SMadhukar Pappireddy @echo " BUILD DOCUMENTATION" 16386de32378SMadhukar Pappireddy ${Q}${MAKE} --no-print-directory -C ${DOCS_PATH} html 16396de32378SMadhukar Pappireddy 164090aa901fSSumit Gargenctool: ${ENCTOOL} 164190aa901fSSumit Garg 1642a9812206SPali Rohár${ENCTOOL}: FORCE 1643598b166bSLionel Debieve ${Q}${MAKE} PLAT=${PLAT} BUILD_INFO=0 OPENSSL_DIR=${OPENSSL_DIR} ENCTOOL=${ENCTOOL} DEBUG=${DEBUG} V=${V} --no-print-directory -C ${ENCTOOLPATH} all 164490aa901fSSumit Garg @${ECHO_BLANK_LINE} 164590aa901fSSumit Garg @echo "Built $@ successfully" 164690aa901fSSumit Garg @${ECHO_BLANK_LINE} 164790aa901fSSumit Garg 164835fab8c9SJoakim Bechcscope: 164935fab8c9SJoakim Bech @echo " CSCOPE" 165035fab8c9SJoakim Bech ${Q}find ${CURDIR} -name "*.[chsS]" > cscope.files 165135fab8c9SJoakim Bech ${Q}cscope -b -q -k 165235fab8c9SJoakim Bech 165372ee3314SRyan Harkinhelp: 16547c23126cSJohn Tsichritzis @echo "usage: ${MAKE} [PLAT=<platform>] [OPTIONS] [TARGET]" 165572ee3314SRyan Harkin @echo "" 165672ee3314SRyan Harkin @echo "PLAT is used to specify which platform you wish to build." 165708c7ed0fSSandrine Bailleux @echo "If no platform is specified, PLAT defaults to: ${DEFAULT_PLAT}" 165872ee3314SRyan Harkin @echo "" 16597c23126cSJohn Tsichritzis @echo "platform = ${PLATFORM_LIST}" 16607c23126cSJohn Tsichritzis @echo "" 16611b578596SSandrine Bailleux @echo "Please refer to the User Guide for a list of all supported options." 16621b578596SSandrine Bailleux @echo "Note that the build system doesn't track dependencies for build " 16631b578596SSandrine Bailleux @echo "options. Therefore, if any of the build options are changed " 16641b578596SSandrine Bailleux @echo "from a previous build, a clean build must be performed." 16651b578596SSandrine Bailleux @echo "" 166672ee3314SRyan Harkin @echo "Supported Targets:" 16671b578596SSandrine Bailleux @echo " all Build all individual bootloader binaries" 166836eaaf37SIan Spray @echo " bl1 Build the BL1 binary" 16698aa559c0SJeenu Viswambharan @echo " bl2 Build the BL2 binary" 16709003fa0bSYatharth Kochar @echo " bl2u Build the BL2U binary" 1671d178637dSJuan Castillo @echo " bl31 Build the BL31 binary" 16729d29c227SSoby Mathew @echo " bl32 Build the BL32 binary. If ARCH=aarch32, then " 16739d29c227SSoby Mathew @echo " this builds secure payload specified by AARCH32_SP" 167473c99d4eSJuan Castillo @echo " certificates Build the certificates (requires 'GENERATE_COT=1')" 16751b578596SSandrine Bailleux @echo " fip Build the Firmware Image Package (FIP)" 16760191262dSYatharth Kochar @echo " fwu_fip Build the FWU Firmware Image Package (FIP)" 167736eaaf37SIan Spray @echo " checkcodebase Check the coding style of the entire source tree" 167836eaaf37SIan Spray @echo " checkpatch Check the coding style on changes in the current" 167936eaaf37SIan Spray @echo " branch against BASE_COMMIT (default origin/master)" 168072ee3314SRyan Harkin @echo " clean Clean the build for the selected platform" 168135fab8c9SJoakim Bech @echo " cscope Generate cscope index" 168272ee3314SRyan Harkin @echo " distclean Remove all build artifacts for all platforms" 16836f971622SJuan Castillo @echo " certtool Build the Certificate generation tool" 168490aa901fSSumit Garg @echo " enctool Build the Firmware encryption tool" 1685f58ad36fSHarry Liebel @echo " fiptool Build the Firmware Image Package (FIP) creation tool" 1686ce2b1ec6SManish Pandey @echo " sp Build the Secure Partition Packages" 168726010da1SAntonio Nino Diaz @echo " sptool Build the Secure Partition Package creation tool" 168838c14d88SSoby Mathew @echo " dtbs Build the Device Tree Blobs (if required for the platform)" 1689cfe83910SLouis Mayencourt @echo " memmap Print the memory map of the built binaries" 16906de32378SMadhukar Pappireddy @echo " doc Build html based documentation using Sphinx tool" 169172ee3314SRyan Harkin @echo "" 16921b578596SSandrine Bailleux @echo "Note: most build targets require PLAT to be set to a specific platform." 169372ee3314SRyan Harkin @echo "" 169472ee3314SRyan Harkin @echo "example: build all targets for the FVP platform:" 169572ee3314SRyan Harkin @echo " CROSS_COMPILE=aarch64-none-elf- make PLAT=fvp all" 1696a9812206SPali Rohár 1697a9812206SPali Rohár.PHONY: FORCE 1698a9812206SPali RohárFORCE:; 1699