Build: Always include preload_ns.cmake if it exists

Rather than using a cmake variable to determine whether to include
preload_ns.cmake, always include it if it exists.

This allows the platforms that currently provide an empty
preload_ns.cmake file to get rid of it.

Change-Id: I7e5755a75133caf7bb3a652a0d4ab2780dc5ae90
Signed-off-by: Chris Brand <chris.brand@cypress.com>
diff --git a/docs/platform/ext/readme.rst b/docs/platform/ext/readme.rst
index 3868e2b..1057e03 100644
--- a/docs/platform/ext/readme.rst
+++ b/docs/platform/ext/readme.rst
@@ -164,10 +164,10 @@
 preload_ns.cmake
 ^^^^^^^^^^^^^^^^
 
-This optional 4th cmake file is required only if the target is utilising
-``TFM_MULTI_CORE_TOPOLOGY``. This file has the same format as ``preload.cmake``,
-but instead details the hardware of the NS core that is **not** running the main
-TF-M secure code.
+This optional cmake file is required only if the target runs the NSPE on a
+core that requires different compiler options than the SPE core. This file has
+the same format as ``preload.cmake``, but instead details the hardware of the
+NS core that is **not** running the main TF-M secure code.
 
 Flash layout header file
 ------------------------
@@ -292,4 +292,5 @@
 --------------
 
 *Copyright (c) 2017-2021, Arm Limited. All rights reserved.*
-*Copyright (c) 2020, Cypress Semiconductor Corporation. All rights reserved.*
+*Copyright (c) 2020-2022 Cypress Semiconductor Corporation (an Infineon company)
+or an affiliate of Cypress Semiconductor Corporation. All rights reserved.*
diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt
index 9dae7c8..0062d56 100644
--- a/interface/CMakeLists.txt
+++ b/interface/CMakeLists.txt
@@ -1,5 +1,7 @@
 #-------------------------------------------------------------------------------
 # Copyright (c) 2020-2022, Arm Limited. All rights reserved.
+# Copyright (c) 2022 Cypress Semiconductor Corporation (an Infineon company)
+# or an affiliate of Cypress Semiconductor Corporation. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -15,9 +17,12 @@
                ${CMAKE_BINARY_DIR}/generated/interface/include/psa/framework_feature.h
                @ONLY)
 
-if (TFM_MULTI_CORE_TOPOLOGY)
+if (EXISTS ${CMAKE_SOURCE_DIR}/platform/ext/target/${TFM_PLATFORM}/preload_ns.cmake)
     include(${CMAKE_SOURCE_DIR}/platform/ext/target/${TFM_PLATFORM}/preload_ns.cmake)
     tfm_toolchain_reload_compiler()
+endif()
+
+if (TFM_MULTI_CORE_TOPOLOGY)
     # The platform target is created in this directory/file so that it has the
     # same settings as the main ns target.
     add_library(platform_ns STATIC EXCLUDE_FROM_ALL)
diff --git a/platform/ext/target/arm/corstone1000/preload_ns.cmake b/platform/ext/target/arm/corstone1000/preload_ns.cmake
deleted file mode 100644
index 9613613..0000000
--- a/platform/ext/target/arm/corstone1000/preload_ns.cmake
+++ /dev/null
@@ -1,9 +0,0 @@
-#-------------------------------------------------------------------------------
-# Copyright (c) 2020-2021, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-#-------------------------------------------------------------------------------
-
-# Placeholder because of interface include rule when TFM_MULTI_CORE_TOPOLOGY is
-# set.
diff --git a/platform/ext/target/arm/musca_b1/secure_enclave/preload_ns.cmake b/platform/ext/target/arm/musca_b1/secure_enclave/preload_ns.cmake
deleted file mode 100644
index 3b9601f..0000000
--- a/platform/ext/target/arm/musca_b1/secure_enclave/preload_ns.cmake
+++ /dev/null
@@ -1,9 +0,0 @@
-#-------------------------------------------------------------------------------
-# Copyright (c) 2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-#-------------------------------------------------------------------------------
-
-# Placeholder because of interface include rule when TFM_MULTI_CORE_TOPOLOGY is
-# set.
diff --git a/platform/ext/target/cypress/psoc64/libs/mtb-pdl-cat1/mtb-pdl-cat1_ns_lib/CMakeLists.txt b/platform/ext/target/cypress/psoc64/libs/mtb-pdl-cat1/mtb-pdl-cat1_ns_lib/CMakeLists.txt
index 38fbf98..73744fa 100644
--- a/platform/ext/target/cypress/psoc64/libs/mtb-pdl-cat1/mtb-pdl-cat1_ns_lib/CMakeLists.txt
+++ b/platform/ext/target/cypress/psoc64/libs/mtb-pdl-cat1/mtb-pdl-cat1_ns_lib/CMakeLists.txt
@@ -17,7 +17,7 @@
     set(MTB_PDL_CAT1_LIB_NS_TARGET mtb-pdl-cat1_lib_ns)
 endif()
 
-if (TFM_MULTI_CORE_TOPOLOGY)
+if (EXISTS ${PLATFORM_DIR}/ext/target/${TFM_PLATFORM}/preload_ns.cmake)
     include(${PLATFORM_DIR}/ext/target/${TFM_PLATFORM}/preload_ns.cmake)
     tfm_toolchain_reload_compiler()
 endif()