aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2020-03-26 13:18:48 +0900
committerMasahiro Yamada <yamada.masahiro@socionext.com>2020-03-31 11:51:56 +0900
commitd5e97a1d2c79121a68ed1c68bd079e80a5f4540a (patch)
tree23d9e16f508e3f10493e1b729eaa4c8dce5757d3
parent21e22c74cd072c878a31e41fd96a4cd1c1048cfc (diff)
downloadtrusted-firmware-a-d5e97a1d2c79121a68ed1c68bd079e80a5f4540a.tar.gz
Build: define IMAGE_AT_EL1 or IMAGE_AT_EL3 globally for C files
The build system defines the IMAGE_BL* macro when compiling each image. This is useful to distinguish which image the current file is being built for by using #if defined(IMAGE_BL2) or #if defined(IMAGE_BL31), or whatever. There are some cases where we are more interested in which exception level the current file is being built for. include/lib/cpus/{aarch32,aarch64}/cpu_macros.S defines IMAGE_AT_EL3, but we do not have it globally. Pass IMAGE_AT_EL1 or IMAGE_AT_EL3 to BL*_CFLAGS so that it is available from all C code. The library code (libc.a, libmbedtls.a, etc.) is exceptional cases, where the code can be shared between BL images. Other than that, we know the exception level at the build time, and this macro will be useful in the shared code. Change-Id: I7c8a1da10726906adfba981cfe8464dff111d6b0 Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
-rw-r--r--Makefile12
1 files changed, 12 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index a1702beaa5..af8f847c79 100644
--- a/Makefile
+++ b/Makefile
@@ -508,6 +508,18 @@ ifeq ($(ARCH),aarch64)
endif
endif
+ifeq (${ARCH},aarch64)
+BL1_CFLAGS += -DIMAGE_AT_EL3
+ifeq ($(BL2_AT_EL3),1)
+BL2_CFLAGS += -DIMAGE_AT_EL3
+else
+BL2_CFLAGS += -DIMAGE_AT_EL1
+endif
+BL2U_CFLAGS += -DIMAGE_AT_EL1
+BL31_CFLAGS += -DIMAGE_AT_EL3
+BL32_CFLAGS += -DIMAGE_AT_EL1
+endif
+
# Include the CPU specific operations makefile, which provides default
# values for all CPU errata workarounds and CPU specific optimisations.
# This can be overridden by the platform.