Test/app: Fix compilation issues after moving test code here
The intention is only to make the codes pass compilation.
Some of the implementations will be refined in the future
Change-Id: I1c84c06705c80be74f270777c1a6d95974f8c240
Signed-off-by: Kevin Peng <kevin.peng@arm.com>
diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt
index 2039a6a..aba1c04 100644
--- a/app/CMakeLists.txt
+++ b/app/CMakeLists.txt
@@ -9,11 +9,13 @@
set(TFM_BUILD_IN_SPE OFF)
-#Tell cmake where our modules can be found
-list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/../cmake)
+if (NOT DEFINED TFM_ROOT_DIR)
+ set(TFM_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../../trusted-firmware-m)
+endif()
-set(APP_DIR ${CMAKE_CURRENT_LIST_DIR})
-get_filename_component(TFM_ROOT_DIR ${APP_DIR}/.. ABSOLUTE)
+#Tell cmake where our modules can be found
+list(APPEND CMAKE_MODULE_PATH ${TFM_ROOT_DIR}/cmake)
+
set(INTERFACE_DIR ${TFM_ROOT_DIR}/interface)
#Include common stuff to control cmake.
@@ -29,11 +31,7 @@
include("${MCUBOOT_DIR}/MCUBoot.cmake")
#CMSIS
-get_filename_component(CMSIS_DIR ${TFM_ROOT_DIR}/../tf-m-tests/CMSIS ABSOLUTE)
-
-if(NOT EXISTS ${CMSIS_DIR})
- message(FATAL_ERROR "Missing CMSIS. Please clone the tf-m-tests repo.")
-endif()
+set(CMSIS_DIR ${CMAKE_CURRENT_LIST_DIR}/../CMSIS)
if (NOT DEFINED BL2)
message(FATAL_ERROR "Incomplete build configuration: BL2 is undefined. ")
@@ -67,13 +65,13 @@
message(FATAL_ERROR "Incomplete build configuration: TFM_PSA_API is undefined.")
endif()
-embedded_include_directories(PATH ${TFM_ROOT_DIR}/app ABSOLUTE)
+embedded_include_directories(PATH ${CMAKE_CURRENT_LIST_DIR} ABSOLUTE)
set(NS_APP_SRC "${CMSIS_DIR}/RTOS2/RTX/Config/RTX_Config.c"
"${CMSIS_DIR}/RTOS2/RTX/Source/rtx_lib.c"
- "${APP_DIR}/main_ns.c"
- "${APP_DIR}/tfm_integ_test.c"
- "${APP_DIR}/os_wrapper_cmsis_rtos_v2.c"
+ "${CMAKE_CURRENT_LIST_DIR}/main_ns.c"
+ "${CMAKE_CURRENT_LIST_DIR}/tfm_integ_test.c"
+ "${CMAKE_CURRENT_LIST_DIR}/os_wrapper_cmsis_rtos_v2.c"
"${TFM_ROOT_DIR}/interface/src/log/tfm_log_raw.c"
)
@@ -139,7 +137,7 @@
endif()
if (PSA_API_TEST_NS)
- list(APPEND NS_APP_SRC "${APP_DIR}/psa_api_test.c")
+ list(APPEND NS_APP_SRC "${CMAKE_CURRENT_LIST_DIR}/psa_api_test.c")
endif()
if (TFM_PSA_API)
@@ -208,6 +206,7 @@
embedded_target_include_directories(TARGET ${PROJECT_OBJ_LIB} PATH ${CMSIS_DIR}/RTOS2/RTX/Include ABSOLUTE APPEND)
embedded_target_include_directories(TARGET ${PROJECT_OBJ_LIB} PATH ${CMSIS_DIR}/RTOS2/Include ABSOLUTE APPEND)
embedded_target_include_directories(TARGET ${PROJECT_OBJ_LIB} PATH ${CMSIS_DIR}/RTOS2/RTX/Config ABSOLUTE APPEND)
+embedded_target_include_directories(TARGET ${PROJECT_OBJ_LIB} PATH ${TEST_DIR}/.. ABSOLUTE APPEND)
if (NOT DEFINED TFM_NS_CLIENT_IDENTIFICATION)
message(FATAL_ERROR "Incomplete build configuration: TFM_NS_CLIENT_IDENTIFICATION is undefined.")
diff --git a/test/CMakeLists.inc b/test/CMakeLists.inc
index ac308f2..a41642b 100644
--- a/test/CMakeLists.inc
+++ b/test/CMakeLists.inc
@@ -33,6 +33,7 @@
embedded_include_directories(PATH ${TFM_ROOT_DIR}/secure_fw/spm ABSOLUTE)
embedded_include_directories(PATH ${TFM_ROOT_DIR}/bl2/include ABSOLUTE)
+embedded_include_directories(PATH ${TEST_DIR}/.. ABSOLUTE)
# Include the test framework
include(${CMAKE_CURRENT_LIST_DIR}/framework/CMakeLists.inc)
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 50a7b17..2c5ea2d 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -7,11 +7,12 @@
cmake_minimum_required(VERSION 3.7)
-#Tell cmake where our modules can be found
-list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/../cmake)
+if (NOT DEFINED TFM_ROOT_DIR)
+ set(TFM_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../../trusted-firmware-m)
+endif()
-#Tell TFM Root before calling sub cmake
-get_filename_component(TFM_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE)
+#Tell cmake where our modules can be found
+list(APPEND CMAKE_MODULE_PATH ${TFM_ROOT_DIR}/cmake)
#Include common stuff to control cmake.
include("Common/BuildSys")