summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSoby Mathew <soby.mathew@arm.com>2023-08-02 14:26:28 +0200
committerTrustedFirmware Code Review <review@review.trustedfirmware.org>2023-08-02 14:26:28 +0200
commit9945bef6b68914e6f412fc91cac6be938ce3dcf3 (patch)
tree4077f539db6348bbe57d3e7c0c562711189ed391
parent13a116c321ffe34c32d4349ac7892b61d8f589d9 (diff)
parentc973b2a60d860775d945b1186b8ca0dfaf29286a (diff)
Merge "feat(rme) : introduce new build flag for RME stack"
-rw-r--r--Makefile27
-rw-r--r--branch_protection.mk3
-rw-r--r--docs/getting_started/build-options.rst5
-rw-r--r--docs/getting_started/build.rst10
-rw-r--r--make_helpers/build_macros.mk16
-rw-r--r--make_helpers/defaults.mk6
6 files changed, 51 insertions, 16 deletions
diff --git a/Makefile b/Makefile
index 34ed34f..0a1ae9e 100644
--- a/Makefile
+++ b/Makefile
@@ -106,6 +106,11 @@ msg_start:
@echo "Building ${PLAT}"
@echo "Selected set of tests: ${TESTS}"
+# Set flags for Realm Payload Tests
+ifeq (${ENABLE_REALM_PAYLOAD_TESTS},1)
+BRANCH_PROTECTION := 2
+endif
+
# Include test images makefiles.
include tftf/framework/framework.mk
include tftf/tests/tests.mk
@@ -148,6 +153,8 @@ $(eval $(call assert_boolean,FIRMWARE_UPDATE))
$(eval $(call assert_boolean,FWU_BL_TEST))
$(eval $(call assert_boolean,NEW_TEST_SESSION))
$(eval $(call assert_boolean,USE_NVM))
+$(eval $(call assert_numeric,BRANCH_PROTECTION))
+$(eval $(call assert_boolean,ENABLE_REALM_PAYLOAD_TESTS))
################################################################################
# Process build options
@@ -537,8 +544,6 @@ ifeq ($(SMC_FUZZING), 1)
--redefine-sym _binary___build_$(PLAT)_$(BUILD_TYPE)_smcf_dtb_end=_binary___dtb_end
endif
-$(eval $(call MAKE_IMG,tftf))
-
ifeq ($(FIRMWARE_UPDATE), 1)
$(eval $(call MAKE_IMG,ns_bl1u))
$(eval $(call MAKE_IMG,ns_bl2u))
@@ -548,11 +553,25 @@ ifeq (${ARCH}-${PLAT},aarch64-fvp)
$(eval $(call MAKE_IMG,cactus_mm))
$(eval $(call MAKE_IMG,cactus))
$(eval $(call MAKE_IMG,ivy))
+endif
+
+ifeq (${ENABLE_REALM_PAYLOAD_TESTS},1)
$(eval $(call MAKE_IMG,realm))
endif
+.PHONY : tftf
+ $(eval $(call MAKE_IMG,tftf))
+
+ifeq (${ENABLE_REALM_PAYLOAD_TESTS},1)
+tftf: realm
+ @echo " PACK REALM PAYLOAD"
+ $(shell dd if=$(BUILD_PLAT)/realm.bin of=$(BUILD_PLAT)/tftf.bin obs=1 \
+ seek=$(TFTF_MAX_IMAGE_SIZE))
+endif
+
ifeq (${ARCH}-${PLAT},aarch64-fvp)
.PHONY : pack_realm
+$(eval $(call MAKE_IMG,realm))
pack_realm: realm tftf
@echo " PACK REALM PAYLOAD"
$(shell dd if=$(BUILD_PLAT)/realm.bin of=$(BUILD_PLAT)/tftf.bin obs=1 \
@@ -595,7 +614,7 @@ cscope:
.SILENT: help
help:
echo "usage: ${MAKE} PLAT=<${PLATFORMS}> \
-<all|tftf|ns_bl1u|ns_bl2u|cactus|ivy|realm|pack_realm|el3_payload|distclean|clean|checkcodebase|checkpatch|help_tests>"
+<all|tftf|ns_bl1u|ns_bl2u|cactus|ivy|el3_payload|distclean|clean|checkcodebase|checkpatch|help_tests>"
echo ""
echo "PLAT is used to specify which platform you wish to build."
echo "If no platform is specified, PLAT defaults to: ${DEFAULT_PLAT}"
@@ -606,8 +625,6 @@ help:
echo " tftf Build the TFTF image"
echo " ns_bl1u Build the NS_BL1U image"
echo " ns_bl2u Build the NS_BL2U image"
- echo " realm Build the Realm image (Test R-EL1 payload)."
- echo " pack_realm Pack the realm image to tftf.bin."
echo " cactus Build the Cactus image (FF-A S-EL1 test payload)."
echo " cactus_mm Build the Cactus-MM image (SPM-MM S-EL0 test payload)."
echo " ivy Build the Ivy image (FF-A S-EL0 test payload)."
diff --git a/branch_protection.mk b/branch_protection.mk
index c16cdad..86f197f 100644
--- a/branch_protection.mk
+++ b/branch_protection.mk
@@ -10,9 +10,6 @@
# poised to handle dependencies, as all build variables would have a default
# value by then.
-# Select the branch protection features to use.
-BRANCH_PROTECTION := 0
-
# Flag to enable Branch Target Identification in the TFTF.
# Internal flag not meant for direct setting.
# Use BRANCH_PROTECTION to enable BTI.
diff --git a/docs/getting_started/build-options.rst b/docs/getting_started/build-options.rst
index a891380..8e62380 100644
--- a/docs/getting_started/build-options.rst
+++ b/docs/getting_started/build-options.rst
@@ -107,6 +107,9 @@ payload, whose simplistic build system is mostly independent.
- ``V``: Verbose build. If assigned anything other than 0, the build commands
are printed. Default is 0.
+- ``ENABLE_REALM_PAYLOAD_TESTS``: This option builds and packs Realm payload tests for
+ RME enabled stack. Default is 0.
+
Arm FVP Platform Specific Build Options
---------------------------------------
@@ -152,7 +155,7 @@ Realm payload specific Build Options
- ``TFTF_MAX_IMAGE_SIZE``: The option needs to be either set by the user or
by the platform makefile to specify the maximum size of TFTF binary. This
is needed so that the Realm payload binary can be appended to TFTF binary
- via ``make pack_realm`` build command.
+ via ``make ENABLE_REALM_PAYLOAD_TESTS=1 tftf`` build command.
FWU-specific Build Options
--------------------------
diff --git a/docs/getting_started/build.rst b/docs/getting_started/build.rst
index 034a99e..70b7edc 100644
--- a/docs/getting_started/build.rst
+++ b/docs/getting_started/build.rst
@@ -111,14 +111,10 @@ the following command:
::
- make PLAT=<platform> realm
+ make PLAT=<platform> ENABLE_REALM_PAYLOAD_TESTS=1 tftf
-The generated ``realm.bin`` needs to be packaged as part of ``tftf.bin`` to
-be used as a single BL33 image and can be done using the following command:
-
-::
-
- make PLAT=<platform> pack_realm
+The generated ``realm.bin`` is packaged as part of ``tftf.bin``
+to be used as a single BL33 image.
Please refer to the `TF-A RME documentation`_ for build and run instructions.
diff --git a/make_helpers/build_macros.mk b/make_helpers/build_macros.mk
index 5cd8bc6..e12f8e2 100644
--- a/make_helpers/build_macros.mk
+++ b/make_helpers/build_macros.mk
@@ -18,6 +18,22 @@ define assert_boolean
$(and $(patsubst 0,,$(value $(1))),$(patsubst 1,,$(value $(1))),$(error $(1) must be boolean))
endef
+0-9 := 0 1 2 3 4 5 6 7 8 9
+
+# Function to verify that a given option $(1) contains a numeric value
+define assert_numeric
+$(if $($(1)),,$(error $(1) must not be empty))
+$(eval __numeric := $($(1)))
+$(foreach d,$(0-9),$(eval __numeric := $(subst $(d),,$(__numeric))))
+$(if $(__numeric),$(error $(1) must be numeric))
+endef
+
+# Convenience function for verifying options have numeric values
+# $(eval $(call assert_numerics,FOO BOO)) will assert FOO and BOO contain numeric values
+define assert_numerics
+ $(foreach num,$1,$(eval $(call assert_numeric,$(num))))
+endef
+
# CREATE_SEQ is a recursive function to create sequence of numbers from 1 to
# $(2) and assign the sequence to $(1)
define CREATE_SEQ
diff --git a/make_helpers/defaults.mk b/make_helpers/defaults.mk
index 2e18d67..3605d01 100644
--- a/make_helpers/defaults.mk
+++ b/make_helpers/defaults.mk
@@ -45,3 +45,9 @@ USE_NVM := 0
# Build verbosity
V := 0
+
+# Select the branch protection features to use
+BRANCH_PROTECTION := 0
+
+# Build RME stack
+ENABLE_REALM_PAYLOAD_TESTS := 0