Merge branch 'release/2.0.x' into main

Accommodate changes made during release v2.0.0

Signed-off-by: David Hu <david.hu@arm.com>
Change-Id: Ic667b23d91f7ae3c6fdd5e2ee16f37701cae577e
diff --git a/.readthedocs.yaml b/.readthedocs.yaml
index baf1fd1..7bf51d8 100644
--- a/.readthedocs.yaml
+++ b/.readthedocs.yaml
@@ -27,6 +27,7 @@
 # The documentation will also be built in a pdf format
 formats:
    - pdf
+   - htmlzip
 
 # Configuration of the Python environment
 python:
diff --git a/docs/conf.py b/docs/conf.py
index 053fb5c..dd8d4c8 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -50,8 +50,17 @@
     'sphinxcontrib.plantuml', #Add support for PlantUML drawings
     'sphinxcontrib.rsvgconverter', #Add support for SVG to PDF
     'sphinx_tabs.tabs', #Enable tab extension in Sphinx
+    'sphinx.ext.intersphinx', #Enable Intersphinx
 ]
 
+intersphinx_mapping = {
+    "TF-M": ("https://trustedfirmware-m.readthedocs.io/en/latest/", None),
+    "TF-M-Tools": ("https://trustedfirmware-m.readthedocs.io/projects/tf-m-tools/en/latest/", None),
+    "TF-M-Extras": ("https://trustedfirmware-m.readthedocs.io/projects/tf-m-extras/en/latest/", None),
+}
+
+intersphinx_disabled_reftypes = ["*"]
+
 # Make auto section labels generated be prefixed with file name.
 autosectionlabel_prefix_document=True
 # Add auto section label for level 2 headers only.
diff --git a/docs/index.rst b/docs/index.rst
index 894dd17..98fb3c2 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -2,7 +2,6 @@
 Trusted Firmware-M Tests
 ########################
 
-.. raw:: html
 
 The Trusted Firmware-M(TF-M) Tests repo is meant to hold various tests for the
 `Trusted Firmware-M`_.
@@ -11,10 +10,10 @@
 
 .. toctree::
   :caption: Overview
-  :maxdepth: 1
+  :titlesonly:
   :hidden:
 
-  Test Framework <tfm_erpc_test_framework>
+  eRPC Test Framework <tfm_erpc_test_framework>
   Test Partitions <tfm_test_partitions_addition>
   Test Suites <tfm_test_suites_addition>
 
@@ -24,8 +23,11 @@
   :hidden:
 
   Trusted Firmware-M <https://trustedfirmware-m.readthedocs.io/en/latest/>
+  TF-M Tools <https://trustedfirmware-m.readthedocs.io/projects/tf-m-tools/en/latest/>
+  TF-M Extras <https://trustedfirmware-m.readthedocs.io/projects/tf-m-extras/en/latest/>
 
 .. _Trusted Firmware-M: https://git.trustedfirmware.org/TF-M/trusted-firmware-m.git/
+
 --------------
 
 *Copyright (c) 2023, Arm Limited. All rights reserved.*
diff --git a/docs/tfm_test_partitions_addition.rst b/docs/tfm_test_partitions_addition.rst
index 8a06171..ba82735 100644
--- a/docs/tfm_test_partitions_addition.rst
+++ b/docs/tfm_test_partitions_addition.rst
@@ -24,7 +24,7 @@
 
 Adding a test partition to provide test services is same as adding a secure
 partition, generally the process can be referenced from the document
-`Adding Secure Partition <https://tf-m-user-guide.trustedfirmware.org/integration_guide/services/tfm_secure_partition_addition.html>`_.
+:doc:`Adding Secure Partition <TF-M:integration_guide/services/tfm_secure_partition_addition>`.
 
 Test Partition Specific Manifest Attributes
 ===========================================
diff --git a/docs/tfm_test_suites_addition.rst b/docs/tfm_test_suites_addition.rst
index b27ed74..9f29518 100644
--- a/docs/tfm_test_suites_addition.rst
+++ b/docs/tfm_test_suites_addition.rst
@@ -69,7 +69,7 @@
 ============================
 
 A test configuration controls whether one or multiple test suites are enabled.
-The doc `TF-M Build Instructions <https://tf-m-user-guide.trustedfirmware.org/technical_references/instructions/tfm_build_instruction.html>`_.
+The doc :doc:`TF-M Build Instructions <TF-M:building/tfm_build_instruction>`.
 shows some test configurations which are already supported in current TF-M.
 An example usage of test configuration shows below.
 
@@ -285,7 +285,7 @@
 Some test group may need specific test services. These test services may support
 one or more groups thus developers shall determine the proper test scope. Refer
 to
