aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSandrine Bailleux <sandrine.bailleux@arm.com>2018-12-13 13:31:48 +0000
committerTrustedFirmware Code Review <review@review.trustedfirmware.org>2018-12-13 13:31:48 +0000
commit9c0acaef487d46f5d1d4cacec8bf31ab5e9739bf (patch)
tree771974c2c77224c703f5bae734cc91338e5305c1
parent2a287fc4ad5fc0e3b0a5e798efc12ab572863958 (diff)
parent1451f6142c9d03af844d0bc77dace24eca5ff81f (diff)
downloadtf-a-tests-9c0acaef487d46f5d1d4cacec8bf31ab5e9739bf.tar.gz
Merge "SPM: Makefile: Add targets to build resource description blobs"
-rw-r--r--Makefile4
-rw-r--r--docs/user-guide.rst2
-rw-r--r--spm/README.txt8
-rw-r--r--spm/cactus/cactus.mk13
-rw-r--r--spm/ivy/ivy.mk13
-rwxr-xr-xtools/generate_dtb/generate_dtb.sh78
6 files changed, 113 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index c0d135402..9c4ae7eb7 100644
--- a/Makefile
+++ b/Makefile
@@ -459,8 +459,8 @@ help:
@echo " tftf Build the TFTF image"
@echo " ns_bl1u Build the NS_BL1U image"
@echo " ns_bl2u Build the NS_BL2U image"
- @echo " cactus Build the Cactus image (Test S-EL0 payload)."
- @echo " ivy Build the Ivy image (Test S-EL0 payload)."
+ @echo " cactus Build the Cactus image (Test S-EL0 payload) and resource description."
+ @echo " ivy Build the Ivy image (Test S-EL0 payload) and resource description."
@echo " el3_payload Build the EL3 test payload"
@echo " checkcodebase Check the coding style of the entire source tree"
@echo " checkpatch Check the coding style on changes in the current"
diff --git a/docs/user-guide.rst b/docs/user-guide.rst
index d070c6a3b..397b4c2c9 100644
--- a/docs/user-guide.rst
+++ b/docs/user-guide.rst
@@ -29,7 +29,7 @@ Install the required packages to build TF-A Tests with the following command:
::
- sudo apt-get install build-essential make git perl libxml-libxml-perl
+ sudo apt-get install device-tree-compiler build-essential make git perl libxml-libxml-perl
Download and install the GNU cross-toolchain from Linaro. The TF-A Tests have
been tested with version 6.2-2016.11 (gcc 6.2):
diff --git a/spm/README.txt b/spm/README.txt
new file mode 100644
index 000000000..bff23efbe
--- /dev/null
+++ b/spm/README.txt
@@ -0,0 +1,8 @@
+This is a prototype loosely based on the SPCI Alpha and SPRT pre-alpha
+specifications. Any interface / platform API introduced for this is subject to
+change as it evolves.
+
+Cactus is meant to be the main test Secure Partition. It is the one meant to
+have most of the tests that a Secure Partition has to do. Ivy is meant to be
+more minimalistic. In the future, Cactus may be modified to be a S-EL1 partition
+while Ivy will remain as a S-EL0 partition.
diff --git a/spm/cactus/cactus.mk b/spm/cactus/cactus.mk
index 6ba0db004..1ebc6927b 100644
--- a/spm/cactus/cactus.mk
+++ b/spm/cactus/cactus.mk
@@ -6,6 +6,8 @@
include lib/sprt/sprt_client.mk
+CACTUS_DTB := $(BUILD_PLAT)/cactus.dtb
+
CACTUS_INCLUDES := \
-Iinclude \
-Iinclude/common \
@@ -73,4 +75,13 @@ else
$(eval $(call add_define,CACTUS_DEFINES,AARCH64))
endif
-cactus: ${AUTOGEN_DIR}/tests_list.h
+$(CACTUS_DTB) : $(BUILD_PLAT)/cactus $(BUILD_PLAT)/cactus/cactus.elf
+$(CACTUS_DTB) : spm/cactus/cactus.dts
+ @echo " DTBGEN spm/cactus/cactus.dts"
+ ${Q}tools/generate_dtb/generate_dtb.sh \
+ cactus spm/cactus/cactus.dts $(BUILD_PLAT)
+ @echo
+ @echo "Built $@ successfully"
+ @echo
+
+cactus: $(CACTUS_DTB) $(AUTOGEN_DIR)/tests_list.h
diff --git a/spm/ivy/ivy.mk b/spm/ivy/ivy.mk
index 2f17433bd..89fd92d47 100644
--- a/spm/ivy/ivy.mk
+++ b/spm/ivy/ivy.mk
@@ -6,6 +6,8 @@
include lib/sprt/sprt_client.mk
+IVY_DTB := $(BUILD_PLAT)/ivy.dtb
+
IVY_INCLUDES := \
-Iinclude \
-Iinclude/common \
@@ -70,4 +72,13 @@ else
$(eval $(call add_define,IVY_DEFINES,AARCH64))
endif
-ivy: ${AUTOGEN_DIR}/tests_list.h
+$(IVY_DTB) : $(BUILD_PLAT)/ivy $(BUILD_PLAT)/ivy/ivy.elf
+$(IVY_DTB) : spm/ivy/ivy.dts
+ @echo " DTBGEN spm/ivy/ivy.dts"
+ ${Q}tools/generate_dtb/generate_dtb.sh \
+ ivy spm/ivy/ivy.dts $(BUILD_PLAT)
+ @echo
+ @echo "Built $@ successfully"
+ @echo
+
+ivy: $(IVY_DTB) $(AUTOGEN_DIR)/tests_list.h
diff --git a/tools/generate_dtb/generate_dtb.sh b/tools/generate_dtb/generate_dtb.sh
new file mode 100755
index 000000000..efcc67edd
--- /dev/null
+++ b/tools/generate_dtb/generate_dtb.sh
@@ -0,0 +1,78 @@
+#!/bin/bash
+
+#
+# Copyright (c) 2018, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+# Generate a DTB file from a base DTS file and the MAP file generated during the
+# compilation of a Secure Partition.
+
+# $1 = image_name (lowercase)
+# $2 = path/to/file.dts
+# $3 = build/$PLAT/$BUILD_TYPE/
+
+ORIGINAL_DTS=$2
+MAPFILE="$3/$1/$1.map"
+EXTRA_DTS="$3/$1/$1_extra.dts"
+COMBINED_DTS="$3/$1/$1_combined.dts"
+PREPROCESSED_DTS="$3/$1/$1_preprocessed.dts"
+GENERATED_DTB="$3/$1.dtb"
+
+# Look for the start and end of the sections that are only known in the elf file
+# after compiling the partition.
+
+TEXT_START=$(grep __TEXT_START__ $MAPFILE | awk {'print $1'})
+TEXT_END=$(grep __TEXT_END__ $MAPFILE | awk {'print $1'})
+
+RODATA_START=$(grep __RODATA_START__ $MAPFILE | awk {'print $1'})
+RODATA_END=$(grep __RODATA_END__ $MAPFILE | awk {'print $1'})
+
+DATA_START=$(grep __DATA_START__ $MAPFILE | awk {'print $1'})
+DATA_END=$(grep __DATA_END__ $MAPFILE | awk {'print $1'})
+
+BSS_START=$(grep __BSS_START__ $MAPFILE | awk {'print $1'})
+BSS_END=$(grep __BSS_END__ $MAPFILE | awk {'print $1'})
+
+# Inject new sections to the base DTS
+
+echo "\
+/ {
+ memory_regions {
+ text {
+ str = \"Text\";
+ base = <0x0 ${TEXT_START}ULL>;
+ size = <0x0 (${TEXT_END}ULL - ${TEXT_START}ULL)>;
+ attr = <RD_MEM_NORMAL_CODE>;
+ };
+ rodata {
+ str = \"RO Data\";
+ base = <0x0 (${RODATA_START}ULL)>;
+ size = <0x0 (${RODATA_END}ULL - ${RODATA_START}ULL)>;
+ attr = <RD_MEM_NORMAL_RODATA>;
+ };
+ rwdata {
+ str = \"Data\";
+ base = <0x0 ${DATA_START}ULL>;
+ size = <0x0 (${DATA_END}ULL - ${DATA_START}ULL)>;
+ attr = <RD_MEM_NORMAL_DATA>;
+ };
+ bss {
+ str = \"BSS\";
+ base = <0x0 ${BSS_START}ULL>;
+ size = <0x0 (${BSS_END}ULL - ${BSS_START}ULL)>;
+ attr = <RD_MEM_NORMAL_BSS>;
+ };
+ };
+};" > "$EXTRA_DTS"
+
+cat "$ORIGINAL_DTS" "$EXTRA_DTS" > "$COMBINED_DTS"
+
+INCLUDES="-I spm/cactus
+ -I spm/ivy
+ -I spm/include
+ -I include/lib"
+
+cpp -x c -P -o "$PREPROCESSED_DTS" "$COMBINED_DTS" ${INCLUDES} -DAARCH64
+dtc -I dts -O dtb "$PREPROCESSED_DTS" > "$GENERATED_DTB"