Build: Refactor toolchain files

Change from a CMAKE toolchain file to a TFM toolchain file, avoiding
some abuses of the CMAKE_TOOLCHAIN_FILE that were used as a workaround
for compiler setup. Also add the CROSS_COMPILE variable. Bump cmake
required version to 3.15.

Change-Id: I0948033045e2d2f34beffa807925fc7375098335
Signed-off-by: Raef Coles <raef.coles@arm.com>
diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt
index f227c6e..85f63f0 100644
--- a/docs/CMakeLists.txt
+++ b/docs/CMakeLists.txt
@@ -5,7 +5,7 @@
 #
 #-------------------------------------------------------------------------------
 
-cmake_minimum_required(VERSION 3.13)
+cmake_minimum_required(VERSION 3.15)
 
 add_custom_target(docs)
 
diff --git a/docs/design_documents/profiles/tfm_profile_medium.rst b/docs/design_documents/profiles/tfm_profile_medium.rst
index cb744d4..8413635 100644
--- a/docs/design_documents/profiles/tfm_profile_medium.rst
+++ b/docs/design_documents/profiles/tfm_profile_medium.rst
@@ -419,7 +419,7 @@
    cd <TFM root dir>
    mkdir build && cd build
    cmake -DTFM_PLATFORM=mps2/an521 \
-         -DCMAKE_TOOLCHAIN_FILE=../toolchain_ARMCLANG.cmake \
+         -DTFM_TOOLCHAIN_FILE=../toolchain_ARMCLANG.cmake \
          -DTFM_PROFILE=profile_medium \
          -DCMAKE_BUILD_TYPE=MinSizeRel \
          ../
@@ -433,7 +433,7 @@
    cd <TFM root dir>
    mkdir build && cd build
    cmake -DTFM_PLATFORM=mps2/an521 \
-         -DCMAKE_TOOLCHAIN_FILE=../toolchain_ARMCLANG.cmake \
+         -DTFM_TOOLCHAIN_FILE=../toolchain_ARMCLANG.cmake \
          -DTFM_PROFILE=profile_medium \
          -DCMAKE_BUILD_TYPE=MinSizeRel \
          -DTEST_S=ON -DTEST_NS=ON \
diff --git a/docs/design_documents/profiles/tfm_profile_small.rst b/docs/design_documents/profiles/tfm_profile_small.rst
index c500f50..abd49c8 100644
--- a/docs/design_documents/profiles/tfm_profile_small.rst
+++ b/docs/design_documents/profiles/tfm_profile_small.rst
@@ -583,7 +583,7 @@
    cd <TFM root dir>
    mkdir build && cd build
    cmake -DTFM_PLATFORM=mps2/an521 \
-         -DCMAKE_TOOLCHAIN_FILE=../toolchain_ARMCLANG.cmake \
+         -DTFM_TOOLCHAIN_FILE=../toolchain_ARMCLANG.cmake \
          -DTFM_PROFILE=profile_small \
          -DCMAKE_BUILD_TYPE=MinSizeRel \
          ../
@@ -597,7 +597,7 @@
    cd <TFM root dir>
    mkdir build && cd build
    cmake -DTFM_PLATFORM=mps2/an521 \
-         -DCMAKE_TOOLCHAIN_FILE=../toolchain_ARMCLANG.cmake \
+         -DTFM_TOOLCHAIN_FILE=../toolchain_ARMCLANG.cmake \
          -DTFM_PROFILE=profile_small \
          -DCMAKE_BUILD_TYPE=MinSizeRel \
          -DTEST_S=ON -DTEST_NS=ON \
diff --git a/docs/getting_started/tfm_build_instruction.rst b/docs/getting_started/tfm_build_instruction.rst
index a2d4ad4..7e92be1 100644
--- a/docs/getting_started/tfm_build_instruction.rst
+++ b/docs/getting_started/tfm_build_instruction.rst
@@ -10,8 +10,7 @@
 TF-M uses `cmake <https://cmake.org/overview/>`__ to provide an out-of-source
 build environment. The instructions are below.
 
-Cmake version ``3.13.0`` or higher is supported, but version ``3.15.0`` or
-higher is required for ARMclang support.
+Cmake version ``3.15.0`` or higher is required.
 
 Getting the source-code
 =======================
@@ -72,7 +71,7 @@
 | TFM_PLATFORM         | The target platform as a path from the base directory |
 |                      | ``/platform/ext/target``                              |
 +----------------------+-------------------------------------------------------+