-`Adding partitions for regression tests <https://git.trustedfirmware.org/TF-M/tf-m-tests.git/tree/docs/tfm_test_services_addition.rst>`_
+:doc:`Adding partitions for regression tests <tfm_test_partitions_addition>`
 to get more information.
 
 **********************************
diff --git a/readme.rst b/readme.rst
index 39df659..3ce86d5 100644
--- a/readme.rst
+++ b/readme.rst
@@ -12,14 +12,15 @@
 ****************
 Folder Structure
 ****************
-- app - The application code that executes the testing, including both the TF-M
-  tests and the `psa-arch-tests`_.
+- app_broker - Common application code that executes the testing, included by the TF-M tests and
+  the `psa-arch-tests`_.
+- cmake - Common CMake utility scripts.
 - docs - The documents about test developments.
-- CMSIS - The libraries of RTX which is the Non-secure RTOS of the tests
-- test - The TF-M test codes including test framework, test suites and test
-  services
-- lib/ext - 3rd party projects. May contain either imported source codes or CMake files to fetch the
-  projects.
+- erpc - eRPC test framework.
+- lib - TF-M libraries and 3rd-party libraries. May contain either imported source codes or CMake
+  files to fetch the projects.
+- tests_psa_arch - PSA Arch tests integration with TF-M.
+- tests_reg - TF-M regression test codes including test framework, test suites and test services.
 
 #######
 License
diff --git a/tests_psa_arch/spe/CMakeLists.txt b/tests_psa_arch/spe/CMakeLists.txt
index 4b71654..1949690 100644
--- a/tests_psa_arch/spe/CMakeLists.txt
+++ b/tests_psa_arch/spe/CMakeLists.txt
@@ -49,6 +49,7 @@
 add_executable(tfm_test_spe IMPORTED)
 
 include(ExternalProject)
+
 ExternalProject_Add(TF-M
     SOURCE_DIR        ${CONFIG_TFM_SOURCE_PATH}
     BINARY_DIR        build-spe
@@ -59,6 +60,7 @@
     CMAKE_ARGS        -DCONFIG_PSA_ARCH_TESTS_CONFIG_FILE=${CMAKE_CURRENT_LIST_DIR}/config/config_test_psa_api.cmake
     CMAKE_CACHE_DEFAULT_ARGS ${TFM_CMDLINE_CONFIGS}
     PREFIX             "temp"
+    BUILD_ALWAYS       ON
 )
 
 add_dependencies(tfm_test_spe TF-M)
diff --git a/tests_reg/CMakeLists.txt b/tests_reg/CMakeLists.txt
index 8f9bf16..3df3034 100644
--- a/tests_reg/CMakeLists.txt
+++ b/tests_reg/CMakeLists.txt
@@ -32,8 +32,6 @@
 include(${CONFIG_SPE_PATH}/cmake/spe_config.cmake)
 # Platform abilities for example IRQ test support status
 include(${CONFIG_SPE_PATH}/platform/config.cmake OPTIONAL)
-# Include coprocessor configs
-include(${CONFIG_SPE_PATH}/config/cp_config_default.cmake)
 
 # Check current tf-m-tests is compatible to TF-M under verfication
 include(check_version)
diff --git a/tests_reg/spe/CMakeLists.txt b/tests_reg/spe/CMakeLists.txt
index f00bf64..c63581a 100644
--- a/tests_reg/spe/CMakeLists.txt
+++ b/tests_reg/spe/CMakeLists.txt
@@ -31,6 +31,7 @@
 endif()
 
 include(ExternalProject)
+
 ExternalProject_Add(TF-M
   SOURCE_DIR        ${CONFIG_TFM_SOURCE_PATH}
   BINARY_DIR        build-spe
@@ -40,6 +41,7 @@
   CMAKE_ARGS        -DCONFIG_TFM_TEST_CONFIG_FILE=${CONFIG_TFM_TEST_CONFIG_FILE}
   CMAKE_CACHE_DEFAULT_ARGS ${TFM_CMDLINE_CONFIGS}
   PREFIX             "temp"
+  BUILD_ALWAYS       ON
 )
 
 add_dependencies(tfm_s_test TF-M)
diff --git a/tests_reg/test/secure_fw/suites/crypto/crypto_tests_check_config.h b/tests_reg/test/secure_fw/suites/crypto/crypto_tests_check_config.h
index d688e06..35d7519 100644
--- a/tests_reg/test/secure_fw/suites/crypto/crypto_tests_check_config.h
+++ b/tests_reg/test/secure_fw/suites/crypto/crypto_tests_check_config.h
@@ -60,12 +60,13 @@
 #error "TFM_CRYPTO_TEST_ALG_ECDH enabled, but ECDH key agreement algorithm is not defined!"
 #endif
 
