Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 1 | # |
Govindraj Raja | 24d3a4e | 2023-12-21 13:57:49 -0600 | [diff] [blame] | 2 | # Copyright (c) 2013-2024, Arm Limited and Contributors. All rights reserved. |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 3 | # |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | # SPDX-License-Identifier: BSD-3-Clause |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 5 | # |
| 6 | |
Jeenu Viswambharan | 19a0ace | 2014-05-15 14:40:58 +0100 | [diff] [blame] | 7 | # |
Juan Castillo | 04be3a5 | 2014-06-30 11:41:46 +0100 | [diff] [blame] | 8 | # Trusted Firmware Version |
| 9 | # |
Soby Mathew | d42eaee | 2018-10-01 16:16:34 +0100 | [diff] [blame] | 10 | VERSION_MAJOR := 2 |
Manish V Badarkhe | 8a7af84 | 2024-05-17 11:09:28 +0100 | [diff] [blame] | 11 | VERSION_MINOR := 11 |
Yann Gautier | 5f4cbed | 2024-02-08 18:40:27 +0100 | [diff] [blame] | 12 | # VERSION_PATCH is only used for LTS releases |
| 13 | VERSION_PATCH := 0 |
Yann Gautier | 57078a9 | 2023-10-03 11:09:07 +0200 | [diff] [blame] | 14 | VERSION := ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH} |
Juan Castillo | 04be3a5 | 2014-06-30 11:41:46 +0100 | [diff] [blame] | 15 | |
Juan Castillo | 396644b | 2015-10-22 11:34:44 +0100 | [diff] [blame] | 16 | # Default goal is build all images |
| 17 | .DEFAULT_GOAL := all |
| 18 | |
Douglas Raillard | 527cd90 | 2016-12-28 14:47:50 +0000 | [diff] [blame] | 19 | # Avoid any implicit propagation of command line variable definitions to |
| 20 | # sub-Makefiles, like CFLAGS that we reserved for the firmware images' |
| 21 | # usage. Other command line options like "-s" are still propagated as usual. |
| 22 | MAKEOVERRIDES = |
| 23 | |
Evan Lloyd | f269714 | 2015-12-02 18:17:37 +0000 | [diff] [blame] | 24 | MAKE_HELPERS_DIRECTORY := make_helpers/ |
| 25 | include ${MAKE_HELPERS_DIRECTORY}build_macros.mk |
Evan Lloyd | a71d259 | 2015-12-02 18:56:06 +0000 | [diff] [blame] | 26 | include ${MAKE_HELPERS_DIRECTORY}build_env.mk |
Chris Kay | 1559f64 | 2024-06-04 00:04:48 +0000 | [diff] [blame] | 27 | include ${MAKE_HELPERS_DIRECTORY}build-rules.mk |
Chris Kay | 1870c72 | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 28 | include ${MAKE_HELPERS_DIRECTORY}common.mk |
Juan Castillo | a3487d1 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 29 | |
| 30 | ################################################################################ |
Jeenu Viswambharan | 615ff39 | 2016-10-24 14:31:51 +0100 | [diff] [blame] | 31 | # Default values for build configurations, and their dependencies |
Juan Castillo | a3487d1 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 32 | ################################################################################ |
Jeenu Viswambharan | 19a0ace | 2014-05-15 14:40:58 +0100 | [diff] [blame] | 33 | |
Jeenu Viswambharan | 615ff39 | 2016-10-24 14:31:51 +0100 | [diff] [blame] | 34 | include ${MAKE_HELPERS_DIRECTORY}defaults.mk |
dp-arm | 3cac786 | 2016-09-19 11:18:44 +0100 | [diff] [blame] | 35 | |
Chris Kay | c8a47ba | 2023-10-20 09:17:33 +0000 | [diff] [blame] | 36 | ################################################################################ |
| 37 | # Configure the toolchains used to build TF-A and its tools |
| 38 | ################################################################################ |
| 39 | |
Chris Kay | 0adde4e | 2024-05-14 13:08:31 +0000 | [diff] [blame] | 40 | # |
| 41 | # The clean and check targets do not behave correctly if the user's environment |
| 42 | # does not appropriately configure a toolchain. While we try to find a permanent |
| 43 | # solution to this, do not try to detect any toolchains if we are building |
| 44 | # exclusively with targets which do not use any toolchain tools. |
| 45 | # |
| 46 | |
| 47 | ifeq ($(filter-out check% %clean doc %tool,$(or $(MAKECMDGOALS),all)),) |
| 48 | toolchains := |
| 49 | endif |
| 50 | |
Chris Kay | c8a47ba | 2023-10-20 09:17:33 +0000 | [diff] [blame] | 51 | include ${MAKE_HELPERS_DIRECTORY}toolchain.mk |
| 52 | |
Antonio Nino Diaz | 808c229 | 2017-04-18 15:16:05 +0100 | [diff] [blame] | 53 | # Assertions enabled for DEBUG builds by default |
Antonio Nino Diaz | 808c229 | 2017-04-18 15:16:05 +0100 | [diff] [blame] | 54 | ENABLE_ASSERTIONS := ${DEBUG} |
Jeenu Viswambharan | 615ff39 | 2016-10-24 14:31:51 +0100 | [diff] [blame] | 55 | ENABLE_PMF := ${ENABLE_RUNTIME_INSTRUMENTATION} |
| 56 | PLAT := ${DEFAULT_PLAT} |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 57 | |
Juan Castillo | a3487d1 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 58 | ################################################################################ |
| 59 | # Checkpatch script options |
| 60 | ################################################################################ |
| 61 | |
Sandrine Bailleux | 0b5a158 | 2016-06-02 11:19:59 +0100 | [diff] [blame] | 62 | CHECKCODE_ARGS := --no-patch |
Dan Handley | d7b59e4 | 2016-06-02 17:15:13 +0100 | [diff] [blame] | 63 | # Do not check the coding style on imported library files or documentation files |
Gilad Ben-Yossef | 033327a | 2019-05-15 09:24:04 +0300 | [diff] [blame] | 64 | INC_DRV_DIRS_TO_CHECK := $(sort $(filter-out \ |
| 65 | include/drivers/arm, \ |
| 66 | $(wildcard include/drivers/*))) |
Dan Handley | d7b59e4 | 2016-06-02 17:15:13 +0100 | [diff] [blame] | 67 | INC_LIB_DIRS_TO_CHECK := $(sort $(filter-out \ |
Dan Handley | 3a35571 | 2016-06-02 18:21:02 +0100 | [diff] [blame] | 68 | include/lib/libfdt \ |
Roberto Vargas | 0f8f985 | 2018-05-08 10:27:10 +0100 | [diff] [blame] | 69 | include/lib/libc, \ |
Dan Handley | d7b59e4 | 2016-06-02 17:15:13 +0100 | [diff] [blame] | 70 | $(wildcard include/lib/*))) |
| 71 | INC_DIRS_TO_CHECK := $(sort $(filter-out \ |
Gilad Ben-Yossef | 033327a | 2019-05-15 09:24:04 +0300 | [diff] [blame] | 72 | include/lib \ |
| 73 | include/drivers, \ |
Dan Handley | d7b59e4 | 2016-06-02 17:15:13 +0100 | [diff] [blame] | 74 | $(wildcard include/*))) |
| 75 | LIB_DIRS_TO_CHECK := $(sort $(filter-out \ |
dp-arm | e3cc838 | 2017-05-04 12:15:35 +0100 | [diff] [blame] | 76 | lib/compiler-rt \ |
Antonio Nino Diaz | d84f88e | 2017-01-16 17:20:45 +0000 | [diff] [blame] | 77 | lib/libfdt% \ |
Roberto Vargas | 0f8f985 | 2018-05-08 10:27:10 +0100 | [diff] [blame] | 78 | lib/libc, \ |
Daniel Boulby | 958f1dd | 2022-10-05 11:05:22 +0100 | [diff] [blame] | 79 | lib/zlib \ |
Dan Handley | d7b59e4 | 2016-06-02 17:15:13 +0100 | [diff] [blame] | 80 | $(wildcard lib/*))) |
| 81 | ROOT_DIRS_TO_CHECK := $(sort $(filter-out \ |
| 82 | lib \ |
| 83 | include \ |
| 84 | docs \ |
Paul Beesley | adfab5b | 2019-03-07 16:42:31 +0000 | [diff] [blame] | 85 | %.rst, \ |
Dan Handley | d7b59e4 | 2016-06-02 17:15:13 +0100 | [diff] [blame] | 86 | $(wildcard *))) |
| 87 | CHECK_PATHS := ${ROOT_DIRS_TO_CHECK} \ |
| 88 | ${INC_DIRS_TO_CHECK} \ |
| 89 | ${INC_LIB_DIRS_TO_CHECK} \ |
Gilad Ben-Yossef | 033327a | 2019-05-15 09:24:04 +0300 | [diff] [blame] | 90 | ${LIB_DIRS_TO_CHECK} \ |
| 91 | ${INC_DRV_DIRS_TO_CHECK} \ |
| 92 | ${INC_ARM_DIRS_TO_CHECK} |
Ian Spray | 36eaaf3 | 2014-01-30 17:25:28 +0000 | [diff] [blame] | 93 | |
Juan Castillo | a3487d1 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 94 | ################################################################################ |
| 95 | # Process build options |
| 96 | ################################################################################ |
| 97 | |
Chris Kay | 1870c72 | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 98 | ifeq ($(verbose),) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 99 | CHECKCODE_ARGS += --no-summary --terse |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 100 | endif |
Andre Przywara | cf2bb08 | 2018-09-27 10:56:05 +0100 | [diff] [blame] | 101 | |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 102 | ################################################################################ |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 103 | # Auxiliary tools (fiptool, cert_create, etc) |
| 104 | ################################################################################ |
| 105 | |
| 106 | # Variables for use with Certificate Generation Tool |
| 107 | CRTTOOLPATH ?= tools/cert_create |
| 108 | CRTTOOL ?= ${CRTTOOLPATH}/cert_create${BIN_EXT} |
| 109 | |
| 110 | # Variables for use with Firmware Encryption Tool |
| 111 | ENCTOOLPATH ?= tools/encrypt_fw |
| 112 | ENCTOOL ?= ${ENCTOOLPATH}/encrypt_fw${BIN_EXT} |
| 113 | |
| 114 | # Variables for use with Firmware Image Package |
| 115 | FIPTOOLPATH ?= tools/fiptool |
| 116 | FIPTOOL ?= ${FIPTOOLPATH}/fiptool${BIN_EXT} |
| 117 | |
| 118 | # Variables for use with sptool |
| 119 | SPTOOLPATH ?= tools/sptool |
| 120 | SPTOOL ?= ${SPTOOLPATH}/sptool.py |
| 121 | SP_MK_GEN ?= ${SPTOOLPATH}/sp_mk_generator.py |
Karl Meakin | aba4618 | 2023-02-14 11:56:02 +0000 | [diff] [blame] | 122 | SP_DTS_LIST_FRAGMENT ?= ${BUILD_PLAT}/sp_list_fragment.dts |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 123 | |
Xialin Liu | cfc4776 | 2024-06-28 12:52:29 -0500 | [diff] [blame] | 124 | # Variables for use with Certificate Conversion (cot-dt2c) Tool |
| 125 | CERTCONVPATH ?= tools/cot_dt2c |
| 126 | |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 127 | # Variables for use with ROMLIB |
| 128 | ROMLIBPATH ?= lib/romlib |
| 129 | |
| 130 | # Variable for use with Python |
| 131 | PYTHON ?= python3 |
| 132 | |
| 133 | # Variables for use with documentation build using Sphinx tool |
| 134 | DOCS_PATH ?= docs |
| 135 | |
| 136 | ################################################################################ |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 137 | # Compiler Configuration based on ARCH_MAJOR and ARCH_MINOR flags |
Juan Castillo | a3487d1 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 138 | ################################################################################ |
Etienne Carriere | 1374fcb | 2017-11-08 13:48:40 +0100 | [diff] [blame] | 139 | ifeq (${ARM_ARCH_MAJOR},7) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 140 | target32-directive = -target arm-none-eabi |
Govindraj Raja | cd10c6e | 2023-05-30 16:52:15 -0500 | [diff] [blame] | 141 | # Will set march-directive from platform configuration |
Etienne Carriere | 1374fcb | 2017-11-08 13:48:40 +0100 | [diff] [blame] | 142 | else |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 143 | target32-directive = -target armv8a-none-eabi |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 144 | endif #(ARM_ARCH_MAJOR) |
| 145 | |
| 146 | ################################################################################ |
| 147 | # Get Architecture Feature Modifiers |
| 148 | ################################################################################ |
| 149 | arch-features = ${ARM_ARCH_FEATURE} |
| 150 | |
Chris Kay | cfba645 | 2023-12-04 09:55:50 +0000 | [diff] [blame] | 151 | ifneq ($(filter %-clang,$($(ARCH)-cc-id)),) |
| 152 | ifeq ($($(ARCH)-cc-id),arm-clang) |
Govindraj Raja | 6909641 | 2023-06-01 16:29:16 -0500 | [diff] [blame] | 153 | TF_CFLAGS_aarch32 := -target arm-arm-none-eabi |
| 154 | TF_CFLAGS_aarch64 := -target aarch64-arm-none-eabi |
origin | fba80d8 | 2022-01-19 16:30:14 +0000 | [diff] [blame] | 155 | else |
Govindraj Raja | 6909641 | 2023-06-01 16:29:16 -0500 | [diff] [blame] | 156 | TF_CFLAGS_aarch32 = $(target32-directive) |
| 157 | TF_CFLAGS_aarch64 := -target aarch64-elf |
origin | fba80d8 | 2022-01-19 16:30:14 +0000 | [diff] [blame] | 158 | endif |
| 159 | |
Chris Kay | cfba645 | 2023-12-04 09:55:50 +0000 | [diff] [blame] | 160 | else ifeq ($($(ARCH)-cc-id),gnu-gcc) |
Chris Kay | 00416dc | 2024-02-20 16:19:54 +0000 | [diff] [blame] | 161 | # Enable LTO only for aarch64 |
| 162 | ifeq (${ARCH},aarch64) |
| 163 | LTO_CFLAGS = $(if $(filter-out 0,$(ENABLE_LTO)),-flto) |
zelalem-aweke | d5f4527 | 2019-11-12 16:20:17 -0600 | [diff] [blame] | 164 | endif |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 165 | endif #(clang) |
dp-arm | 320e844 | 2017-05-02 12:00:08 +0100 | [diff] [blame] | 166 | |
Ahmad Fatoum | 2633cbb | 2020-02-25 11:25:08 +0100 | [diff] [blame] | 167 | # Process Debug flag |
| 168 | $(eval $(call add_define,DEBUG)) |
| 169 | ifneq (${DEBUG}, 0) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 170 | BUILD_TYPE := debug |
| 171 | TF_CFLAGS += -g -gdwarf-4 |
| 172 | ASFLAGS += -g -Wa,-gdwarf-4 |
Ahmad Fatoum | 2633cbb | 2020-02-25 11:25:08 +0100 | [diff] [blame] | 173 | |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 174 | # Use LOG_LEVEL_INFO by default for debug builds |
| 175 | LOG_LEVEL := 40 |
Ahmad Fatoum | 2633cbb | 2020-02-25 11:25:08 +0100 | [diff] [blame] | 176 | else |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 177 | BUILD_TYPE := release |
| 178 | # Use LOG_LEVEL_NOTICE by default for release builds |
| 179 | LOG_LEVEL := 20 |
| 180 | endif #(Debug) |
Ahmad Fatoum | 2633cbb | 2020-02-25 11:25:08 +0100 | [diff] [blame] | 181 | |
Peiyuan Song | 44f8f47 | 2020-04-25 16:53:43 +0800 | [diff] [blame] | 182 | # Default build string (git branch and commit) |
| 183 | ifeq (${BUILD_STRING},) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 184 | BUILD_STRING := $(shell git describe --always --dirty --tags 2> /dev/null) |
Peiyuan Song | 44f8f47 | 2020-04-25 16:53:43 +0800 | [diff] [blame] | 185 | endif |
laurenw-arm | e954f65 | 2022-07-12 10:12:05 -0500 | [diff] [blame] | 186 | VERSION_STRING := v${VERSION}(${BUILD_TYPE}):${BUILD_STRING} |
Peiyuan Song | 44f8f47 | 2020-04-25 16:53:43 +0800 | [diff] [blame] | 187 | |
Antonio Nino Diaz | 80914a8 | 2018-08-08 16:28:43 +0100 | [diff] [blame] | 188 | ifeq (${AARCH32_INSTRUCTION_SET},A32) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 189 | TF_CFLAGS_aarch32 += -marm |
Antonio Nino Diaz | 80914a8 | 2018-08-08 16:28:43 +0100 | [diff] [blame] | 190 | else ifeq (${AARCH32_INSTRUCTION_SET},T32) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 191 | TF_CFLAGS_aarch32 += -mthumb |
Antonio Nino Diaz | 80914a8 | 2018-08-08 16:28:43 +0100 | [diff] [blame] | 192 | else |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 193 | $(error Error: Unknown AArch32 instruction set ${AARCH32_INSTRUCTION_SET}) |
| 194 | endif #(AARCH32_INSTRUCTION_SET) |
Antonio Nino Diaz | 80914a8 | 2018-08-08 16:28:43 +0100 | [diff] [blame] | 195 | |
Sandrine Bailleux | 1aa72ec | 2018-07-03 09:14:45 +0200 | [diff] [blame] | 196 | TF_CFLAGS_aarch32 += -mno-unaligned-access |
dp-arm | 320e844 | 2017-05-02 12:00:08 +0100 | [diff] [blame] | 197 | TF_CFLAGS_aarch64 += -mgeneral-regs-only -mstrict-align |
Soby Mathew | a194125 | 2016-05-05 14:33:33 +0100 | [diff] [blame] | 198 | |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 199 | ############################################################################## |
| 200 | # WARNINGS Configuration |
| 201 | ############################################################################### |
Justin Chadwell | e72a1eb | 2019-07-31 11:36:41 +0100 | [diff] [blame] | 202 | # General warnings |
| 203 | WARNINGS := -Wall -Wmissing-include-dirs -Wunused \ |
Yann Gautier | 94a40b6 | 2021-05-20 13:18:14 +0200 | [diff] [blame] | 204 | -Wdisabled-optimization -Wvla -Wshadow \ |
Boyan Karatotev | de4240f | 2022-11-21 14:16:43 +0000 | [diff] [blame] | 205 | -Wredundant-decls |
| 206 | # stricter warnings |
| 207 | WARNINGS += -Wextra -Wno-trigraphs |
| 208 | # too verbose for generic build |
| 209 | WARNINGS += -Wno-missing-field-initializers \ |
| 210 | -Wno-type-limits -Wno-sign-compare \ |
| 211 | # on clang this flag gets reset if -Wextra is set after it. No difference on gcc |
| 212 | WARNINGS += -Wno-unused-parameter |
Justin Chadwell | e72a1eb | 2019-07-31 11:36:41 +0100 | [diff] [blame] | 213 | |
| 214 | # Additional warnings |
Boyan Karatotev | de4240f | 2022-11-21 14:16:43 +0000 | [diff] [blame] | 215 | # Level 1 - infrequent warnings we should have none of |
| 216 | # full -Wextra |
| 217 | WARNING1 += -Wsign-compare |
| 218 | WARNING1 += -Wtype-limits |
| 219 | WARNING1 += -Wmissing-field-initializers |
Yann Gautier | 82b2f8c | 2018-12-10 18:00:26 +0100 | [diff] [blame] | 220 | |
Boyan Karatotev | de4240f | 2022-11-21 14:16:43 +0000 | [diff] [blame] | 221 | # Level 2 - problematic warnings that we want |
| 222 | # zlib, compiler-rt, coreboot, and mbdedtls blow up with these |
| 223 | # TODO: disable just for them and move into default build |
| 224 | WARNING2 += -Wold-style-definition |
| 225 | WARNING2 += -Wmissing-prototypes |
| 226 | WARNING2 += -Wmissing-format-attribute |
| 227 | # TF-A aims to comply with this eventually. Effort too large at present |
| 228 | WARNING2 += -Wundef |
Boyan Karatotev | 9c6ba59 | 2022-11-21 14:49:05 +0000 | [diff] [blame] | 229 | # currently very involved and many platforms set this off |
| 230 | WARNING2 += -Wunused-const-variable=2 |
Yann Gautier | 82b2f8c | 2018-12-10 18:00:26 +0100 | [diff] [blame] | 231 | |
Boyan Karatotev | de4240f | 2022-11-21 14:16:43 +0000 | [diff] [blame] | 232 | # Level 3 - very pedantic, frequently ignored |
Yann Gautier | 82b2f8c | 2018-12-10 18:00:26 +0100 | [diff] [blame] | 233 | WARNING3 := -Wbad-function-cast |
Boyan Karatotev | de4240f | 2022-11-21 14:16:43 +0000 | [diff] [blame] | 234 | WARNING3 += -Waggregate-return |
| 235 | WARNING3 += -Wnested-externs |
| 236 | WARNING3 += -Wcast-align |
Yann Gautier | 82b2f8c | 2018-12-10 18:00:26 +0100 | [diff] [blame] | 237 | WARNING3 += -Wcast-qual |
| 238 | WARNING3 += -Wconversion |
| 239 | WARNING3 += -Wpacked |
Yann Gautier | 82b2f8c | 2018-12-10 18:00:26 +0100 | [diff] [blame] | 240 | WARNING3 += -Wpointer-arith |
Yann Gautier | 82b2f8c | 2018-12-10 18:00:26 +0100 | [diff] [blame] | 241 | WARNING3 += -Wswitch-default |
Yann Gautier | 82b2f8c | 2018-12-10 18:00:26 +0100 | [diff] [blame] | 242 | |
Boyan Karatotev | de4240f | 2022-11-21 14:16:43 +0000 | [diff] [blame] | 243 | # Setting W is quite verbose and most warnings will be pre-existing issues |
| 244 | # outside of the contributor's control. Don't fail the build on them so warnings |
| 245 | # can be seen and hopefully addressed |
| 246 | ifdef W |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 247 | ifneq (${W},0) |
| 248 | E ?= 0 |
| 249 | endif |
Boyan Karatotev | de4240f | 2022-11-21 14:16:43 +0000 | [diff] [blame] | 250 | endif |
| 251 | |
Yann Gautier | 82b2f8c | 2018-12-10 18:00:26 +0100 | [diff] [blame] | 252 | ifeq (${W},1) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 253 | WARNINGS += $(WARNING1) |
Yann Gautier | 82b2f8c | 2018-12-10 18:00:26 +0100 | [diff] [blame] | 254 | else ifeq (${W},2) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 255 | WARNINGS += $(WARNING1) $(WARNING2) |
Yann Gautier | 82b2f8c | 2018-12-10 18:00:26 +0100 | [diff] [blame] | 256 | else ifeq (${W},3) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 257 | WARNINGS += $(WARNING1) $(WARNING2) $(WARNING3) |
| 258 | endif #(W) |
Yann Gautier | 82b2f8c | 2018-12-10 18:00:26 +0100 | [diff] [blame] | 259 | |
Justin Chadwell | e72a1eb | 2019-07-31 11:36:41 +0100 | [diff] [blame] | 260 | # Compiler specific warnings |
Chris Kay | cfba645 | 2023-12-04 09:55:50 +0000 | [diff] [blame] | 261 | ifeq ($(filter %-clang,$($(ARCH)-cc-id)),) |
Justin Chadwell | 7a91423 | 2019-07-03 14:15:56 +0100 | [diff] [blame] | 262 | # not using clang |
Justin Chadwell | 42d18ca | 2019-09-18 14:13:42 +0100 | [diff] [blame] | 263 | WARNINGS += -Wunused-but-set-variable -Wmaybe-uninitialized \ |
| 264 | -Wpacked-bitfield-compat -Wshift-overflow=2 \ |
| 265 | -Wlogical-op |
Govindraj Raja | aa8ef3f | 2023-05-05 09:09:36 -0500 | [diff] [blame] | 266 | |
| 267 | # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105523 |
| 268 | TF_CFLAGS += $(call cc_option, --param=min-pagesize=0) |
| 269 | |
Bipin Ravi | e53e6ae | 2023-09-28 13:17:24 -0500 | [diff] [blame] | 270 | ifeq ($(HARDEN_SLS), 1) |
| 271 | TF_CFLAGS_aarch64 += $(call cc_option, -mharden-sls=all) |
| 272 | endif |
| 273 | |
Justin Chadwell | 7a91423 | 2019-07-03 14:15:56 +0100 | [diff] [blame] | 274 | else |
| 275 | # using clang |
Justin Chadwell | 42d18ca | 2019-09-18 14:13:42 +0100 | [diff] [blame] | 276 | WARNINGS += -Wshift-overflow -Wshift-sign-overflow \ |
| 277 | -Wlogical-op-parentheses |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 278 | endif #(Clang Warning) |
Ambroise Vincent | 067e4d9 | 2019-05-24 12:47:43 +0100 | [diff] [blame] | 279 | |
Yann Gautier | 957c353 | 2018-12-10 18:08:53 +0100 | [diff] [blame] | 280 | ifneq (${E},0) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 281 | ERRORS := -Werror |
| 282 | endif #(E) |
Yann Gautier | 957c353 | 2018-12-10 18:08:53 +0100 | [diff] [blame] | 283 | |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 284 | ################################################################################ |
| 285 | # Compiler and Linker Directives |
| 286 | ################################################################################ |
Justin Chadwell | e72a1eb | 2019-07-31 11:36:41 +0100 | [diff] [blame] | 287 | CPPFLAGS = ${DEFINES} ${INCLUDES} ${MBEDTLS_INC} -nostdinc \ |
| 288 | $(ERRORS) $(WARNINGS) |
Govindraj Raja | cd10c6e | 2023-05-30 16:52:15 -0500 | [diff] [blame] | 289 | ASFLAGS += $(CPPFLAGS) \ |
Julius Werner | 53456fc | 2019-07-09 13:49:11 -0700 | [diff] [blame] | 290 | -ffreestanding -Wa,--fatal-warnings |
Masahiro Yamada | 0dec9fa | 2016-12-22 12:51:53 +0900 | [diff] [blame] | 291 | TF_CFLAGS += $(CPPFLAGS) $(TF_CFLAGS_$(ARCH)) \ |
Samuel Holland | 23f5e54 | 2019-10-20 16:11:25 -0500 | [diff] [blame] | 292 | -ffunction-sections -fdata-sections \ |
| 293 | -ffreestanding -fno-builtin -fno-common \ |
| 294 | -Os -std=gnu99 |
Juan Castillo | a3487d1 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 295 | |
Justin Chadwell | 83e0488 | 2019-08-20 11:01:52 +0100 | [diff] [blame] | 296 | ifeq (${SANITIZE_UB},on) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 297 | TF_CFLAGS += -fsanitize=undefined -fno-sanitize-recover |
| 298 | endif #(${SANITIZE_UB},on) |
| 299 | |
Justin Chadwell | 83e0488 | 2019-08-20 11:01:52 +0100 | [diff] [blame] | 300 | ifeq (${SANITIZE_UB},trap) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 301 | TF_CFLAGS += -fsanitize=undefined -fno-sanitize-recover \ |
Justin Chadwell | 83e0488 | 2019-08-20 11:01:52 +0100 | [diff] [blame] | 302 | -fsanitize-undefined-trap-on-error |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 303 | endif #(${SANITIZE_UB},trap) |
Justin Chadwell | 83e0488 | 2019-08-20 11:01:52 +0100 | [diff] [blame] | 304 | |
Chris Kay | 0adde4e | 2024-05-14 13:08:31 +0000 | [diff] [blame] | 305 | GCC_V_OUTPUT := $(if $($(ARCH)-cc),$(shell $($(ARCH)-cc) -v 2>&1)) |
david cunado | 34ab609 | 2017-11-30 21:58:01 +0000 | [diff] [blame] | 306 | |
Marco Felsch | 24ad840 | 2022-11-09 12:59:09 +0100 | [diff] [blame] | 307 | TF_LDFLAGS += -z noexecstack |
| 308 | |
Ambroise Vincent | 05c07c5 | 2019-07-17 11:08:38 +0100 | [diff] [blame] | 309 | # LD = armlink |
Chris Kay | cfba645 | 2023-12-04 09:55:50 +0000 | [diff] [blame] | 310 | ifeq ($($(ARCH)-ld-id),arm-link) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 311 | TF_LDFLAGS += --diag_error=warning --lto_level=O1 |
| 312 | TF_LDFLAGS += --remove --info=unused,unusedsymbols |
| 313 | TF_LDFLAGS += $(TF_LDFLAGS_$(ARCH)) |
Ambroise Vincent | 05c07c5 | 2019-07-17 11:08:38 +0100 | [diff] [blame] | 314 | |
| 315 | # LD = gcc (used when GCC LTO is enabled) |
Chris Kay | cfba645 | 2023-12-04 09:55:50 +0000 | [diff] [blame] | 316 | else ifeq ($($(ARCH)-ld-id),gnu-gcc) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 317 | # Pass ld options with Wl or Xlinker switches |
Chris Kay | b0fe96f | 2024-01-16 11:53:35 +0000 | [diff] [blame] | 318 | TF_LDFLAGS += $(call ld_option,-Xlinker --no-warn-rwx-segments) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 319 | TF_LDFLAGS += -Wl,--fatal-warnings -O1 |
| 320 | TF_LDFLAGS += -Wl,--gc-sections |
Chris Kay | 73b1f40 | 2022-12-22 13:26:37 +0000 | [diff] [blame] | 321 | |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 322 | TF_LDFLAGS += -Wl,-z,common-page-size=4096 #Configure page size constants |
| 323 | TF_LDFLAGS += -Wl,-z,max-page-size=4096 |
Andrey Skvortsov | e2ebb72 | 2023-09-05 23:06:29 +0300 | [diff] [blame] | 324 | TF_LDFLAGS += -Wl,--build-id=none |
Chris Kay | 73b1f40 | 2022-12-22 13:26:37 +0000 | [diff] [blame] | 325 | |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 326 | ifeq ($(ENABLE_LTO),1) |
| 327 | ifeq (${ARCH},aarch64) |
| 328 | TF_LDFLAGS += -flto -fuse-linker-plugin |
Andrey Skvortsov | 664d650 | 2023-12-08 18:04:51 +0300 | [diff] [blame] | 329 | TF_LDFLAGS += -flto-partition=one |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 330 | endif |
| 331 | endif #(ENABLE_LTO) |
| 332 | |
zelalem-aweke | d5f4527 | 2019-11-12 16:20:17 -0600 | [diff] [blame] | 333 | # GCC automatically adds fix-cortex-a53-843419 flag when used to link |
| 334 | # which breaks some builds, so disable if errata fix is not explicitly enabled |
Yann Gautier | 3d73d16 | 2023-03-15 16:18:16 +0100 | [diff] [blame] | 335 | ifeq (${ARCH},aarch64) |
| 336 | ifneq (${ERRATA_A53_843419},1) |
| 337 | TF_LDFLAGS += -mno-fix-cortex-a53-843419 |
| 338 | endif |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 339 | endif |
| 340 | TF_LDFLAGS += -nostdlib |
| 341 | TF_LDFLAGS += $(subst --,-Xlinker --,$(TF_LDFLAGS_$(ARCH))) |
Ambroise Vincent | 05c07c5 | 2019-07-17 11:08:38 +0100 | [diff] [blame] | 342 | |
| 343 | # LD = gcc-ld (ld) or llvm-ld (ld.lld) or other |
Varun Wadekar | 4d034c5 | 2019-01-11 14:47:48 -0800 | [diff] [blame] | 344 | else |
Marco Felsch | 24ad840 | 2022-11-09 12:59:09 +0100 | [diff] [blame] | 345 | # With ld.bfd version 2.39 and newer new warnings are added. Skip those since we |
| 346 | # are not loaded by a elf loader. |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 347 | TF_LDFLAGS += $(call ld_option, --no-warn-rwx-segments) |
| 348 | TF_LDFLAGS += -O1 |
| 349 | TF_LDFLAGS += --gc-sections |
Chris Kay | 73b1f40 | 2022-12-22 13:26:37 +0000 | [diff] [blame] | 350 | |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 351 | TF_LDFLAGS += -z common-page-size=4096 # Configure page size constants |
| 352 | TF_LDFLAGS += -z max-page-size=4096 |
Andrey Skvortsov | e2ebb72 | 2023-09-05 23:06:29 +0300 | [diff] [blame] | 353 | TF_LDFLAGS += --build-id=none |
Chris Kay | 73b1f40 | 2022-12-22 13:26:37 +0000 | [diff] [blame] | 354 | |
Ambroise Vincent | 05c07c5 | 2019-07-17 11:08:38 +0100 | [diff] [blame] | 355 | # ld.lld doesn't recognize the errata flags, |
Yabin Cui | ed7dc51 | 2023-01-19 20:06:04 +0000 | [diff] [blame] | 356 | # therefore don't add those in that case. |
| 357 | # ld.lld reports section type mismatch warnings, |
| 358 | # therefore don't add --fatal-warnings to it. |
Chris Kay | cfba645 | 2023-12-04 09:55:50 +0000 | [diff] [blame] | 359 | ifneq ($($(ARCH)-ld-id),llvm-lld) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 360 | TF_LDFLAGS += $(TF_LDFLAGS_$(ARCH)) --fatal-warnings |
| 361 | endif |
| 362 | |
| 363 | endif #(LD = armlink) |
Juan Castillo | a3487d1 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 364 | |
| 365 | ################################################################################ |
Govindraj Raja | 0386e31 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 366 | # Setup ARCH_MAJOR/MINOR before parsing arch_features. |
| 367 | ################################################################################ |
| 368 | ifeq (${ENABLE_RME},1) |
AlexeiFedorov | 6525845 | 2024-03-13 11:53:44 +0000 | [diff] [blame] | 369 | ARM_ARCH_MAJOR := 9 |
| 370 | ARM_ARCH_MINOR := 2 |
Govindraj Raja | 0386e31 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 371 | endif |
| 372 | |
| 373 | ################################################################################ |
Juan Castillo | a3487d1 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 374 | # Common sources and include directories |
| 375 | ################################################################################ |
dp-arm | e3cc838 | 2017-05-04 12:15:35 +0100 | [diff] [blame] | 376 | include lib/compiler-rt/compiler-rt.mk |
Juan Castillo | a3487d1 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 377 | |
Chris Kay | 99b5b2e | 2024-03-08 16:08:31 +0000 | [diff] [blame] | 378 | # Allow overriding the timestamp, for example for reproducible builds, or to |
| 379 | # synchronize timestamps across multiple projects. |
| 380 | # This must be set to a C string (including quotes where applicable). |
| 381 | BUILD_MESSAGE_TIMESTAMP ?= __TIME__", "__DATE__ |
| 382 | |
| 383 | DEFINES += -DBUILD_MESSAGE_TIMESTAMP='$(BUILD_MESSAGE_TIMESTAMP)' |
| 384 | DEFINES += -DBUILD_MESSAGE_VERSION_STRING='"$(VERSION_STRING)"' |
| 385 | DEFINES += -DBUILD_MESSAGE_VERSION='"$(VERSION)"' |
| 386 | |
Juan Castillo | a3487d1 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 387 | BL_COMMON_SOURCES += common/bl_common.c \ |
Soby Mathew | aaf15f5 | 2017-09-04 11:49:29 +0100 | [diff] [blame] | 388 | common/tf_log.c \ |
Soby Mathew | a194125 | 2016-05-05 14:33:33 +0100 | [diff] [blame] | 389 | common/${ARCH}/debug.S \ |
Julius Werner | 03020da | 2018-11-27 22:10:56 -0800 | [diff] [blame] | 390 | drivers/console/multi_console.c \ |
Soby Mathew | a194125 | 2016-05-05 14:33:33 +0100 | [diff] [blame] | 391 | lib/${ARCH}/cache_helpers.S \ |
| 392 | lib/${ARCH}/misc_helpers.S \ |
Boyan Karatotev | 05504ba | 2023-02-15 13:21:50 +0000 | [diff] [blame] | 393 | lib/extensions/pmuv3/${ARCH}/pmuv3.c \ |
Soby Mathew | 2f38ce3 | 2018-02-08 17:45:12 +0000 | [diff] [blame] | 394 | plat/common/plat_bl_common.c \ |
Soby Mathew | aaf15f5 | 2017-09-04 11:49:29 +0100 | [diff] [blame] | 395 | plat/common/plat_log_common.c \ |
dp-arm | 230011c | 2017-03-07 11:02:47 +0000 | [diff] [blame] | 396 | plat/common/${ARCH}/plat_common.c \ |
Soby Mathew | a194125 | 2016-05-05 14:33:33 +0100 | [diff] [blame] | 397 | plat/common/${ARCH}/platform_helpers.S \ |
Roberto Vargas | 0f8f985 | 2018-05-08 10:27:10 +0100 | [diff] [blame] | 398 | ${COMPILER_RT_SRCS} |
Ryan Harkin | d7a6b0f | 2014-01-13 14:40:13 +0000 | [diff] [blame] | 399 | |
Chris Kay | cfba645 | 2023-12-04 09:55:50 +0000 | [diff] [blame] | 400 | ifeq ($($(ARCH)-cc-id),arm-clang) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 401 | BL_COMMON_SOURCES += lib/${ARCH}/armclang_printf.S |
Antonio Nino Diaz | eea20fc | 2018-08-16 15:42:44 +0100 | [diff] [blame] | 402 | endif |
| 403 | |
Justin Chadwell | 83e0488 | 2019-08-20 11:01:52 +0100 | [diff] [blame] | 404 | ifeq (${SANITIZE_UB},on) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 405 | BL_COMMON_SOURCES += plat/common/ubsan.c |
Justin Chadwell | 83e0488 | 2019-08-20 11:01:52 +0100 | [diff] [blame] | 406 | endif |
| 407 | |
Yann Gautier | 2cf1dbc | 2018-06-18 16:00:23 +0200 | [diff] [blame] | 408 | INCLUDES += -Iinclude \ |
Antonio Nino Diaz | 8d1ade6 | 2018-12-17 17:20:57 +0000 | [diff] [blame] | 409 | -Iinclude/arch/${ARCH} \ |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 410 | -Iinclude/lib/cpus/${ARCH} \ |
| 411 | -Iinclude/lib/el3_runtime/${ARCH} \ |
| 412 | ${PLAT_INCLUDES} \ |
| 413 | ${SPD_INCLUDES} |
| 414 | |
Nishant Sharma | 331b568 | 2022-08-15 16:37:07 +0100 | [diff] [blame] | 415 | DTC_FLAGS += -I dts -O dtb |
| 416 | DTC_CPPFLAGS += -P -nostdinc $(INCLUDES) -Ifdts -undef \ |
| 417 | -x assembler-with-cpp $(DEFINES) |
| 418 | |
Antonio Nino Diaz | c3a2cf2 | 2018-11-19 11:48:30 +0000 | [diff] [blame] | 419 | include common/backtrace/backtrace.mk |
| 420 | |
Juan Castillo | a3487d1 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 421 | ################################################################################ |
Govindraj Raja | 1a21129 | 2023-09-20 14:32:24 -0500 | [diff] [blame] | 422 | # Generic definitions |
| 423 | ################################################################################ |
| 424 | include ${MAKE_HELPERS_DIRECTORY}plat_helpers.mk |
| 425 | |
| 426 | ifeq (${BUILD_BASE},) |
| 427 | BUILD_BASE := ./build |
| 428 | endif |
| 429 | BUILD_PLAT := $(abspath ${BUILD_BASE})/${PLAT}/${BUILD_TYPE} |
| 430 | |
| 431 | SPDS := $(sort $(filter-out none, $(patsubst services/spd/%,%,$(wildcard services/spd/*)))) |
| 432 | |
| 433 | # Platforms providing their own TBB makefile may override this value |
| 434 | INCLUDE_TBBR_MK := 1 |
| 435 | |
| 436 | ################################################################################ |
| 437 | # Include SPD Makefile if one has been specified |
| 438 | ################################################################################ |
| 439 | |
| 440 | ifneq (${SPD},none) |
| 441 | ifeq (${ARCH},aarch32) |
| 442 | $(error "Error: SPD is incompatible with AArch32.") |
| 443 | endif |
| 444 | |
| 445 | ifdef EL3_PAYLOAD_BASE |
| 446 | $(warning "SPD and EL3_PAYLOAD_BASE are incompatible build options.") |
| 447 | $(warning "The SPD and its BL32 companion will be present but \ |
| 448 | ignored.") |
| 449 | endif |
| 450 | |
| 451 | ifeq (${SPD},spmd) |
| 452 | # SPMD is located in std_svc directory |
| 453 | SPD_DIR := std_svc |
| 454 | |
| 455 | ifeq ($(SPMD_SPM_AT_SEL2),1) |
| 456 | CTX_INCLUDE_EL2_REGS := 1 |
| 457 | ifeq ($(SPMC_AT_EL3),1) |
| 458 | $(error SPM cannot be enabled in both S-EL2 and EL3.) |
| 459 | endif |
| 460 | endif |
| 461 | |
| 462 | ifeq ($(findstring optee_sp,$(ARM_SPMC_MANIFEST_DTS)),optee_sp) |
| 463 | DTC_CPPFLAGS += -DOPTEE_SP_FW_CONFIG |
| 464 | endif |
| 465 | |
Arunachalam Ganapathy | fd29d58 | 2022-04-11 14:36:54 +0100 | [diff] [blame] | 466 | ifeq ($(findstring trusty_sp,$(ARM_SPMC_MANIFEST_DTS)),trusty_sp) |
| 467 | DTC_CPPFLAGS += -DTRUSTY_SP_FW_CONFIG |
| 468 | endif |
| 469 | |
Govindraj Raja | 1a21129 | 2023-09-20 14:32:24 -0500 | [diff] [blame] | 470 | ifeq ($(TS_SP_FW_CONFIG),1) |
Arunachalam Ganapathy | fd29d58 | 2022-04-11 14:36:54 +0100 | [diff] [blame] | 471 | DTC_CPPFLAGS += -DTS_SP_FW_CONFIG |
Govindraj Raja | 1a21129 | 2023-09-20 14:32:24 -0500 | [diff] [blame] | 472 | endif |
| 473 | |
| 474 | ifneq ($(ARM_BL2_SP_LIST_DTS),) |
| 475 | DTC_CPPFLAGS += -DARM_BL2_SP_LIST_DTS=$(ARM_BL2_SP_LIST_DTS) |
| 476 | endif |
| 477 | |
| 478 | ifneq ($(SP_LAYOUT_FILE),) |
| 479 | BL2_ENABLE_SP_LOAD := 1 |
| 480 | endif |
Govindraj Raja | bad835a | 2023-10-31 14:48:11 -0500 | [diff] [blame] | 481 | |
| 482 | ifeq ($(SPMC_AT_EL3_SEL0_SP),1) |
| 483 | ifneq ($(SPMC_AT_EL3),1) |
| 484 | $(error SEL0 SP cannot be enabled without SPMC at EL3) |
| 485 | endif |
| 486 | endif |
Govindraj Raja | 1a21129 | 2023-09-20 14:32:24 -0500 | [diff] [blame] | 487 | else |
| 488 | # All other SPDs in spd directory |
| 489 | SPD_DIR := spd |
| 490 | endif #(SPD) |
| 491 | |
| 492 | # We expect to locate an spd.mk under the specified SPD directory |
| 493 | SPD_MAKE := $(wildcard services/${SPD_DIR}/${SPD}/${SPD}.mk) |
| 494 | |
| 495 | ifeq (${SPD_MAKE},) |
| 496 | $(error Error: No services/${SPD_DIR}/${SPD}/${SPD}.mk located) |
| 497 | endif |
| 498 | $(info Including ${SPD_MAKE}) |
| 499 | include ${SPD_MAKE} |
| 500 | |
| 501 | # If there's BL32 companion for the chosen SPD, we expect that the SPD's |
| 502 | # Makefile would set NEED_BL32 to "yes". In this case, the build system |
| 503 | # supports two mutually exclusive options: |
| 504 | # * BL32 is built from source: then BL32_SOURCES must contain the list |
| 505 | # of source files to build BL32 |
| 506 | # * BL32 is a prebuilt binary: then BL32 must point to the image file |
| 507 | # that will be included in the FIP |
| 508 | # If both BL32_SOURCES and BL32 are defined, the binary takes precedence |
| 509 | # over the sources. |
| 510 | endif #(SPD=none) |
| 511 | |
| 512 | ifeq (${ENABLE_SPMD_LP}, 1) |
| 513 | ifneq (${SPD},spmd) |
| 514 | $(error Error: ENABLE_SPMD_LP requires SPD=spmd.) |
| 515 | endif |
| 516 | ifeq ($(SPMC_AT_EL3),1) |
| 517 | $(error SPMC at EL3 not supported when enabling SPMD Logical partitions.) |
| 518 | endif |
| 519 | endif |
| 520 | |
| 521 | ################################################################################ |
Govindraj Raja | 0386e31 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 522 | # Process BRANCH_PROTECTION value and set |
| 523 | # Pointer Authentication and Branch Target Identification flags |
| 524 | ################################################################################ |
| 525 | ifeq (${BRANCH_PROTECTION},0) |
| 526 | # Default value turns off all types of branch protection |
| 527 | BP_OPTION := none |
| 528 | else ifneq (${ARCH},aarch64) |
| 529 | $(error BRANCH_PROTECTION requires AArch64) |
| 530 | else ifeq (${BRANCH_PROTECTION},1) |
| 531 | # Enables all types of branch protection features |
| 532 | BP_OPTION := standard |
| 533 | ENABLE_BTI := 1 |
| 534 | ENABLE_PAUTH := 1 |
| 535 | else ifeq (${BRANCH_PROTECTION},2) |
| 536 | # Return address signing to its standard level |
| 537 | BP_OPTION := pac-ret |
| 538 | ENABLE_PAUTH := 1 |
| 539 | else ifeq (${BRANCH_PROTECTION},3) |
| 540 | # Extend the signing to include leaf functions |
| 541 | BP_OPTION := pac-ret+leaf |
| 542 | ENABLE_PAUTH := 1 |
| 543 | else ifeq (${BRANCH_PROTECTION},4) |
| 544 | # Turn on branch target identification mechanism |
| 545 | BP_OPTION := bti |
| 546 | ENABLE_BTI := 1 |
| 547 | else |
| 548 | $(error Unknown BRANCH_PROTECTION value ${BRANCH_PROTECTION}) |
| 549 | endif #(BRANCH_PROTECTION) |
| 550 | |
| 551 | ifeq ($(ENABLE_PAUTH),1) |
| 552 | CTX_INCLUDE_PAUTH_REGS := 1 |
| 553 | endif |
| 554 | ifneq (${BP_OPTION},none) |
| 555 | TF_CFLAGS_aarch64 += -mbranch-protection=${BP_OPTION} |
| 556 | endif #(BP_OPTION) |
| 557 | |
| 558 | # Pointer Authentication sources |
| 559 | ifeq (${ENABLE_PAUTH}, 1) |
| 560 | # arm/common/aarch64/arm_pauth.c contains a sample platform hook to complete the |
| 561 | # Pauth support. As it's not secure, it must be reimplemented for real platforms |
| 562 | BL_COMMON_SOURCES += lib/extensions/pauth/pauth_helpers.S |
| 563 | endif |
| 564 | |
Govindraj Raja | 1a21129 | 2023-09-20 14:32:24 -0500 | [diff] [blame] | 565 | ################################################################################ |
| 566 | # Include the platform specific Makefile after the SPD Makefile (the platform |
| 567 | # makefile may use all previous definitions in this file) |
| 568 | ################################################################################ |
| 569 | include ${PLAT_MAKEFILE_FULL} |
| 570 | |
| 571 | ################################################################################ |
| 572 | # Setup arch_features based on ARM_ARCH_MAJOR, ARM_ARCH_MINOR provided from |
| 573 | # platform. |
| 574 | ################################################################################ |
| 575 | include ${MAKE_HELPERS_DIRECTORY}arch_features.mk |
| 576 | |
Govindraj Raja | 0386e31 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 577 | #################################################### |
| 578 | # Enable required options for Memory Stack Tagging. |
| 579 | #################################################### |
| 580 | |
| 581 | # Currently, these options are enabled only for clang and armclang compiler. |
| 582 | ifeq (${SUPPORT_STACK_MEMTAG},yes) |
| 583 | ifdef mem_tag_arch_support |
| 584 | # Check for armclang and clang compilers |
Chris Kay | cfba645 | 2023-12-04 09:55:50 +0000 | [diff] [blame] | 585 | ifneq ($(filter %-clang,$($(ARCH)-cc-id)),) |
Govindraj Raja | 0386e31 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 586 | # Add "memtag" architecture feature modifier if not specified |
| 587 | ifeq ( ,$(findstring memtag,$(arch-features))) |
| 588 | arch-features := $(arch-features)+memtag |
| 589 | endif # memtag |
Chris Kay | cfba645 | 2023-12-04 09:55:50 +0000 | [diff] [blame] | 590 | ifeq ($($(ARCH)-cc-id),arm-clang) |
Govindraj Raja | 0386e31 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 591 | TF_CFLAGS += -mmemtag-stack |
Chris Kay | cfba645 | 2023-12-04 09:55:50 +0000 | [diff] [blame] | 592 | else ifeq ($($(ARCH)-cc-id),llvm-clang) |
Govindraj Raja | 0386e31 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 593 | TF_CFLAGS += -fsanitize=memtag |
| 594 | endif # armclang |
| 595 | endif |
| 596 | else |
| 597 | $(error "Error: stack memory tagging is not supported for \ |
| 598 | architecture ${ARCH},armv${ARM_ARCH_MAJOR}.${ARM_ARCH_MINOR}-a") |
| 599 | endif #(mem_tag_arch_support) |
| 600 | endif #(SUPPORT_STACK_MEMTAG) |
| 601 | |
| 602 | ################################################################################ |
| 603 | # RME dependent flags configuration, Enable optional features for RME. |
| 604 | ################################################################################ |
| 605 | # FEAT_RME |
| 606 | ifeq (${ENABLE_RME},1) |
Govindraj Raja | 60f5266 | 2023-10-12 16:57:46 -0500 | [diff] [blame] | 607 | # RME doesn't support BRBE |
| 608 | ENABLE_BRBE_FOR_NS := 0 |
| 609 | |
Govindraj Raja | 0386e31 | 2023-08-17 10:41:48 -0500 | [diff] [blame] | 610 | # RME doesn't support PIE |
| 611 | ifneq (${ENABLE_PIE},0) |
| 612 | $(error ENABLE_RME does not support PIE) |
| 613 | endif |
| 614 | |
| 615 | # RME doesn't support BRBE |
| 616 | ifneq (${ENABLE_BRBE_FOR_NS},0) |
| 617 | $(error ENABLE_RME does not support BRBE.) |
| 618 | endif |
| 619 | |
| 620 | # RME requires AARCH64 |
| 621 | ifneq (${ARCH},aarch64) |
| 622 | $(error ENABLE_RME requires AArch64) |
| 623 | endif |
| 624 | |
| 625 | # RME requires el2 context to be saved for now. |
| 626 | CTX_INCLUDE_EL2_REGS := 1 |
| 627 | CTX_INCLUDE_AARCH32_REGS := 0 |
| 628 | CTX_INCLUDE_PAUTH_REGS := 1 |
| 629 | |
| 630 | # RME enables CSV2_2 extension by default. |
| 631 | ENABLE_FEAT_CSV2_2 = 1 |
| 632 | endif #(FEAT_RME) |
| 633 | |
| 634 | ################################################################################ |
Zelalem Aweke | 4d37db8 | 2021-07-11 18:33:20 -0500 | [diff] [blame] | 635 | # Include rmmd Makefile if RME is enabled |
| 636 | ################################################################################ |
Zelalem Aweke | 4d37db8 | 2021-07-11 18:33:20 -0500 | [diff] [blame] | 637 | ifneq (${ENABLE_RME},0) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 638 | ifneq (${ARCH},aarch64) |
| 639 | $(error ENABLE_RME requires AArch64) |
| 640 | endif |
| 641 | ifeq ($(SPMC_AT_EL3),1) |
| 642 | $(error SPMC_AT_EL3 and ENABLE_RME cannot both be enabled.) |
| 643 | endif |
| 644 | |
| 645 | ifneq (${SPD}, none) |
| 646 | ifneq (${SPD}, spmd) |
| 647 | $(error ENABLE_RME is incompatible with SPD=${SPD}. Use SPD=spmd) |
| 648 | endif |
| 649 | endif |
Zelalem Aweke | 4d37db8 | 2021-07-11 18:33:20 -0500 | [diff] [blame] | 650 | include services/std_svc/rmmd/rmmd.mk |
| 651 | $(warning "RME is an experimental feature") |
| 652 | endif |
| 653 | |
Govindraj Raja | 1a21129 | 2023-09-20 14:32:24 -0500 | [diff] [blame] | 654 | ifeq (${CTX_INCLUDE_EL2_REGS}, 1) |
| 655 | ifeq (${SPD},none) |
| 656 | ifeq (${ENABLE_RME},0) |
| 657 | $(error CTX_INCLUDE_EL2_REGS is available only when SPD \ |
| 658 | or RME is enabled) |
| 659 | endif |
| 660 | endif |
| 661 | endif |
Jon Medhurst | 66573cb | 2014-02-13 15:19:28 +0000 | [diff] [blame] | 662 | |
Govindraj Raja | 6909641 | 2023-06-01 16:29:16 -0500 | [diff] [blame] | 663 | ################################################################################ |
| 664 | # Platform specific Makefile might provide us ARCH_MAJOR/MINOR use that to come |
| 665 | # up with appropriate march values for compiler. |
| 666 | ################################################################################ |
| 667 | include ${MAKE_HELPERS_DIRECTORY}march.mk |
| 668 | |
| 669 | TF_CFLAGS += $(march-directive) |
Govindraj Raja | 0c57247 | 2024-01-23 16:00:19 -0600 | [diff] [blame] | 670 | ASFLAGS += $(march-directive) |
Govindraj Raja | 6909641 | 2023-06-01 16:29:16 -0500 | [diff] [blame] | 671 | |
Arvind Ram Prakash | 11b9b49 | 2022-11-22 14:41:00 -0600 | [diff] [blame] | 672 | # This internal flag is common option which is set to 1 for scenarios |
| 673 | # when the BL2 is running in EL3 level. This occurs in two scenarios - |
| 674 | # 4 world system running BL2 at EL3 and two world system without BL1 running |
| 675 | # BL2 in EL3 |
| 676 | |
| 677 | ifeq (${RESET_TO_BL2},1) |
| 678 | BL2_RUNS_AT_EL3 := 1 |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 679 | ifeq (${ENABLE_RME},1) |
| 680 | $(error RESET_TO_BL2=1 and ENABLE_RME=1 configuration is not \ |
| 681 | supported at the moment.) |
| 682 | endif |
Arvind Ram Prakash | 11b9b49 | 2022-11-22 14:41:00 -0600 | [diff] [blame] | 683 | else ifeq (${ENABLE_RME},1) |
| 684 | BL2_RUNS_AT_EL3 := 1 |
| 685 | else |
| 686 | BL2_RUNS_AT_EL3 := 0 |
| 687 | endif |
| 688 | |
Manish Pandey | f90a73c | 2023-10-10 15:42:19 +0100 | [diff] [blame] | 689 | # This internal flag is set to 1 when Firmware First handling of External aborts |
| 690 | # is required by lowe ELs. Currently only NS requires this support. |
| 691 | ifeq ($(HANDLE_EA_EL3_FIRST_NS),1) |
| 692 | FFH_SUPPORT := 1 |
| 693 | else |
| 694 | FFH_SUPPORT := 0 |
| 695 | endif |
| 696 | |
Etienne Carriere | 1374fcb | 2017-11-08 13:48:40 +0100 | [diff] [blame] | 697 | ifeq (${ARM_ARCH_MAJOR},7) |
| 698 | include make_helpers/armv7-a-cpus.mk |
| 699 | endif |
| 700 | |
Masahiro Yamada | c3ca881 | 2020-01-17 13:44:37 +0900 | [diff] [blame] | 701 | PIE_FOUND := $(findstring --enable-default-pie,${GCC_V_OUTPUT}) |
| 702 | ifneq ($(PIE_FOUND),) |
| 703 | TF_CFLAGS += -fno-PIE |
Chris Kay | cfba645 | 2023-12-04 09:55:50 +0000 | [diff] [blame] | 704 | ifeq ($($(ARCH)-ld-id),gnu-gcc) |
Samuel Holland | 9286c02 | 2022-04-08 21:56:02 -0500 | [diff] [blame] | 705 | TF_LDFLAGS += -no-pie |
| 706 | endif |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 707 | endif #(PIE_FOUND) |
Masahiro Yamada | c3ca881 | 2020-01-17 13:44:37 +0900 | [diff] [blame] | 708 | |
Chris Kay | cfba645 | 2023-12-04 09:55:50 +0000 | [diff] [blame] | 709 | ifeq ($($(ARCH)-ld-id),gnu-gcc) |
Masahiro Yamada | c3ca881 | 2020-01-17 13:44:37 +0900 | [diff] [blame] | 710 | PIE_LDFLAGS += -Wl,-pie -Wl,--no-dynamic-linker |
Soby Mathew | 078f1a4 | 2018-08-28 11:13:55 +0100 | [diff] [blame] | 711 | else |
Masahiro Yamada | c3ca881 | 2020-01-17 13:44:37 +0900 | [diff] [blame] | 712 | PIE_LDFLAGS += -pie --no-dynamic-linker |
| 713 | endif |
| 714 | |
| 715 | ifeq ($(ENABLE_PIE),1) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 716 | ifeq ($(RESET_TO_BL2),1) |
| 717 | ifneq ($(BL2_IN_XIP_MEM),1) |
| 718 | BL2_CPPFLAGS += -fpie |
| 719 | BL2_CFLAGS += -fpie |
| 720 | BL2_LDFLAGS += $(PIE_LDFLAGS) |
| 721 | endif #(BL2_IN_XIP_MEM) |
| 722 | endif #(RESET_TO_BL2) |
Chris Kay | 13886c8 | 2023-02-02 14:39:03 +0000 | [diff] [blame] | 723 | BL31_CPPFLAGS += -fpie |
| 724 | BL31_CFLAGS += -fpie |
Masahiro Yamada | c3ca881 | 2020-01-17 13:44:37 +0900 | [diff] [blame] | 725 | BL31_LDFLAGS += $(PIE_LDFLAGS) |
Chris Kay | 13886c8 | 2023-02-02 14:39:03 +0000 | [diff] [blame] | 726 | |
| 727 | BL32_CPPFLAGS += -fpie |
Masahiro Yamada | de634f8 | 2020-01-17 13:45:14 +0900 | [diff] [blame] | 728 | BL32_CFLAGS += -fpie |
| 729 | BL32_LDFLAGS += $(PIE_LDFLAGS) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 730 | endif #(ENABLE_PIE) |
Soby Mathew | 078f1a4 | 2018-08-28 11:13:55 +0100 | [diff] [blame] | 731 | |
Boyan Karatotev | e7d7c27 | 2023-01-25 16:55:18 +0000 | [diff] [blame] | 732 | BL1_CPPFLAGS += -DREPORT_ERRATA=${DEBUG} |
| 733 | BL31_CPPFLAGS += -DREPORT_ERRATA=${DEBUG} |
| 734 | BL32_CPPFLAGS += -DREPORT_ERRATA=${DEBUG} |
| 735 | |
Masahiro Yamada | f144157 | 2020-04-01 14:20:58 +0900 | [diff] [blame] | 736 | BL1_CPPFLAGS += -DIMAGE_AT_EL3 |
Arvind Ram Prakash | 11b9b49 | 2022-11-22 14:41:00 -0600 | [diff] [blame] | 737 | ifeq ($(RESET_TO_BL2),1) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 738 | BL2_CPPFLAGS += -DIMAGE_AT_EL3 |
Masahiro Yamada | 003dd76 | 2020-03-26 13:18:48 +0900 | [diff] [blame] | 739 | else |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 740 | BL2_CPPFLAGS += -DIMAGE_AT_EL1 |
| 741 | endif #(RESET_TO_BL2) |
Boyan Karatotev | e7d7c27 | 2023-01-25 16:55:18 +0000 | [diff] [blame] | 742 | |
| 743 | ifeq (${ARCH},aarch64) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 744 | BL2U_CPPFLAGS += -DIMAGE_AT_EL1 |
| 745 | BL31_CPPFLAGS += -DIMAGE_AT_EL3 |
| 746 | BL32_CPPFLAGS += -DIMAGE_AT_EL1 |
Boyan Karatotev | e7d7c27 | 2023-01-25 16:55:18 +0000 | [diff] [blame] | 747 | else |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 748 | BL32_CPPFLAGS += -DIMAGE_AT_EL3 |
Masahiro Yamada | 003dd76 | 2020-03-26 13:18:48 +0900 | [diff] [blame] | 749 | endif |
| 750 | |
Sandrine Bailleux | d481759 | 2016-01-13 14:57:38 +0000 | [diff] [blame] | 751 | # Include the CPU specific operations makefile, which provides default |
| 752 | # values for all CPU errata workarounds and CPU specific optimisations. |
| 753 | # This can be overridden by the platform. |
Soby Mathew | 937488b | 2014-09-22 14:13:34 +0100 | [diff] [blame] | 754 | include lib/cpus/cpu-ops.mk |
Soby Mathew | 802f865 | 2014-08-14 16:19:29 +0100 | [diff] [blame] | 755 | |
dp-arm | cdd03cb | 2017-02-15 11:07:55 +0000 | [diff] [blame] | 756 | ################################################################################ |
| 757 | # Build `AARCH32_SP` as BL32 image for AArch32 |
| 758 | ################################################################################ |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 759 | ifeq (${ARCH},aarch32) |
| 760 | NEED_BL32 := yes |
dp-arm | cdd03cb | 2017-02-15 11:07:55 +0000 | [diff] [blame] | 761 | |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 762 | ifneq (${AARCH32_SP},none) |
| 763 | # We expect to locate an sp.mk under the specified AARCH32_SP directory |
| 764 | AARCH32_SP_MAKE := $(wildcard bl32/${AARCH32_SP}/${AARCH32_SP}.mk) |
dp-arm | cdd03cb | 2017-02-15 11:07:55 +0000 | [diff] [blame] | 765 | |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 766 | ifeq (${AARCH32_SP_MAKE},) |
| 767 | $(error Error: No bl32/${AARCH32_SP}/${AARCH32_SP}.mk located) |
| 768 | endif |
Juan Pablo Conde | 6aba3b1 | 2023-08-09 13:19:21 -0500 | [diff] [blame] | 769 | $(info Including ${AARCH32_SP_MAKE}) |
| 770 | include ${AARCH32_SP_MAKE} |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 771 | endif |
| 772 | endif #(ARCH=aarch32) |
Varun Wadekar | 3f9002c | 2019-01-31 09:22:30 -0800 | [diff] [blame] | 773 | |
| 774 | ################################################################################ |
| 775 | # Include libc if not overridden |
| 776 | ################################################################################ |
| 777 | ifeq (${OVERRIDE_LIBC},0) |
| 778 | include lib/libc/libc.mk |
dp-arm | cdd03cb | 2017-02-15 11:07:55 +0000 | [diff] [blame] | 779 | endif |
Juan Castillo | a3487d1 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 780 | |
| 781 | ################################################################################ |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 782 | # Check incompatible options and dependencies |
Antonio Nino Diaz | faf573a | 2016-02-15 14:53:10 +0000 | [diff] [blame] | 783 | ################################################################################ |
| 784 | |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 785 | # USE_DEBUGFS experimental feature recommended only in debug builds |
| 786 | ifeq (${USE_DEBUGFS},1) |
| 787 | ifeq (${DEBUG},1) |
| 788 | $(warning DEBUGFS experimental feature is enabled.) |
| 789 | else |
| 790 | $(warning DEBUGFS experimental, recommended in DEBUG builds ONLY) |
Qixiang Xu | be9bd9d | 2017-08-24 11:03:23 +0800 | [diff] [blame] | 791 | endif |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 792 | endif #(USE_DEBUGFS) |
| 793 | |
| 794 | # USE_SPINLOCK_CAS requires AArch64 build |
| 795 | ifeq (${USE_SPINLOCK_CAS},1) |
| 796 | ifneq (${ARCH},aarch64) |
| 797 | $(error USE_SPINLOCK_CAS requires AArch64) |
Qixiang Xu | be9bd9d | 2017-08-24 11:03:23 +0800 | [diff] [blame] | 798 | endif |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 799 | endif #(USE_SPINLOCK_CAS) |
| 800 | |
| 801 | # The cert_create tool cannot generate certificates individually, so we use the |
| 802 | # target 'certificates' to create them all |
| 803 | ifneq (${GENERATE_COT},0) |
| 804 | FIP_DEPS += certificates |
| 805 | FWU_FIP_DEPS += fwu_certificates |
Antonio Nino Diaz | faf573a | 2016-02-15 14:53:10 +0000 | [diff] [blame] | 806 | endif |
| 807 | |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 808 | ifneq (${DECRYPTION_SUPPORT},none) |
| 809 | ENC_ARGS += -f ${FW_ENC_STATUS} |
| 810 | ENC_ARGS += -k ${ENC_KEY} |
| 811 | ENC_ARGS += -n ${ENC_NONCE} |
| 812 | FIP_DEPS += enctool |
| 813 | FWU_FIP_DEPS += enctool |
| 814 | endif #(DECRYPTION_SUPPORT) |
| 815 | |
| 816 | ifdef EL3_PAYLOAD_BASE |
| 817 | ifdef PRELOADED_BL33_BASE |
| 818 | $(warning "PRELOADED_BL33_BASE and EL3_PAYLOAD_BASE are \ |
| 819 | incompatible build options. EL3_PAYLOAD_BASE has priority.") |
| 820 | endif |
| 821 | ifneq (${GENERATE_COT},0) |
| 822 | $(error "GENERATE_COT and EL3_PAYLOAD_BASE are incompatible \ |
| 823 | build options.") |
| 824 | endif |
| 825 | ifneq (${TRUSTED_BOARD_BOOT},0) |
| 826 | $(error "TRUSTED_BOARD_BOOT and EL3_PAYLOAD_BASE are \ |
| 827 | incompatible \ build options.") |
| 828 | endif |
| 829 | endif #(EL3_PAYLOAD_BASE) |
| 830 | |
Antonio Nino Diaz | faf573a | 2016-02-15 14:53:10 +0000 | [diff] [blame] | 831 | ifeq (${NEED_BL33},yes) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 832 | ifdef EL3_PAYLOAD_BASE |
Antonio Nino Diaz | faf573a | 2016-02-15 14:53:10 +0000 | [diff] [blame] | 833 | $(warning "BL33 image is not needed when option \ |
| 834 | BL33_PAYLOAD_BASE is used and won't be added to the FIP file.") |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 835 | endif |
| 836 | ifdef PRELOADED_BL33_BASE |
Antonio Nino Diaz | 2b8277b | 2016-04-06 17:31:57 +0100 | [diff] [blame] | 837 | $(warning "BL33 image is not needed when option \ |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 838 | PRELOADED_BL33_BASE is used and won't be added to the FIP file.") |
| 839 | endif |
| 840 | endif #(NEED_BL33) |
Antonio Nino Diaz | faf573a | 2016-02-15 14:53:10 +0000 | [diff] [blame] | 841 | |
Jeenu Viswambharan | 7ed2cbc | 2017-01-06 16:14:42 +0000 | [diff] [blame] | 842 | # When building for systems with hardware-assisted coherency, there's no need to |
| 843 | # use USE_COHERENT_MEM. Require that USE_COHERENT_MEM must be set to 0 too. |
| 844 | ifeq ($(HW_ASSISTED_COHERENCY)-$(USE_COHERENT_MEM),1-1) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 845 | $(error USE_COHERENT_MEM cannot be enabled with HW_ASSISTED_COHERENCY) |
Jeenu Viswambharan | 7ed2cbc | 2017-01-06 16:14:42 +0000 | [diff] [blame] | 846 | endif |
Yatharth Kochar | f528faf | 2016-06-28 16:58:26 +0100 | [diff] [blame] | 847 | |
Arvind Ram Prakash | 11b9b49 | 2022-11-22 14:41:00 -0600 | [diff] [blame] | 848 | #For now, BL2_IN_XIP_MEM is only supported when RESET_TO_BL2 is 1. |
| 849 | ifeq ($(RESET_TO_BL2)-$(BL2_IN_XIP_MEM),0-1) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 850 | $(error "BL2_IN_XIP_MEM is only supported when RESET_TO_BL2 is enabled") |
Jiafei Pan | 43a7bf4 | 2018-03-21 07:20:09 +0000 | [diff] [blame] | 851 | endif |
| 852 | |
Manish Pandey | d419e22 | 2023-02-13 12:39:17 +0000 | [diff] [blame] | 853 | # RAS_EXTENSION is deprecated, provide alternate build options |
Jeenu Viswambharan | 9a7ce2f | 2018-04-04 16:07:11 +0100 | [diff] [blame] | 854 | ifeq ($(RAS_EXTENSION),1) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 855 | $(error "RAS_EXTENSION is now deprecated, please use ENABLE_FEAT_RAS \ |
Manish Pandey | f90a73c | 2023-10-10 15:42:19 +0100 | [diff] [blame] | 856 | and HANDLE_EA_EL3_FIRST_NS instead") |
Manish Pandey | d419e22 | 2023-02-13 12:39:17 +0000 | [diff] [blame] | 857 | endif |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 858 | |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 859 | |
Manish Pandey | d419e22 | 2023-02-13 12:39:17 +0000 | [diff] [blame] | 860 | # When FAULT_INJECTION_SUPPORT is used, require that FEAT_RAS is enabled |
Jeenu Viswambharan | f00da74 | 2017-12-08 12:13:51 +0000 | [diff] [blame] | 861 | ifeq ($(FAULT_INJECTION_SUPPORT),1) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 862 | ifeq ($(ENABLE_FEAT_RAS),0) |
| 863 | $(error For FAULT_INJECTION_SUPPORT, ENABLE_FEAT_RAS must not be 0) |
| 864 | endif |
| 865 | endif #(FAULT_INJECTION_SUPPORT) |
Jeenu Viswambharan | f00da74 | 2017-12-08 12:13:51 +0000 | [diff] [blame] | 866 | |
Roberto Vargas | 025946a | 2018-09-24 17:20:48 +0100 | [diff] [blame] | 867 | # DYN_DISABLE_AUTH can be set only when TRUSTED_BOARD_BOOT=1 |
Soby Mathew | 9fe8804 | 2018-03-26 12:43:37 +0100 | [diff] [blame] | 868 | ifeq ($(DYN_DISABLE_AUTH), 1) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 869 | ifeq (${TRUSTED_BOARD_BOOT}, 0) |
| 870 | $(error "TRUSTED_BOARD_BOOT must be enabled for DYN_DISABLE_AUTH \ |
| 871 | to be set.") |
| 872 | endif |
| 873 | endif #(DYN_DISABLE_AUTH) |
Soby Mathew | 9fe8804 | 2018-03-26 12:43:37 +0100 | [diff] [blame] | 874 | |
Manish V Badarkhe | c9fdaf6 | 2022-06-20 15:32:38 +0100 | [diff] [blame] | 875 | ifeq ($(MEASURED_BOOT)-$(TRUSTED_BOARD_BOOT),1-1) |
| 876 | # Support authentication verification and hash calculation |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 877 | CRYPTO_SUPPORT := 3 |
Manish V Badarkhe | c9fdaf6 | 2022-06-20 15:32:38 +0100 | [diff] [blame] | 878 | else ifeq ($(DRTM_SUPPORT)-$(TRUSTED_BOARD_BOOT),1-1) |
| 879 | # Support authentication verification and hash calculation |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 880 | CRYPTO_SUPPORT := 3 |
Manish V Badarkhe | c9fdaf6 | 2022-06-20 15:32:38 +0100 | [diff] [blame] | 881 | else ifneq ($(filter 1,${MEASURED_BOOT} ${DRTM_SUPPORT}),) |
| 882 | # Support hash calculation only |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 883 | CRYPTO_SUPPORT := 2 |
Manish V Badarkhe | c9fdaf6 | 2022-06-20 15:32:38 +0100 | [diff] [blame] | 884 | else ifeq (${TRUSTED_BOARD_BOOT},1) |
| 885 | # Support authentication verification only |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 886 | CRYPTO_SUPPORT := 1 |
Manish V Badarkhe | 5181d60 | 2022-01-08 22:56:06 +0000 | [diff] [blame] | 887 | else |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 888 | CRYPTO_SUPPORT := 0 |
| 889 | endif #($(MEASURED_BOOT)-$(TRUSTED_BOARD_BOOT)) |
Manish V Badarkhe | 5181d60 | 2022-01-08 22:56:06 +0000 | [diff] [blame] | 890 | |
Balint Dobszay | d0dbd5e | 2019-12-18 15:28:00 +0100 | [diff] [blame] | 891 | # SDEI_IN_FCONF is only supported when SDEI_SUPPORT is enabled. |
| 892 | ifeq ($(SDEI_SUPPORT)-$(SDEI_IN_FCONF),0-1) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 893 | $(error "SDEI_IN_FCONF is only supported when SDEI_SUPPORT is enabled") |
Manish V Badarkhe | ad33989 | 2020-06-29 10:32:53 +0100 | [diff] [blame] | 894 | endif |
| 895 | |
Antonio Nino Diaz | 25cda67 | 2019-02-19 11:53:51 +0000 | [diff] [blame] | 896 | # If pointer authentication is used in the firmware, make sure that all the |
Alexei Fedorov | 90f2e88 | 2019-05-24 12:17:09 +0100 | [diff] [blame] | 897 | # registers associated to it are also saved and restored. |
| 898 | # Not doing it would leak the value of the keys used by EL3 to EL1 and S-EL1. |
Antonio Nino Diaz | 25cda67 | 2019-02-19 11:53:51 +0000 | [diff] [blame] | 899 | ifeq ($(ENABLE_PAUTH),1) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 900 | ifeq ($(CTX_INCLUDE_PAUTH_REGS),0) |
| 901 | $(error Pointer Authentication requires CTX_INCLUDE_PAUTH_REGS=1) |
| 902 | endif |
| 903 | endif #(ENABLE_PAUTH) |
Alexei Fedorov | 90f2e88 | 2019-05-24 12:17:09 +0100 | [diff] [blame] | 904 | |
| 905 | ifeq ($(CTX_INCLUDE_PAUTH_REGS),1) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 906 | ifneq (${ARCH},aarch64) |
| 907 | $(error CTX_INCLUDE_PAUTH_REGS requires AArch64) |
| 908 | endif |
| 909 | endif #(CTX_INCLUDE_PAUTH_REGS) |
Antonio Nino Diaz | 25cda67 | 2019-02-19 11:53:51 +0000 | [diff] [blame] | 910 | |
Jayanth Dodderi Chidanand | 9461a89 | 2022-01-17 18:57:17 +0000 | [diff] [blame] | 911 | ifeq ($(FEATURE_DETECTION),1) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 912 | $(info FEATURE_DETECTION is an experimental feature) |
| 913 | endif #(FEATURE_DETECTION) |
Jayanth Dodderi Chidanand | 9461a89 | 2022-01-17 18:57:17 +0000 | [diff] [blame] | 914 | |
Jayanth Dodderi Chidanand | cfe053a | 2022-11-08 10:31:07 +0000 | [diff] [blame] | 915 | ifneq ($(ENABLE_SME2_FOR_NS), 0) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 916 | ifeq (${ENABLE_SME_FOR_NS}, 0) |
| 917 | $(warning "ENABLE_SME2_FOR_NS requires ENABLE_SME_FOR_NS also \ |
| 918 | to be set") |
| 919 | $(warning "Forced ENABLE_SME_FOR_NS=1") |
| 920 | override ENABLE_SME_FOR_NS := 1 |
| 921 | endif |
| 922 | endif #(ENABLE_SME2_FOR_NS) |
Jayanth Dodderi Chidanand | 605419a | 2023-03-06 23:56:14 +0000 | [diff] [blame] | 923 | |
Petre-Ionut Tudor | e5a6fef | 2019-11-07 15:18:03 +0000 | [diff] [blame] | 924 | ifeq (${ARM_XLAT_TABLES_LIB_V1}, 1) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 925 | ifeq (${ALLOW_RO_XLAT_TABLES}, 1) |
| 926 | $(error "ALLOW_RO_XLAT_TABLES requires translation tables \ |
| 927 | library v2") |
| 928 | endif |
| 929 | endif #(ARM_XLAT_TABLES_LIB_V1) |
Petre-Ionut Tudor | e5a6fef | 2019-11-07 15:18:03 +0000 | [diff] [blame] | 930 | |
Sumit Garg | 392e4df | 2019-11-15 10:43:00 +0530 | [diff] [blame] | 931 | ifneq (${DECRYPTION_SUPPORT},none) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 932 | ifeq (${TRUSTED_BOARD_BOOT}, 0) |
| 933 | $(error TRUSTED_BOARD_BOOT must be enabled for DECRYPTION_SUPPORT \ |
| 934 | to be set) |
| 935 | endif |
| 936 | endif #(DECRYPTION_SUPPORT) |
Sumit Garg | 392e4df | 2019-11-15 10:43:00 +0530 | [diff] [blame] | 937 | |
johpow01 | 8186596 | 2022-01-28 17:06:20 -0600 | [diff] [blame] | 938 | # Ensure that no Aarch64-only features are enabled in Aarch32 build |
johpow01 | 9baade3 | 2021-07-08 14:14:00 -0500 | [diff] [blame] | 939 | ifeq (${ARCH},aarch32) |
johpow01 | 8186596 | 2022-01-28 17:06:20 -0600 | [diff] [blame] | 940 | |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 941 | # SME/SVE only supported on AArch64 |
| 942 | ifneq (${ENABLE_SME_FOR_NS},0) |
| 943 | $(error "ENABLE_SME_FOR_NS cannot be used with ARCH=aarch32") |
| 944 | endif |
Jayanth Dodderi Chidanand | cfe053a | 2022-11-08 10:31:07 +0000 | [diff] [blame] | 945 | |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 946 | ifeq (${ENABLE_SVE_FOR_NS},1) |
| 947 | # Warning instead of error due to CI dependency on this |
| 948 | $(error "ENABLE_SVE_FOR_NS cannot be used with ARCH=aarch32") |
| 949 | endif |
johpow01 | 8186596 | 2022-01-28 17:06:20 -0600 | [diff] [blame] | 950 | |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 951 | # BRBE is not supported in AArch32 |
| 952 | ifeq (${ENABLE_BRBE_FOR_NS},1) |
| 953 | $(error "ENABLE_BRBE_FOR_NS cannot be used with ARCH=aarch32") |
| 954 | endif |
johpow01 | 8186596 | 2022-01-28 17:06:20 -0600 | [diff] [blame] | 955 | |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 956 | # FEAT_RNG_TRAP is not supported in AArch32 |
| 957 | ifeq (${ENABLE_FEAT_RNG_TRAP},1) |
| 958 | $(error "ENABLE_FEAT_RNG_TRAP cannot be used with ARCH=aarch32") |
| 959 | endif |
| 960 | endif #(ARCH=aarch32) |
johpow01 | 9baade3 | 2021-07-08 14:14:00 -0500 | [diff] [blame] | 961 | |
Boyan Karatotev | 7f5dcc7 | 2023-03-08 16:29:26 +0000 | [diff] [blame] | 962 | ifneq (${ENABLE_SME_FOR_NS},0) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 963 | ifeq (${ENABLE_SVE_FOR_NS},0) |
| 964 | $(error "ENABLE_SME_FOR_NS requires ENABLE_SVE_FOR_NS") |
| 965 | endif |
| 966 | endif #(ENABLE_SME_FOR_NS) |
Boyan Karatotev | 7f5dcc7 | 2023-03-08 16:29:26 +0000 | [diff] [blame] | 967 | |
johpow01 | 9baade3 | 2021-07-08 14:14:00 -0500 | [diff] [blame] | 968 | # Secure SME/SVE requires the non-secure component as well |
| 969 | ifeq (${ENABLE_SME_FOR_SWD},1) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 970 | ifeq (${ENABLE_SME_FOR_NS},0) |
| 971 | $(error "ENABLE_SME_FOR_SWD requires ENABLE_SME_FOR_NS") |
| 972 | endif |
| 973 | ifeq (${ENABLE_SVE_FOR_SWD},0) |
| 974 | $(error "ENABLE_SME_FOR_SWD requires ENABLE_SVE_FOR_SWD") |
| 975 | endif |
| 976 | endif #(ENABLE_SME_FOR_SWD) |
| 977 | |
Madhukar Pappireddy | 7ff1be8 | 2024-06-17 15:28:33 -0500 | [diff] [blame] | 978 | # Enabling SVE for SWD requires enabling SVE for NWD due to ENABLE_FEAT |
| 979 | # mechanism. |
johpow01 | 9baade3 | 2021-07-08 14:14:00 -0500 | [diff] [blame] | 980 | ifeq (${ENABLE_SVE_FOR_SWD},1) |
Madhukar Pappireddy | 7ff1be8 | 2024-06-17 15:28:33 -0500 | [diff] [blame] | 981 | ifeq (${ENABLE_SVE_FOR_NS},0) |
| 982 | $(error "ENABLE_SVE_FOR_SWD requires ENABLE_SVE_FOR_NS") |
| 983 | endif |
| 984 | endif |
johpow01 | 9baade3 | 2021-07-08 14:14:00 -0500 | [diff] [blame] | 985 | |
Madhukar Pappireddy | 7ff1be8 | 2024-06-17 15:28:33 -0500 | [diff] [blame] | 986 | # Enabling SVE for both the worlds typically requires the context |
| 987 | # management of SVE registers. The only exception being SPMC at S-EL2. |
| 988 | ifeq (${ENABLE_SVE_FOR_SWD}, 1) |
| 989 | ifneq (${ENABLE_SVE_FOR_NS}, 0) |
| 990 | ifeq (${CTX_INCLUDE_SVE_REGS}-$(SPMD_SPM_AT_SEL2),0-0) |
| 991 | $(warning "ENABLE_SVE_FOR_SWD and ENABLE_SVE_FOR_NS together require CTX_INCLUDE_SVE_REGS") |
| 992 | endif |
| 993 | endif |
| 994 | endif |
| 995 | |
| 996 | # Enabling SVE in either world while enabling CTX_INCLUDE_FPREGS requires |
| 997 | # CTX_INCLUDE_SVE_REGS to be enabled due to architectural dependency between FP |
| 998 | # and SVE registers. |
| 999 | ifeq (${CTX_INCLUDE_FPREGS}, 1) |
| 1000 | ifneq (${ENABLE_SVE_FOR_NS},0) |
| 1001 | ifeq (${CTX_INCLUDE_SVE_REGS},0) |
| 1002 | # Warning instead of error due to CI dependency on this |
| 1003 | $(warning "CTX_INCLUDE_FPREGS and ENABLE_SVE_FOR_NS together require CTX_INCLUDE_SVE_REGS") |
| 1004 | $(warning "Forced ENABLE_SVE_FOR_NS=0") |
| 1005 | override ENABLE_SVE_FOR_NS := 0 |
| 1006 | endif |
| 1007 | endif |
| 1008 | endif #(CTX_INCLUDE_FPREGS) |
Jayanth Dodderi Chidanand | cfe053a | 2022-11-08 10:31:07 +0000 | [diff] [blame] | 1009 | |
Madhukar Pappireddy | 7ff1be8 | 2024-06-17 15:28:33 -0500 | [diff] [blame] | 1010 | # SVE context management is only required if secure world has access to SVE/FP |
| 1011 | # functionality. |
| 1012 | ifeq (${CTX_INCLUDE_SVE_REGS},1) |
| 1013 | ifeq (${ENABLE_SVE_FOR_SWD},0) |
| 1014 | $(error "CTX_INCLUDE_SVE_REGS requires ENABLE_SVE_FOR_SWD to also be enabled") |
| 1015 | endif |
| 1016 | endif |
| 1017 | |
| 1018 | # SME cannot be used with CTX_INCLUDE_FPREGS since SPM does its own context |
| 1019 | # management including FPU registers. |
| 1020 | ifeq (${CTX_INCLUDE_FPREGS},1) |
| 1021 | ifneq (${ENABLE_SME_FOR_NS},0) |
| 1022 | $(error "ENABLE_SME_FOR_NS cannot be used with CTX_INCLUDE_FPREGS") |
| 1023 | endif |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1024 | endif #(CTX_INCLUDE_FPREGS) |
johpow01 | 9baade3 | 2021-07-08 14:14:00 -0500 | [diff] [blame] | 1025 | |
Manish V Badarkhe | 191a5fc | 2022-03-02 12:06:35 +0000 | [diff] [blame] | 1026 | ifeq ($(DRTM_SUPPORT),1) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1027 | $(info DRTM_SUPPORT is an experimental feature) |
Manish V Badarkhe | 191a5fc | 2022-03-02 12:06:35 +0000 | [diff] [blame] | 1028 | endif |
| 1029 | |
Raymond Mao | 9898339 | 2023-07-25 07:53:35 -0700 | [diff] [blame] | 1030 | ifeq (${TRANSFER_LIST},1) |
| 1031 | $(info TRANSFER_LIST is an experimental feature) |
| 1032 | endif |
| 1033 | |
Chris Kay | d02c231 | 2022-09-29 16:21:24 +0100 | [diff] [blame] | 1034 | ifeq (${ENABLE_RME},1) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1035 | ifneq (${SEPARATE_CODE_AND_RODATA},1) |
| 1036 | $(error `ENABLE_RME=1` requires `SEPARATE_CODE_AND_RODATA=1`) |
| 1037 | endif |
Chris Kay | d02c231 | 2022-09-29 16:21:24 +0100 | [diff] [blame] | 1038 | endif |
| 1039 | |
Manish V Badarkhe | 78e14f8 | 2023-09-06 09:08:28 +0100 | [diff] [blame] | 1040 | ifeq ($(PSA_CRYPTO),1) |
| 1041 | $(info PSA_CRYPTO is an experimental feature) |
| 1042 | endif |
| 1043 | |
Manish V Badarkhe | d8d7d93 | 2024-05-09 12:14:13 +0100 | [diff] [blame] | 1044 | ifeq ($(DICE_PROTECTION_ENVIRONMENT),1) |
| 1045 | $(info DICE_PROTECTION_ENVIRONMENT is an experimental feature) |
| 1046 | endif |
| 1047 | |
Antonio Nino Diaz | faf573a | 2016-02-15 14:53:10 +0000 | [diff] [blame] | 1048 | ################################################################################ |
Juan Castillo | a3487d1 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1049 | # Process platform overrideable behaviour |
| 1050 | ################################################################################ |
| 1051 | |
Manish Pandey | b0e7efa | 2021-10-06 10:59:52 +0100 | [diff] [blame] | 1052 | ifdef BL1_SOURCES |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1053 | NEED_BL1 := yes |
| 1054 | endif #(BL1_SOURCES) |
Manish Pandey | b0e7efa | 2021-10-06 10:59:52 +0100 | [diff] [blame] | 1055 | |
Jon Medhurst | 66573cb | 2014-02-13 15:19:28 +0000 | [diff] [blame] | 1056 | ifdef BL2_SOURCES |
Manish Pandey | b0e7efa | 2021-10-06 10:59:52 +0100 | [diff] [blame] | 1057 | NEED_BL2 := yes |
| 1058 | |
| 1059 | # Using BL2 implies that a BL33 image also needs to be supplied for the FIP and |
| 1060 | # Certificate generation tools. This flag can be overridden by the platform. |
| 1061 | ifdef EL3_PAYLOAD_BASE |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1062 | # If booting an EL3 payload there is no need for a BL33 image |
| 1063 | # in the FIP file. |
| 1064 | NEED_BL33 := no |
| 1065 | else |
| 1066 | ifdef PRELOADED_BL33_BASE |
| 1067 | # If booting a BL33 preloaded image there is no need of |
| 1068 | # another one in the FIP file. |
| 1069 | NEED_BL33 := no |
| 1070 | else |
| 1071 | NEED_BL33 ?= yes |
| 1072 | endif |
| 1073 | endif |
| 1074 | endif #(BL2_SOURCES) |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 1075 | |
Manish Pandey | b0e7efa | 2021-10-06 10:59:52 +0100 | [diff] [blame] | 1076 | ifdef BL2U_SOURCES |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1077 | NEED_BL2U := yes |
| 1078 | endif #(BL2U_SOURCES) |
Manish Pandey | b0e7efa | 2021-10-06 10:59:52 +0100 | [diff] [blame] | 1079 | |
Masahiro Yamada | e76b4f8 | 2017-04-05 19:11:41 +0900 | [diff] [blame] | 1080 | # If SCP_BL2 is given, we always want FIP to include it. |
| 1081 | ifdef SCP_BL2 |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1082 | NEED_SCP_BL2 := yes |
| 1083 | endif #(SCP_BL2) |
Masahiro Yamada | e76b4f8 | 2017-04-05 19:11:41 +0900 | [diff] [blame] | 1084 | |
Soby Mathew | bf16923 | 2017-11-14 14:10:10 +0000 | [diff] [blame] | 1085 | # For AArch32, BL31 is not currently supported. |
| 1086 | ifneq (${ARCH},aarch32) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1087 | ifdef BL31_SOURCES |
| 1088 | # When booting an EL3 payload, there is no need to compile the BL31 |
| 1089 | # image nor put it in the FIP. |
| 1090 | ifndef EL3_PAYLOAD_BASE |
| 1091 | NEED_BL31 := yes |
| 1092 | endif |
| 1093 | endif |
| 1094 | endif #(ARCH=aarch64) |
Soby Mathew | bf16923 | 2017-11-14 14:10:10 +0000 | [diff] [blame] | 1095 | |
Juan Castillo | a3487d1 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1096 | # Process TBB related flags |
| 1097 | ifneq (${GENERATE_COT},0) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1098 | # Common cert_create options |
| 1099 | ifneq (${CREATE_KEYS},0) |
Juan Castillo | a3487d1 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1100 | $(eval CRT_ARGS += -n) |
Yatharth Kochar | d1a9343 | 2015-10-12 12:33:47 +0100 | [diff] [blame] | 1101 | $(eval FWU_CRT_ARGS += -n) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1102 | ifneq (${SAVE_KEYS},0) |
Juan Castillo | a3487d1 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1103 | $(eval CRT_ARGS += -k) |
Yatharth Kochar | d1a9343 | 2015-10-12 12:33:47 +0100 | [diff] [blame] | 1104 | $(eval FWU_CRT_ARGS += -k) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1105 | endif |
| 1106 | endif |
| 1107 | # Include TBBR makefile (unless the platform indicates otherwise) |
| 1108 | ifeq (${INCLUDE_TBBR_MK},1) |
Juan Castillo | a3487d1 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1109 | include make_helpers/tbbr/tbbr_tools.mk |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1110 | endif |
| 1111 | endif #(GENERATE_COT) |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 1112 | |
Masahiro Yamada | 4d87eb4 | 2016-12-25 13:52:22 +0900 | [diff] [blame] | 1113 | ifneq (${FIP_ALIGN},0) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1114 | FIP_ARGS += --align ${FIP_ALIGN} |
| 1115 | endif #(FIP_ALIGN) |
Masahiro Yamada | 4d87eb4 | 2016-12-25 13:52:22 +0900 | [diff] [blame] | 1116 | |
Manish Pandey | b0e7efa | 2021-10-06 10:59:52 +0100 | [diff] [blame] | 1117 | ifdef FDT_SOURCES |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1118 | NEED_FDT := yes |
| 1119 | endif #(FDT_SOURCES) |
Manish Pandey | b0e7efa | 2021-10-06 10:59:52 +0100 | [diff] [blame] | 1120 | |
Juan Castillo | a3487d1 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1121 | ################################################################################ |
Michalis Pappas | 0f223c5 | 2018-03-20 13:01:27 +0800 | [diff] [blame] | 1122 | # Include libraries' Makefile that are used in all BL |
| 1123 | ################################################################################ |
| 1124 | |
| 1125 | include lib/stack_protector/stack_protector.mk |
| 1126 | |
| 1127 | ################################################################################ |
Soby Mathew | 574e01e | 2017-02-14 10:05:07 +0000 | [diff] [blame] | 1128 | # Include BL specific makefiles |
| 1129 | ################################################################################ |
Manish Pandey | b0e7efa | 2021-10-06 10:59:52 +0100 | [diff] [blame] | 1130 | |
| 1131 | ifeq (${NEED_BL1},yes) |
Soby Mathew | 574e01e | 2017-02-14 10:05:07 +0000 | [diff] [blame] | 1132 | include bl1/bl1.mk |
| 1133 | endif |
| 1134 | |
Manish Pandey | b0e7efa | 2021-10-06 10:59:52 +0100 | [diff] [blame] | 1135 | ifeq (${NEED_BL2},yes) |
Soby Mathew | 574e01e | 2017-02-14 10:05:07 +0000 | [diff] [blame] | 1136 | include bl2/bl2.mk |
| 1137 | endif |
| 1138 | |
Manish Pandey | b0e7efa | 2021-10-06 10:59:52 +0100 | [diff] [blame] | 1139 | ifeq (${NEED_BL2U},yes) |
Soby Mathew | 574e01e | 2017-02-14 10:05:07 +0000 | [diff] [blame] | 1140 | include bl2u/bl2u.mk |
| 1141 | endif |
| 1142 | |
Soby Mathew | bf16923 | 2017-11-14 14:10:10 +0000 | [diff] [blame] | 1143 | ifeq (${NEED_BL31},yes) |
Soby Mathew | 574e01e | 2017-02-14 10:05:07 +0000 | [diff] [blame] | 1144 | include bl31/bl31.mk |
| 1145 | endif |
Nishanth Menon | 4ac02ba | 2016-10-14 01:13:57 +0000 | [diff] [blame] | 1146 | |
Soby Mathew | 574e01e | 2017-02-14 10:05:07 +0000 | [diff] [blame] | 1147 | ################################################################################ |
Juan Castillo | a3487d1 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1148 | # Build options checks |
| 1149 | ################################################################################ |
| 1150 | |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1151 | # Boolean_Flags |
Leonardo Sandoval | 65fca7c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1152 | $(eval $(call assert_booleans,\ |
| 1153 | $(sort \ |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1154 | ALLOW_RO_XLAT_TABLES \ |
| 1155 | BL2_ENABLE_SP_LOAD \ |
| 1156 | COLD_BOOT_SINGLE_CPU \ |
| 1157 | CREATE_KEYS \ |
| 1158 | CTX_INCLUDE_AARCH32_REGS \ |
| 1159 | CTX_INCLUDE_FPREGS \ |
Madhukar Pappireddy | dd9af9b | 2024-06-17 15:17:03 -0500 | [diff] [blame] | 1160 | CTX_INCLUDE_SVE_REGS \ |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1161 | CTX_INCLUDE_EL2_REGS \ |
Arvind Ram Prakash | 4851b49 | 2023-10-06 14:35:21 -0500 | [diff] [blame] | 1162 | CTX_INCLUDE_MPAM_REGS \ |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1163 | DEBUG \ |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1164 | DYN_DISABLE_AUTH \ |
| 1165 | EL3_EXCEPTION_HANDLING \ |
| 1166 | ENABLE_AMU_AUXILIARY_COUNTERS \ |
| 1167 | ENABLE_AMU_FCONF \ |
| 1168 | AMU_RESTRICT_COUNTERS \ |
| 1169 | ENABLE_ASSERTIONS \ |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1170 | ENABLE_PIE \ |
| 1171 | ENABLE_PMF \ |
| 1172 | ENABLE_PSCI_STAT \ |
| 1173 | ENABLE_RUNTIME_INSTRUMENTATION \ |
| 1174 | ENABLE_SME_FOR_SWD \ |
| 1175 | ENABLE_SVE_FOR_SWD \ |
Manish Pandey | 514a301 | 2023-10-10 13:53:25 +0100 | [diff] [blame] | 1176 | ENABLE_FEAT_RAS \ |
Manish Pandey | f90a73c | 2023-10-10 15:42:19 +0100 | [diff] [blame] | 1177 | FFH_SUPPORT \ |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1178 | ERROR_DEPRECATED \ |
| 1179 | FAULT_INJECTION_SUPPORT \ |
| 1180 | GENERATE_COT \ |
| 1181 | GICV2_G0_FOR_EL3 \ |
| 1182 | HANDLE_EA_EL3_FIRST_NS \ |
Bipin Ravi | e53e6ae | 2023-09-28 13:17:24 -0500 | [diff] [blame] | 1183 | HARDEN_SLS \ |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1184 | HW_ASSISTED_COHERENCY \ |
| 1185 | MEASURED_BOOT \ |
Tamas Ban | a426089 | 2023-06-07 13:35:04 +0200 | [diff] [blame] | 1186 | DICE_PROTECTION_ENVIRONMENT \ |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1187 | DRTM_SUPPORT \ |
| 1188 | NS_TIMER_SWITCH \ |
| 1189 | OVERRIDE_LIBC \ |
| 1190 | PL011_GENERIC_UART \ |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1191 | PROGRAMMABLE_RESET_ADDRESS \ |
| 1192 | PSCI_EXTENDED_STATE_ID \ |
| 1193 | PSCI_OS_INIT_MODE \ |
| 1194 | RESET_TO_BL31 \ |
| 1195 | SAVE_KEYS \ |
| 1196 | SEPARATE_CODE_AND_RODATA \ |
| 1197 | SEPARATE_BL2_NOLOAD_REGION \ |
| 1198 | SEPARATE_NOBITS_REGION \ |
Madhukar Pappireddy | 5c1b8d9 | 2024-06-17 15:26:00 -0500 | [diff] [blame] | 1199 | SEPARATE_SIMD_SECTION \ |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1200 | SPIN_ON_BL1_EXIT \ |
| 1201 | SPM_MM \ |
| 1202 | SPMC_AT_EL3 \ |
Nishant Sharma | 9e71911 | 2023-06-27 00:36:01 +0100 | [diff] [blame] | 1203 | SPMC_AT_EL3_SEL0_SP \ |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1204 | SPMD_SPM_AT_SEL2 \ |
Raghu Krishnamurthy | 7f046c1 | 2023-02-25 13:26:10 -0800 | [diff] [blame] | 1205 | ENABLE_SPMD_LP \ |
Raymond Mao | 9898339 | 2023-07-25 07:53:35 -0700 | [diff] [blame] | 1206 | TRANSFER_LIST \ |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1207 | TRUSTED_BOARD_BOOT \ |
| 1208 | USE_COHERENT_MEM \ |
| 1209 | USE_DEBUGFS \ |
| 1210 | ARM_IO_IN_DTB \ |
| 1211 | SDEI_IN_FCONF \ |
| 1212 | SEC_INT_DESC_IN_FCONF \ |
| 1213 | USE_ROMLIB \ |
| 1214 | USE_TBBR_DEFS \ |
| 1215 | WARMBOOT_ENABLE_DCACHE_EARLY \ |
| 1216 | RESET_TO_BL2 \ |
| 1217 | BL2_IN_XIP_MEM \ |
| 1218 | BL2_INV_DCACHE \ |
| 1219 | USE_SPINLOCK_CAS \ |
| 1220 | ENCRYPT_BL31 \ |
| 1221 | ENCRYPT_BL32 \ |
| 1222 | ERRATA_SPECULATIVE_AT \ |
| 1223 | RAS_TRAP_NS_ERR_REC_ACCESS \ |
| 1224 | COT_DESC_IN_DTB \ |
| 1225 | USE_SP804_TIMER \ |
| 1226 | PSA_FWU_SUPPORT \ |
Sughosh Ganu | 61905e5 | 2024-02-01 12:51:20 +0530 | [diff] [blame] | 1227 | PSA_FWU_METADATA_FW_STORE_DESC \ |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1228 | ENABLE_MPMM \ |
| 1229 | ENABLE_MPMM_FCONF \ |
| 1230 | FEATURE_DETECTION \ |
Jayanth Dodderi Chidanand | 7c7faff | 2022-10-11 17:16:07 +0100 | [diff] [blame] | 1231 | TRNG_SUPPORT \ |
Sona Mathew | 7fe0352 | 2022-11-18 18:05:38 -0600 | [diff] [blame] | 1232 | ERRATA_ABI_SUPPORT \ |
Sona Mathew | 5a4c9fc | 2023-03-14 14:02:03 -0500 | [diff] [blame] | 1233 | ERRATA_NON_ARM_INTERCONNECT \ |
Okash Khawaja | 037b56e | 2022-11-04 12:38:01 +0000 | [diff] [blame] | 1234 | CONDITIONAL_CMO \ |
Manish V Badarkhe | 78e14f8 | 2023-09-06 09:08:28 +0100 | [diff] [blame] | 1235 | PSA_CRYPTO \ |
Sandrine Bailleux | f57e203 | 2023-10-11 08:38:00 +0200 | [diff] [blame] | 1236 | ENABLE_CONSOLE_GETC \ |
Arvind Ram Prakash | 8bd27c9 | 2023-08-15 16:28:06 -0500 | [diff] [blame] | 1237 | INIT_UNUSED_NS_EL2 \ |
Juan Pablo Conde | b5ec138 | 2023-11-08 16:14:28 -0600 | [diff] [blame] | 1238 | PLATFORM_REPORT_CTX_MEM_USE \ |
Yann Gautier | 5ae29c0 | 2024-01-16 19:39:31 +0100 | [diff] [blame] | 1239 | EARLY_CONSOLE \ |
Arvind Ram Prakash | eaa9019 | 2023-12-21 00:25:52 -0600 | [diff] [blame] | 1240 | PRESERVE_DSU_PMU_REGS \ |
Leonardo Sandoval | 65fca7c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1241 | ))) |
Dan Handley | 81be100 | 2015-03-27 17:44:35 +0000 | [diff] [blame] | 1242 | |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1243 | # Numeric_Flags |
Leonardo Sandoval | 65fca7c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1244 | $(eval $(call assert_numerics,\ |
| 1245 | $(sort \ |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1246 | ARM_ARCH_MAJOR \ |
| 1247 | ARM_ARCH_MINOR \ |
| 1248 | BRANCH_PROTECTION \ |
| 1249 | CTX_INCLUDE_PAUTH_REGS \ |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1250 | CTX_INCLUDE_NEVE_REGS \ |
| 1251 | CRYPTO_SUPPORT \ |
Boyan Karatotev | 677ed8a | 2023-02-16 09:45:29 +0000 | [diff] [blame] | 1252 | DISABLE_MTPMU \ |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1253 | ENABLE_BRBE_FOR_NS \ |
| 1254 | ENABLE_TRBE_FOR_NS \ |
| 1255 | ENABLE_BTI \ |
| 1256 | ENABLE_PAUTH \ |
| 1257 | ENABLE_FEAT_AMU \ |
| 1258 | ENABLE_FEAT_AMUv1p1 \ |
| 1259 | ENABLE_FEAT_CSV2_2 \ |
Sona Mathew | 3b84c96 | 2023-10-25 16:48:19 -0500 | [diff] [blame] | 1260 | ENABLE_FEAT_CSV2_3 \ |
Arvind Ram Prakash | 05b4763 | 2024-05-22 15:24:00 -0500 | [diff] [blame] | 1261 | ENABLE_FEAT_DEBUGV8P9 \ |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1262 | ENABLE_FEAT_DIT \ |
| 1263 | ENABLE_FEAT_ECV \ |
| 1264 | ENABLE_FEAT_FGT \ |
Arvind Ram Prakash | 62d87e7 | 2024-06-06 11:33:37 -0500 | [diff] [blame] | 1265 | ENABLE_FEAT_FGT2 \ |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1266 | ENABLE_FEAT_HCX \ |
Govindraj Raja | d7b63ac | 2024-01-26 10:08:37 -0600 | [diff] [blame] | 1267 | ENABLE_FEAT_MTE2 \ |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1268 | ENABLE_FEAT_PAN \ |
| 1269 | ENABLE_FEAT_RNG \ |
| 1270 | ENABLE_FEAT_RNG_TRAP \ |
| 1271 | ENABLE_FEAT_SEL2 \ |
| 1272 | ENABLE_FEAT_TCR2 \ |
Govindraj Raja | c2dad57 | 2024-01-23 16:03:53 -0600 | [diff] [blame] | 1273 | ENABLE_FEAT_SB \ |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1274 | ENABLE_FEAT_S2PIE \ |
| 1275 | ENABLE_FEAT_S1PIE \ |
| 1276 | ENABLE_FEAT_S2POE \ |
| 1277 | ENABLE_FEAT_S1POE \ |
| 1278 | ENABLE_FEAT_GCS \ |
| 1279 | ENABLE_FEAT_VHE \ |
Arvind Ram Prakash | ab28d4b | 2023-10-11 12:10:56 -0500 | [diff] [blame] | 1280 | ENABLE_FEAT_MPAM \ |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1281 | ENABLE_RME \ |
| 1282 | ENABLE_SPE_FOR_NS \ |
| 1283 | ENABLE_SYS_REG_TRACE_FOR_NS \ |
| 1284 | ENABLE_SME_FOR_NS \ |
| 1285 | ENABLE_SME2_FOR_NS \ |
| 1286 | ENABLE_SVE_FOR_NS \ |
| 1287 | ENABLE_TRF_FOR_NS \ |
| 1288 | FW_ENC_STATUS \ |
| 1289 | NR_OF_FW_BANKS \ |
| 1290 | NR_OF_IMAGES_IN_FW_BANK \ |
| 1291 | TWED_DELAY \ |
| 1292 | ENABLE_FEAT_TWED \ |
| 1293 | SVE_VECTOR_LEN \ |
Varun Wadekar | 0a46eb1 | 2023-04-13 21:06:18 +0100 | [diff] [blame] | 1294 | IMPDEF_SYSREG_TRAP \ |
Leonardo Sandoval | 65fca7c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1295 | ))) |
Jeenu Viswambharan | fca7680 | 2017-01-16 16:52:35 +0000 | [diff] [blame] | 1296 | |
Justin Chadwell | f9b32c1 | 2019-07-29 17:13:10 +0100 | [diff] [blame] | 1297 | ifdef KEY_SIZE |
| 1298 | $(eval $(call assert_numeric,KEY_SIZE)) |
| 1299 | endif |
| 1300 | |
Justin Chadwell | 83e0488 | 2019-08-20 11:01:52 +0100 | [diff] [blame] | 1301 | ifeq ($(filter $(SANITIZE_UB), on off trap),) |
| 1302 | $(error "Invalid value for SANITIZE_UB: can be one of on, off, trap") |
| 1303 | endif |
| 1304 | |
Juan Castillo | a3487d1 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1305 | ################################################################################ |
| 1306 | # Add definitions to the cpp preprocessor based on the current build options. |
| 1307 | # This is done after including the platform specific makefile to allow the |
| 1308 | # platform to overwrite the default options |
| 1309 | ################################################################################ |
Jeenu Viswambharan | d1b6015 | 2014-05-12 15:28:47 +0100 | [diff] [blame] | 1310 | |
Leonardo Sandoval | 65fca7c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1311 | $(eval $(call add_defines,\ |
| 1312 | $(sort \ |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1313 | ALLOW_RO_XLAT_TABLES \ |
| 1314 | ARM_ARCH_MAJOR \ |
| 1315 | ARM_ARCH_MINOR \ |
| 1316 | BL2_ENABLE_SP_LOAD \ |
| 1317 | COLD_BOOT_SINGLE_CPU \ |
| 1318 | CTX_INCLUDE_AARCH32_REGS \ |
| 1319 | CTX_INCLUDE_FPREGS \ |
Madhukar Pappireddy | dd9af9b | 2024-06-17 15:17:03 -0500 | [diff] [blame] | 1320 | CTX_INCLUDE_SVE_REGS \ |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1321 | CTX_INCLUDE_PAUTH_REGS \ |
Arvind Ram Prakash | 4851b49 | 2023-10-06 14:35:21 -0500 | [diff] [blame] | 1322 | CTX_INCLUDE_MPAM_REGS \ |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1323 | EL3_EXCEPTION_HANDLING \ |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1324 | CTX_INCLUDE_EL2_REGS \ |
| 1325 | CTX_INCLUDE_NEVE_REGS \ |
| 1326 | DECRYPTION_SUPPORT_${DECRYPTION_SUPPORT} \ |
| 1327 | DISABLE_MTPMU \ |
| 1328 | ENABLE_FEAT_AMU \ |
| 1329 | ENABLE_AMU_AUXILIARY_COUNTERS \ |
| 1330 | ENABLE_AMU_FCONF \ |
| 1331 | AMU_RESTRICT_COUNTERS \ |
| 1332 | ENABLE_ASSERTIONS \ |
| 1333 | ENABLE_BTI \ |
Arvind Ram Prakash | 05b4763 | 2024-05-22 15:24:00 -0500 | [diff] [blame] | 1334 | ENABLE_FEAT_DEBUGV8P9 \ |
Arvind Ram Prakash | ab28d4b | 2023-10-11 12:10:56 -0500 | [diff] [blame] | 1335 | ENABLE_FEAT_MPAM \ |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1336 | ENABLE_PAUTH \ |
| 1337 | ENABLE_PIE \ |
| 1338 | ENABLE_PMF \ |
| 1339 | ENABLE_PSCI_STAT \ |
| 1340 | ENABLE_RME \ |
| 1341 | ENABLE_RUNTIME_INSTRUMENTATION \ |
| 1342 | ENABLE_SME_FOR_NS \ |
| 1343 | ENABLE_SME2_FOR_NS \ |
| 1344 | ENABLE_SME_FOR_SWD \ |
| 1345 | ENABLE_SPE_FOR_NS \ |
| 1346 | ENABLE_SVE_FOR_NS \ |
| 1347 | ENABLE_SVE_FOR_SWD \ |
Manish Pandey | 514a301 | 2023-10-10 13:53:25 +0100 | [diff] [blame] | 1348 | ENABLE_FEAT_RAS \ |
Manish Pandey | f90a73c | 2023-10-10 15:42:19 +0100 | [diff] [blame] | 1349 | FFH_SUPPORT \ |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1350 | ENCRYPT_BL31 \ |
| 1351 | ENCRYPT_BL32 \ |
| 1352 | ERROR_DEPRECATED \ |
| 1353 | FAULT_INJECTION_SUPPORT \ |
| 1354 | GICV2_G0_FOR_EL3 \ |
| 1355 | HANDLE_EA_EL3_FIRST_NS \ |
| 1356 | HW_ASSISTED_COHERENCY \ |
| 1357 | LOG_LEVEL \ |
| 1358 | MEASURED_BOOT \ |
Tamas Ban | a426089 | 2023-06-07 13:35:04 +0200 | [diff] [blame] | 1359 | DICE_PROTECTION_ENVIRONMENT \ |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1360 | DRTM_SUPPORT \ |
| 1361 | NS_TIMER_SWITCH \ |
| 1362 | PL011_GENERIC_UART \ |
| 1363 | PLAT_${PLAT} \ |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1364 | PROGRAMMABLE_RESET_ADDRESS \ |
| 1365 | PSCI_EXTENDED_STATE_ID \ |
| 1366 | PSCI_OS_INIT_MODE \ |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1367 | RESET_TO_BL31 \ |
AlexeiFedorov | c0ca2d7 | 2024-05-13 15:35:54 +0100 | [diff] [blame] | 1368 | RME_GPT_BITLOCK_BLOCK \ |
AlexeiFedorov | bd8b1bb | 2024-03-13 17:07:03 +0000 | [diff] [blame] | 1369 | RME_GPT_MAX_BLOCK \ |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1370 | SEPARATE_CODE_AND_RODATA \ |
| 1371 | SEPARATE_BL2_NOLOAD_REGION \ |
| 1372 | SEPARATE_NOBITS_REGION \ |
Madhukar Pappireddy | 5c1b8d9 | 2024-06-17 15:26:00 -0500 | [diff] [blame] | 1373 | SEPARATE_SIMD_SECTION \ |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1374 | RECLAIM_INIT_CODE \ |
| 1375 | SPD_${SPD} \ |
| 1376 | SPIN_ON_BL1_EXIT \ |
| 1377 | SPM_MM \ |
| 1378 | SPMC_AT_EL3 \ |
Nishant Sharma | 9e71911 | 2023-06-27 00:36:01 +0100 | [diff] [blame] | 1379 | SPMC_AT_EL3_SEL0_SP \ |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1380 | SPMD_SPM_AT_SEL2 \ |
Raymond Mao | 9898339 | 2023-07-25 07:53:35 -0700 | [diff] [blame] | 1381 | TRANSFER_LIST \ |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1382 | TRUSTED_BOARD_BOOT \ |
| 1383 | CRYPTO_SUPPORT \ |
| 1384 | TRNG_SUPPORT \ |
| 1385 | ERRATA_ABI_SUPPORT \ |
Sona Mathew | 5a4c9fc | 2023-03-14 14:02:03 -0500 | [diff] [blame] | 1386 | ERRATA_NON_ARM_INTERCONNECT \ |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1387 | USE_COHERENT_MEM \ |
| 1388 | USE_DEBUGFS \ |
| 1389 | ARM_IO_IN_DTB \ |
| 1390 | SDEI_IN_FCONF \ |
| 1391 | SEC_INT_DESC_IN_FCONF \ |
| 1392 | USE_ROMLIB \ |
| 1393 | USE_TBBR_DEFS \ |
| 1394 | WARMBOOT_ENABLE_DCACHE_EARLY \ |
| 1395 | RESET_TO_BL2 \ |
| 1396 | BL2_RUNS_AT_EL3 \ |
| 1397 | BL2_IN_XIP_MEM \ |
| 1398 | BL2_INV_DCACHE \ |
| 1399 | USE_SPINLOCK_CAS \ |
| 1400 | ERRATA_SPECULATIVE_AT \ |
| 1401 | RAS_TRAP_NS_ERR_REC_ACCESS \ |
| 1402 | COT_DESC_IN_DTB \ |
| 1403 | USE_SP804_TIMER \ |
| 1404 | ENABLE_FEAT_RNG \ |
| 1405 | ENABLE_FEAT_RNG_TRAP \ |
| 1406 | ENABLE_FEAT_SB \ |
| 1407 | ENABLE_FEAT_DIT \ |
| 1408 | NR_OF_FW_BANKS \ |
| 1409 | NR_OF_IMAGES_IN_FW_BANK \ |
| 1410 | PSA_FWU_SUPPORT \ |
Sughosh Ganu | 61905e5 | 2024-02-01 12:51:20 +0530 | [diff] [blame] | 1411 | PSA_FWU_METADATA_FW_STORE_DESC \ |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1412 | ENABLE_BRBE_FOR_NS \ |
| 1413 | ENABLE_TRBE_FOR_NS \ |
| 1414 | ENABLE_SYS_REG_TRACE_FOR_NS \ |
| 1415 | ENABLE_TRF_FOR_NS \ |
| 1416 | ENABLE_FEAT_HCX \ |
| 1417 | ENABLE_MPMM \ |
| 1418 | ENABLE_MPMM_FCONF \ |
| 1419 | ENABLE_FEAT_FGT \ |
Arvind Ram Prakash | 62d87e7 | 2024-06-06 11:33:37 -0500 | [diff] [blame] | 1420 | ENABLE_FEAT_FGT2 \ |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1421 | ENABLE_FEAT_ECV \ |
| 1422 | ENABLE_FEAT_AMUv1p1 \ |
| 1423 | ENABLE_FEAT_SEL2 \ |
| 1424 | ENABLE_FEAT_VHE \ |
| 1425 | ENABLE_FEAT_CSV2_2 \ |
Sona Mathew | 3b84c96 | 2023-10-25 16:48:19 -0500 | [diff] [blame] | 1426 | ENABLE_FEAT_CSV2_3 \ |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1427 | ENABLE_FEAT_PAN \ |
| 1428 | ENABLE_FEAT_TCR2 \ |
| 1429 | ENABLE_FEAT_S2PIE \ |
| 1430 | ENABLE_FEAT_S1PIE \ |
| 1431 | ENABLE_FEAT_S2POE \ |
| 1432 | ENABLE_FEAT_S1POE \ |
| 1433 | ENABLE_FEAT_GCS \ |
Govindraj Raja | d7b63ac | 2024-01-26 10:08:37 -0600 | [diff] [blame] | 1434 | ENABLE_FEAT_MTE2 \ |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1435 | FEATURE_DETECTION \ |
| 1436 | TWED_DELAY \ |
| 1437 | ENABLE_FEAT_TWED \ |
Okash Khawaja | 037b56e | 2022-11-04 12:38:01 +0000 | [diff] [blame] | 1438 | CONDITIONAL_CMO \ |
Varun Wadekar | 0a46eb1 | 2023-04-13 21:06:18 +0100 | [diff] [blame] | 1439 | IMPDEF_SYSREG_TRAP \ |
Jayanth Dodderi Chidanand | 23c2fe2 | 2023-04-26 15:57:30 +0100 | [diff] [blame] | 1440 | SVE_VECTOR_LEN \ |
Raghu Krishnamurthy | 7f046c1 | 2023-02-25 13:26:10 -0800 | [diff] [blame] | 1441 | ENABLE_SPMD_LP \ |
Manish V Badarkhe | 78e14f8 | 2023-09-06 09:08:28 +0100 | [diff] [blame] | 1442 | PSA_CRYPTO \ |
Sandrine Bailleux | f57e203 | 2023-10-11 08:38:00 +0200 | [diff] [blame] | 1443 | ENABLE_CONSOLE_GETC \ |
Arvind Ram Prakash | 8bd27c9 | 2023-08-15 16:28:06 -0500 | [diff] [blame] | 1444 | INIT_UNUSED_NS_EL2 \ |
Juan Pablo Conde | b5ec138 | 2023-11-08 16:14:28 -0600 | [diff] [blame] | 1445 | PLATFORM_REPORT_CTX_MEM_USE \ |
Yann Gautier | 5ae29c0 | 2024-01-16 19:39:31 +0100 | [diff] [blame] | 1446 | EARLY_CONSOLE \ |
Arvind Ram Prakash | eaa9019 | 2023-12-21 00:25:52 -0600 | [diff] [blame] | 1447 | PRESERVE_DSU_PMU_REGS \ |
Leonardo Sandoval | 65fca7c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 1448 | ))) |
Jeenu Viswambharan | 615ff39 | 2016-10-24 14:31:51 +0100 | [diff] [blame] | 1449 | |
Juan Pablo Conde | b5ec138 | 2023-11-08 16:14:28 -0600 | [diff] [blame] | 1450 | ifeq (${PLATFORM_REPORT_CTX_MEM_USE}, 1) |
| 1451 | ifeq (${DEBUG}, 0) |
| 1452 | $(warning "PLATFORM_REPORT_CTX_MEM_USE can be applied when DEBUG=1 only") |
| 1453 | override PLATFORM_REPORT_CTX_MEM_USE := 0 |
| 1454 | endif |
| 1455 | endif |
| 1456 | |
Justin Chadwell | 83e0488 | 2019-08-20 11:01:52 +0100 | [diff] [blame] | 1457 | ifeq (${SANITIZE_UB},trap) |
| 1458 | $(eval $(call add_define,MONITOR_TRAPS)) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1459 | endif #(SANITIZE_UB) |
Justin Chadwell | 83e0488 | 2019-08-20 11:01:52 +0100 | [diff] [blame] | 1460 | |
Sandrine Bailleux | 03897bb | 2015-11-26 16:31:34 +0000 | [diff] [blame] | 1461 | # Define the EL3_PAYLOAD_BASE flag only if it is provided. |
| 1462 | ifdef EL3_PAYLOAD_BASE |
Antonio Nino Diaz | faf573a | 2016-02-15 14:53:10 +0000 | [diff] [blame] | 1463 | $(eval $(call add_define,EL3_PAYLOAD_BASE)) |
| 1464 | else |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1465 | # Define the PRELOADED_BL33_BASE flag only if it is provided and |
| 1466 | # EL3_PAYLOAD_BASE is not defined, as it has priority. |
| 1467 | ifdef PRELOADED_BL33_BASE |
Antonio Nino Diaz | 2b8277b | 2016-04-06 17:31:57 +0100 | [diff] [blame] | 1468 | $(eval $(call add_define,PRELOADED_BL33_BASE)) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1469 | endif |
| 1470 | endif #(EL3_PAYLOAD_BASE) |
Soby Mathew | 85dbf5a | 2015-04-07 12:16:56 +0100 | [diff] [blame] | 1471 | |
Soby Mathew | 9fe8804 | 2018-03-26 12:43:37 +0100 | [diff] [blame] | 1472 | # Define the DYN_DISABLE_AUTH flag only if set. |
| 1473 | ifeq (${DYN_DISABLE_AUTH},1) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1474 | $(eval $(call add_define,DYN_DISABLE_AUTH)) |
Soby Mathew | 9fe8804 | 2018-03-26 12:43:37 +0100 | [diff] [blame] | 1475 | endif |
| 1476 | |
Chris Kay | cfba645 | 2023-12-04 09:55:50 +0000 | [diff] [blame] | 1477 | ifeq ($($(ARCH)-ld-id),arm-link) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1478 | $(eval $(call add_define,USE_ARM_LINK)) |
Varun Wadekar | 4d034c5 | 2019-01-11 14:47:48 -0800 | [diff] [blame] | 1479 | endif |
| 1480 | |
Manish Pandey | 3f90ad7 | 2020-01-14 11:52:05 +0000 | [diff] [blame] | 1481 | # Generate and include sp_gen.mk if SPD is spmd and SP_LAYOUT_FILE is defined |
Manish Pandey | 3f90ad7 | 2020-01-14 11:52:05 +0000 | [diff] [blame] | 1482 | ifeq (${SPD},spmd) |
Olivier Deprez | 042db53 | 2020-03-19 09:27:11 +0100 | [diff] [blame] | 1483 | ifdef SP_LAYOUT_FILE |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1484 | -include $(BUILD_PLAT)/sp_gen.mk |
| 1485 | FIP_DEPS += sp |
| 1486 | CRT_DEPS += sp |
| 1487 | NEED_SP_PKG := yes |
Manish Pandey | 3f90ad7 | 2020-01-14 11:52:05 +0000 | [diff] [blame] | 1488 | else |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1489 | ifeq (${SPMD_SPM_AT_SEL2},1) |
| 1490 | $(error "SPMD with SPM at S-EL2 require SP_LAYOUT_FILE") |
| 1491 | endif |
| 1492 | endif #(SP_LAYOUT_FILE) |
| 1493 | endif #(SPD) |
Manish Pandey | 3f90ad7 | 2020-01-14 11:52:05 +0000 | [diff] [blame] | 1494 | |
Juan Castillo | a3487d1 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1495 | ################################################################################ |
Juan Castillo | a3487d1 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1496 | # Build targets |
| 1497 | ################################################################################ |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 1498 | |
Sumit Garg | b6c4b3c | 2019-11-11 18:46:36 +0530 | [diff] [blame] | 1499 | .PHONY: all msg_start clean realclean distclean cscope locate-checkpatch checkcodebase checkpatch fiptool sptool fip sp fwu_fip certtool dtbs memmap doc enctool |
Juan Castillo | a3487d1 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1500 | .SUFFIXES: |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 1501 | |
Juan Castillo | a3487d1 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1502 | all: msg_start |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 1503 | |
Juan Castillo | a3487d1 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1504 | msg_start: |
Chris Kay | 1870c72 | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1505 | $(s)echo "Building ${PLAT}" |
Juan Castillo | 11abdcd | 2014-10-21 11:30:42 +0100 | [diff] [blame] | 1506 | |
Soby Mathew | 18a6204 | 2015-10-26 14:29:21 +0000 | [diff] [blame] | 1507 | ifeq (${ERROR_DEPRECATED},0) |
Julius Werner | 53456fc | 2019-07-09 13:49:11 -0700 | [diff] [blame] | 1508 | # Check if deprecated declarations and cpp warnings should be treated as error or not. |
Chris Kay | cfba645 | 2023-12-04 09:55:50 +0000 | [diff] [blame] | 1509 | ifneq ($(filter %-clang,$($(ARCH)-cc-id)),) |
Varun Wadekar | 4d034c5 | 2019-01-11 14:47:48 -0800 | [diff] [blame] | 1510 | CPPFLAGS += -Wno-error=deprecated-declarations |
| 1511 | else |
Dan Handley | 6fa89a2 | 2018-02-27 16:03:58 +0000 | [diff] [blame] | 1512 | CPPFLAGS += -Wno-error=deprecated-declarations -Wno-error=cpp |
Soby Mathew | 18a6204 | 2015-10-26 14:29:21 +0000 | [diff] [blame] | 1513 | endif |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1514 | endif #(!ERROR_DEPRECATED) |
Soby Mathew | 18a6204 | 2015-10-26 14:29:21 +0000 | [diff] [blame] | 1515 | |
Roberto Vargas | 0f8f985 | 2018-05-08 10:27:10 +0100 | [diff] [blame] | 1516 | $(eval $(call MAKE_LIB,c)) |
Roberto Vargas | 21360f3 | 2018-05-08 10:27:10 +0100 | [diff] [blame] | 1517 | |
Juan Castillo | a3487d1 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1518 | # Expand build macros for the different images |
| 1519 | ifeq (${NEED_BL1},yes) |
Chris Kay | 0a542ec | 2021-09-28 15:44:19 +0100 | [diff] [blame] | 1520 | BL1_SOURCES := $(sort ${BL1_SOURCES}) |
Zelalem Aweke | b44dec1 | 2021-07-11 17:25:48 -0500 | [diff] [blame] | 1521 | $(eval $(call MAKE_BL,bl1)) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1522 | endif #(NEED_BL1) |
Juan Castillo | 11abdcd | 2014-10-21 11:30:42 +0100 | [diff] [blame] | 1523 | |
Juan Castillo | a3487d1 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1524 | ifeq (${NEED_BL2},yes) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1525 | |
Arvind Ram Prakash | 11b9b49 | 2022-11-22 14:41:00 -0600 | [diff] [blame] | 1526 | ifeq (${RESET_TO_BL2}, 0) |
Roberto Vargas | 53c052b | 2018-01-02 11:23:41 +0000 | [diff] [blame] | 1527 | FIP_BL2_ARGS := tb-fw |
| 1528 | endif |
| 1529 | |
Chris Kay | fb3b051 | 2021-09-28 15:44:37 +0100 | [diff] [blame] | 1530 | BL2_SOURCES := $(sort ${BL2_SOURCES}) |
| 1531 | |
Masahiro Yamada | 9c5ca52 | 2018-01-26 11:42:01 +0900 | [diff] [blame] | 1532 | $(if ${BL2}, $(eval $(call TOOL_ADD_IMG,bl2,--${FIP_BL2_ARGS})),\ |
Zelalem Aweke | b44dec1 | 2021-07-11 17:25:48 -0500 | [diff] [blame] | 1533 | $(eval $(call MAKE_BL,bl2,${FIP_BL2_ARGS}))) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1534 | |
| 1535 | endif #(NEED_BL2) |
Juan Castillo | 11abdcd | 2014-10-21 11:30:42 +0100 | [diff] [blame] | 1536 | |
Masahiro Yamada | e76b4f8 | 2017-04-05 19:11:41 +0900 | [diff] [blame] | 1537 | ifeq (${NEED_SCP_BL2},yes) |
Masahiro Yamada | 9c5ca52 | 2018-01-26 11:42:01 +0900 | [diff] [blame] | 1538 | $(eval $(call TOOL_ADD_IMG,scp_bl2,--scp-fw)) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1539 | endif #(NEED_SCP_BL2) |
Masahiro Yamada | e76b4f8 | 2017-04-05 19:11:41 +0900 | [diff] [blame] | 1540 | |
Juan Castillo | a3487d1 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1541 | ifeq (${NEED_BL31},yes) |
| 1542 | BL31_SOURCES += ${SPD_SOURCES} |
Madhukar Pappireddy | ae9677b | 2020-01-27 13:37:51 -0600 | [diff] [blame] | 1543 | # Sort BL31 source files to remove duplicates |
| 1544 | BL31_SOURCES := $(sort ${BL31_SOURCES}) |
Sumit Garg | eec5244 | 2019-11-14 16:33:45 +0530 | [diff] [blame] | 1545 | ifneq (${DECRYPTION_SUPPORT},none) |
| 1546 | $(if ${BL31}, $(eval $(call TOOL_ADD_IMG,bl31,--soc-fw,,$(ENCRYPT_BL31))),\ |
Zelalem Aweke | b44dec1 | 2021-07-11 17:25:48 -0500 | [diff] [blame] | 1547 | $(eval $(call MAKE_BL,bl31,soc-fw,,$(ENCRYPT_BL31)))) |
Sumit Garg | eec5244 | 2019-11-14 16:33:45 +0530 | [diff] [blame] | 1548 | else |
Masahiro Yamada | 9c5ca52 | 2018-01-26 11:42:01 +0900 | [diff] [blame] | 1549 | $(if ${BL31}, $(eval $(call TOOL_ADD_IMG,bl31,--soc-fw)),\ |
Zelalem Aweke | b44dec1 | 2021-07-11 17:25:48 -0500 | [diff] [blame] | 1550 | $(eval $(call MAKE_BL,bl31,soc-fw))) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1551 | endif #(DECRYPTION_SUPPORT) |
| 1552 | endif #(NEED_BL31) |
Juan Castillo | 379954c | 2014-11-04 17:36:40 +0000 | [diff] [blame] | 1553 | |
Juan Castillo | 671b8db | 2015-11-12 10:59:26 +0000 | [diff] [blame] | 1554 | # If a BL32 image is needed but neither BL32 nor BL32_SOURCES is defined, the |
Masahiro Yamada | 4d15680 | 2018-01-26 11:42:01 +0900 | [diff] [blame] | 1555 | # build system will call TOOL_ADD_IMG to print a warning message and abort the |
Juan Castillo | 671b8db | 2015-11-12 10:59:26 +0000 | [diff] [blame] | 1556 | # process. Note that the dependency on BL32 applies to the FIP only. |
Juan Castillo | a3487d1 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1557 | ifeq (${NEED_BL32},yes) |
Madhukar Pappireddy | ae9677b | 2020-01-27 13:37:51 -0600 | [diff] [blame] | 1558 | # Sort BL32 source files to remove duplicates |
| 1559 | BL32_SOURCES := $(sort ${BL32_SOURCES}) |
Masahiro Yamada | 6ced1b2 | 2018-01-26 11:42:01 +0900 | [diff] [blame] | 1560 | BUILD_BL32 := $(if $(BL32),,$(if $(BL32_SOURCES),1)) |
| 1561 | |
Sumit Garg | eec5244 | 2019-11-14 16:33:45 +0530 | [diff] [blame] | 1562 | ifneq (${DECRYPTION_SUPPORT},none) |
Zelalem Aweke | b44dec1 | 2021-07-11 17:25:48 -0500 | [diff] [blame] | 1563 | $(if ${BUILD_BL32}, $(eval $(call MAKE_BL,bl32,tos-fw,,$(ENCRYPT_BL32))),\ |
Sumit Garg | eec5244 | 2019-11-14 16:33:45 +0530 | [diff] [blame] | 1564 | $(eval $(call TOOL_ADD_IMG,bl32,--tos-fw,,$(ENCRYPT_BL32)))) |
| 1565 | else |
Zelalem Aweke | b44dec1 | 2021-07-11 17:25:48 -0500 | [diff] [blame] | 1566 | $(if ${BUILD_BL32}, $(eval $(call MAKE_BL,bl32,tos-fw)),\ |
Masahiro Yamada | 9c5ca52 | 2018-01-26 11:42:01 +0900 | [diff] [blame] | 1567 | $(eval $(call TOOL_ADD_IMG,bl32,--tos-fw))) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1568 | endif #(DECRYPTION_SUPPORT) |
| 1569 | endif #(NEED_BL32) |
Juan Castillo | 11abdcd | 2014-10-21 11:30:42 +0100 | [diff] [blame] | 1570 | |
Zelalem Aweke | 4d37db8 | 2021-07-11 18:33:20 -0500 | [diff] [blame] | 1571 | # If RMM image is needed but RMM is not defined, Test Realm Payload (TRP) |
| 1572 | # needs to be built from RMM_SOURCES. |
| 1573 | ifeq (${NEED_RMM},yes) |
| 1574 | # Sort RMM source files to remove duplicates |
| 1575 | RMM_SOURCES := $(sort ${RMM_SOURCES}) |
| 1576 | BUILD_RMM := $(if $(RMM),,$(if $(RMM_SOURCES),1)) |
| 1577 | |
| 1578 | $(if ${BUILD_RMM}, $(eval $(call MAKE_BL,rmm,rmm-fw)),\ |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1579 | $(eval $(call TOOL_ADD_IMG,rmm,--rmm-fw))) |
| 1580 | endif #(NEED_RMM) |
Zelalem Aweke | 4d37db8 | 2021-07-11 18:33:20 -0500 | [diff] [blame] | 1581 | |
Juan Castillo | a3487d1 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1582 | # Add the BL33 image if required by the platform |
| 1583 | ifeq (${NEED_BL33},yes) |
Masahiro Yamada | 9c5ca52 | 2018-01-26 11:42:01 +0900 | [diff] [blame] | 1584 | $(eval $(call TOOL_ADD_IMG,bl33,--nt-fw)) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1585 | endif #(NEED_BL33) |
Juan Castillo | 9c25a40 | 2015-01-13 12:21:04 +0000 | [diff] [blame] | 1586 | |
Yatharth Kochar | b1c2fe0 | 2015-10-14 15:27:24 +0100 | [diff] [blame] | 1587 | ifeq (${NEED_BL2U},yes) |
Masahiro Yamada | 9c5ca52 | 2018-01-26 11:42:01 +0900 | [diff] [blame] | 1588 | $(if ${BL2U}, $(eval $(call TOOL_ADD_IMG,bl2u,--ap-fwu-cfg,FWU_)),\ |
Zelalem Aweke | b44dec1 | 2021-07-11 17:25:48 -0500 | [diff] [blame] | 1589 | $(eval $(call MAKE_BL,bl2u,ap-fwu-cfg,FWU_))) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1590 | endif #(NEED_BL2U) |
Yatharth Kochar | b1c2fe0 | 2015-10-14 15:27:24 +0100 | [diff] [blame] | 1591 | |
Nishanth Menon | 4ac02ba | 2016-10-14 01:13:57 +0000 | [diff] [blame] | 1592 | # Expand build macros for the different images |
| 1593 | ifeq (${NEED_FDT},yes) |
Soby Mathew | ab4181d | 2017-12-14 17:44:56 +0000 | [diff] [blame] | 1594 | $(eval $(call MAKE_DTBS,$(BUILD_PLAT)/fdts,$(FDT_SOURCES))) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1595 | endif #(NEED_FDT) |
Nishanth Menon | 4ac02ba | 2016-10-14 01:13:57 +0000 | [diff] [blame] | 1596 | |
Manish Pandey | 3f90ad7 | 2020-01-14 11:52:05 +0000 | [diff] [blame] | 1597 | # Add Secure Partition packages |
| 1598 | ifeq (${NEED_SP_PKG},yes) |
Chris Kay | d67442e | 2024-07-30 13:33:56 +0000 | [diff] [blame] | 1599 | $(BUILD_PLAT)/sp_gen.mk: ${SP_MK_GEN} ${SP_LAYOUT_FILE} | $$(@D)/ |
Chris Kay | 1870c72 | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1600 | $(q)${PYTHON} "$<" "$@" $(filter-out $<,$^) $(BUILD_PLAT) ${COT} ${SP_DTS_LIST_FRAGMENT} |
J-Alves | ef8e098 | 2022-03-22 16:28:51 +0000 | [diff] [blame] | 1601 | sp: $(DTBS) $(BUILD_PLAT)/sp_gen.mk $(SP_PKGS) |
Chris Kay | 1870c72 | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1602 | $(s)echo |
| 1603 | $(s)echo "Built SP Images successfully" |
| 1604 | $(s)echo |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1605 | endif #(NEED_SP_PKG) |
Manish Pandey | 3f90ad7 | 2020-01-14 11:52:05 +0000 | [diff] [blame] | 1606 | |
Ian Spray | 36eaaf3 | 2014-01-30 17:25:28 +0000 | [diff] [blame] | 1607 | locate-checkpatch: |
| 1608 | ifndef CHECKPATCH |
Etienne Carriere | f565757 | 2017-08-23 15:44:01 +0200 | [diff] [blame] | 1609 | $(error "Please set CHECKPATCH to point to the Linux checkpatch.pl file, eg: CHECKPATCH=../linux/scripts/checkpatch.pl") |
Ian Spray | 36eaaf3 | 2014-01-30 17:25:28 +0000 | [diff] [blame] | 1610 | else |
| 1611 | ifeq (,$(wildcard ${CHECKPATCH})) |
Etienne Carriere | f565757 | 2017-08-23 15:44:01 +0200 | [diff] [blame] | 1612 | $(error "The file CHECKPATCH points to cannot be found, use eg: CHECKPATCH=../linux/scripts/checkpatch.pl") |
Ian Spray | 36eaaf3 | 2014-01-30 17:25:28 +0000 | [diff] [blame] | 1613 | endif |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1614 | endif #(CHECKPATCH) |
Ian Spray | 36eaaf3 | 2014-01-30 17:25:28 +0000 | [diff] [blame] | 1615 | |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 1616 | clean: |
Chris Kay | 1870c72 | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1617 | $(s)echo " CLEAN" |
Evan Lloyd | 26c6cb4 | 2015-12-02 18:33:55 +0000 | [diff] [blame] | 1618 | $(call SHELL_REMOVE_DIR,${BUILD_PLAT}) |
Xialin Liu | cfc4776 | 2024-06-28 12:52:29 -0500 | [diff] [blame] | 1619 | $(q)${MAKE} -C ${CERTCONVPATH} clean |
Sami Mujawar | e7cdc3f | 2020-04-30 12:41:57 +0100 | [diff] [blame] | 1620 | ifdef UNIX_MK |
Chris Kay | 1870c72 | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1621 | $(q)${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean |
Sami Mujawar | e7cdc3f | 2020-04-30 12:41:57 +0100 | [diff] [blame] | 1622 | else |
| 1623 | # Clear the MAKEFLAGS as we do not want |
| 1624 | # to pass the gnumake flags to nmake. |
Chris Kay | 1870c72 | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1625 | $(q)set MAKEFLAGS= && ${MSVC_NMAKE} /nologo /f ${FIPTOOLPATH}/Makefile.msvc FIPTOOLPATH=$(subst /,\,$(FIPTOOLPATH)) FIPTOOL=$(subst /,\,$(FIPTOOL)) clean |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1626 | endif #(UNIX_MK) |
Chris Kay | 1870c72 | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1627 | $(q)${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} clean |
| 1628 | $(q)${MAKE} PLAT=${PLAT} --no-print-directory -C ${ENCTOOLPATH} clean |
| 1629 | $(q)${MAKE} --no-print-directory -C ${ROMLIBPATH} clean |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 1630 | |
James Morrissey | eaaeece | 2013-11-01 13:56:59 +0000 | [diff] [blame] | 1631 | realclean distclean: |
Chris Kay | 1870c72 | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1632 | $(s)echo " REALCLEAN" |
Evan Lloyd | 26c6cb4 | 2015-12-02 18:33:55 +0000 | [diff] [blame] | 1633 | $(call SHELL_REMOVE_DIR,${BUILD_BASE}) |
| 1634 | $(call SHELL_DELETE_ALL, ${CURDIR}/cscope.*) |
Xialin Liu | cfc4776 | 2024-06-28 12:52:29 -0500 | [diff] [blame] | 1635 | $(q)${MAKE} -C ${CERTCONVPATH} clean |
Sami Mujawar | e7cdc3f | 2020-04-30 12:41:57 +0100 | [diff] [blame] | 1636 | ifdef UNIX_MK |
Chris Kay | 1870c72 | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1637 | $(q)${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean |
Sami Mujawar | e7cdc3f | 2020-04-30 12:41:57 +0100 | [diff] [blame] | 1638 | else |
| 1639 | # Clear the MAKEFLAGS as we do not want |
| 1640 | # to pass the gnumake flags to nmake. |
Chris Kay | 1870c72 | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1641 | $(q)set MAKEFLAGS= && ${MSVC_NMAKE} /nologo /f ${FIPTOOLPATH}/Makefile.msvc FIPTOOLPATH=$(subst /,\,$(FIPTOOLPATH)) FIPTOOL=$(subst /,\,$(FIPTOOL)) realclean |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1642 | endif #(UNIX_MK) |
Chris Kay | 1870c72 | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1643 | $(q)${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} realclean |
| 1644 | $(q)${MAKE} PLAT=${PLAT} --no-print-directory -C ${ENCTOOLPATH} realclean |
| 1645 | $(q)${MAKE} --no-print-directory -C ${ROMLIBPATH} clean |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 1646 | |
Ian Spray | 36eaaf3 | 2014-01-30 17:25:28 +0000 | [diff] [blame] | 1647 | checkcodebase: locate-checkpatch |
Chris Kay | 1870c72 | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1648 | $(s)echo " CHECKING STYLE" |
| 1649 | $(q)if test -d .git ; then \ |
Paul Beesley | adfab5b | 2019-03-07 16:42:31 +0000 | [diff] [blame] | 1650 | git ls-files | grep -E -v 'libfdt|libc|docs|\.rst' | \ |
Dan Handley | 3a35571 | 2016-06-02 18:21:02 +0100 | [diff] [blame] | 1651 | while read GIT_FILE ; \ |
| 1652 | do ${CHECKPATCH} ${CHECKCODE_ARGS} -f $$GIT_FILE ; \ |
| 1653 | done ; \ |
| 1654 | else \ |
| 1655 | find . -type f -not -iwholename "*.git*" \ |
| 1656 | -not -iwholename "*build*" \ |
| 1657 | -not -iwholename "*libfdt*" \ |
Roberto Vargas | 0f8f985 | 2018-05-08 10:27:10 +0100 | [diff] [blame] | 1658 | -not -iwholename "*libc*" \ |
Dan Handley | 3a35571 | 2016-06-02 18:21:02 +0100 | [diff] [blame] | 1659 | -not -iwholename "*docs*" \ |
Paul Beesley | adfab5b | 2019-03-07 16:42:31 +0000 | [diff] [blame] | 1660 | -not -iwholename "*.rst" \ |
Dan Handley | 3a35571 | 2016-06-02 18:21:02 +0100 | [diff] [blame] | 1661 | -exec ${CHECKPATCH} ${CHECKCODE_ARGS} -f {} \; ; \ |
| 1662 | fi |
Ian Spray | 36eaaf3 | 2014-01-30 17:25:28 +0000 | [diff] [blame] | 1663 | |
| 1664 | checkpatch: locate-checkpatch |
Chris Kay | 1870c72 | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1665 | $(s)echo " CHECKING STYLE" |
| 1666 | $(q)if test -n "${CHECKPATCH_OPTS}"; then \ |
Yann Gautier | 0c26a2a | 2019-03-08 15:44:00 +0100 | [diff] [blame] | 1667 | echo " with ${CHECKPATCH_OPTS} option(s)"; \ |
| 1668 | fi |
Chris Kay | 1870c72 | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1669 | $(q)COMMON_COMMIT=$$(git merge-base HEAD ${BASE_COMMIT}); \ |
Yann Gautier | a10a685 | 2021-11-02 18:03:31 +0100 | [diff] [blame] | 1670 | for commit in `git rev-list --no-merges $$COMMON_COMMIT..HEAD`; \ |
| 1671 | do \ |
Antonio Nino Diaz | 2cd4b58 | 2018-01-29 12:00:31 +0000 | [diff] [blame] | 1672 | printf "\n[*] Checking style of '$$commit'\n\n"; \ |
| 1673 | git log --format=email "$$commit~..$$commit" \ |
Yann Gautier | 0c26a2a | 2019-03-08 15:44:00 +0100 | [diff] [blame] | 1674 | -- ${CHECK_PATHS} | \ |
| 1675 | ${CHECKPATCH} ${CHECKPATCH_OPTS} - || true; \ |
Antonio Nino Diaz | 2cd4b58 | 2018-01-29 12:00:31 +0000 | [diff] [blame] | 1676 | git diff --format=email "$$commit~..$$commit" \ |
Yann Gautier | 0c26a2a | 2019-03-08 15:44:00 +0100 | [diff] [blame] | 1677 | -- ${CHECK_PATHS} | \ |
| 1678 | ${CHECKPATCH} ${CHECKPATCH_OPTS} - || true; \ |
Antonio Nino Diaz | 2cd4b58 | 2018-01-29 12:00:31 +0000 | [diff] [blame] | 1679 | done |
Juan Castillo | a3487d1 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1680 | |
| 1681 | certtool: ${CRTTOOL} |
Ian Spray | 36eaaf3 | 2014-01-30 17:25:28 +0000 | [diff] [blame] | 1682 | |
Pali Rohár | 54ff213 | 2020-11-24 15:38:08 +0100 | [diff] [blame] | 1683 | ${CRTTOOL}: FORCE |
Chris Kay | 1870c72 | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1684 | $(q)${MAKE} PLAT=${PLAT} USE_TBBR_DEFS=${USE_TBBR_DEFS} COT=${COT} OPENSSL_DIR=${OPENSSL_DIR} CRTTOOL=${CRTTOOL} DEBUG=${DEBUG} --no-print-directory -C ${CRTTOOLPATH} all |
| 1685 | $(s)echo |
| 1686 | $(s)echo "Built $@ successfully" |
| 1687 | $(s)echo |
Jon Medhurst | 407a95c | 2014-02-12 15:54:48 +0000 | [diff] [blame] | 1688 | |
Juan Castillo | 11abdcd | 2014-10-21 11:30:42 +0100 | [diff] [blame] | 1689 | ifneq (${GENERATE_COT},0) |
Juan Castillo | a3487d1 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1690 | certificates: ${CRT_DEPS} ${CRTTOOL} |
Chris Kay | 1870c72 | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1691 | $(q)${CRTTOOL} ${CRT_ARGS} |
| 1692 | $(s)echo |
| 1693 | $(s)echo "Built $@ successfully" |
| 1694 | $(s)echo "Certificates can be found in ${BUILD_PLAT}" |
| 1695 | $(s)echo |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1696 | endif #(GENERATE_COT) |
Juan Castillo | 11abdcd | 2014-10-21 11:30:42 +0100 | [diff] [blame] | 1697 | |
Juan Castillo | a3487d1 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1698 | ${BUILD_PLAT}/${FIP_NAME}: ${FIP_DEPS} ${FIPTOOL} |
Pali Rohár | a5416ab | 2020-11-24 16:53:04 +0100 | [diff] [blame] | 1699 | $(eval ${CHECK_FIP_CMD}) |
Chris Kay | 1870c72 | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1700 | $(q)${FIPTOOL} create ${FIP_ARGS} $@ |
| 1701 | $(q)${FIPTOOL} info $@ |
| 1702 | $(s)echo |
| 1703 | $(s)echo "Built $@ successfully" |
| 1704 | $(s)echo |
Soby Mathew | dbee7fc | 2014-09-08 17:51:01 +0100 | [diff] [blame] | 1705 | |
Yatharth Kochar | d1a9343 | 2015-10-12 12:33:47 +0100 | [diff] [blame] | 1706 | ifneq (${GENERATE_COT},0) |
| 1707 | fwu_certificates: ${FWU_CRT_DEPS} ${CRTTOOL} |
Chris Kay | 1870c72 | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1708 | $(q)${CRTTOOL} ${FWU_CRT_ARGS} |
| 1709 | $(s)echo |
| 1710 | $(s)echo "Built $@ successfully" |
| 1711 | $(s)echo "FWU certificates can be found in ${BUILD_PLAT}" |
| 1712 | $(s)echo |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1713 | endif #(GENERATE_COT) |
Yatharth Kochar | d1a9343 | 2015-10-12 12:33:47 +0100 | [diff] [blame] | 1714 | |
| 1715 | ${BUILD_PLAT}/${FWU_FIP_NAME}: ${FWU_FIP_DEPS} ${FIPTOOL} |
Pali Rohár | a5416ab | 2020-11-24 16:53:04 +0100 | [diff] [blame] | 1716 | $(eval ${CHECK_FWU_FIP_CMD}) |
Chris Kay | 1870c72 | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1717 | $(q)${FIPTOOL} create ${FWU_FIP_ARGS} $@ |
| 1718 | $(q)${FIPTOOL} info $@ |
| 1719 | $(s)echo |
| 1720 | $(s)echo "Built $@ successfully" |
| 1721 | $(s)echo |
Yatharth Kochar | d1a9343 | 2015-10-12 12:33:47 +0100 | [diff] [blame] | 1722 | |
Juan Castillo | a3487d1 | 2015-08-18 14:23:04 +0100 | [diff] [blame] | 1723 | fiptool: ${FIPTOOL} |
| 1724 | fip: ${BUILD_PLAT}/${FIP_NAME} |
Yatharth Kochar | d1a9343 | 2015-10-12 12:33:47 +0100 | [diff] [blame] | 1725 | fwu_fip: ${BUILD_PLAT}/${FWU_FIP_NAME} |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 1726 | |
Pali Rohár | 54ff213 | 2020-11-24 15:38:08 +0100 | [diff] [blame] | 1727 | ${FIPTOOL}: FORCE |
Sami Mujawar | e7cdc3f | 2020-04-30 12:41:57 +0100 | [diff] [blame] | 1728 | ifdef UNIX_MK |
Chris Kay | 1870c72 | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1729 | $(q)${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" FIPTOOL=${FIPTOOL} OPENSSL_DIR=${OPENSSL_DIR} DEBUG=${DEBUG} --no-print-directory -C ${FIPTOOLPATH} all |
Sami Mujawar | e7cdc3f | 2020-04-30 12:41:57 +0100 | [diff] [blame] | 1730 | else |
| 1731 | # Clear the MAKEFLAGS as we do not want |
| 1732 | # to pass the gnumake flags to nmake. |
Chris Kay | 1870c72 | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1733 | $(q)set MAKEFLAGS= && ${MSVC_NMAKE} /nologo /f ${FIPTOOLPATH}/Makefile.msvc FIPTOOLPATH=$(subst /,\,$(FIPTOOLPATH)) FIPTOOL=$(subst /,\,$(FIPTOOL)) |
Jayanth Dodderi Chidanand | 2ee5d40 | 2023-04-24 15:57:05 +0100 | [diff] [blame] | 1734 | endif #(UNIX_MK) |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 1735 | |
Pali Rohár | 54ff213 | 2020-11-24 15:38:08 +0100 | [diff] [blame] | 1736 | romlib.bin: libraries FORCE |
Chris Kay | 1870c72 | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1737 | $(q)${MAKE} PLAT_DIR=${PLAT_DIR} BUILD_PLAT=${BUILD_PLAT} ENABLE_BTI=${ENABLE_BTI} ARM_ARCH_MINOR=${ARM_ARCH_MINOR} INCLUDES=$(call escape-shell,$(INCLUDES)) DEFINES=$(call escape-shell,$(DEFINES)) --no-print-directory -C ${ROMLIBPATH} all |
Roberto Vargas | e92111a | 2018-05-22 16:05:42 +0100 | [diff] [blame] | 1738 | |
Louis Mayencourt | cc3e8b8 | 2019-10-16 14:30:51 +0100 | [diff] [blame] | 1739 | memmap: all |
Harrison Mutai | e9bc488 | 2023-02-23 10:33:58 +0000 | [diff] [blame] | 1740 | ifdef UNIX_MK |
Chris Kay | 1870c72 | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1741 | $(q)PYTHONPATH=${CURDIR}/tools/memory \ |
Harrison Mutai | e9bc488 | 2023-02-23 10:33:58 +0000 | [diff] [blame] | 1742 | ${PYTHON} -m memory.memmap -sr ${BUILD_PLAT} |
| 1743 | else |
Chris Kay | 1870c72 | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1744 | $(q)set PYTHONPATH=${CURDIR}/tools/memory && \ |
Harrison Mutai | e9bc488 | 2023-02-23 10:33:58 +0000 | [diff] [blame] | 1745 | ${PYTHON} -m memory.memmap -sr ${BUILD_PLAT} |
| 1746 | endif |
Louis Mayencourt | cc3e8b8 | 2019-10-16 14:30:51 +0100 | [diff] [blame] | 1747 | |
Madhukar Pappireddy | 46adb1b | 2020-01-28 12:41:20 -0600 | [diff] [blame] | 1748 | doc: |
Chris Kay | 1870c72 | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1749 | $(s)echo " BUILD DOCUMENTATION" |
| 1750 | $(q)${MAKE} --no-print-directory -C ${DOCS_PATH} html |
Madhukar Pappireddy | 46adb1b | 2020-01-28 12:41:20 -0600 | [diff] [blame] | 1751 | |
Sumit Garg | b6c4b3c | 2019-11-11 18:46:36 +0530 | [diff] [blame] | 1752 | enctool: ${ENCTOOL} |
| 1753 | |
Pali Rohár | 54ff213 | 2020-11-24 15:38:08 +0100 | [diff] [blame] | 1754 | ${ENCTOOL}: FORCE |
Chris Kay | 1870c72 | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1755 | $(q)${MAKE} PLAT=${PLAT} BUILD_INFO=0 OPENSSL_DIR=${OPENSSL_DIR} ENCTOOL=${ENCTOOL} DEBUG=${DEBUG} --no-print-directory -C ${ENCTOOLPATH} all |
| 1756 | $(s)echo |
| 1757 | $(s)echo "Built $@ successfully" |
| 1758 | $(s)echo |
Sumit Garg | b6c4b3c | 2019-11-11 18:46:36 +0530 | [diff] [blame] | 1759 | |
Joakim Bech | 35fab8c | 2014-01-23 14:51:49 +0100 | [diff] [blame] | 1760 | cscope: |
Chris Kay | 1870c72 | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1761 | $(s)echo " CSCOPE" |
| 1762 | $(q)find ${CURDIR} -name "*.[chsS]" > cscope.files |
| 1763 | $(q)cscope -b -q -k |
Joakim Bech | 35fab8c | 2014-01-23 14:51:49 +0100 | [diff] [blame] | 1764 | |
Ryan Harkin | 72ee331 | 2014-01-15 16:55:07 +0000 | [diff] [blame] | 1765 | help: |
Chris Kay | 1870c72 | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 1766 | $(s)echo "usage: ${MAKE} [PLAT=<platform>] [OPTIONS] [TARGET]" |
| 1767 | $(s)echo "" |
| 1768 | $(s)echo "PLAT is used to specify which platform you wish to build." |
| 1769 | $(s)echo "If no platform is specified, PLAT defaults to: ${DEFAULT_PLAT}" |
| 1770 | $(s)echo "" |
| 1771 | $(s)echo "platform = ${PLATFORM_LIST}" |
| 1772 | $(s)echo "" |
| 1773 | $(s)echo "Please refer to the User Guide for a list of all supported options." |
| 1774 | $(s)echo "Note that the build system doesn't track dependencies for build " |
| 1775 | $(s)echo "options. Therefore, if any of the build options are changed " |
| 1776 | $(s)echo "from a previous build, a clean build must be performed." |
| 1777 | $(s)echo "" |
| 1778 | $(s)echo "Supported Targets:" |
| 1779 | $(s)echo " all Build all individual bootloader binaries" |
| 1780 | $(s)echo " bl1 Build the BL1 binary" |
| 1781 | $(s)echo " bl2 Build the BL2 binary" |
| 1782 | $(s)echo " bl2u Build the BL2U binary" |
| 1783 | $(s)echo " bl31 Build the BL31 binary" |
| 1784 | $(s)echo " bl32 Build the BL32 binary. If ARCH=aarch32, then " |
| 1785 | $(s)echo " this builds secure payload specified by AARCH32_SP" |
| 1786 | $(s)echo " certificates Build the certificates (requires 'GENERATE_COT=1')" |
| 1787 | $(s)echo " fip Build the Firmware Image Package (FIP)" |
| 1788 | $(s)echo " fwu_fip Build the FWU Firmware Image Package (FIP)" |
| 1789 | $(s)echo " checkcodebase Check the coding style of the entire source tree" |
| 1790 | $(s)echo " checkpatch Check the coding style on changes in the current" |
| 1791 | $(s)echo " branch against BASE_COMMIT (default origin/master)" |
| 1792 | $(s)echo " clean Clean the build for the selected platform" |
| 1793 | $(s)echo " cscope Generate cscope index" |
| 1794 | $(s)echo " distclean Remove all build artifacts for all platforms" |
| 1795 | $(s)echo " certtool Build the Certificate generation tool" |
| 1796 | $(s)echo " enctool Build the Firmware encryption tool" |
| 1797 | $(s)echo " fiptool Build the Firmware Image Package (FIP) creation tool" |
| 1798 | $(s)echo " sp Build the Secure Partition Packages" |
| 1799 | $(s)echo " sptool Build the Secure Partition Package creation tool" |
| 1800 | $(s)echo " dtbs Build the Device Tree Blobs (if required for the platform)" |
| 1801 | $(s)echo " memmap Print the memory map of the built binaries" |
| 1802 | $(s)echo " doc Build html based documentation using Sphinx tool" |
| 1803 | $(s)echo "" |
| 1804 | $(s)echo "Note: most build targets require PLAT to be set to a specific platform." |
| 1805 | $(s)echo "" |
| 1806 | $(s)echo "example: build all targets for the FVP platform:" |
| 1807 | $(s)echo " CROSS_COMPILE=aarch64-none-elf- make PLAT=fvp all" |
Pali Rohár | 54ff213 | 2020-11-24 15:38:08 +0100 | [diff] [blame] | 1808 | |
| 1809 | .PHONY: FORCE |
| 1810 | FORCE:; |