psa arch test v1.2 release commits
diff --git a/secure-debug/tools/cmake/common/CMakeSettings.cmake b/secure-debug/tools/cmake/common/CMakeSettings.cmake
new file mode 100644
index 0000000..e709dc0
--- /dev/null
+++ b/secure-debug/tools/cmake/common/CMakeSettings.cmake
@@ -0,0 +1,25 @@
+#/** @file
+# * Copyright (c) 2021, Arm Limited or its affiliates. All rights reserved.
+# * SPDX-License-Identifier : Apache-2.0
+# *
+# * Licensed under the Apache License, Version 2.0 (the "License");
+# * you may not use this file except in compliance with the License.
+# * You may obtain a copy of the License at
+# *
+# *  http://www.apache.org/licenses/LICENSE-2.0
+# *
+# * Unless required by applicable law or agreed to in writing, software
+# * distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+#**/
+
+#Stop built in CMakeDetermine<lang>.cmake scripts to run.
+set (CMAKE_C_COMPILER_ID_RUN 1)
+#Stop cmake run compiler tests.
+set (CMAKE_C_COMPILER_FORCED true)
+
+set(CMAKE_STATIC_LIBRARY_PREFIX "")
+set(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
+set(CMAKE_SHARED_LIBRARY_SUFFIX "")
diff --git a/secure-debug/tools/cmake/common/Utils.cmake b/secure-debug/tools/cmake/common/Utils.cmake
new file mode 100644
index 0000000..6013fef
--- /dev/null
+++ b/secure-debug/tools/cmake/common/Utils.cmake
@@ -0,0 +1,37 @@
+#/** @file
+# * Copyright (c) 2021, Arm Limited or its affiliates. All rights reserved.
+# * SPDX-License-Identifier : Apache-2.0
+# *
+# * Licensed under the Apache License, Version 2.0 (the "License");
+# * you may not use this file except in compliance with the License.
+# * You may obtain a copy of the License at
+# *
+# *  http://www.apache.org/licenses/LICENSE-2.0
+# *
+# * Unless required by applicable law or agreed to in writing, software
+# * distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+#**/
+
+# Function to CMake arguments
+function(_check_arguments)
+        foreach(_ARG IN LISTS ARGV)
+                if(NOT DEFINED ${_ARG})
+                        message(FATAL_ERROR "[PSA] : ${_ARG} is not passed! Please specify -D${_ARG}=<...> to CMake.")
+                endif()
+        endforeach()
+endfunction(_check_arguments)
+
+# Function to get all the folders inside given parent directory
+function(_get_sub_dir_list result parent_dir)
+        file(GLOB parent_dir_items RELATIVE ${parent_dir} ${parent_dir}/*)
+        set(dir_list "")
+        foreach(item ${parent_dir_items})
+                if(IS_DIRECTORY ${parent_dir}/${item})
+                        list(APPEND dir_list ${item})
+                endif()
+        endforeach()
+        set(${result} ${dir_list} PARENT_SCOPE)
+endfunction(_get_sub_dir_list)
diff --git a/secure-debug/tools/cmake/compiler/ARMCLANG.cmake b/secure-debug/tools/cmake/compiler/ARMCLANG.cmake
new file mode 100644
index 0000000..c6a8b0d
--- /dev/null
+++ b/secure-debug/tools/cmake/compiler/ARMCLANG.cmake
@@ -0,0 +1,63 @@
+#/** @file
+# * Copyright (c) 2021, Arm Limited or its affiliates. All rights reserved.
+# * SPDX-License-Identifier : Apache-2.0
+# *
+# * Licensed under the Apache License, Version 2.0 (the "License");
+# * you may not use this file except in compliance with the License.
+# * You may obtain a copy of the License at
+# *
+# *  http://www.apache.org/licenses/LICENSE-2.0
+# *
+# * Unless required by applicable law or agreed to in writing, software
+# * distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+#**/
+
+set(CMAKE_SYSTEM_NAME Generic)
+set(CMKE_SYSTEM_PROCESSOR ARM)
+
+set(_C_TOOLCHAIN_NAME armclang)
+
+if(WIN32)
+        if (NOT DEFINED ARMCLANG_PATH)
+                set(ARMCLANG_PATH "C:" CACHE PATH "Install directory for ARMCLANG Compiler")
+        endif()
+else(WIN32)
+        if (NOT DEFINED ARMCLANG_PATH)
+                set(ARMCLANG_PATH "/" CACHE PATH "Install directory for ARMCLANG Compiler")
+        endif()
+endif(WIN32)
+
+find_program(
+        _C_TOOLCHAIN_PATH
+        ${_C_TOOLCHAIN_NAME}
+        PATHS env PATH
+        HINTS ${ARMCLANG_PATH}
+        HINTS bin
+)
+
+if(_C_TOOLCHAIN_PATH STREQUAL "_C_TOOLCHAIN_PATH-NOTFOUND")
+        message(FATAL_ERROR "[PSA] : Couldn't find ${_C_TOOLCHAIN_NAME}."
+                            " Either put ${_C_TOOLCHAIN_NAME} on the PATH or set ARMCLANG_PATH set properly.")
+endif()
+
+set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
+
+foreach(_LNG IN ITEMS "C" "ASM")
+        set(CMAKE_${_LNG}_COMPILER ${_C_TOOLCHAIN_PATH})
+        message(STATUS "[PSA] : ${_LNG}  compiler used '${CMAKE_${_LNG}_COMPILER}'")
+endforeach()
+
+if(${CPU_ARCH} STREQUAL armv7m)
+	set(TARGET_SWITCH "-march=armv7-m")
+elseif(${CPU_ARCH} STREQUAL armv8m_ml)
+	set(TARGET_SWITCH "-march=armv8-m.main -mcmse")
+elseif(${CPU_ARCH} STREQUAL armv8m_bl)
+	set(TARGET_SWITCH "-march=armv8-m.base -mcmse")
+endif()
+
+set(CMAKE_C_FLAGS              "--target=arm-arm-none-eabi ${TARGET_SWITCH} -g -Wall -Werror -Wextra -fshort-enums -fshort-wchar -funsigned-char -fdata-sections -ffunction-sections -mno-unaligned-access -mfpu=none")
+set(CMAKE_ASM_FLAGS            "${TARGET_SWITCH} -mthumb")
+set(CMAKE_EXE_LINKER_FLAGS     "--strict --map --symbols --xref  --info=summarysizes,sizes,totals,unused,veneers --diag_warning=L6204")
diff --git a/secure-debug/tools/cmake/compiler/GNUARM.cmake b/secure-debug/tools/cmake/compiler/GNUARM.cmake
new file mode 100644
index 0000000..3bd8347
--- /dev/null
+++ b/secure-debug/tools/cmake/compiler/GNUARM.cmake
@@ -0,0 +1,63 @@
+#/** @file
+# * Copyright (c) 2021, Arm Limited or its affiliates. All rights reserved.
+# * SPDX-License-Identifier : Apache-2.0
+# *
+# * Licensed under the Apache License, Version 2.0 (the "License");
+# * you may not use this file except in compliance with the License.
+# * You may obtain a copy of the License at
+# *
+# *  http://www.apache.org/licenses/LICENSE-2.0
+# *
+# * Unless required by applicable law or agreed to in writing, software
+# * distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+#**/
+
+set(CMAKE_SYSTEM_NAME Generic)
+set(CMKE_SYSTEM_PROCESSOR ARM)
+
+set(_C_TOOLCHAIN_NAME arm-none-eabi-gcc)
+
+if(WIN32)
+	if (NOT DEFINED GNUARM_PATH)
+		set(GNUARM_PATH "C:" CACHE PATH "Install directory for GNUARM Compiler")
+	endif()
+else(WIN32)
+	if (NOT DEFINED GNUARM_PATH)
+		set(GNUARM_PATH "/" CACHE PATH "Install directory for GNUARM Compiler")
+	endif()
+endif(WIN32)
+
+find_program(
+	_C_TOOLCHAIN_PATH
+	${_C_TOOLCHAIN_NAME}
+	PATHS env PATH
+	HINTS ${GNUARM_PATH}
+	HINTS bin
+)
+
+if(_C_TOOLCHAIN_PATH STREQUAL "_C_TOOLCHAIN_PATH-NOTFOUND")
+        message(FATAL_ERROR "[PSA] : Couldn't find ${_C_TOOLCHAIN_NAME}."
+			    " Either put ${_C_TOOLCHAIN_NAME} on the PATH or set GNUARM_PATH set properly.")
+endif()
+
+set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
+
+foreach(_LNG IN ITEMS "C" "ASM")
+	set(CMAKE_${_LNG}_COMPILER ${_C_TOOLCHAIN_PATH})
+	message(STATUS "[PSA] : ${_LNG}  compiler used '${CMAKE_${_LNG}_COMPILER}'")
+endforeach()
+
+if(${CPU_ARCH} STREQUAL armv7m)
+	set(TARGET_SWITCH "-march=armv7-m")
+elseif(${CPU_ARCH} STREQUAL armv8m_ml)
+	set(TARGET_SWITCH "-march=armv8-m.main -mcmse")
+elseif(${CPU_ARCH} STREQUAL armv8m_bl)
+	set(TARGET_SWITCH "-march=armv8-m.base -mcmse")
+endif()
+
+set(CMAKE_C_FLAGS          "${TARGET_SWITCH} -g -Wall -Werror -Wextra -fdata-sections -ffunction-sections -mno-unaligned-access")
+set(CMAKE_ASM_FLAGS        "${TARGET_SWITCH} -mthumb")
+set(CMAKE_EXE_LINKER_FLAGS "-Xlinker --fatal-warnings -Xlinker --gc-sections -z max-page-size=0x400 -lgcc -lc -lnosys")
diff --git a/secure-debug/tools/cmake/compiler/HOST_GCC.cmake b/secure-debug/tools/cmake/compiler/HOST_GCC.cmake
new file mode 100644
index 0000000..5b43cb0
--- /dev/null
+++ b/secure-debug/tools/cmake/compiler/HOST_GCC.cmake
@@ -0,0 +1,52 @@
+#/** @file
+# * Copyright (c) 2021, Arm Limited or its affiliates. All rights reserved.
+# * SPDX-License-Identifier : Apache-2.0
+# *
+# * Licensed under the Apache License, Version 2.0 (the "License");
+# * you may not use this file except in compliance with the License.
+# * You may obtain a copy of the License at
+# *
+# *  http://www.apache.org/licenses/LICENSE-2.0
+# *
+# * Unless required by applicable law or agreed to in writing, software
+# * distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+#**/
+
+set(CMAKE_SYSTEM_NAME Generic)
+set(CMKE_SYSTEM_PROCESSOR x86_64)
+
+set(_C_TOOLCHAIN_NAME gcc)
+
+if(WIN32)
+	if (NOT DEFINED HOST_GCC_PATH)
+		set(HOST_GCC_PATH "C:" CACHE PATH "Install directory for Host GCC Compiler")
+	endif()
+else(WIN32)
+	if (NOT DEFINED HOST_GCC_PATH)
+		set(HOST_GCC_PATH "/" CACHE PATH "Install directory for Host GCC Compiler")
+	endif()
+endif(WIN32)
+
+find_program(
+	_C_TOOLCHAIN_PATH
+	${_C_TOOLCHAIN_NAME}
+	PATHS env PATH
+	HINTS ${HOST_GCC_PATH}
+	HINTS bin
+)
+
+if(_C_TOOLCHAIN_PATH STREQUAL "_C_TOOLCHAIN_PATH-NOTFOUND")
+        message(FATAL_ERROR "[PSA] : Couldn't find ${_C_TOOLCHAIN_NAME}."
+			    " Either put ${_C_TOOLCHAIN_NAME} on the PATH or set GNUARM_PATH set properly.")
+endif()
+
+set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
+
+foreach(_LNG IN ITEMS "C" "ASM")
+	set(CMAKE_${_LNG}_COMPILER ${_C_TOOLCHAIN_PATH})
+	set(CMAKE_C_FLAGS	"-g -Wall -Werror -Werror -std=c99")
+	message(STATUS "[PSA] : ${_LNG}  compiler used '${CMAKE_${_LNG}_COMPILER}'")
+endforeach()
diff --git a/secure-debug/tools/scripts/gen_tests_list.py b/secure-debug/tools/scripts/gen_tests_list.py
new file mode 100644
index 0000000..2bd0ab3
--- /dev/null
+++ b/secure-debug/tools/scripts/gen_tests_list.py
@@ -0,0 +1,87 @@
+#!/usr/bin/python
+#/** @file
+# * Copyright (c) 2021 Arm Limited or its affiliates. All rights reserved.
+# * SPDX-License-Identifier : Apache-2.0
+# *
+# * Licensed under the Apache License, Version 2.0 (the "License");
+# * you may not use this file except in compliance with the License.
+# * You may obtain a copy of the License at
+# *
+# *  http://www.apache.org/licenses/LICENSE-2.0
+# *
+# * Unless required by applicable law or agreed to in writing, software
+# * distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+#**/
+
+import sys
+
+if (len(sys.argv) != 8):
+        print("\nScript requires following inputs")
+        print("\narg1  : <INPUT  SUITE identifier>")
+        print("\narg2  : <INPUT  testsuite.db file>")
+        print("\narg3  : <OUTPUT testlist file>")
+        print("\narg4  : <OUTPUT test_entry_list>")
+        print("\narg5  : <OUTPUT test_entry_fn_declare_list>")
+        print("\narg6  : <OUTPUT Suite test start number")
+        print("\narg7  : <OUTPUT Suite test end number")
+        sys.exit(1)
+
+suite                      = sys.argv[1]
+testsuite_db_file          = sys.argv[2]
+testlist_file              = sys.argv[3]
+test_entry_list            = sys.argv[4]
+test_entry_fn_declare_list = sys.argv[5]
+if sys.argv[6] != "None":
+	suite_test_start_number    = int(sys.argv[6])
+else:
+	suite_test_start_number    = 0
+if sys.argv[7] != "None":
+	suite_test_end_number      = int(sys.argv[7])
+else:
+	suite_test_end_number      = sys.maxsize
+
+# Dictionary to hold the mapping between suite and the base number
+suite_with_base_dict = {"adac":4}
+
+def gen_test_list():
+	"""
+	Read the input testsuite.db file and generates the output file with list of tests
+	"""
+	with open(testlist_file, mode='w') as o_f:
+		with open(testsuite_db_file, mode='r') as i_f:
+			for line in i_f:
+				if (('test_' == line[0:5]) and
+				    (int(line[6:9]) >= suite_test_start_number) and
+				    (int(line[6:9]) <= suite_test_end_number)):
+						o_f.write(line)
+
+def gen_test_entry_info():
+	"""
+	Generate inc files
+	"""
+	test_num           = 0
+	uniq_test_string   = ''
+	max_test_per_suite = 200
+	suite_base         = 0
+
+	if (suite not in suite_with_base_dict.keys()):
+		print("\nProvide a valid SUITE identifier")
+		sys.exit()
+
+	with open(test_entry_list, mode='w') as o_f1, \
+             open(test_entry_fn_declare_list, mode='w') as o_f2,\
+             open(testlist_file, mode='r') as i_f:
+		for line in i_f:
+			line = line.strip()
+			test_num = int(line[6:9]) + (max_test_per_suite * suite_with_base_dict[suite])
+			uniq_test_string = line[5:9]
+			o_f1.write("\t{%d, &test_entry_%s},\n" %(test_num, uniq_test_string))
+			o_f2.write("void test_entry_%s(val_api_t *val_api);\n" %(uniq_test_string))
+	print("Test entry symbol list:\n\t%s,\n\t%s" %(test_entry_list, test_entry_fn_declare_list))
+
+# Call routines
+gen_test_list()
+gen_test_entry_info()