Tests: The "split build" adaptation

This code builds TEST_NS_ITS test using split build.

cd ./trusted-firmware-m

cmake -S . -B ../tf-m-tests/build-tfm -DTFM_PLATFORM=arm/mps2/an521
-DCONFIG_TFM_BUILD_SPLIT=ON
-DCMAKE_INSTALL_PREFIX=../tf-m-tests/build-tfm/api_ns
-DTFM_TOOLCHAINE=toolchain_GNUARM.cmake
-DTFM_PROFILE=profile_small
-DNS=OFF -DTEST_S=OFF -DPLATFORM_DEFAULT_IMAGE_SIGNING=ON

cmake --build build -- install

cd ../tf-m-tests/app_ns_test

cmake -S . -B build -DTEST_NS_ITS=OFF
-DCONFIG_SPE_PATH=../build-tfm/api_ns

cmake --build build -- tfm_app_binaries

Check the binary in ./build/tfm_s_ns_signed.bin

Signed-off-by: Anton Komlev <anton.komlev@arm.com>
Change-Id: Icaf38d844fe38d444b973776af2616d16c5439b1
diff --git a/app_ns_test/CMakeLists.txt b/app_ns_test/CMakeLists.txt
new file mode 100644
index 0000000..d66ece8
--- /dev/null
+++ b/app_ns_test/CMakeLists.txt
@@ -0,0 +1,56 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2023, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+cmake_minimum_required(VERSION 3.15)
+
+if (NOT DEFINED CONFIG_SPE_PATH OR NOT EXISTS ${CONFIG_SPE_PATH})
+    message(FATAL_ERROR "CONFIG_SPE_PATH = ${CONFIG_SPE_PATH} is not defined or incorrect. Please provide full path to TF-M build artifacts using -DCONFIG_SPE_PATH=")
+endif()
+
+if (NOT DEFINED CMAKE_TOOLCHAIN_FILE)
+    set(CROSS_COMPILE         arm-none-eabi)
+    set(CMAKE_TOOLCHAIN_FILE  ${CONFIG_SPE_PATH}/cmake/toolchain_ns_GNUARM.cmake)
+endif()
+
+if (NOT DEFINED TFM_TEST_PATH)
+    set(TFM_TEST_PATH ${CMAKE_SOURCE_DIR}/../test)
+endif()
+
+set(TFM_NS_REG_TEST       ON)
+set(NS                    ON)
+set(TEST_NS               ON)
+#------------------------------------------------------------------------------
+
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/../cmake)
+list(APPEND CMAKE_MODULE_PATH ${CONFIG_SPE_PATH}/cmake)
+
+project(tfm_ns LANGUAGES C)
+
+add_executable(tfm_ns)
+
+add_subdirectory(../ns_interface ${CMAKE_BINARY_DIR}/ns_interface)
+add_subdirectory(../test         ${CMAKE_BINARY_DIR}/tests)
+
+include(../test/config/set_config.cmake)
+
+############################# TFM NS main app ##################################
+
+target_sources(tfm_ns
+    PRIVATE
+        test_app.c
+)
+
+target_link_libraries(tfm_ns
+    PRIVATE
+        tfm_test_broker
+        tfm_ns_tests
+        tfm_test_framework_common
+)
+
+set_target_properties(tfm_ns PROPERTIES
+    SUFFIX ".axf"
+    RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
+)
diff --git a/app_ns_test/test_app.c b/app_ns_test/test_app.c
new file mode 100644
index 0000000..bd45b38
--- /dev/null
+++ b/app_ns_test/test_app.c
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2017-2022, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#include "test_app.h"
+#include "tfm_log.h"
+#include "test_framework_integ_test.h"
+
+/**
+ * \brief Services test thread
+ *
+ */
+__attribute__((noreturn))
+void test_app(void *argument)
+{
+    UNUSED_VARIABLE(argument);
+
+    tfm_non_secure_client_run_tests();
+
+    /* Output EOT char for test environments like FVP. */
+    LOG_MSG("\x04");
+
+    /* End of test */
+    for (;;) {
+    }
+}