opteesp: consolidate stripped elf generation
Move the generation and installation code of stripped elf files needed
by the opteesp environment to a common place. The intent is to remove
code duplication and to make creating new deployments easier and more
robust.
Change-Id: I4088dc47c13dc9f35f6b35fb44afee620303bac3
Signed-off-by: Gyorgy Szing <Gyorgy.Szing@arm.com>
diff --git a/components/service/spm_test/spm_test.cmake b/components/service/spm_test/spm_test.cmake
index e77dbf9..c35544e 100644
--- a/components/service/spm_test/spm_test.cmake
+++ b/components/service/spm_test/spm_test.cmake
@@ -60,8 +60,6 @@
${TS_ROOT}/components/service/spm_test/sp.c
)
-compiler_generate_stripped_elf(TARGET spm-test${SP_NUMBER} NAME "${SP_UUID_CANON}.stripped.elf" RES STRIPPED_ELF)
-
######################################## install
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "location to install build output to." FORCE)
@@ -71,8 +69,6 @@
PUBLIC_HEADER DESTINATION ${TS_ENV}/include
RUNTIME DESTINATION ${TS_ENV}/bin
)
-install(FILES ${STRIPPED_ELF} DESTINATION ${TS_ENV}/bin)
-
include(${TS_ROOT}/tools/cmake/common/ExportSp.cmake)
export_sp(
diff --git a/deployments/attestation/config/default-opteesp/CMakeLists.txt b/deployments/attestation/config/default-opteesp/CMakeLists.txt
index 8cc8347..02c79eb 100644
--- a/deployments/attestation/config/default-opteesp/CMakeLists.txt
+++ b/deployments/attestation/config/default-opteesp/CMakeLists.txt
@@ -73,8 +73,6 @@
endif()
-compiler_generate_stripped_elf(TARGET attestation NAME "${SP_UUID_CANON}.stripped.elf" RES STRIPPED_ELF)
-
#-------------------------------------------------------------------------------
# Deployment specific install options
#-------------------------------------------------------------------------------
@@ -87,7 +85,6 @@
PUBLIC_HEADER DESTINATION ${TS_ENV}/include
RUNTIME DESTINATION ${TS_ENV}/bin
)
-install(FILES ${STRIPPED_ELF} DESTINATION ${TS_ENV}/bin)
get_property(_PROTO_FILES TARGET attestation PROPERTY PROTOBUF_FILES)
install(FILES ${_PROTO_FILES} DESTINATION ${TS_ENV}/lib/protobuf)
diff --git a/deployments/block-storage/config/cfi-flash-optee/CMakeLists.txt b/deployments/block-storage/config/cfi-flash-optee/CMakeLists.txt
index 156cfb1..28b0624 100644
--- a/deployments/block-storage/config/cfi-flash-optee/CMakeLists.txt
+++ b/deployments/block-storage/config/cfi-flash-optee/CMakeLists.txt
@@ -82,8 +82,6 @@
endif()
-compiler_generate_stripped_elf(TARGET block-storage NAME "${SP_UUID_CANON}.stripped.elf" RES STRIPPED_ELF)
-
#-------------------------------------------------------------------------------
# Deployment specific install options
#-------------------------------------------------------------------------------
@@ -95,7 +93,6 @@
PUBLIC_HEADER DESTINATION ${TS_ENV}/include
RUNTIME DESTINATION ${TS_ENV}/bin
)
-install(FILES ${STRIPPED_ELF} DESTINATION ${TS_ENV}/bin)
include(${TS_ROOT}/tools/cmake/common/ExportSp.cmake)
export_sp(
diff --git a/deployments/block-storage/config/default-opteesp/CMakeLists.txt b/deployments/block-storage/config/default-opteesp/CMakeLists.txt
index e565233..657df4a 100644
--- a/deployments/block-storage/config/default-opteesp/CMakeLists.txt
+++ b/deployments/block-storage/config/default-opteesp/CMakeLists.txt
@@ -60,8 +60,6 @@
endif()
-compiler_generate_stripped_elf(TARGET block-storage NAME "${SP_UUID_CANON}.stripped.elf" RES STRIPPED_ELF)
-
#-------------------------------------------------------------------------------
# Deployment specific install options
#-------------------------------------------------------------------------------
@@ -73,7 +71,6 @@
PUBLIC_HEADER DESTINATION ${TS_ENV}/include
RUNTIME DESTINATION ${TS_ENV}/bin
)
-install(FILES ${STRIPPED_ELF} DESTINATION ${TS_ENV}/bin)
include(${TS_ROOT}/tools/cmake/common/ExportSp.cmake)
export_sp(
diff --git a/deployments/block-storage/config/edk2-secure-flash-opteesp/CMakeLists.txt b/deployments/block-storage/config/edk2-secure-flash-opteesp/CMakeLists.txt
index 0d14694..76eec3a 100644
--- a/deployments/block-storage/config/edk2-secure-flash-opteesp/CMakeLists.txt
+++ b/deployments/block-storage/config/edk2-secure-flash-opteesp/CMakeLists.txt
@@ -83,8 +83,6 @@
endif()
-compiler_generate_stripped_elf(TARGET block-storage NAME "${SP_UUID_CANON}.stripped.elf" RES STRIPPED_ELF)
-
#-------------------------------------------------------------------------------
# Deployment specific install options
#-------------------------------------------------------------------------------
@@ -96,7 +94,6 @@
PUBLIC_HEADER DESTINATION ${TS_ENV}/include
RUNTIME DESTINATION ${TS_ENV}/bin
)
-install(FILES ${STRIPPED_ELF} DESTINATION ${TS_ENV}/bin)
include(${TS_ROOT}/tools/cmake/common/ExportSp.cmake)
export_sp(
diff --git a/deployments/block-storage/config/semihosted-opteesp/CMakeLists.txt b/deployments/block-storage/config/semihosted-opteesp/CMakeLists.txt
index 1dbe0e0..ed89203 100644
--- a/deployments/block-storage/config/semihosted-opteesp/CMakeLists.txt
+++ b/deployments/block-storage/config/semihosted-opteesp/CMakeLists.txt
@@ -79,8 +79,6 @@
endif()
-compiler_generate_stripped_elf(TARGET block-storage NAME "${SP_UUID_CANON}.stripped.elf" RES STRIPPED_ELF)
-
#-------------------------------------------------------------------------------
# Deployment specific install options
#-------------------------------------------------------------------------------
@@ -92,7 +90,6 @@
PUBLIC_HEADER DESTINATION ${TS_ENV}/include
RUNTIME DESTINATION ${TS_ENV}/bin
)
-install(FILES ${STRIPPED_ELF} DESTINATION ${TS_ENV}/bin)
include(${TS_ROOT}/tools/cmake/common/ExportSp.cmake)
export_sp(
diff --git a/deployments/crypto/config/default-opteesp/CMakeLists.txt b/deployments/crypto/config/default-opteesp/CMakeLists.txt
index 6d92c79..e62c23f 100644
--- a/deployments/crypto/config/default-opteesp/CMakeLists.txt
+++ b/deployments/crypto/config/default-opteesp/CMakeLists.txt
@@ -74,8 +74,6 @@
endif()
-compiler_generate_stripped_elf(TARGET crypto NAME "${SP_UUID_CANON}.stripped.elf" RES STRIPPED_ELF)
-
#-------------------------------------------------------------------------------
# Deployment specific install options
#-------------------------------------------------------------------------------
@@ -88,7 +86,6 @@
PUBLIC_HEADER DESTINATION ${TS_ENV}/include
RUNTIME DESTINATION ${TS_ENV}/bin
)
-install(FILES ${STRIPPED_ELF} DESTINATION ${TS_ENV}/bin)
get_property(_PROTO_FILES TARGET crypto PROPERTY PROTOBUF_FILES)
install(FILES ${_PROTO_FILES} DESTINATION ${TS_ENV}/lib/protobuf)
diff --git a/deployments/env-test/config/baremetal-fvp_base_revc-opteesp/CMakeLists.txt b/deployments/env-test/config/baremetal-fvp_base_revc-opteesp/CMakeLists.txt
index b885cac..19985b6 100644
--- a/deployments/env-test/config/baremetal-fvp_base_revc-opteesp/CMakeLists.txt
+++ b/deployments/env-test/config/baremetal-fvp_base_revc-opteesp/CMakeLists.txt
@@ -74,8 +74,6 @@
)
endif()
-compiler_generate_stripped_elf(TARGET env-test NAME "${SP_UUID_CANON}.stripped.elf" RES STRIPPED_ELF)
-
#-------------------------------------------------------------------------------
# Deployment specific install options
#-------------------------------------------------------------------------------
@@ -88,7 +86,6 @@
PUBLIC_HEADER DESTINATION ${TS_ENV}/include
RUNTIME DESTINATION ${TS_ENV}/bin
)
-install(FILES ${STRIPPED_ELF} DESTINATION ${TS_ENV}/bin)
get_property(_PROTO_FILES TARGET env-test PROPERTY PROTOBUF_FILES)
install(FILES ${_PROTO_FILES} DESTINATION ${TS_ENV}/lib/protobuf)
diff --git a/deployments/env-test/config/n1sdp-opteesp/CMakeLists.txt b/deployments/env-test/config/n1sdp-opteesp/CMakeLists.txt
index 68758e4..6540dd0 100644
--- a/deployments/env-test/config/n1sdp-opteesp/CMakeLists.txt
+++ b/deployments/env-test/config/n1sdp-opteesp/CMakeLists.txt
@@ -67,8 +67,6 @@
)
endif()
-compiler_generate_stripped_elf(TARGET env-test NAME "${SP_UUID_CANON}.stripped.elf" RES STRIPPED_ELF)
-
#-------------------------------------------------------------------------------
# Deployment specific install options
#-------------------------------------------------------------------------------
@@ -81,7 +79,6 @@
PUBLIC_HEADER DESTINATION ${TS_ENV}/include
RUNTIME DESTINATION ${TS_ENV}/bin
)
-install(FILES ${STRIPPED_ELF} DESTINATION ${TS_ENV}/bin)
get_property(_PROTO_FILES TARGET env-test PROPERTY PROTOBUF_FILES)
install(FILES ${_PROTO_FILES} DESTINATION ${TS_ENV}/lib/protobuf)
diff --git a/deployments/fwu/config/default-opteesp/CMakeLists.txt b/deployments/fwu/config/default-opteesp/CMakeLists.txt
index ad07f69..5503715 100644
--- a/deployments/fwu/config/default-opteesp/CMakeLists.txt
+++ b/deployments/fwu/config/default-opteesp/CMakeLists.txt
@@ -73,8 +73,6 @@
endif()
-compiler_generate_stripped_elf(TARGET fwu NAME "${SP_UUID_CANON}.stripped.elf" RES STRIPPED_ELF)
-
#-------------------------------------------------------------------------------
# Deployment specific install options
#-------------------------------------------------------------------------------
@@ -87,7 +85,6 @@
PUBLIC_HEADER DESTINATION ${TS_ENV}/include
RUNTIME DESTINATION ${TS_ENV}/bin
)
-install(FILES ${STRIPPED_ELF} DESTINATION ${TS_ENV}/bin)
get_property(_PROTO_FILES TARGET fwu PROPERTY PROTOBUF_FILES)
install(FILES ${_PROTO_FILES} DESTINATION ${TS_ENV}/lib/protobuf)
diff --git a/deployments/internal-trusted-storage/config/default-opteesp/CMakeLists.txt b/deployments/internal-trusted-storage/config/default-opteesp/CMakeLists.txt
index 693ebf5..21f4efb 100644
--- a/deployments/internal-trusted-storage/config/default-opteesp/CMakeLists.txt
+++ b/deployments/internal-trusted-storage/config/default-opteesp/CMakeLists.txt
@@ -60,8 +60,6 @@
endif()
-compiler_generate_stripped_elf(TARGET internal-trusted-storage NAME "${SP_UUID_CANON}.stripped.elf" RES STRIPPED_ELF)
-
#-------------------------------------------------------------------------------
# Deployment specific install options
#
@@ -73,7 +71,6 @@
PUBLIC_HEADER DESTINATION ${TS_ENV}/include
RUNTIME DESTINATION ${TS_ENV}/bin
)
-install(FILES ${STRIPPED_ELF} DESTINATION ${TS_ENV}/bin)
include(${TS_ROOT}/tools/cmake/common/ExportSp.cmake)
export_sp(
diff --git a/deployments/internal-trusted-storage/config/shared-flash-opteesp/CMakeLists.txt b/deployments/internal-trusted-storage/config/shared-flash-opteesp/CMakeLists.txt
index 449e369..e05cb21 100644
--- a/deployments/internal-trusted-storage/config/shared-flash-opteesp/CMakeLists.txt
+++ b/deployments/internal-trusted-storage/config/shared-flash-opteesp/CMakeLists.txt
@@ -60,8 +60,6 @@
endif()
-compiler_generate_stripped_elf(TARGET internal-trusted-storage NAME "${SP_UUID_CANON}.stripped.elf" RES STRIPPED_ELF)
-
#-------------------------------------------------------------------------------
# Deployment specific install options
#
@@ -73,7 +71,6 @@
PUBLIC_HEADER DESTINATION ${TS_ENV}/include
RUNTIME DESTINATION ${TS_ENV}/bin
)
-install(FILES ${STRIPPED_ELF} DESTINATION ${TS_ENV}/bin)
include(${TS_ROOT}/tools/cmake/common/ExportSp.cmake)
export_sp(
diff --git a/deployments/protected-storage/config/default-opteesp/CMakeLists.txt b/deployments/protected-storage/config/default-opteesp/CMakeLists.txt
index 47f1f53..690094f 100644
--- a/deployments/protected-storage/config/default-opteesp/CMakeLists.txt
+++ b/deployments/protected-storage/config/default-opteesp/CMakeLists.txt
@@ -59,8 +59,6 @@
)
endif()
-compiler_generate_stripped_elf(TARGET protected-storage NAME "${SP_UUID_CANON}.stripped.elf" RES STRIPPED_ELF)
-
#-------------------------------------------------------------------------------
# Deployment specific install options
#
@@ -72,7 +70,6 @@
PUBLIC_HEADER DESTINATION ${TS_ENV}/include
RUNTIME DESTINATION ${TS_ENV}/bin
)
-install(FILES ${STRIPPED_ELF} DESTINATION ${TS_ENV}/bin)
include(${TS_ROOT}/tools/cmake/common/ExportSp.cmake)
export_sp(
diff --git a/deployments/protected-storage/config/shared-flash-opteesp/CMakeLists.txt b/deployments/protected-storage/config/shared-flash-opteesp/CMakeLists.txt
index 02b8a9e..ad9bfe4 100644
--- a/deployments/protected-storage/config/shared-flash-opteesp/CMakeLists.txt
+++ b/deployments/protected-storage/config/shared-flash-opteesp/CMakeLists.txt
@@ -59,8 +59,6 @@
)
endif()
-compiler_generate_stripped_elf(TARGET protected-storage NAME "${SP_UUID_CANON}.stripped.elf" RES STRIPPED_ELF)
-
#-------------------------------------------------------------------------------
# Deployment specific install options
#
@@ -72,7 +70,6 @@
PUBLIC_HEADER DESTINATION ${TS_ENV}/include
RUNTIME DESTINATION ${TS_ENV}/bin
)
-install(FILES ${STRIPPED_ELF} DESTINATION ${TS_ENV}/bin)
include(${TS_ROOT}/tools/cmake/common/ExportSp.cmake)
export_sp(
diff --git a/deployments/se-proxy/config/corstone1000-opteesp/CMakeLists.txt b/deployments/se-proxy/config/corstone1000-opteesp/CMakeLists.txt
index 1691329..4e8431f 100644
--- a/deployments/se-proxy/config/corstone1000-opteesp/CMakeLists.txt
+++ b/deployments/se-proxy/config/corstone1000-opteesp/CMakeLists.txt
@@ -66,8 +66,6 @@
endif()
-compiler_generate_stripped_elf(TARGET se-proxy NAME "${SP_UUID_CANON}.stripped.elf" RES STRIPPED_ELF)
-
#-------------------------------------------------------------------------------
# Deployment specific install options
#-------------------------------------------------------------------------------
@@ -80,7 +78,6 @@
PUBLIC_HEADER DESTINATION ${TS_ENV}/include
RUNTIME DESTINATION ${TS_ENV}/bin
)
-install(FILES ${STRIPPED_ELF} DESTINATION ${TS_ENV}/bin)
get_property(_PROTO_FILES TARGET se-proxy PROPERTY PROTOBUF_FILES)
install(FILES ${_PROTO_FILES} DESTINATION ${TS_ENV}/lib/protobuf)
diff --git a/deployments/se-proxy/config/default-opteesp/CMakeLists.txt b/deployments/se-proxy/config/default-opteesp/CMakeLists.txt
index 5ecef65..d90eeb6 100644
--- a/deployments/se-proxy/config/default-opteesp/CMakeLists.txt
+++ b/deployments/se-proxy/config/default-opteesp/CMakeLists.txt
@@ -68,8 +68,6 @@
endif()
-compiler_generate_stripped_elf(TARGET se-proxy NAME "${SP_UUID_CANON}.stripped.elf" RES STRIPPED_ELF)
-
#-------------------------------------------------------------------------------
# Deployment specific install options
#-------------------------------------------------------------------------------
@@ -82,7 +80,6 @@
PUBLIC_HEADER DESTINATION ${TS_ENV}/include
RUNTIME DESTINATION ${TS_ENV}/bin
)
-install(FILES ${STRIPPED_ELF} DESTINATION ${TS_ENV}/bin)
get_property(_PROTO_FILES TARGET se-proxy PROPERTY PROTOBUF_FILES)
install(FILES ${_PROTO_FILES} DESTINATION ${TS_ENV}/lib/protobuf)
diff --git a/deployments/sfs-demo/opteesp/CMakeLists.txt b/deployments/sfs-demo/opteesp/CMakeLists.txt
index 1dbc279..a1fa569 100644
--- a/deployments/sfs-demo/opteesp/CMakeLists.txt
+++ b/deployments/sfs-demo/opteesp/CMakeLists.txt
@@ -48,8 +48,6 @@
endif()
-compiler_generate_stripped_elf(TARGET sfs-demo NAME "${SP_UUID_CANON}.stripped.elf" RES STRIPPED_ELF)
-
######################################## install
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "location to install build output to." FORCE)
@@ -58,7 +56,6 @@
PUBLIC_HEADER DESTINATION ${TS_ENV}/include
RUNTIME DESTINATION ${TS_ENV}/bin
)
-install(FILES ${STRIPPED_ELF} DESTINATION ${TS_ENV}/bin)
include(${TS_ROOT}/tools/cmake/common/ExportSp.cmake)
export_sp(
diff --git a/deployments/smm-gateway/config/default-opteesp/CMakeLists.txt b/deployments/smm-gateway/config/default-opteesp/CMakeLists.txt
index be5f293..06c0138 100644
--- a/deployments/smm-gateway/config/default-opteesp/CMakeLists.txt
+++ b/deployments/smm-gateway/config/default-opteesp/CMakeLists.txt
@@ -71,8 +71,6 @@
endif()
-compiler_generate_stripped_elf(TARGET smm-gateway NAME "${SP_UUID_CANON}.stripped.elf" RES STRIPPED_ELF)
-
#-------------------------------------------------------------------------------
# Deployment specific install options
#-------------------------------------------------------------------------------
@@ -85,7 +83,6 @@
PUBLIC_HEADER DESTINATION ${TS_ENV}/include
RUNTIME DESTINATION ${TS_ENV}/bin
)
-install(FILES ${STRIPPED_ELF} DESTINATION ${TS_ENV}/bin)
get_property(_PROTO_FILES TARGET smm-gateway PROPERTY PROTOBUF_FILES)
install(FILES ${_PROTO_FILES} DESTINATION ${TS_ENV}/lib/protobuf)
diff --git a/environments/opteesp/component.cmake b/environments/opteesp/component.cmake
index 526d8c8..f05b12a 100644
--- a/environments/opteesp/component.cmake
+++ b/environments/opteesp/component.cmake
@@ -19,6 +19,12 @@
endif()
ts_add_uuid_to_exe_name(TGT "${TGT}" UUID "${SP_BIN_UUID_CANON}" )
+get_target_property(_tgt_type ${TGT} TYPE)
+if ("${_tgt_type}" STREQUAL "EXECUTABLE")
+ compiler_generate_stripped_elf(TARGET ${TGT} NAME "${SP_BIN_UUID_CANON}.stripped.elf" RES STRIPPED_ELF)
+ install(FILES ${STRIPPED_ELF} DESTINATION ${TS_ENV}/bin)
+endif()
+
target_sources(${TGT} PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/optee_sp_header.c"
"${CMAKE_CURRENT_LIST_DIR}/sp_assert.c"