From 5accce5bcc211c08e80c638acbd01099af81cc37 Mon Sep 17 00:00:00 2001 From: Roberto Vargas Date: Tue, 22 May 2018 16:05:42 +0100 Subject: 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 --- make_helpers/build_macros.mk | 22 +++++++++++++++++----- make_helpers/defaults.mk | 3 +++ 2 files changed, 20 insertions(+), 5 deletions(-) (limited to 'make_helpers') 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) -- cgit v1.2.3