summaryrefslogtreecommitdiff
path: root/make_helpers
diff options
context:
space:
mode:
authorRoberto Vargas <roberto.vargas@arm.com>2018-05-22 16:05:42 +0100
committerRoberto Vargas <roberto.vargas@arm.com>2018-08-03 11:31:42 +0100
commit5accce5bcc211c08e80c638acbd01099af81cc37 (patch)
tree923fe8d7c1cd69eccef6eeb9ed5c875f65f9b5c8 /make_helpers
parent6c3733456706809d5c9fb78a9746bf2fa484fb91 (diff)
Add support for romlib in the build system
Romlib is a new image that is stored in ROM and contains the code of several libraries that can be shared between different images. All the functions within in the library are accessed using a jump table which allows to update the romlib image whithout changing the binary compatibility. This jump table can be also stored in RAM and it can allow to patch a romlib with potential bugs fixes.. Change-Id: If980ccdaca24b7aaca900e32acc68baf6f94ab35 Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
Diffstat (limited to 'make_helpers')
-rw-r--r--make_helpers/build_macros.mk22
-rw-r--r--make_helpers/defaults.mk3
2 files changed, 20 insertions, 5 deletions
diff --git a/make_helpers/build_macros.mk b/make_helpers/build_macros.mk
index ca826941..92a0f6e8 100644
--- a/make_helpers/build_macros.mk
+++ b/make_helpers/build_macros.mk
@@ -306,12 +306,15 @@ BUILD_MESSAGE_TIMESTAMP ?= __TIME__", "__DATE__
.PHONY: libraries
-
-# MAKE_LIB_DIR macro defines the target for the directory where
+# MAKE_LIB_DIRS macro defines the target for the directory where
# libraries are created
-define MAKE_LIB_DIR
+define MAKE_LIB_DIRS
$(eval LIB_DIR := ${BUILD_PLAT}/lib)
- $(eval $(call MAKE_PREREQ_DIR,${LIB_DIR},${BUILD_PLAT}))
+ $(eval ROMLIB_DIR := ${BUILD_PLAT}/romlib)
+ $(eval LIBWRAPPER_DIR := ${BUILD_PLAT}/libwrapper)
+ $(eval $(call MAKE_PREREQ_DIR,${LIB_DIR},${BUILD_PLAT}))
+ $(eval $(call MAKE_PREREQ_DIR,${ROMLIB_DIR},${BUILD_PLAT}))
+ $(eval $(call MAKE_PREREQ_DIR,${LIBWRAPPER_DIR},${BUILD_PLAT}))
endef
# MAKE_LIB macro defines the targets and options to build each BL image.
@@ -320,6 +323,7 @@ endef
define MAKE_LIB
$(eval BUILD_DIR := ${BUILD_PLAT}/lib$(1))
$(eval LIB_DIR := ${BUILD_PLAT}/lib)
+ $(eval ROMLIB_DIR := ${BUILD_PLAT}/romlib)
$(eval SOURCES := $(LIB$(call uppercase,$(1))_SRCS))
$(eval OBJS := $(addprefix $(BUILD_DIR)/,$(call SOURCES_TO_OBJS,$(SOURCES))))
@@ -327,11 +331,15 @@ $(eval $(call MAKE_PREREQ_DIR,${BUILD_DIR},${BUILD_PLAT}))
$(eval $(call MAKE_LIB_OBJS,$(BUILD_DIR),$(SOURCES),$(1)))
.PHONY : lib${1}_dirs
-lib${1}_dirs: | ${BUILD_DIR} ${LIB_DIR}
+lib${1}_dirs: | ${BUILD_DIR} ${LIB_DIR} ${ROMLIB_DIR} ${LIBWRAPPER_DIR}
libraries: ${LIB_DIR}/lib$(1).a
LDPATHS = -L${LIB_DIR}
LDLIBS += -l$(1)
+ifeq ($(USE_ROMLIB),1)
+LDLIBS := -lwrappers -lc
+endif
+
all: ${LIB_DIR}/lib$(1).a
${LIB_DIR}/lib$(1).a: $(OBJS)
@@ -378,6 +386,10 @@ bl${1}_dirs: | ${OBJ_DIRS}
$(eval $(call MAKE_OBJS,$(BUILD_DIR),$(SOURCES),$(1)))
$(eval $(call MAKE_LD,$(LINKERFILE),$(BL_LINKERFILE),$(1)))
+ifeq ($(USE_ROMLIB),1)
+$(ELF): romlib.bin
+endif
+
$(ELF): $(OBJS) $(LINKERFILE) | bl$(1)_dirs libraries $(BL_LIBS)
@echo " LD $$@"
ifdef MAKE_BUILD_STRINGS
diff --git a/make_helpers/defaults.mk b/make_helpers/defaults.mk
index cea85338..e4b5bdc9 100644
--- a/make_helpers/defaults.mk
+++ b/make_helpers/defaults.mk
@@ -166,6 +166,9 @@ TRUSTED_BOARD_BOOT := 0
# Build option to choose whether Trusted firmware uses Coherent memory or not.
USE_COHERENT_MEM := 1
+# Build option to choose wheter Trusted firmware uses library at ROM
+USE_ROMLIB := 0
+
# Use tbbr_oid.h instead of platform_oid.h
USE_TBBR_DEFS = $(ERROR_DEPRECATED)