Build: Move 'secure_fw' out of 'app' build territory
'secure_fw' should be a standalone project instead of
being launched by 'app' build. Move it out of 'app'
territory and correct veneer lib settings for 'app'.
Change-Id: Ic50b0df234cbee0741ff9385a0c59ef87070df41
Signed-off-by: Ken Liu <ken.liu@arm.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1b6d722..4dd21e6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,5 @@
#-------------------------------------------------------------------------------
-# Copyright (c) 2017, Arm Limited. All rights reserved.
+# Copyright (c) 2017-2019, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -10,6 +10,7 @@
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
include("Common/BuildSys")
+add_subdirectory(secure_fw)
add_subdirectory(app)
add_subdirectory(bl2/ext/mcuboot)
diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt
index 54e25a6..b4084bb 100644
--- a/app/CMakeLists.txt
+++ b/app/CMakeLists.txt
@@ -303,8 +303,16 @@
#Ensure secure_fw is built before our executable.
add_dependencies(${EXE_NAME} ${S_BIN})
+ if (NOT DEFINED S_VENEER_PATH)
+ if (EXISTS ${CMAKE_CURRENT_BINARY_DIR}/../secure_fw)
+ set (S_VENEER_PATH "${CMAKE_CURRENT_BINARY_DIR}/../secure_fw")
+ else()
+ message(FATAL_ERROR "No valid path for S_VENEER_PATH, secure_fw is built?")
+ endif()
+ endif()
+
#Add the veneers to the executable.
- set(S_VENEER_FILE "${CMAKE_CURRENT_BINARY_DIR}/${VENEER_NAME}")
+ set(S_VENEER_FILE "${S_VENEER_PATH}/${VENEER_NAME}")
set_property(TARGET ${EXE_NAME} APPEND PROPERTY LINK_LIBRARIES ${S_VENEER_FILE})
#Collect executables to common location: build/install/outputs/
@@ -317,11 +325,6 @@
DESTINATION outputs/fvp/)
endfunction()
-if (NOT TARGET_TFM_S_EXISTED)
- set(S_VENEER_FILE_LOCATION "${CMAKE_CURRENT_BINARY_DIR}")
- add_subdirectory(../secure_fw ${CMAKE_CURRENT_BINARY_DIR}/secure_fw)
-endif()
-
if (LINK_TO_BOTH_MEMORY_REGION)
#Link to primary memory region
set_up_app_build(NS_TARGET ${PROJECT_NAME}
diff --git a/secure_fw/CMakeLists.txt b/secure_fw/CMakeLists.txt
index 63a8ba3..1fe005a 100644
--- a/secure_fw/CMakeLists.txt
+++ b/secure_fw/CMakeLists.txt
@@ -143,15 +143,11 @@
#Set common linker flags
config_setting_shared_linker_flags(${EXE_NAME})
- #Indicates to secure target(s) already created
- set(TARGET_TFM_S_EXISTED True PARENT_SCOPE)
-
#Set individual linker flags per linker target/executable
foreach(flag ${_MY_PARAMS_LINK_DEFINES})
embedded_set_target_link_defines(TARGET ${EXE_NAME} DEFINES "${flag}")
endforeach(flag)
-
embedded_set_target_linker_file(TARGET ${EXE_NAME} PATH "${S_SCATTER_FILE_NAME}")
add_dependencies(${EXE_NAME} tfm_crypto)
@@ -273,11 +269,7 @@
compiler_generate_binary_output(${EXE_NAME})
#Configure where we put the CMSE veneers generated by the compiler.
- if (DEFINED S_VENEER_FILE_LOCATION)
- set(S_VENEER_FILE "${S_VENEER_FILE_LOCATION}/${VENEER_NAME}")
- else()
- set(S_VENEER_FILE "${CMAKE_CURRENT_BINARY_DIR}/${VENEER_NAME}")
- endif()
+ set(S_VENEER_FILE "${CMAKE_CURRENT_BINARY_DIR}/${VENEER_NAME}")
compiler_set_cmse_output(${EXE_NAME} "${S_VENEER_FILE}")
#Configure what file shall be installed.
@@ -386,6 +378,9 @@
add_subdirectory(${SECURE_FW_DIR}/services/audit_logging)
endif()
+#Broadcast veneer path in bundled building case
+set(S_VENEER_PATH "${CMAKE_CURRENT_BINARY_DIR}" CACHE INTERNAL "")
+
if (LINK_TO_BOTH_MEMORY_REGION)
#Link to primary memory region
set_up_secure_fw_build(S_TARGET ${PROJECT_NAME}