-| CMAKE_TOOLCHAIN_FILE | The path to the toolchain file that corresponds to    |
+| TFM_TOOLCHAIN_FILE   | The path to the toolchain file that corresponds to    |
 |                      | the desired compiler.                                 |
 +----------------------+-------------------------------------------------------+
 
@@ -260,7 +259,7 @@
 
     cd <base folder>
     cd trusted-firmware-m
-    cmake -S . -B cmake_build -DTFM_PLATFORM=mps2/an521 -DCMAKE_TOOLCHAIN_FILE=toolchain_GNUARM.cmake
+    cmake -S . -B cmake_build -DTFM_PLATFORM=mps2/an521 -DTFM_TOOLCHAIN_FILE=toolchain_GNUARM.cmake
     cmake --build cmake_build -- install
 
 Alternately using traditional cmake syntax
@@ -271,7 +270,7 @@
     cd trusted-firmware-m
     mkdir cmake_build
     cd cmake_build
-    cmake .. -DTFM_PLATFORM=mps2/an521 -DCMAKE_TOOLCHAIN_FILE=../toolchain_GNUARM.cmake
+    cmake .. -DTFM_PLATFORM=mps2/an521 -DTFM_TOOLCHAIN_FILE=../toolchain_GNUARM.cmake
     make install
 
 .. Note::
@@ -295,7 +294,7 @@
 
     cd <base folder>
     cd trusted-firmware-m
-    cmake -S . -B cmake_build -DTFM_PLATFORM=mps2/an521 -DCMAKE_TOOLCHAIN_FILE=toolchain_GNUARM.cmake -DTEST_S=ON -DTEST_NS=ON
+    cmake -S . -B cmake_build -DTFM_PLATFORM=mps2/an521 -DTFM_TOOLCHAIN_FILE=toolchain_GNUARM.cmake -DTEST_S=ON -DTEST_NS=ON
     cmake --build cmake_build -- install
 
 Alternately using traditional cmake syntax
@@ -306,7 +305,7 @@
     cd trusted-firmware-m
     mkdir cmake_build
     cd cmake_build
-    cmake .. -DTFM_PLATFORM=mps2/an521 -DCMAKE_TOOLCHAIN_FILE=../toolchain_GNUARM.cmake -DTEST_S=ON -DTEST_NS=ON
+    cmake .. -DTFM_PLATFORM=mps2/an521 -DTFM_TOOLCHAIN_FILE=../toolchain_GNUARM.cmake -DTEST_S=ON -DTEST_NS=ON
     make install
 
 Build for PSA Functional API compliance tests
@@ -333,7 +332,7 @@
 
     cd <base folder>
     cd trusted-firmware-m
-    cmake -S . -B cmake_build -DTFM_PLATFORM=mps2/an521 -DCMAKE_TOOLCHAIN_FILE=toolchain_GNUARM.cmake -DTEST_PSA_API=CRYPTO
+    cmake -S . -B cmake_build -DTFM_PLATFORM=mps2/an521 -DTFM_TOOLCHAIN_FILE=toolchain_GNUARM.cmake -DTEST_PSA_API=CRYPTO
     cmake --build cmake_build -- install
 
 Alternately using traditional cmake syntax
@@ -344,7 +343,7 @@
     cd trusted-firmware-m
     mkdir cmake_build
     cd cmake_build
-    cmake .. -DTFM_PLATFORM=mps2/an521 -DCMAKE_TOOLCHAIN_FILE=../toolchain_GNUARM.cmake -DTEST_PSA_API=CRYPTO
+    cmake .. -DTFM_PLATFORM=mps2/an521 -DTFM_TOOLCHAIN_FILE=../toolchain_GNUARM.cmake -DTEST_PSA_API=CRYPTO
     make install
 
 Build for PSA FF (IPC) compliance tests
@@ -361,7 +360,7 @@
 
     cd <base folder>
     cd trusted-firmware-m
-    cmake -S . -B cmake_build -DTFM_PLATFORM=mps2/an521 -DCMAKE_TOOLCHAIN_FILE=toolchain_GNUARM.cmake -DTEST_PSA_API=IPC -DTFM_PSA_API=ON
+    cmake -S . -B cmake_build -DTFM_PLATFORM=mps2/an521 -DTFM_TOOLCHAIN_FILE=toolchain_GNUARM.cmake -DTEST_PSA_API=IPC -DTFM_PSA_API=ON
     cmake --build cmake_build -- install
 
 Alternately using traditional cmake syntax
@@ -372,7 +371,7 @@
     cd trusted-firmware-m
     mkdir cmake_build
     cd cmake_build
