Adding CMake build support.
diff --git a/api-tests/tools/cmake/common/CMakeSettings.cmake b/api-tests/tools/cmake/common/CMakeSettings.cmake
new file mode 100644
index 0000000..eb812a9
--- /dev/null
+++ b/api-tests/tools/cmake/common/CMakeSettings.cmake
@@ -0,0 +1,24 @@
+#/** @file
+# * Copyright (c) 2019, 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")
diff --git a/api-tests/tools/cmake/common/Utils.cmake b/api-tests/tools/cmake/common/Utils.cmake
new file mode 100644
index 0000000..6751763
--- /dev/null
+++ b/api-tests/tools/cmake/common/Utils.cmake
@@ -0,0 +1,37 @@
+#/** @file
+# * Copyright (c) 2019, 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/api-tests/tools/cmake/compiler/ARMCLANG.cmake b/api-tests/tools/cmake/compiler/ARMCLANG.cmake
new file mode 100644
index 0000000..d96dc9d
--- /dev/null
+++ b/api-tests/tools/cmake/compiler/ARMCLANG.cmake
@@ -0,0 +1,63 @@
+#/** @file
+# * Copyright (c) 2019, 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} -Wall -Werror -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/api-tests/tools/cmake/compiler/GNUARM.cmake b/api-tests/tools/cmake/compiler/GNUARM.cmake
new file mode 100644
index 0000000..cede575
--- /dev/null
+++ b/api-tests/tools/cmake/compiler/GNUARM.cmake
@@ -0,0 +1,63 @@
+#/** @file
+# * Copyright (c) 2019, 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} -Wall -Werror -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/api-tests/tools/cmake/compiler/HOST_GCC.cmake b/api-tests/tools/cmake/compiler/HOST_GCC.cmake
new file mode 100644
index 0000000..e7be183
--- /dev/null
+++ b/api-tests/tools/cmake/compiler/HOST_GCC.cmake
@@ -0,0 +1,51 @@
+#/** @file
+# * Copyright (c) 2019, 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})
+ message(STATUS "[PSA] : ${_LNG} compiler used '${CMAKE_${_LNG}_COMPILER}'")
+endforeach()
diff --git a/api-tests/tools/makefiles/Makefile b/api-tests/tools/makefiles/Makefile
deleted file mode 100644
index 1aa790b..0000000
--- a/api-tests/tools/makefiles/Makefile
+++ /dev/null
@@ -1,131 +0,0 @@
-# * Copyright (c) 2018-2019, 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.
-#**/
-
-ifeq (${SUITE}, ipc)
-SUITE_DIR = ff/$(SUITE)
-else
-SUITE_DIR = dev_apis/$(SUITE)
-endif
-
-export SUITE_IN= $(SOURCE)/$(SUITE_DIR)
-export SUITE_OUT= $(BUILD)/$(SUITE_DIR)
-
-include $(SOURCE)/tools/makefiles/toolchain.mk
-
-
-all: clean target_cfg gen_linker process_testsuite.db build
-
-#Generate target files from User provided data base
-target_cfg:
- @echo ""
- @echo "Processing target configuration..."
- mkdir -p $(BUILD)/platform/${TARGET}/
- @if [ ! -f "$(SOURCE)/platform/targets/$(TARGET)/target.cfg" ]; then { echo "Error: Target Not Found!!!"; exit 1; } fi
- python $(SOURCE)/tools/scripts/targetConfigGen.py ${TARGET} $(SOURCE)/val/common/val_target.h \
- $(SOURCE)/platform/targets/${TARGET}/target.cfg $(BUILD)/platform/${TARGET}/targetConfigGen.c \
- $(BUILD)/platform/${TARGET}/target_database.h target_database ""
- gcc -D__addr_t_defined -DTARGET_CFG_BUILD $(BUILD)/platform/${TARGET}/targetConfigGen.c -o $(BUILD)/platform/${TARGET}/targetConfigGen \
- -I$(SOURCE)/val/nspe -I$(SOURCE)/val/common -I$(SOURCE)/platform/targets/${TARGET}/nspe/common
- ./$(BUILD)/platform/${TARGET}/targetConfigGen
-
-#Read target.cfg and update the addresses in linker script
-gen_linker:
- @echo ""
- @echo "Updating linker files..."
- mkdir -p $(SUITE_OUT)/ $(BUILD)/val/ $(BUILD)/partition/ ;
- perl $(SOURCE)/tools/scripts/process_test_linker_file.pl $(SOURCE) $(SUITE_OUT) ${TARGET} $(TOOLCHAIN)
-
-process_testsuite.db:
- @echo ""
- @echo "Creating testlist..."
-ifeq (${INCLUDE_PANIC_TESTS}, 1)
- $(eval TEST_LIST := $(shell grep -o "^test....." $(SUITE_IN)/testsuite.db > $(SUITE_OUT)/.testlist.txt ; dos2unix $(SUITE_OUT)/.testlist.txt ; cat $(SUITE_OUT)/.testlist.txt))
-else
- $(eval TEST_LIST := $(shell grep -v "^test....., panic_test" $(SUITE_IN)/testsuite.db | grep "^test" > $(SUITE_OUT)/.testlist.txt ; dos2unix $(SUITE_OUT)/.testlist.txt ; cat $(SUITE_OUT)/.testlist.txt))
-endif
- perl $(SOURCE)/tools/scripts/gen_tests_list.pl $(BUILD) $(SUITE_OUT)/.testlist.txt $(SUITE)
-
-
-#Build framework archives and test_combine.elf
-build: build_pal val_nspe.a test_combine.elf partition_build output_list
-
-build_pal:
- @echo ""
- @echo "----------pal build start-------------"
- make -f $(SOURCE)/platform/targets/$(TARGET)/Makefile
- @echo "----------pal build complete-------------"
-
-val_nspe.a:
- @echo ""
- @echo "----------val build start-------------"
- make -f $(SOURCE)/tools/makefiles/valbuild.mk
- @echo "----------val build complete-------------"
-
-test_combine.elf: test.elf
- @echo ""
-ifeq (${TEST_COMBINE_ARCHIVE}, 1)
- @echo "----------Combine NS test objects into archive start-------------"
- $(AR) $(AR_OPTIONS) $(SUITE_OUT)/test_combine.a $(SUITE_OUT)/test*/test_*_nspe.o
- @echo "----------Combine NS test objects into archive complete-------------"
-else
- @echo "----------Combine NS test elfs into binary start-------------"
- perl $(SOURCE)/tools/scripts/test_elf_combine.pl $(SUITE_OUT)/.testlist.txt
- hexdump -v -e ' 1/4 "%08X" "\n"' $(SUITE_OUT)/test_elf_combine.bin > $(SUITE_OUT)/test_elf_combine.hex
- @echo "----------Combine NS test elfs into binary complete-------------"
-endif
-
-test.elf:
- @echo ""
- @echo "----------test build start-------------"
- @$(foreach TEST,$(TEST_LIST), make -f $(SOURCE)/tools/makefiles/testbuild.mk TEST=$(TEST) ;)
- @echo "----------test build complete-------------"
-
-partition_build:
-ifeq (${PSA_IPC_IMPLEMENTED}, 1)
- @echo ""
- @echo "----------test partition build start-------------"
- make -f $(SOURCE)/tools/makefiles/spbuild.mk
- @echo "----------test partition build complete-------------"
-endif
-
-output_list:
- @echo ""
- @echo "Below are the list of output binaries/libraries. Integrate these"
- @echo "to your software stack to execute test suite."
- @echo ""
- @echo "a) NSPE files:"
- @echo " $(BUILD)/val/val_nspe.a"
- @echo " $(BUILD)/platform/pal_nspe.a"
-ifeq (${TEST_COMBINE_ARCHIVE}, 1)
- @echo " $(SUITE_OUT)/test_combine.a"
-else
- @echo " $(SUITE_OUT)/test_elf_combine.bin"
-endif
- @echo ""
-ifeq (${PSA_IPC_IMPLEMENTED}, 1)
- @echo "b) SPE files"
- @echo " $(BUILD)/partition/driver_partition.a"
-endif
-ifeq (${SUITE}, ipc)
- @echo " $(BUILD)/partition/client_partition.a"
- @echo " $(BUILD)/partition/server_partition.a"
-endif
- @echo ""
-
-clean:
- @echo ""
- @echo "Cleaning the build directory..."
- rm -rf $(BUILD)/*
diff --git a/api-tests/tools/makefiles/linker/test.linker b/api-tests/tools/makefiles/linker/test.linker
deleted file mode 100644
index 69fc4d1..0000000
--- a/api-tests/tools/makefiles/linker/test.linker
+++ /dev/null
@@ -1,55 +0,0 @@
-/* Copyright (c) 2018-2019, 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.
-**/
-
-ENTRY(TEST_START)
-
-TEST_START = 0x2004F000;
-
-MEMORY
-{
- TEST_INFO (R) : ORIGIN = TEST_START, LENGTH = 0x100
- TEST_TEXT (RX) : ORIGIN = TEST_START +0x100, LENGTH = 0x1A00
- TEST_DATA (RW) : ORIGIN = TEST_START +0x1B00, LENGTH = 0x1800
-}
-
-SECTIONS
-{
- .acs_test_info :
- {
- KEEP(*(.acs_test_info))
- } > TEST_INFO
-
- .text :
- {
- *(.text)
- *(.text*)
- *(.rodata)
- *(.rodata*)
- } > TEST_TEXT
-
- .data :
- {
- *(.data)
- *(.data*)
- } > TEST_DATA
-
- .bss :
- {
- *(.bss)
- *(.bss.*)
- *(COMMON)
- } > TEST_DATA
-}
diff --git a/api-tests/tools/makefiles/linker/test.sct b/api-tests/tools/makefiles/linker/test.sct
deleted file mode 100644
index 4de849d..0000000
--- a/api-tests/tools/makefiles/linker/test.sct
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (c) 2018-2019, 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.
-**/
-
-#define TEST_CODE_START 0x0
-#define TEST_INFO_SIZE 0x100
-#define TEST_TEXT_SIZE 0x1A00
-#define TEST_DATA_SIZE 0x1800
-
-LR_CODE TEST_CODE_START
-{
-
- ER_CODE TEST_CODE_START (TEST_INFO_SIZE+TEST_TEXT_SIZE+TEST_DATA_SIZE)
- {
- test_entry_*_nspe.o(.acs_test_info +FIRST)
- * (+CODE)
- * (+RO)
- * (+ZI +RW)
- }
-
-}
diff --git a/api-tests/tools/makefiles/spbuild.mk b/api-tests/tools/makefiles/spbuild.mk
deleted file mode 100644
index 1479e74..0000000
--- a/api-tests/tools/makefiles/spbuild.mk
+++ /dev/null
@@ -1,74 +0,0 @@
-# * Copyright (c) 2018-2019, 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.
-#**/
-
-include $(SOURCE)/tools/makefiles/toolchain.mk
-
-INCLUDE= -I$(SOURCE)/val/common/ \
- -I$(SOURCE)/val/nspe/ \
- -I$(SOURCE)/val/spe/ \
- -I$(SOURCE)/ \
- -I$(SOURCE)/ff/partition/common/ \
- -I$(SOURCE)/ff/partition/ipc/ \
- -I$(BUILD)/partition/ \
- -I$(BUILD)/platform/$(TARGET)/ \
- -I$(SOURCE)/platform/targets/$(TARGET)/nspe \
- -I$(SOURCE)/platform/targets/$(TARGET)/nspe/common \
- -I$(SOURCE)/platform/targets/$(TARGET)/nspe/crypto \
- -I$(SOURCE)/platform/targets/$(TARGET)/spe
-
-VPATH=$(SOURCE)/val/common/:\
- $(SOURCE)/val/nspe/:\
- $(SOURCE)/val/spe/:\
- $(SOURCE)/ff/partition/common/: \
- $(SOURCE)/ff/partition/ipc/
-
-
-CC_SOURCE += driver_partition.c val_driver_service_apis.c
-
-ifeq (${SUITE}, ipc)
-CC_SOURCE += client_partition.c server_partition.c
-all: mkdir compile_c compile_asm driver_partition.a client_partition.a server_partition.a
-else
-all: mkdir compile_c compile_asm driver_partition.a
-endif
-
-
-mkdir:
- @mkdir -p $(BUILD)/partition/
-
-compile_c: $(CC_SOURCE:%.c=$(BUILD)/partition/%.o)
-compile_asm: $(AS_SOURCE:%.s=$(BUILD)/partition/%.o)
-
-$(BUILD)/partition/%.o : %.c
- $(CC) -DSPE_BUILD -o $@ -c $<
-
-$(BUILD)/partition/%.o : %.s
- $(AS) -o $@ $<
-
-client_partition.a:
-ifeq ($(wildcard $(SUITE_OUT)/test_i*/.*),)
- $(AR) $(AR_OPTIONS) $(BUILD)/partition/client_partition.a $(BUILD)/partition/client_partition.o $(SUITE_OUT)/test*/test_l*_spe.o
-else ifeq ($(wildcard $(SUITE_OUT)/test_l*/.*),)
- $(AR) $(AR_OPTIONS) $(BUILD)/partition/client_partition.a $(BUILD)/partition/client_partition.o $(SUITE_OUT)/test*/test_i*_spe.o
-else
- $(AR) $(AR_OPTIONS) $(BUILD)/partition/client_partition.a $(BUILD)/partition/client_partition.o $(SUITE_OUT)/test*/test_i*_spe.o $(SUITE_OUT)/test*/test_l*_spe.o
-endif
-
-server_partition.a:
- $(AR) $(AR_OPTIONS) $(BUILD)/partition/server_partition.a $(BUILD)/partition/server_partition.o $(SUITE_OUT)/test*/test_supp_*_spe.o
-
-driver_partition.a:
- $(AR) $(AR_OPTIONS) $(BUILD)/partition/driver_partition.a $(BUILD)/platform/spe/*_driver_sp.o $(BUILD)/partition/driver_partition.o $(BUILD)/partition/val_driver_service_apis.o
diff --git a/api-tests/tools/makefiles/testbuild.mk b/api-tests/tools/makefiles/testbuild.mk
deleted file mode 100644
index 373111d..0000000
--- a/api-tests/tools/makefiles/testbuild.mk
+++ /dev/null
@@ -1,78 +0,0 @@
-# * Copyright (c) 2018-2019, 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.
-#**/
-
-include $(SOURCE)/tools/makefiles/toolchain.mk
-include $(SUITE_IN)/$(TEST)/source.mk
-
-INCLUDE= -I$(SOURCE)/val/common/ \
- -I$(SOURCE)/val/nspe/ \
- -I$(SOURCE)/val/spe/ \
- -I$(SOURCE)/ \
- -I$(SOURCE)/platform/targets/$(TARGET)/nspe/ \
- -I$(SOURCE)/platform/targets/$(TARGET)/nspe/common \
- -I$(SOURCE)/platform/targets/$(TARGET)/nspe/crypto \
- -I$(BUILD)/platform/$(TARGET)/ \
- -I$(SUITE_IN)/$(TEST)/\
- -I$(SUITE_IN)/include/ \
- -I$(BUILD)/val/
-
-ifeq (${SUITE}, protected_storage)
-INCLUDE += -I$(SUITE_IN)/../internal_trusted_storage/$(TEST)
-endif
-
-VPATH=$(SOURCE)/val/common/:\
- $(SOURCE)/val/nspe/:\
- $(SOURCE)/val/spe/:\
- $(SUITE_IN)/$(TEST)/:\
- $(SUITE_IN)/include/:
-
-ifeq (${SUITE}, protected_storage)
-VPATH += $(SUITE_IN)/../internal_trusted_storage/$(TEST)/
-endif
-
-
-all: mkdir compile_c_nspe compile_asm_nspe test.elf compile_c_spe compile_asm_spe
-
-mkdir:
- mkdir -p $(SUITE_OUT)/$(TEST)/
-
-compile_c_nspe: $(CC_SOURCE:%.c=$(SUITE_OUT)/$(TEST)/%_nspe.o)
-compile_asm_nspe: $(AS_SOURCE:%.s=$(SUITE_OUT)/$(TEST)/%_nspe.o)
-
-$(SUITE_OUT)/$(TEST)/%_nspe.o : %.c
- $(CC) -D NONSECURE_TEST_BUILD -DVAL_NSPE_BUILD -o $@ -c $<
-
-$(SUITE_OUT)/$(TEST)/%_nspe.o : %.s
- $(AS) -o $@ $<
-
-# Generated %_spe.o(s) are used in spbuild.mk to create final client_partition.a and server_partition.a
-compile_c_spe: $(CC_SOURCE_SPE:%.c=$(SUITE_OUT)/$(TEST)/%_spe.o)
-compile_asm_spe: $(AS_SOURCE_SPE:%.s=$(SUITE_OUT)/$(TEST)/%_spe.o)
-
-$(SUITE_OUT)/$(TEST)/%_spe.o : %.c
- $(CC) -DSPE_BUILD -o $@ -c $<
-
-$(SUITE_OUT)/$(TEST)/%_spe.o : %.s
- $(AS) -o $@ $<
-
-test.elf:
-ifeq (${TOOLCHAIN}, GNUARM)
- $(LD) -Xlinker -Map=$(SUITE_OUT)/$(TEST)/test.map -o $(SUITE_OUT)/$(TEST)/test.elf -T$(SUITE_OUT)/.test.linker $(SUITE_OUT)/$(TEST)/*_nspe.o
-else
- $(LD) --scatter=$(SUITE_OUT)/.test.sct --list=$(SUITE_OUT)/$(TEST)/test.map -o $(SUITE_OUT)/$(TEST)/test.elf $(SUITE_OUT)/$(TEST)/*_nspe.o
-endif
- $(DS) $(SUITE_OUT)/$(TEST)/test.elf > $(SUITE_OUT)/$(TEST)/test.disass
-
diff --git a/api-tests/tools/makefiles/toolchain.mk b/api-tests/tools/makefiles/toolchain.mk
deleted file mode 100644
index 699e6bb..0000000
--- a/api-tests/tools/makefiles/toolchain.mk
+++ /dev/null
@@ -1,119 +0,0 @@
-# * Copyright (c) 2018-2019, 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.
-#**/
-
-TOOLCHAIN=GNUARM
-PREFIX=
-
-#### GNUARM OPTIONS - START ####
-ifneq (,$(findstring $(TOOLCHAIN),GNUARM-GCC))
- ifeq (${TOOLCHAIN}, GNUARM)
- PREFIX=arm-none-eabi-
- endif
-
- ifeq (${CPU_ARCH}, armv7m)
- TARGET_SWITCH= -march=armv7-m
- else
- ifeq (${CPU_ARCH}, armv8m_ml)
- TARGET_SWITCH= -march=armv8-m.main -mcmse
- else
- TARGET_SWITCH= -march=armv8-m.base -mcmse
- endif
- endif
-
-COMPILER= $(PREFIX)gcc
-ASSEMBLER= $(PREFIX)as
-AR= $(PREFIX)ar
-LINKER= $(PREFIX)gcc
-OBJDUMP=$(PREFIX)objdump
-
-COMPILER_OPTIONS= $(TARGET_SWITCH) -Wall -Werror -fdata-sections -ffunction-sections -mno-unaligned-access
-
-ASSEMBLER_OPTIONS= $(TARGET_SWITCH) -mthumb
-AR_OPTIONS= -rcs
-LINKER_OPTIONS= $(TARGET_SWITCH) -mthumb -Wall -Werror -O0 -fdata-sections \
- -ffunction-sections -Xlinker --fatal-warnings -Xlinker --gc-sections \
- -z max-page-size=0x400 -lgcc -lc -lnosys
-OBJDUMP_OPTIONS= -d
-endif #GNUARM-GCC
-#### GNUARM OPTIONS - END ####
-
-#### ARMCLANG OPTIONS - START ####
-ifeq (${TOOLCHAIN}, ARMCLANG)
-
-COMPILER= armclang
-ASSEMBLER= armclang
-AR= armar
-LINKER= armlink
-OBJDUMP=fromelf
-
- ifeq (${CPU_ARCH}, armv7m)
- TARGET_SWITCH= -march=armv7-m
- TARGET_SWITCH_LD= --cpu=7-M
- else
- ifeq (${CPU_ARCH}, armv8m_ml)
- TARGET_SWITCH= -march=armv8-m.main -mcmse
- TARGET_SWITCH_LD= --cpu=8-M.Main
- else
- TARGET_SWITCH= -march=armv8-m.base -mcmse
- TARGET_SWITCH_LD= --cpu=8-M.Base
- endif
- endif
-
-COMPILER_OPTIONS= --target=arm-arm-none-eabi $(TARGET_SWITCH) -Wall -Werror -fshort-enums -fshort-wchar -funsigned-char -fdata-sections -ffunction-sections -mno-unaligned-access -mfpu=none
-AR_OPTIONS= --create -cr
-LINKER_OPTIONS= --strict --map --symbols --xref --info=summarysizes,sizes,totals,unused,veneers --diag_warning=L6204
-OBJDUMP_OPTIONS= -c -d --datasymbols
-endif
-#### ARMCLANG OPTIONS - END ####
-
-COMPILER_OPTIONS += -DVERBOSE=$(VERBOSE)
-
-ifeq (${TEST_COMBINE_ARCHIVE}, 1)
-COMPILER_OPTIONS += -DTEST_COMBINE_ARCHIVE=1
-endif
-
-ifeq (${WATCHDOG_AVAILABLE}, 1)
-COMPILER_OPTIONS += -DWATCHDOG_AVAILABLE=1
-endif
-
-ifeq (${SP_HEAP_MEM_SUPP}, 1)
-COMPILER_OPTIONS += -DSP_HEAP_MEM_SUPP=1
-endif
-
-ifeq (${PSA_IPC_IMPLEMENTED}, 1)
-COMPILER_OPTIONS += -DPSA_IPC_IMPLEMENTED=1
-endif
-
-ifeq (${PSA_CRYPTO_IMPLEMENTED}, 1)
-COMPILER_OPTIONS += -DPSA_CRYPTO_IMPLEMENTED=1
-endif
-
-ifeq (${PSA_PROTECTED_STORAGE_IMPLEMENTED}, 1)
-COMPILER_OPTIONS += -DPSA_PROTECTED_STORAGE_IMPLEMENTED=1
-endif
-
-ifeq (${PSA_INTERNAL_TRUSTED_STORAGE_IMPLEMENTED}, 1)
-COMPILER_OPTIONS += -DPSA_INTERNAL_TRUSTED_STORAGE_IMPLEMENTED=1
-endif
-
-ifeq (${PSA_INITIAL_ATTESTATION_IMPLEMENTED}, 1)
-COMPILER_OPTIONS += -DPSA_INITIAL_ATTESTATION_IMPLEMENTED=1
-endif
-
-CC= $(COMPILER) $(COMPILER_OPTIONS) $(CC_OPTIONS) $(USER_INCLUDE) $(INCLUDE)
-AS= $(ASSEMBLER) $(ASSEMBLER_OPTIONS) $(AS_OPTIONS)
-LD= $(LINKER) $(LINKER_OPTIONS)
-DS= $(OBJDUMP) $(OBJDUMP_OPTIONS)
diff --git a/api-tests/tools/makefiles/valbuild.mk b/api-tests/tools/makefiles/valbuild.mk
deleted file mode 100644
index ef0ad4c..0000000
--- a/api-tests/tools/makefiles/valbuild.mk
+++ /dev/null
@@ -1,52 +0,0 @@
-# * Copyright (c) 2018-2019, 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.
-#**/
-
-include $(SOURCE)/tools/makefiles/toolchain.mk
-
-INCLUDE= -I$(SOURCE)/val/common/ \
- -I$(SOURCE)/val/nspe/ \
- -I$(SOURCE)/val/spe/ \
- -I$(SOURCE)/platform/targets/$(TARGET)/nspe/ \
- -I$(SOURCE)/platform/targets/$(TARGET)/nspe/common \
- -I$(SOURCE)/platform/targets/$(TARGET)/nspe/crypto \
- -I$(BUILD)/platform/$(TARGET)/ \
- -I$(BUILD)/val/
-
-VPATH=$(SOURCE)/val/common/:\
- $(SOURCE)/val/nspe/:\
- $(SOURCE)/val/spe/
-
-SRC_COMMON=
-SRC_NS= val_entry.c val_dispatcher.c val_framework.c val_crypto.c val_interfaces.c val_peripherals.c val_target.c val_protected_storage.c val_internal_trusted_storage.c val_attestation.c
-
-all: build
-
-build: mkdir build_common build_ns val_nspe.a
-
-mkdir:
- @mkdir -p $(BUILD)/val/
-
-build_common: $(SRC_COMMON:%.c=$(BUILD)/val/%.o)
-build_ns: $(SRC_NS:%.c=$(BUILD)/val/%.o)
-
-$(BUILD)/val/%.o : %.c
- $(CC) $(INCLUDE) -DVAL_NSPE_BUILD -o $@ -c $<
-
-val_nspe.a:
- $(AR) $(AR_OPTIONS) $(BUILD)/val/val_nspe.a $(BUILD)/val/*.o
-
-clean:
- @rm -rf $(BUILD)/val/*.o $(BUILD)/val/*.a
diff --git a/api-tests/tools/scripts/gen_tests_list.pl b/api-tests/tools/scripts/gen_tests_list.pl
deleted file mode 100644
index f98bb56..0000000
--- a/api-tests/tools/scripts/gen_tests_list.pl
+++ /dev/null
@@ -1,127 +0,0 @@
-#!/usr/bin/env perl
-#/** @file
-# * Copyright (c) 2019, 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.
-#**/
-
-
-$build=$ARGV[0];
-$tests_list=$ARGV[1];
-$suite=$ARGV[2];
-
-&gen_test_entry_info();
-&gen_secure_tests_list() if ($suite eq "ipc");
-
-sub gen_test_entry_info
-{
- my $test_num = 0;
- my $uniq_test_string = '';
- my $max_test_per_suite = 200;
- my $suite_base = 0;
- my $test_entry_list = "$build/val/test_entry_list.inc";
- my $test_entry_fn_declare_list = "$build/val/test_entry_fn_declare_list.inc";
-
- if ($suite eq "crypto")
- {
- $suite_base = 1;
- }
- elsif ($suite eq "protected_storage")
- {
- $suite_base = 2;
- }
- elsif ($suite eq "internal_trusted_storage")
- {
- $suite_base = 3;
- }
- elsif ($suite eq "initial_attestation")
- {
- $suite_base = 4;
- }
-
- open(IN, $tests_list) or die "Unable to open $tests_list $!";
- open(OUT1, '>', $test_entry_fn_declare_list) or die "Unable to open: $!";
- open(OUT2, '>', $test_entry_list) or die "Unable to open: $!";
-
- while(<IN>) {
- if($_ !~ /^\//) {# exclude commented lines if any
- chomp($_);
- if($_ =~ /^test_(.+)/) {
- $uniq_test_string = $1;
- $uniq_test_string =~ s/s/p/ if ($suite eq "protected_storage");
- print OUT1 "void test_entry_$uniq_test_string(val_api_t *val_api, psa_api_t *psa_api);\n";
- if($_ =~ /^test_\w0*(\d+)/) {
- $test_num = $1 + ($max_test_per_suite * $suite_base);
- print OUT2 "\t{$test_num, &test_entry_$uniq_test_string},\n";
- }
- }
- }
- }
- close IN;
- close OUT1;
- close OUT2;
- print "Non-secure test entry symbol list:
- $test_entry_list,
- $test_entry_fn_declare_list\n";
-}
-
-sub gen_secure_tests_list
-{
- my $test_num = 0;
- my $test_num_prev = 0;
- my $client_tests_list_declare = "$build/partition/client_tests_list_declare.inc";
- my $client_tests_list = "$build/partition/client_tests_list.inc";
- my $server_tests_list_declare = "$build/partition/server_tests_list_declare.inc";
- my $server_tests_list = "$build/partition/server_tests_list.inc";
-
- open(IN, $tests_list) or die "Unable to open $tests_list $!";
- open(OUT1, '>', $client_tests_list_declare) or die "Unable to open: $!";
- open(OUT2, '>', $client_tests_list) or die "Unable to open: $!";
- open(OUT3, '>', $server_tests_list_declare) or die "Unable to open: $!";
- open(OUT4, '>', $server_tests_list) or die "Unable to open: $!";
-
- while(<IN>) {
- if($_ !~ /^\//) {# exclude commented lines if any
- chomp($_);
- if($_ =~ /^test_\w(\d+)/) {
- $test_num = $1;
- print OUT1 " extern client_test_t $_\_client_tests_list[];\n";
- print OUT3 " extern server_test_t $_\_server_tests_list[];\n";
-
- if ($test_num - $test_num_prev > 1)
- {
- for ($i = $test_num_prev; $i < ($test_num - 1); $i++)
- {
- print OUT2 "\tNULL,\n";
- print OUT4 "\tNULL,\n";
- }
- }
- print OUT2 "\t$_\_client_tests_list,\n";
- print OUT4 "\t$_\_server_tests_list,\n";
- }
- }
- $test_num_prev = $test_num;
- }
- close IN;
- close OUT1;
- close OUT2;
- close OUT3;
- close OUT4;
-
- print "Secure test entry symbol list:
- $client_tests_list_declare,
- $client_tests_list,
- $server_tests_list_declare,
- $server_tests_list \n\n";
-}
diff --git a/api-tests/tools/scripts/gen_tests_list.py b/api-tests/tools/scripts/gen_tests_list.py
new file mode 100644
index 0000000..7d33bb5
--- /dev/null
+++ b/api-tests/tools/scripts/gen_tests_list.py
@@ -0,0 +1,126 @@
+#!/usr/bin/python
+#/** @file
+# * Copyright (c) 2019, 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) != 11):
+ print("\nScript requires following inputs")
+ print("\narg1 : <INPUT SUITE identifier>")
+ print("\narg2 : <INPUT testsuite.db file>")
+ print("\narg3 : <INPUT panic test>")
+ print("\narg4 : <OUTPUT testlist file>")
+ print("\narg5 : <OUTPUT test_entry_list>")
+ print("\narg6 : <OUTPUT test_entry_fn_declare_list>")
+ print("\narg7 : <OUTPUT client_tests_list_declare>")
+ print("\narg8 : <OUTPUT client_tests_list>")
+ print("\narg9 : <OUTPUT server_tests_list_declare>")
+ print("\narg10 : <OUTPUT server_tests_list>")
+ sys.exit(1)
+
+suite = sys.argv[1]
+testsuite_db_file = sys.argv[2]
+panic_tests_included = int(sys.argv[3])
+testlist_file = sys.argv[4]
+test_entry_list = sys.argv[5]
+test_entry_fn_declare_list = sys.argv[6]
+client_tests_list_declare = sys.argv[7]
+client_tests_list = sys.argv[8]
+server_tests_list_declare = sys.argv[9]
+server_tests_list = sys.argv[10]
+
+# Dictionary to hold the mapping between suite and the base number
+suite_with_base_dict = {"ipc":0, "crypto":1, "protected_storage":2, "internal_trusted_storage":3, "initial_attestation":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]):
+ if ((panic_tests_included == 1) and ("panic" not in line)):
+ o_f.write(line)
+ elif ((panic_tests_included == 1) and ("panic" in line)):
+ o_f.write(line[0:line.find(',')]+'\n')
+ elif ((panic_tests_included == 0) and ("panic" not in line)):
+ o_f.write(line)
+
+def gen_test_entry_info():
+ """
+ Generate Non-secure related 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])
+ if (suite == "protected_storage"):
+ uniq_test_string = 'p'+line[6:9]
+ else:
+ 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, psa_api_t *psa_api);\n" %(uniq_test_string))
+ print("Non-secure test entry symbol list:\n\t%s,\n\t%s" %(test_entry_list, test_entry_fn_declare_list))
+
+def gen_secure_tests_list():
+ """
+ Generate partition related inc files
+ """
+ test_num = 0
+ test_num_prev = 0
+
+ with open(testlist_file, mode='r') as i_f, \
+ open(client_tests_list_declare, mode='w') as o_f1, \
+ open(client_tests_list, mode='w') as o_f2, \
+ open(server_tests_list_declare, mode='w') as o_f3, \
+ open(server_tests_list, mode='w') as o_f4:
+ for line in i_f:
+ line = line.strip()
+ o_f1.write("extern client_test_t %s_client_tests_list[];\n" %(line))
+ o_f3.write("extern server_test_t %s_server_tests_list[];\n" %(line))
+
+ test_num = int(line[6:9])
+ if ((test_num - test_num_prev) > 1):
+ for num in range(test_num_prev, test_num-1):
+ o_f2.write("\tNULL,\n")
+ o_f4.write("\tNULL,\n")
+ o_f2.write("\t%s_client_tests_list,\n" %(line[0:9]));
+ o_f4.write("\t%s_server_tests_list,\n" %(line[0:9]));
+
+ test_num_prev = test_num
+
+ print("Secure test entry symbol list:\n\t%s,\n\t%s,\n\t%s,\n\t%s" \
+ %(client_tests_list_declare, client_tests_list, \
+ server_tests_list_declare, server_tests_list))
+
+# Call routines
+gen_test_list()
+gen_test_entry_info()
+if (suite == "ipc"):
+ gen_secure_tests_list()
diff --git a/api-tests/tools/scripts/process_test_linker_file.pl b/api-tests/tools/scripts/process_test_linker_file.pl
deleted file mode 100755
index 4b0bb27..0000000
--- a/api-tests/tools/scripts/process_test_linker_file.pl
+++ /dev/null
@@ -1,77 +0,0 @@
-#!/usr/bin/env perl
-#/** @file
-# * Copyright (c) 2018-2019, 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.
-#**/
-
-#inputs
-$source=$ARGV[0];
-$suite_out=$ARGV[1];
-$target=$ARGV[2];
-$toolchain=$ARGV[3];
-
-$targetConfigPath = "$source/platform/targets/$target/target.cfg";
-$linker_in = "";
-$linker_out = "";
-$ns_test_start_addr = undef;
-
-if($toolchain eq "GNUARM")
-{
- $linker_in = "$source/tools/makefiles/linker/test.linker";
- $linker_out = "$suite_out/.test.linker";
-}
-else
-{
- $linker_in = "$source/tools/makefiles/linker/test.sct";
- $linker_out = "$suite_out/.test.sct";
-}
-
-open(IN, $targetConfigPath) or die "Unable to open $targetConfigPath $!";
-while(<IN>) {
- if($_ !~ /^\//) {# exclude commented lines
- if($_ =~ /\.ns_test_addr(\s*)\=(\s*)(.+)(\s*)\;/) {
- $ns_test_start_addr = $3;
- }
- }
-}
-close IN;
-
-if(defined($ns_test_start_addr))
-{
- open(IN, $linker_in) or die "Unable to open $linker_in $!";
- open(OUT, '>', $linker_out) or die "Unable to open: $!";
- while(<IN>) {
- if($_ =~ /^TEST_START/){
- print OUT "TEST_START = $ns_test_start_addr;\n";
- }elsif($_ =~ /#define *TEST_CODE_START/){
- print OUT "#define TEST_CODE_START $ns_test_start_addr\n";
- }else{
- print OUT "$_";
- }
- }
- close IN;
- close OUT;
- print "linker file - $linker_out\n"
-}
-else
-{
- die ("Error: ns_test_addr is not found in target.cfg file\n");
-}
-
-if($toolchain eq "ARMCLANG")
-{
- system("cpp -x assembler-with-cpp -w -E -o $linker_out.tmp $linker_out ") && die ("Failed to process $linker_out\n");
- system("cp $linker_out.tmp $linker_out");
-}
diff --git a/api-tests/tools/scripts/setup.sh b/api-tests/tools/scripts/setup.sh
deleted file mode 100755
index 7d6b36c..0000000
--- a/api-tests/tools/scripts/setup.sh
+++ /dev/null
@@ -1,497 +0,0 @@
-#!/usr/bin/env bash
-#/** @file
-# * Copyright (c) 2018-2019, 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.
-#**/
-
-echo ""
-
-declare -a INCLUDE_PATHS
-export SUITE=" "
-export TEST_COMBINE_ARCHIVE=0
-export INCLUDE_PANIC_TESTS=0
-export WATCHDOG_AVAILABLE=0
-export SP_HEAP_MEM_SUPP=0
-export CLIENT_FILE_FOUND=0
-export SERVICE_FILE_FOUND=0
-export MANIFEST_OUT_FILE_FOUND=0
-export CRYPTO_FILE_FOUND=0
-export PROTECTED_STORAGE_FILE_FOUND=0
-export INTERNAL_TRUSTED_STORAGE_FILE_FOUND=0
-export INITIAL_ATTESTATION_FILE_FOUND=0
-export LIFECYCLE_FILE_FOUND=0
-
-IPC_HEADER_FILE_REQ="If PSA IPC implemented in your platform, include path must point to path
-where \"psa/client.h\", \"psa/service.h\", \"psa/lifecycle.h\" and test partition manifest output files
-(\"psa_manifest/sid.h\", \"psa_manifest/pid.h\" and \"psa_manifest/<manifestfilename>.h\") are located.
-"
-CRYPTO_HEADER_FILE_REQ="If PSA CRYPTO APIs are implemented into your platform then you must provide
-\"psa/crypto.h\" file to setup.sh script using --include option to compile tests and framework.
-"
-PS_HEADER_FILE_REQ="If PSA PROTECTED STORAGE APIs are implemented into your platform then you must provide
-\"psa/protected_storage.h\" file to setup.sh script using --include option to compile tests and framework.
-"
-ITS_HEADER_FILE_REQ="If PSA INTERNAL_TRUSTED_STORAGE APIs are implemented into your platform then you must provide
-\"psa/internal_trusted_storage.h\" file to setup.sh script using --include option to compile tests and framework.
-"
-ATTESTATION_HEADER_FILE_REQ="If PSA INITIAL_ATTESTATION APIs are implemented into your platform then you must provide
-\"psa/initial_attestation.h\" and \"psa/crypto.h\" file to setup.sh script using --include option to compile tests and framework.
-"
-
-HELP="
-
-Usage: setup.sh [--source SOURCE_DIR] [--build BUILD_DIR] [--target TARGET] [--suite SUITE]
- [--toolchain TOOLCHAIN] [--cpu_arch CPU_ARCH] [--verbose PRINT_LEVEL]
- [--include INCLUDE_PATH] [--help|-h]
-Toplevel script to build tests and framework sources for given test suite.
-
-Arguments Info:
- --source <SOURCE_DIR> : SOURCE_DIR pointing to architecture test suite directory structure.
- Default is current directory
- --build <BUILD_DIR> : To select the build (output) directory. Default: BUILD/ inside current directory
- --target <TARGET> : Provide target string as argument.
- target.cfg file corresponding to input string must be avaiable at
- platform/targets/<TARGET>/
- --suite <SUITE> : Compile tests for given suite. Support values are:
- ipc, crypto, internal_trusted_storage, protected_storage,
- and initial_attestation.
- --toolchain <TOOLCHAIN> : Build using the given TOOLCHAIN.
- Supported values are GNUARM (GNU Arm Embedded) and ARMCLANG (ARM Compiler 6.x).
- --cpu_arch <CPU_ARCH> : Provide cpu arch string as argument.
- Supported CPU arch are armv8m_ml, armv8m_bl and armv7m.
- --verbose <PRINT_LEVEL> : Print verbosity level
- Supported print levels are:
- 1 - INFO & above.
- 2 - DEBUG & above.
- 3 - TEST & above.(Default)
- 4 - WARN & ERROR.
- 5 - ERROR.
- --archive_tests : Create combine test archive(.a) file by combining available test objects files.
- Absence of this option would create combine test binary(.bin) by combining available test elfs
- --include_panic_tests : Consider panic tests (mentioned in testsuite.db of respective suite) along with functional tests
- for building the final executables. Absence of this option would consider only non-panic (ie, functional) tests
- --include <INCLUDE_PATH>: Additional directory to be included into compiler search path. Provide --include <path>
- where path pointing to location of PSA defined header files.
- You can specify multiple source locations using --include option.
- Ex: --include <path1> --include <path2>
- --help|-h : Print this help message
-
-Notes:
-1. $IPC_HEADER_FILE_REQ
-2. $CRYPTO_HEADER_FILE_REQ
-3. $PS_HEADER_FILE_REQ
-4. $ITS_HEADER_FILE_REQ
-5. $ATTESTATION_HEADER_FILE_REQ
-
-"
-
-if [ "$#" == "0" ]; then
- echo "Error: no argument to setup.sh"
- echo "$HELP"
- exit 1
-fi
-
-while [ $# -gt 0 ]; do
- case $1 in
- --source ) shift
- export SOURCE=$1
- ;;
- --build ) shift
- export BUILD="$1/BUILD"
- ;;
- --target ) shift
- export TARGET=$1
- ;;
- --suite ) shift
- export SUITE=$1
- ;;
- --toolchain ) shift
- export TOOLCHAIN=$1
- ;;
- --cpu_arch ) shift
- export CPU_ARCH=$1
- ;;
- --verbose ) shift
- export VERBOSE=$1
- ;;
- --archive_tests )
- export TEST_COMBINE_ARCHIVE=1
- ;;
- --include_panic_tests )
- export INCLUDE_PANIC_TESTS=1
- ;;
- --include ) shift
- export INCLUDE="$INCLUDE -I $1/"
- INCLUDE_PATHS=("${INCLUDE_PATHS[@]}" $1)
- ;;
- --help | -h )
- echo "$HELP"
- exit 1
- ;;
- * )
- echo "Error: Invaid argument $1"
- echo "$HELP"
- exit 1
- esac
- shift
-done
-
-echo "----------Process input arguments- start-------------"
-if [ -z "$SOURCE" ]
-then
- export SOURCE=./
- echo "--source option is not provided, hence setting \$SOURCE to present dir"
-else
- echo "setting \$SOURCE to $SOURCE"
-fi
-
-if [ ! -d "$SOURCE/dev_apis" ] || [ ! -d "$SOURCE/ff" ]
-then
- echo "Error: Could not find architecture test suite directories in current path $SOURCE"
- exit 1
-fi
-
-if [ -z "$BUILD" ]
-then
- export BUILD="./BUILD"
- echo "--build option is not provided, hence setting \$BUILD to ./BUILD"
-else
- echo "setting \$BUILD to $BUILD"
-fi
-
-if [ -z "$TARGET" ]
-then
- echo "Provide target string as argument using --target <string>"
- exit 1
-else
- echo "Using \$TARGET=$TARGET"
-fi
-
-if [ "$SUITE" != "ipc" ] && [ "$SUITE" != "crypto" ] && [ "$SUITE" != "protected_storage" ] &&
- [ "$SUITE" != "internal_trusted_storage" ] && [ "$SUITE" != "initial_attestation" ]
-then
- echo "Error: Unsupported value for --suite=$SUITE.
- Refer help message to see supported suites"
- exit 1
-fi
-
-PLATFORM_MAKEFILE=$SOURCE/platform/targets/$TARGET/Makefile
-PSA_IPC_IMPLEMENTED=`grep -c "^ *PSA_IPC_IMPLEMENTED\s*:=\s*1" $PLATFORM_MAKEFILE`
-PSA_CRYPTO_IMPLEMENTED=`grep -c "^ *PSA_CRYPTO_IMPLEMENTED\s*:=\s*1" $PLATFORM_MAKEFILE`
-PSA_PROTECTED_STORAGE_IMPLEMENTED=`grep -c "^ *PSA_PROTECTED_STORAGE_IMPLEMENTED\s*:=\s*1" $PLATFORM_MAKEFILE`
-PSA_INTERNAL_TRUSTED_STORAGE_IMPLEMENTED=`grep -c "^ *PSA_INTERNAL_TRUSTED_STORAGE_IMPLEMENTED\s*:=\s*1" $PLATFORM_MAKEFILE`
-PSA_INITIAL_ATTESTATION_IMPLEMENTED=`grep -c "^ *PSA_INITIAL_ATTESTATION_IMPLEMENTED\s*:=\s*1" $PLATFORM_MAKEFILE`
-WATCHDOG_AVAILABLE=`grep -c "^ *watchdog.num\s*=\s*1\s*;" $SOURCE/platform/targets/$TARGET/target.cfg`
-SP_HEAP_MEM_SUPP=`grep -c "^ *dut.0.sp_heap_mem_supp\s*=\s*AVAILABLE\s*;" $SOURCE/platform/targets/$TARGET/target.cfg`
-
-# Check PSA_IPC_IMPLEMENTED validity
-if [ $SUITE == "ipc" ] && [ $PSA_IPC_IMPLEMENTED == "0" ]
-then
- echo "Error: PSA_IPC_IMPLEMENTED must be set to 1 for ipc suite
- in $PLATFORM_MAKEFILE"
- exit 1
-fi
-
-# Check PSA_CRYPTO_IMPLEMENTED validity
-if [ $SUITE == "crypto" ] && [ $PSA_CRYPTO_IMPLEMENTED == "0" ]
-then
- echo "Error: PSA_CRYPTO_IMPLEMENTED must be set to 1 for crypto suite
- in $PLATFORM_MAKEFILE"
- exit 1
-fi
-
-# Check PSA_PROTECTED_STORAGE_IMPLEMENTED validity
-if [ $SUITE == "protected_storage" ] && [ $PSA_PROTECTED_STORAGE_IMPLEMENTED == "0" ]
-then
- echo "Error: PSA_PROTECTED_STORAGE_IMPLEMENTED must be set to 1 for protected_storage suite
- in $PLATFORM_MAKEFILE"
- exit 1
-fi
-
-# Check PSA_INTERNAL_TRUSTED_STORAGE_IMPLEMENTED validity
-if [ $SUITE == "internal_trusted_storage" ] && [ $PSA_INTERNAL_TRUSTED_STORAGE_IMPLEMENTED == "0" ]
-then
- echo "Error: PSA_INTERNAL_TRUSTED_STORAGE_IMPLEMENTED must be set to 1 for internal_trusted_storage suite
- in $PLATFORM_MAKEFILE"
- exit 1
-fi
-
-# Check PSA_INITIAL_ATTESTATION_IMPLEMENTED validity
-if [ $SUITE == "initial_attestation" ] && [ $PSA_INITIAL_ATTESTATION_IMPLEMENTED == "0" ]
-then
- echo "Error: PSA_INITIAL_ATTESTATION_IMPLEMENTED must be set to 1 for initial_attestation suite
- in $PLATFORM_MAKEFILE"
- exit 1
-fi
-
-if [ $PSA_IPC_IMPLEMENTED == "1" ]
-then
- # Check --include validity for ipc suite
- if [ -z "$INCLUDE" ]
- then
- echo "Error: --include option is not provided. $IPC_HEADER_FILE_REQ"
- exit 1
- else
- for path in "${INCLUDE_PATHS[@]}"
- do
- if [ -f "$path/psa/client.h" ]
- then
- export CLIENT_FILE_FOUND=1
- fi
- if [ -f "$path/psa/service.h" ]
- then
- export SERVICE_FILE_FOUND=1
- fi
- if [ -f "$path/psa_manifest/sid.h" ] && [ -f "$path/psa_manifest/pid.h" ]
- then
- export MANIFEST_OUT_FILE_FOUND=1
- fi
- if [ -f "$path/psa/lifecycle.h" ]
- then
- export LIFECYCLE_FILE_FOUND=1
- fi
- done
- if [ $CLIENT_FILE_FOUND == "0" ]
- then
- echo "Couldn't find psa/client.h file in paths: ${INCLUDE_PATHS[@]}"
- echo "$IPC_HEADER_FILE_REQ"
- exit 1
- fi
- if [ $SERVICE_FILE_FOUND == "0" ]
- then
- echo "Couldn't find psa/service.h file in paths: ${INCLUDE_PATHS[@]}"
- echo "$IPC_HEADER_FILE_REQ"
- exit 1
- fi
- if [ $MANIFEST_OUT_FILE_FOUND == "0" ]
- then
- echo "Couldn't find psa_manifest/sid.h or psa_manifest/pid.h file in paths: ${INCLUDE_PATHS[@]}"
- echo "$IPC_HEADER_FILE_REQ"
- exit 1
- fi
- if [ $LIFECYCLE_FILE_FOUND == "0" ]
- then
- echo "Couldn't find psa/lifecycle.h file in paths: ${INCLUDE_PATHS[@]}"
- echo "$IPC_HEADER_FILE_REQ"
- exit 1
- fi
- fi
-fi
-
-if [ $PSA_CRYPTO_IMPLEMENTED == "1" ]
-then
- # Check --include validity for crypto suite
- if [ -z "$INCLUDE" ]
- then
- echo "Error: --include option is not provided."
- echo "$CRYPTO_HEADER_FILE_REQ"
- exit 1
- else
- for path in "${INCLUDE_PATHS[@]}"
- do
- if [ -f "$path/psa/crypto.h" ]
- then
- export CRYPTO_FILE_FOUND=1
- fi
- done
- if [ $CRYPTO_FILE_FOUND == "0" ]
- then
- echo "Couldn't find psa/crypto.h file in paths: ${INCLUDE_PATHS[@]}"
- echo "$CRYPTO_HEADER_FILE_REQ"
- exit 1
- fi
- fi
-fi
-
-if [ $PSA_PROTECTED_STORAGE_IMPLEMENTED == "1" ]
-then
- # Check --include validity for protected storage suite
- if [ -z "$INCLUDE" ]
- then
- echo "Error: --include option is not provided."
- echo "$PS_HEADER_FILE_REQ"
- exit 1
- else
- for path in "${INCLUDE_PATHS[@]}"
- do
- if [ -f "$path/psa/protected_storage.h" ]
- then
- export PROTECTED_STORAGE_FILE_FOUND=1
- fi
- done
- if [ $PROTECTED_STORAGE_FILE_FOUND == "0" ]
- then
- echo "Couldn't find psa/protected_storage.h file in paths: ${INCLUDE_PATHS[@]}"
- echo "$PS_HEADER_FILE_REQ"
- exit 1
- fi
- fi
-fi
-
-if [ $PSA_INTERNAL_TRUSTED_STORAGE_IMPLEMENTED == "1" ]
-then
- # Check --include validity for internal trusted storage suite
- if [ -z "$INCLUDE" ]
- then
- echo "Error: --include option is not provided."
- echo "$ITS_HEADER_FILE_REQ"
- exit 1
- else
- for path in "${INCLUDE_PATHS[@]}"
- do
- if [ -f "$path/psa/internal_trusted_storage.h" ]
- then
- export INTERNAL_TRUSTED_STORAGE_FILE_FOUND=1
- fi
- done
- if [ $INTERNAL_TRUSTED_STORAGE_FILE_FOUND == "0" ]
- then
- echo "Couldn't find psa/internal_trusted_storage.h file in paths: ${INCLUDE_PATHS[@]}"
- echo "$ITS_HEADER_FILE_REQ"
- exit 1
- fi
- fi
-fi
-
-if [ $PSA_INITIAL_ATTESTATION_IMPLEMENTED == "1" ]
-then
- # Check --include validity for initial_attestation suite
- if [ -z "$INCLUDE" ]
- then
- echo "Error: --include option is not provided."
- echo "$ATTESTATION_HEADER_FILE_REQ"
- exit 1
- else
- for path in "${INCLUDE_PATHS[@]}"
- do
- if [ -f "$path/psa/initial_attestation.h" ]
- then
- export INITIAL_ATTESTATION_FILE_FOUND=1
- fi
- if [ -f "$path/psa/crypto.h" ]
- then
- export CRYPTO_FILE_FOUND=1
- fi
- done
-
- if [ $INITIAL_ATTESTATION_FILE_FOUND == "0" ]
- then
- echo "Couldn't find psa/initial_attestation.h file in paths: ${INCLUDE_PATHS[@]}"
- echo "$ATTESTATION_HEADER_FILE_REQ"
- exit 1
- elif [ $INITIAL_ATTESTATION_FILE_FOUND == "1" ]
- then
- if [ $CRYPTO_FILE_FOUND == "0" ]
- then
- echo "Couldn't find psa/crypto.h file in paths: ${INCLUDE_PATHS[@]}"
- echo "$CRYPTO_HEADER_FILE_REQ"
- exit 1
- fi
- if [ ! -d "$SOURCE/platform/targets/$TARGET/nspe/initial_attestation/ext" ]
- then
- git clone https://github.com/laurencelundblade/QCBOR.git $SOURCE/platform/targets/$TARGET/nspe/initial_attestation/ext
- cd $SOURCE/platform/targets/$TARGET/nspe/initial_attestation/ext; git checkout da53227db1488dde0952bdff66c3d904dce270b3 ; cd -
- else
- echo "QCBOR library already cloned"
- fi
- fi
- fi
-fi
-
-if [ -z "$TOOLCHAIN" ]
-then
- export TOOLCHAIN=GNUARM
- echo "--toolchain option is not provided, hence using default value \$TOOLCHAIN=$TOOLCHAIN"
-else
- echo "Using \$TOOLCHAIN=$TOOLCHAIN"
-fi
-
-if [ $TOOLCHAIN != "GNUARM" ] && [ $TOOLCHAIN != "ARMCLANG" ]
-then
- echo "Error: Unsupported value for --toolchain=$TOOLCHAIN.
- Supported toolchain are GNUARM and ARMCLANG"
- exit 1
-fi
-
-if [ -z "$CPU_ARCH" ]
-then
- echo "Error: Provide cpu arch string as argument using --cpu_arch <string>"
- echo "Supported CPU arch are armv8m_ml, armv8m_bl, armv7m"
- exit 1
-else
- echo "Using \$CPU_ARCH=$CPU_ARCH"
-fi
-
-if [ $CPU_ARCH != "armv8m_ml" ] && [ $CPU_ARCH != "armv8m_bl" ] && [ $CPU_ARCH != "armv7m" ]
-then
- echo "Error: Unsupported value for --cpu_arch=$CPU_ARCH.
- Supported CPU arch are armv8m_ml, armv8m_bl, armv7m"
- exit 1
-fi
-
-if [ ! -z "$VERBOSE" ]
-then
- if [ $VERBOSE != "1" ] && [ $VERBOSE != "2" ] &&
- [ $VERBOSE != "3" ] && [ $VERBOSE != "4" ] &&
- [ $VERBOSE != "5" ]
- then
- echo "Error: Unsupported value for --verbose=$VERBOSE."
- echo "Supported print levels are:"
- echo "1 - INFO & above."
- echo "2 - DEBUG & above."
- echo "3 - TEST & above."
- echo "4 - WARN & ERROR."
- echo "5 - ERROR."
- exit 1
- fi
-else
- export VERBOSE=3
-fi
-
-if [ $INCLUDE_PANIC_TESTS == "1" ] && [ $WATCHDOG_AVAILABLE == "0" ]
-then
- echo "
-Warning: You have set watchdog.num to 0 in $SOURCE/platform/targets/$TARGET/target.cfg
-Note - To test PSA APIs panic conditions, test harness may require to access watchdog timer
-to recover from panic and to be able to continue with next test.
-Ignore this warning if system under test has capability to reset the system
-when it encounters panic condition.
-"
-fi
-
-echo "----------Process input arguments- complete-------------"
-echo ""
-
-MAKE_OPTIONS=" SOURCE=$SOURCE "
-MAKE_OPTIONS+=" BUILD=$BUILD "
-MAKE_OPTIONS+=" TARGET=$TARGET "
-MAKE_OPTIONS+=" SUITE=$SUITE "
-MAKE_OPTIONS+=" TOOLCHAIN=$TOOLCHAIN "
-MAKE_OPTIONS+=" CPU_ARCH=$CPU_ARCH "
-MAKE_OPTIONS+=" VERBOSE=$VERBOSE "
-MAKE_OPTIONS+=" TEST_COMBINE_ARCHIVE=$TEST_COMBINE_ARCHIVE "
-MAKE_OPTIONS+=" INCLUDE_PANIC_TESTS=$INCLUDE_PANIC_TESTS "
-MAKE_OPTIONS+=" WATCHDOG_AVAILABLE=$WATCHDOG_AVAILABLE "
-MAKE_OPTIONS+=" SP_HEAP_MEM_SUPP=$SP_HEAP_MEM_SUPP "
-MAKE_OPTIONS+=" PSA_IPC_IMPLEMENTED=$PSA_IPC_IMPLEMENTED "
-MAKE_OPTIONS+=" PSA_CRYPTO_IMPLEMENTED=$PSA_CRYPTO_IMPLEMENTED "
-MAKE_OPTIONS+=" PSA_PROTECTED_STORAGE_IMPLEMENTED=$PSA_PROTECTED_STORAGE_IMPLEMENTED "
-MAKE_OPTIONS+=" PSA_INTERNAL_TRUSTED_STORAGE_IMPLEMENTED=$PSA_INTERNAL_TRUSTED_STORAGE_IMPLEMENTED "
-MAKE_OPTIONS+=" PSA_INITIAL_ATTESTATION_IMPLEMENTED=$PSA_INITIAL_ATTESTATION_IMPLEMENTED "
-MAKE_OPTIONS+=" USER_INCLUDE=\"$INCLUDE\" "
-
-#Build VAL/PAL static library and Tests ELFs
-echo "make -f $SOURCE/tools/makefiles/Makefile $MAKE_OPTIONS USER_INCLUDE=\"$INCLUDE\" all "
-make -f $SOURCE/tools/makefiles/Makefile $MAKE_OPTIONS USER_INCLUDE="$INCLUDE" all
diff --git a/api-tests/tools/scripts/target_cfg/CMakeLists.txt b/api-tests/tools/scripts/target_cfg/CMakeLists.txt
new file mode 100644
index 0000000..546c068
--- /dev/null
+++ b/api-tests/tools/scripts/target_cfg/CMakeLists.txt
@@ -0,0 +1,76 @@
+#/** @file
+# * Copyright (c) 2019, 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 the minimum required version of CMake for the project
+cmake_minimum_required(VERSION 3.10)
+
+# cmake_policy
+cmake_policy(SET CMP0057 NEW)
+
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../tools/cmake)
+include("common/CMakeSettings")
+include("common/Utils")
+
+# Let the CMake look for C compiler
+project(TargetConfigGen LANGUAGES C)
+
+# Check whether required arguments are passed to CMake
+_check_arguments("OUT_DIR"
+ "TARGET"
+ "GENERATOR_FILE"
+ "INCLUDE_DIR"
+ "TARGET_CONFIGURATION_FILE"
+ "TGT_CONFIG_SOURCE_C"
+ "OUTPUT_HEADER"
+ "DATABASE_TABLE_NAME"
+ "DATABASE_TABLE_SECTION_NAME"
+ "TARGET_HEADER_GEN_INCLUDE_PATHS"
+)
+
+# add_custom_command to generate intermediate source file
+add_custom_command(
+ OUTPUT
+ ${TGT_CONFIG_SOURCE_C}
+ COMMENT "[PSA] : Creating generator source ${TGT_CONFIG_SOURCE_C}"
+ COMMAND ${PYTHON_EXECUTABLE} ${GENERATOR_FILE} ${TARGET} ${INCLUDE_DIR}/val_target.h ${TARGET_CONFIGURATION_FILE} ${TGT_CONFIG_SOURCE_C} ${OUTPUT_HEADER} ${DATABASE_TABLE_NAME} ${DATABASE_TABLE_SECTION_NAME}
+)
+
+# Adding command to execute the generator
+add_custom_command(
+ OUTPUT
+ ${OUTPUT_HEADER}
+ COMMENT "[PSA] : Creating output header ${OUTPUT_HEADER}"
+ COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}
+)
+
+# Adding executable
+add_executable(${PROJECT_NAME} ${TGT_CONFIG_SOURCE_C})
+foreach(include_path ${TARGET_HEADER_GEN_INCLUDE_PATHS})
+ target_include_directories(${PROJECT_NAME} PRIVATE ${include_path})
+endforeach()
+set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "-m32 -w")
+set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "-m32")
+
+# Adding target to tell we want OUTPUT_HEADER
+add_custom_target(
+ run_generator_output ALL
+ SOURCES ${OUTPUT_HEADER}
+)
+
+# install target to put the OUTPUT_HEADER to it's final location
+get_filename_component(INSTALL_DST "${OUT_DIR}" ABSOLUTE)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_HEADER} DESTINATION ${INSTALL_DST})
diff --git a/api-tests/tools/scripts/targetConfigGen.py b/api-tests/tools/scripts/target_cfg/targetConfigGen.py
similarity index 99%
rename from api-tests/tools/scripts/targetConfigGen.py
rename to api-tests/tools/scripts/target_cfg/targetConfigGen.py
index 6442f74..fd1f7e4 100644
--- a/api-tests/tools/scripts/targetConfigGen.py
+++ b/api-tests/tools/scripts/target_cfg/targetConfigGen.py
@@ -41,6 +41,9 @@
unique_major_groups = []
unique_minor_components = []
+if section_name == "NOSECTION":
+ section_name = ""
+
def get_minor_major_map():
""" This method populates the dictionary which maps between every available minor component to their major group """
try:
diff --git a/api-tests/tools/scripts/test_elf_combine.pl b/api-tests/tools/scripts/test_elf_combine.pl
deleted file mode 100755
index fb50e32..0000000
--- a/api-tests/tools/scripts/test_elf_combine.pl
+++ /dev/null
@@ -1,85 +0,0 @@
-#!/usr/bin/env perl
-#/** @file
-# * Copyright (c) 2018-2019, 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.
-#**/
-
-use File::Find;
-use File::Basename;
-
-#Inputs
-$test_list_file = $ARGV[0];
-
-@suite_out = split("/.testlist.txt", $test_list_file);
-
-# Final output elf file
-$output_elf = "$suite_out[0]/test_elf_combine.bin";
-
-
-my @all_elf_paths;
-@test_list = `cat $test_list_file`;
-
-
-open(OUT, '>:raw', $output_elf) or die "Unable to open: $!";
-
-# Collecting all elf file paths
-
-foreach $test (@test_list)
-{
- chomp($test);
- push @all_elf_paths, "$suite_out[0]/$test/test.elf";
- if (!(-e "$suite_out[0]/$test/test.elf"))
- {
- print "ELF not found - $suite_out[0]/$test/test.elf\n";
- exit 1;
- }
-}
-
-foreach $elf (@all_elf_paths) {
-
- # Find elf sizes
- $elf_size = -s $elf;
-
- # Get readelf program header info from either elf and process it
- $out = `readelf -l $elf`;
- if($out =~ /LOAD(\s+)(0[xX][0-9a-fA-F]+)/)
- {
- $program_header = hex($2);
- }
-
- # Determining test_id from elf at location pointed by program header
- open(TEST_NS_ID, '<:raw', $elf) or die "Unable to open: $!";
- seek(TEST_NS_ID, $program_header, 0);
- read TEST_NS_ID, $test_id_raw, 4;
-
- $test_id = unpack('L<', $test_id_raw);
- close TEST_NS_ID;
-
- printf("test_id:\t%4d, ", $test_id);
- print "ELF:$elf,\tSIZE:$elf_size\n";
-
- # 'L' unsigned-32 ; '<' Little endian
- print OUT pack('L<', 0xFACEFACE);
- print OUT pack('L<', $test_id);
- print OUT pack('L<', $elf_size);
-
- # Temporarily closing final ELF to concatenate ELFs
- close OUT;
- system("cat $elf >> $output_elf");
- # Open final ELF again
- open(OUT, '>>:raw', $output_elf) or die "Unable to open: $!";
-}
-print OUT pack('L<', 0xC3C3C3C3);
-close OUT;