-#if defined(TFM_CRYPTO_TEST_CHACHA20) && !defined(PSA_WANT_KEY_TYPE_CHACHA20)
+#if defined(TFM_CRYPTO_TEST_CHACHA20) && \
+    (!defined(PSA_WANT_KEY_TYPE_CHACHA20) || !defined(PSA_WANT_ALG_STREAM_CIPHER))
 #error "TFM_CRYPTO_TEST_ALG_CHACHA20 enabled, but ChaCha20 stream cipher algorithm is not defined!"
 #endif
 
 #if defined(TFM_CRYPTO_TEST_ALG_CHACHA20_POLY1305) && \
-    !defined(PSA_WANT_ALG_CHACHA20_POLY1305)
+    (!defined(PSA_WANT_ALG_CHACHA20_POLY1305) || !defined(PSA_WANT_KEY_TYPE_CHACHA20))
 #error "TFM_CRYPTO_TEST_ALG_CHACHA20_POLY1305 enabled, but ChaCha20-Poly1305 AEAD algorithm is not defined!"
 #endif
 
diff --git a/tests_reg/test/secure_fw/suites/fwu/mcuboot/fwu_tests_common.c b/tests_reg/test/secure_fw/suites/fwu/mcuboot/fwu_tests_common.c
index 56cac2d..8d88dd6 100644
--- a/tests_reg/test/secure_fw/suites/fwu/mcuboot/fwu_tests_common.c
+++ b/tests_reg/test/secure_fw/suites/fwu/mcuboot/fwu_tests_common.c
@@ -1008,7 +1008,7 @@
     ret->val = TEST_PASSED;
 }
 
-#if (FWU_CONCURRENTLY_UPDATE_COMPONENTS > 1)
+#if (FWU_COMPONENT_NUMBER > 1)
 void tfm_fwu_test_common_006(struct test_result_t *ret)
 {
     psa_status_t status;
@@ -1364,7 +1364,7 @@
     /* End of the test. The candidate is back to PSA_FWU_READY state now. */
     ret->val = TEST_PASSED;
 }
-#endif /* FWU_CONCURRENTLY_UPDATE_COMPONENTS > 1 */
+#endif /* FWU_COMPONENT_NUMBER > 1 */
 #endif /* MCUBOOT_IMAGE_NUMBER > 1 */
 
 #ifdef TFM_FWU_TEST_REQUEST_REBOOT
diff --git a/tests_reg/test/secure_fw/suites/fwu/mcuboot/non_secure/psa_fwu_ns_interface_testsuite.c b/tests_reg/test/secure_fw/suites/fwu/mcuboot/non_secure/psa_fwu_ns_interface_testsuite.c
index 9821765..4e01cfa 100644
--- a/tests_reg/test/secure_fw/suites/fwu/mcuboot/non_secure/psa_fwu_ns_interface_testsuite.c
+++ b/tests_reg/test/secure_fw/suites/fwu/mcuboot/non_secure/psa_fwu_ns_interface_testsuite.c
@@ -21,7 +21,7 @@
 #if (MCUBOOT_IMAGE_NUMBER > 1)
     {&tfm_fwu_test_common_005, "TFM_NS_FWU_TEST_1005",
      "Dependency pass in multiple components case."},
-#if (FWU_CONCURRENTLY_UPDATE_COMPONENTS > 1)
+#if (FWU_COMPONENT_NUMBER > 1)
     {&tfm_fwu_test_common_006, "TFM_NS_FWU_TEST_1006",
      "Update two components which depends on each other."},
 #endif
diff --git a/tests_reg/test/secure_fw/suites/fwu/mcuboot/secure/psa_fwu_s_interface_testsuite.c b/tests_reg/test/secure_fw/suites/fwu/mcuboot/secure/psa_fwu_s_interface_testsuite.c
index e50d0d0..d332ba1 100644
--- a/tests_reg/test/secure_fw/suites/fwu/mcuboot/secure/psa_fwu_s_interface_testsuite.c
+++ b/tests_reg/test/secure_fw/suites/fwu/mcuboot/secure/psa_fwu_s_interface_testsuite.c
@@ -22,7 +22,7 @@
 #if (MCUBOOT_IMAGE_NUMBER > 1)
     {&tfm_fwu_test_common_005, "TFM_S_FWU_TEST_1005",
      "Dependency pass in multiple components case."},
-#if (FWU_CONCURRENTLY_UPDATE_COMPONENTS > 1)
+#if (FWU_COMPONENT_NUMBER > 1)
     {&tfm_fwu_test_common_006, "TFM_S_FWU_TEST_1006",
      "Update two components which depends on each other."},
 #endif