-    cmake .. -DTFM_PLATFORM=mps2/an521 -DCMAKE_TOOLCHAIN_FILE=../toolchain_GNUARM.cmake -DTEST_PSA_API=IPC -DTFM_PSA_API=ON
+    cmake .. -DTFM_PLATFORM=mps2/an521 -DTFM_TOOLCHAIN_FILE=../toolchain_GNUARM.cmake -DTEST_PSA_API=IPC -DTFM_PSA_API=ON
     make install
 
 Location of build artifacts
@@ -413,7 +412,7 @@
 .. code-block:: bash
 
     cd <TF-M base folder>
-    cmake -S . -B cmake_doc -DTFM_PLATFORM=mps2/an521 -DCMAKE_TOOLCHAIN_FILE=toolchain_GNUARM.cmake
+    cmake -S . -B cmake_doc -DTFM_PLATFORM=mps2/an521 -DTFM_TOOLCHAIN_FILE=toolchain_GNUARM.cmake
     cmake --build cmake_doc -- tfm_docs_refman_html tfm_docs_refman_pdf
 
 The documentation files will be available under the directory::
@@ -425,7 +424,7 @@
 .. code-block:: bash
 
     cd <TF-M base folder>
-    cmake -S . -B cmake_doc -DTFM_PLATFORM=mps2/an521 -DCMAKE_TOOLCHAIN_FILE=toolchain_GNUARM.cmake
+    cmake -S . -B cmake_doc -DTFM_PLATFORM=mps2/an521 -DTFM_TOOLCHAIN_FILE=toolchain_GNUARM.cmake
     cmake --build cmake_doc -- tfm_docs_userguide_html tfm_docs_userguide_pdf
 
 The documentation files will be available under the directory::
@@ -524,7 +523,7 @@
 
     cd <base folder>
     cd trusted-firmware-m
-    cmake -S . -B cmake_build -DTFM_PLATFORM=mps2/an521 -DCMAKE_TOOLCHAIN_FILE=toolchain_GNUARM.cmake -DMBEDCRYPTO_PATH=<Mbed Crypto base folder>/mbedtls
+    cmake -S . -B cmake_build -DTFM_PLATFORM=mps2/an521 -DTFM_TOOLCHAIN_FILE=toolchain_GNUARM.cmake -DMBEDCRYPTO_PATH=<Mbed Crypto base folder>/mbedtls
     cmake --build cmake_build -- install
 
 Alternately using traditional cmake syntax
@@ -535,7 +534,7 @@
     cd trusted-firmware-m
     mkdir cmake_build
     cd cmake_build
-    cmake .. -DTFM_PLATFORM=mps2/an521 -DCMAKE_TOOLCHAIN_FILE=../toolchain_GNUARM.cmake -DMBEDCRYPTO_PATH=<Mbed Crypto base folder>/mbedtls
+    cmake .. -DTFM_PLATFORM=mps2/an521 -DTFM_TOOLCHAIN_FILE=../toolchain_GNUARM.cmake -DMBEDCRYPTO_PATH=<Mbed Crypto base folder>/mbedtls
     make install
 
 --------------
diff --git a/docs/getting_started/tfm_build_instruction_iar.rst b/docs/getting_started/tfm_build_instruction_iar.rst
index 8df576f..8a6e007 100644
--- a/docs/getting_started/tfm_build_instruction_iar.rst
+++ b/docs/getting_started/tfm_build_instruction_iar.rst
@@ -3,7 +3,7 @@
 ###################################################
 
 Follow the instructions in
-:doc:`software requirements <tfm_build_instruction>`, but replace the -DCMAKE_TOOLCHAIN_FILE setting with toolchain_IARARM.cmake.
+:doc:`software requirements <tfm_build_instruction>`, but replace the -DTFM_TOOLCHAIN_FILE setting with toolchain_IARARM.cmake.
 
 
 Notes for building with IARARM
@@ -29,7 +29,7 @@
 
     cd <base folder>
     cd trusted-firmware-m
-    cmake -S . -B cmake_build -DTFM_PLATFORM=mps2/an521 -DCMAKE_TOOLCHAIN_FILE=toolchain_IARARM.cmake
+    cmake -S . -B cmake_build -DTFM_PLATFORM=mps2/an521 -DTFM_TOOLCHAIN_FILE=toolchain_IARARM.cmake
     cmake --build cmake_build -- install
 
 Alternately using traditional cmake syntax
@@ -40,7 +40,7 @@
     cd trusted-firmware-m
     mkdir cmake_build
     cd cmake_build
-    cmake .. -DTFM_PLATFORM=mps2/an521 -DCMAKE_TOOLCHAIN_FILE=../toolchain_IARARM.cmake
+    cmake .. -DTFM_PLATFORM=mps2/an521 -DTFM_TOOLCHAIN_FILE=../toolchain_IARARM.cmake
     make install
 
 Regression Tests for the AN521 target platform
@@ -50,7 +50,7 @@
 
     cd <base folder>
     cd trusted-firmware-m
-    cmake -S . -B cmake_build -DTFM_PLATFORM=mps2/an521 -DCMAKE_TOOLCHAIN_FILE=toolchain_IARARM.cmake -DTEST_S=ON -DTEST_NS=ON
+    cmake -S . -B cmake_build -DTFM_PLATFORM=mps2/an521 -DTFM_TOOLCHAIN_FILE=toolchain_IARARM.cmake -DTEST_S=ON -DTEST_NS=ON
     cmake --build cmake_build -- install
 
 Alternately using traditional cmake syntax
@@ -61,7 +61,7 @@
     cd trusted-firmware-m
     mkdir cmake_build
     cd cmake_build
-    cmake .. -DTFM_PLATFORM=mps2/an521 -DCMAKE_TOOLCHAIN_FILE=../toolchain_IARARM.cmake -DTEST_S=ON -DTEST_NS=ON
+    cmake .. -DTFM_PLATFORM=mps2/an521 -DTFM_TOOLCHAIN_FILE=../toolchain_IARARM.cmake -DTEST_S=ON -DTEST_NS=ON
     make install
 
  *Copyright (c) 2020, Arm Limited. All rights reserved.*
diff --git a/docs/getting_started/tfm_secure_boot.rst b/docs/getting_started/tfm_secure_boot.rst
index f9f4599..61be329 100644
--- a/docs/getting_started/tfm_secure_boot.rst
+++ b/docs/getting_started/tfm_secure_boot.rst
@@ -309,7 +309,7 @@
 
 Example of how to provide the secure image minimum version::
 
-    cmake -DTFM_PLATFORM=musca_b1 -DCMAKE_TOOLCHAIN_FILE=../toolchain_GNUARM.cmake -DMCUBOOT_S_IMAGE_MIN_VER=1.2.3+4 ..
+    cmake -DTFM_PLATFORM=musca_b1 -DTFM_TOOLCHAIN_FILE=../toolchain_GNUARM.cmake -DMCUBOOT_S_IMAGE_MIN_VER=1.2.3+4 ..
 
 ********************
 Signature algorithms
@@ -428,7 +428,7 @@
 The version number of the image (single image boot) can manually be passed in
 through the command line in the cmake configuration step::
 
-    cmake -DTFM_PLATFORM=musca_b1 -DCMAKE_TOOLCHAIN_FILE=../toolchain_GNUARM.cmake -DIMAGE_VERSION_S=1.2.3+4 ..
+    cmake -DTFM_PLATFORM=musca_b1 -DTFM_TOOLCHAIN_FILE=../toolchain_GNUARM.cmake -DIMAGE_VERSION_S=1.2.3+4 ..
 
 Alternatively, the version number can be less specific (e.g 1, 1.2, or 1.2.3),
 where the missing numbers are automatically set to zero. The image version
@@ -462,7 +462,7 @@
 current image version. The value of the security counter (single image boot) can
 be specified at build time in the cmake configuration step::
 
-    cmake -DTFM_PLATFORM=musca_b1 -DCMAKE_TOOLCHAIN_FILE=../toolchain_GNUARM.cmake -DSECURITY_COUNTER_S=42 ../
+    cmake -DTFM_PLATFORM=musca_b1 -DTFM_TOOLCHAIN_FILE=../toolchain_GNUARM.cmake -DSECURITY_COUNTER_S=42 ../
 
 The security counter can be independent from the image version, but not
 necessarily. Alternatively, if it is not specified at build time with the
diff --git a/docs/getting_started/tfm_sw_requirement.rst b/docs/getting_started/tfm_sw_requirement.rst
index 24d42aa..9e83d23 100644
--- a/docs/getting_started/tfm_sw_requirement.rst
+++ b/docs/getting_started/tfm_sw_requirement.rst
@@ -81,12 +81,7 @@
 
 The build-system is CMake based and supports the following versions:
 
-    - 3.13
-    - 3.14
-    - 3.15
-    - 3.16
-    - 3.17
-    - 3.18
+The build-system is CMake based and supports the versions 3.15 or higher.
 
 .. Note::
     - IAR requires version 3.14 or later.