diff --git a/tbsa-v8m/CMakeLists.txt b/tbsa-v8m/CMakeLists.txt
new file mode 100644
index 00000000..ab74d676
--- /dev/null
+++ b/tbsa-v8m/CMakeLists.txt
@@ -0,0 +1,319 @@
+#/** @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)
+
+# Find python interpreter version 3 or greater
+find_package(PythonInterp 3 REQUIRED)
+# Find Git package
+find_package(Git REQUIRED)
+
+get_filename_component(TBSA_ROOT_DIR . ABSOLUTE)
+
+list(APPEND CMAKE_MODULE_PATH ${TBSA_ROOT_DIR}/cmake)
+include("common/Utils")
+include(${TBSA_ROOT_DIR}/cmake/common/CMakeSettings.cmake)
+
+# Check for TARGET command line argument
+_check_arguments("TARGET")
+
+# Check for COMPILER command line argument
+if(NOT DEFINED COMPILER)
+ set(COMPILER "GNUARM" CACHE INTERNAL "Compiler used" FORCE)
+ message(STATUS "[TBSA] : Defaulting compiler to ${COMPILER}")
+endif()
+
+# Check for ARCH command line argument
+if(NOT DEFINED ARCH)
+ message(STATUS "[TBSA] : Defaulting architecture to armv8-m.main")
+ set(ARCH "main")
+endif()
+
+# Check for CMSIS command line argument which drives platform driver selection
+if(NOT DEFINED CMSIS_DRIVER)
+ set(CMSIS_DRIVER OFF CACHE INTERNAL "CMSIS Driver selection" FORCE)
+endif()
+
+# Check for SUITE command line argument
+if(NOT DEFINED SUITE)
+ set(SUITE "ALL" CACHE INTERNAL "Test Component selection" FORCE)
+endif()
+
+# Supported architectures
+list(APPEND ARCHITECTURE_SUPPORT
+ main
+ base
+)
+
+# Supported toolchains
+list(APPEND TOOLCHAIN_SUPPORT
+ GNUARM
+)
+
+# Variables of the project
+set(TBSA_PROJECT_NAME tbsa)
+set(TARGET_CONFIGURATION_FILE ${TBSA_ROOT_DIR}/platform/board/${TARGET}/tbsa_tgt.cfg)
+set(TBSA_MAIN_APP_ENTRY tbsa_entry)
+set(TBSA_TEST_APP_ENTRY tbsa_test_info)
+set(TBSA_TARGET_GENERATE_DATABASE generate_database)
+set(TBSA_TARGET_GENERATE_DATABASE_POST generate_database_cleanup)
+set(TBSA_TARGET_CMSIS cmsis_setup)
+set(TBSA_TARGET_GENERATE_LINKER_SCRIPTS generate_linker_scripts)
+set(TBSA_TARGET_TEST_ELF_COMBINE test_elf_combine)
+set(TBSA_TARGET_VAL_LIB tbsa_val)
+set(TBSA_TARGET_PAL_LIB tbsa_pal)
+set(TBSA_CMSIS_GIT_REPO_LINK https://github.com/ARM-software/CMSIS_5.git CACHE INTERNAL "CMSIS Git Repo path" FORCE)
+set(TBSA_CMSIS_GIT_REPO_TAG 49ac527aa7406cecbba46d4d3bdbc7f60c6c6d42 CACHE INTERNAL "CMSIS Git Repo Tag Id" FORCE)
+set(TBSA_TARGET_CONFIG_HEADER_GENERATOR ${TBSA_ROOT_DIR}/tools/tgt_cfg_parser/targetConfigGen.py)
+set(TBSA_LINKER_SCRIPT_GENERATOR ${TBSA_ROOT_DIR}/tools/gen_linker_scripts/gen_linker_scripts.py)
+set(TBSA_TEST_ELF_COMBINE_GENERATOR ${TBSA_ROOT_DIR}/tools/test_elf_combine.py)
+set(TEST_COMBINED_BINARY_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/tbsa_test_combined.bin CACHE INTERNAL "TBSA Test Binary Name" FORCE)
+set(TGT_CONFIG_SOURCE_C ${CMAKE_CURRENT_BINARY_DIR}/targetConfigGen.c)
+set(OUTPUT_HEADER pal_database.h)
+set(DATABASE_TABLE_NAME database)
+set(DATABASE_TABLE_SECTION_NAME .ns_target_database)
+set(TBSA_MAP_FILE ${CMAKE_CURRENT_BINARY_DIR}/${TBSA_PROJECT_NAME}.map)
+set(TBSA_EXECUTABLE_SUFFIX ".elf" CACHE INTERNAL "Executable suffix" FORCE)
+
+if(NOT DEFINED CMSIS_REPO_PATH)
+ get_filename_component(CMSIS_5_DIR ${CMAKE_CURRENT_BINARY_DIR}/src/${TBSA_TARGET_CMSIS} ABSOLUTE)
+else()
+ set(CMSIS_5_DIR ${CMSIS_REPO_PATH})
+endif()
+
+function(validate_target_directory)
+ # Get the list of available directories under platform/board
+ _get_sub_dir_list(BOARD_LIST ${TBSA_ROOT_DIR}/platform/board)
+ # Removing include directory which is not a target
+ list(REMOVE_ITEM BOARD_LIST include)
+ if(${TARGET} IN_LIST BOARD_LIST)
+ message(STATUS "[TBSA] : Working on target '${TARGET}'")
+ else()
+ message(FATAL_ERROR "[TBSA] : Specified target directory '${TARGET}' not found!")
+ endif()
+endfunction()
+
+function(validate_suite_directory)
+ # Get the list of available directories under test_pool
+ _get_sub_dir_list(SUITE_LIST ${TBSA_ROOT_DIR}/test_pool)
+ if(${SUITE} IN_LIST SUITE_LIST)
+ message(STATUS "[TBSA] : Testing '${SUITE}' suite")
+ else()
+ message(FATAL_ERROR "[TBSA] : Specified suite directory '${SUITE}' not found!")
+ endif()
+endfunction()
+
+# test pool source directory
+set(TEST_POOL_SOURCE_DIR ${TBSA_ROOT_DIR}/test_pool)
+if(SUITE STREQUAL "ALL")
+ # Get all the test pool components
+ _get_sub_dir_list(TEST_POOL_COMP_LIST ${TEST_POOL_SOURCE_DIR})
+else()
+ validate_suite_directory()
+ set(TEST_POOL_COMP_LIST ${SUITE})
+endif()
+
+# Project starts
+project(${TBSA_PROJECT_NAME} C ASM)
+
+# Name of final executable
+set(EXE_NAME ${TBSA_PROJECT_NAME})
+
+message(STATUS "[TBSA] : CMake is running on '${CMAKE_HOST_SYSTEM_NAME}'")
+validate_target_directory()
+
+# Check for supported architectues
+if(NOT ${ARCH} IN_LIST ARCHITECTURE_SUPPORT)
+ message(FATAL_ERROR "[TBSA] : armv8-m.${ARCH} architecture support not available")
+endif()
+
+# Check for supported toolchain/s
+if(${COMPILER} IN_LIST TOOLCHAIN_SUPPORT)
+ include(${TBSA_ROOT_DIR}/cmake/compiler/${COMPILER}.cmake)
+else()
+ message(FATAL_ERROR "[TBSA] : ${COMPILER} toolchain support not available")
+endif()
+
+# Files to clean
+list(APPEND TBSA_CLEAN_LIST
+ ${TEST_COMBINED_BINARY_FILE_NAME}
+ ${TBSA_MAP_FILE}
+ ${TGT_CONFIG_SOURCE_C}
+ ${TBSA_LINKER_SCRIPT}
+ ${TBSA_TEST_S_LINKER_SCRIPT}
+ ${TBSA_TEST_NS_LINKER_SCRIPT}
+ ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_HEADER}
+)
+
+# Adding files to clean for incremental build
+_get_sub_dir_list(TEST_POOL_CLEAN_LIST ${TEST_POOL_SOURCE_DIR})
+foreach(test_comp ${TEST_POOL_CLEAN_LIST})
+ # Set source directory
+ set(TEST_COMP_SOURCE_DIR ${TEST_POOL_SOURCE_DIR}/${test_comp})
+ # Get all the test folders from a given test component
+ _get_sub_dir_list(COMP_TEST_LIST ${TEST_COMP_SOURCE_DIR})
+ foreach(test ${COMP_TEST_LIST})
+ set(TEST_S_EXE_NAME "${test}.secure${TBSA_EXECUTABLE_SUFFIX}")
+ set(TEST_NS_EXE_NAME "${test}.non_secure${TBSA_EXECUTABLE_SUFFIX}")
+ list(APPEND TBSA_CLEAN_LIST
+ ${CMAKE_CURRENT_BINARY_DIR}/${TEST_S_EXE_NAME}
+ ${CMAKE_CURRENT_BINARY_DIR}/${test}.secure.map)
+ list(APPEND TBSA_CLEAN_LIST
+ ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NS_EXE_NAME}
+ ${CMAKE_CURRENT_BINARY_DIR}/${test}.non_secure.map)
+ endforeach()
+endforeach()
+
+# Target configuration parsing
+include(ExternalProject)
+ExternalProject_Add(
+ ${TBSA_TARGET_GENERATE_DATABASE}
+ PREFIX ${CMAKE_CURRENT_BINARY_DIR}
+ DOWNLOAD_COMMAND ""
+ UPDATE_COMMAND ""
+ PATCH_COMMAND ""
+ BUILD_COMMAND ""
+ SOURCE_DIR "${TBSA_ROOT_DIR}/tools/tgt_cfg_parser"
+ CMAKE_ARGS -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
+ -DOUT_DIR=${CMAKE_CURRENT_BINARY_DIR}
+ -DTARGET=${TARGET}
+ -DGENERATOR_FILE=${TBSA_TARGET_CONFIG_HEADER_GENERATOR}
+ -DINCLUDE_DIR=${TBSA_ROOT_DIR}/val/include
+ -DTARGET_CONFIGURATION_FILE=${TARGET_CONFIGURATION_FILE}
+ -DTGT_CONFIG_SOURCE_C=${TGT_CONFIG_SOURCE_C}
+ -DOUTPUT_HEADER=${OUTPUT_HEADER}
+ -DDATABASE_TABLE_NAME=${DATABASE_TABLE_NAME}
+ -DDATABASE_TABLE_SECTION_NAME=${DATABASE_TABLE_SECTION_NAME}
+ TEST_COMMAND ""
+)
+
+# Add custom target to clean generated files of the external project
+add_custom_target(
+ ${TBSA_TARGET_GENERATE_DATABASE_POST}
+ COMMAND ${CMAKE_COMMAND} --build ${CMAKE_CURRENT_BINARY_DIR}/src/${TBSA_TARGET_GENERATE_DATABASE}-build/ -- clean
+)
+
+if(NOT DEFINED CMSIS_REPO_PATH)
+# Cloning CMSIS_5 repo
+ExternalProject_Add(
+ ${TBSA_TARGET_CMSIS}
+ PREFIX ${CMAKE_CURRENT_BINARY_DIR}
+ GIT_REPOSITORY ${TBSA_CMSIS_GIT_REPO_LINK}
+ GIT_TAG ${TBSA_CMSIS_GIT_REPO_TAG}
+ CONFIGURE_COMMAND ""
+ UPDATE_COMMAND ""
+ PATCH_COMMAND ""
+ BUILD_COMMAND ""
+ TEST_COMMAND ""
+ INSTALL_COMMAND ""
+)
+endif()
+
+# Linker scripts generation
+add_custom_target(
+ ${TBSA_TARGET_GENERATE_LINKER_SCRIPTS}
+ COMMENT "[TBSA] : Generating linker scripts for the target"
+ COMMAND ${PYTHON_EXECUTABLE} ${TBSA_LINKER_SCRIPT_GENERATOR}
+ ${TARGET_CONFIGURATION_FILE}
+ ${TBSA_LINKER_TEMPLATE}
+ ${TBSA_TEST_LINKER_TEMPLATE}
+ ${TBSA_LINKER_SCRIPT}
+ ${TBSA_TEST_S_LINKER_SCRIPT}
+ ${TBSA_TEST_NS_LINKER_SCRIPT}
+)
+
+#Combine test ELFs into binary file
+add_custom_target(
+ ${TBSA_TARGET_TEST_ELF_COMBINE}
+ COMMENT "[TBSA] : Combining TEST ELFs"
+ COMMAND ${PYTHON_EXECUTABLE} ${TBSA_TEST_ELF_COMBINE_GENERATOR}
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${TEST_COMBINED_BINARY_FILE_NAME}
+)
+
+
+# Generate VAL LIB
+include(${TBSA_ROOT_DIR}/val/val.cmake)
+# Generate PAL LIB
+include(${TBSA_ROOT_DIR}/platform/board/${TARGET}/target.cmake)
+
+# Final executable of the build process
+add_executable(${EXE_NAME} ${TBSA_ROOT_DIR}/tbsa_app/tbsa_main.c)
+
+target_link_libraries(${EXE_NAME} ${TBSA_TARGET_VAL_LIB} ${TBSA_TARGET_PAL_LIB})
+set_target_properties(${EXE_NAME} PROPERTIES SUFFIX ${TBSA_EXECUTABLE_SUFFIX})
+compiler_set_linker_options(TARGET_NAME ${EXE_NAME}
+ ENTRY_FUNCTION ${TBSA_MAIN_APP_ENTRY}
+ LINKER_SCRIPT ${TBSA_LINKER_SCRIPT}
+ MAP_FILE ${TBSA_MAP_FILE})
+target_include_directories(${EXE_NAME} PRIVATE ${TBSA_ROOT_DIR}/tbsa_app)
+
+# Dependency chain
+add_dependencies(${TBSA_TARGET_GENERATE_DATABASE_POST} ${TBSA_TARGET_GENERATE_DATABASE})
+if(NOT DEFINED CMSIS_REPO_PATH)
+ add_dependencies(${TBSA_TARGET_CMSIS} ${TBSA_TARGET_GENERATE_DATABASE_POST})
+ add_dependencies(${TBSA_TARGET_GENERATE_LINKER_SCRIPTS} ${TBSA_TARGET_CMSIS})
+else()
+ add_dependencies(${TBSA_TARGET_GENERATE_LINKER_SCRIPTS} ${TBSA_TARGET_GENERATE_DATABASE_POST})
+endif()
+add_dependencies(${TBSA_TARGET_PAL_LIB} ${TBSA_TARGET_GENERATE_LINKER_SCRIPTS})
+add_dependencies(${TBSA_TARGET_VAL_LIB} ${TBSA_TARGET_PAL_LIB})
+add_dependencies(${TBSA_TARGET_TEST_ELF_COMBINE} ${TBSA_TARGET_VAL_LIB})
+add_dependencies(${EXE_NAME} ${TBSA_TARGET_TEST_ELF_COMBINE})
+
+# Generate test ELFs for all the relevant components
+foreach(test_comp ${TEST_POOL_COMP_LIST})
+ # Set source directory
+ set(TEST_COMP_SOURCE_DIR ${TEST_POOL_SOURCE_DIR}/${test_comp})
+ # Get all the test folders from a given test component
+ _get_sub_dir_list(COMP_TEST_LIST ${TEST_COMP_SOURCE_DIR})
+ foreach(test ${COMP_TEST_LIST})
+ set(TEST_S_EXE_NAME "${test}.secure")
+ set(TEST_NS_EXE_NAME "${test}.non_secure")
+ set(TEST_S_SRC_C "${TEST_POOL_SOURCE_DIR}/${test_comp}/${test}/secure.c")
+ set(TEST_NS_SRC_C "${TEST_POOL_SOURCE_DIR}/${test_comp}/${test}/non_secure.c")
+ # Secure Test ELF
+ add_executable(${TEST_S_EXE_NAME} ${TEST_S_SRC_C})
+ target_link_libraries(${TEST_S_EXE_NAME} ${TBSA_TARGET_VAL_LIB} ${TBSA_TARGET_PAL_LIB})
+ set_target_properties(${TEST_S_EXE_NAME} PROPERTIES SUFFIX ${TBSA_EXECUTABLE_SUFFIX})
+ compiler_set_linker_options(TARGET_NAME ${TEST_S_EXE_NAME}
+ ENTRY_FUNCTION ${TBSA_TEST_APP_ENTRY}
+ LINKER_SCRIPT ${TBSA_TEST_S_LINKER_SCRIPT}
+ MAP_FILE ${CMAKE_CURRENT_BINARY_DIR}/${test}.secure.map)
+ add_dependencies(${EXE_NAME} ${TEST_S_EXE_NAME})
+ add_dependencies(${TBSA_TARGET_TEST_ELF_COMBINE} ${TEST_S_EXE_NAME})
+ # Non secure Test ELF
+ add_executable(${TEST_NS_EXE_NAME} ${TEST_NS_SRC_C})
+ target_link_libraries(${TEST_NS_EXE_NAME} ${TBSA_TARGET_VAL_LIB} ${TBSA_TARGET_PAL_LIB})
+ set_target_properties(${TEST_NS_EXE_NAME} PROPERTIES SUFFIX ${TBSA_EXECUTABLE_SUFFIX})
+ compiler_set_linker_options(TARGET_NAME ${TEST_NS_EXE_NAME}
+ ENTRY_FUNCTION ${TBSA_TEST_APP_ENTRY}
+ LINKER_SCRIPT ${TBSA_TEST_NS_LINKER_SCRIPT}
+ MAP_FILE ${CMAKE_CURRENT_BINARY_DIR}/${test}.non_secure.map)
+ add_dependencies(${EXE_NAME} ${TEST_NS_EXE_NAME})
+ add_dependencies(${TBSA_TARGET_TEST_ELF_COMBINE} ${TEST_NS_EXE_NAME})
+ endforeach()
+endforeach()
+
+# Include the files for make clean
+foreach(clean_item ${TBSA_CLEAN_LIST})
+ set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${clean_item})
+endforeach()
diff --git a/tbsa-v8m/Makefile b/tbsa-v8m/Makefile
deleted file mode 100644
index 85b32ec8..00000000
--- a/tbsa-v8m/Makefile
+++ /dev/null
@@ -1,127 +0,0 @@
-#/** @file
-# * Copyright (c) 2018, 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
-PREFIX:=arm-none-eabi-
-CC:=$(PREFIX)gcc
-CXX:=$(PREFIX)g++
-OBJCOPY:=$(PREFIX)objcopy
-OBJDUMP:=$(PREFIX)objdump
-AS:=$(PREFIX)as
-
-# Root folder
-ROOT_DIR:=.
-
-# Test specific macros
-OUT_DIR :=./out/$(TARGET)
-VLIB :=tbsa_val.a
-PLIB :=tbsa_pal.a
-CLEAN_DIR:= $(dir $(wildcard $(ROOT_DIR)/platform/board/*/))
-CLEAN_DIR:= $(filter-out ./, $(CLEAN_DIR))
-
-SUITE :=
-
-.PHONY: all clean
-
-all: check_target check_arch clean gen_database gen_linker setup_cmsis build
-
-check_target:
-ifeq ($(TARGET),)
- @echo "TARGET not specified"
- @exit 1
-endif
- @if [ ! -d "./platform/board/$(TARGET)/" ]; then { echo "Target Not Found!!!"; exit 1; } fi
-
-check_arch:
-ifeq ($(ARCH),)
-ARCH := main
-endif
-
-VALINCDIR :=val/include/
-CFLAGS :=-march=armv8-m.$(ARCH) -mcmse -mthumb -Wall -Werror -O0 -fdata-sections -ffunction-sections -I$(VALINCDIR)
-ASFLAGS :=-march=armv8-m.$(ARCH) -mthumb
-LDFLAGS :=\
- -Xlinker --fatal-warnings \
- -Xlinker --gc-sections \
- -z max-page-size=0x400 \
- -Xlinker -Map=tbsa.map
-
-SYSLIBS :=$(OUT_DIR)/$(VLIB) $(OUT_DIR)/$(PLIB) -lgcc -lc -lnosys
-
-gen_database:
- @echo ""
- @echo "Reading target configuration file ..."
- mkdir -p platform/board/$(TARGET)/include
- ./tools/tgt_cfg_parser/targetConfigGen.pl ./platform/board/$(TARGET)/tbsa_tgt.cfg platform/board/$(TARGET)/include/pal_database
- gcc -m32 targetConfigGen.c -w -o targetConfigGen -I$(VALINCDIR)
- ./targetConfigGen
- rm -f ./targetConfigGen
- rm -f ./targetConfigGen.c
-
-gen_linker:
- @echo ""
- @echo "Generating target specific linker scripts ..."
- cd tools/gen_linker_scripts/ && python gen_linker_scripts.py $(TARGET)
- @echo ""
-
-setup_cmsis:
- @if [ ! -d "./platform/CMSIS_5" ]; then\
- cd platform && git clone https://github.com/ARM-software/CMSIS_5.git && cd -;\
- cd platform/CMSIS_5 && git checkout 49ac527aa7406cecbba46d4d3bdbc7f60c6c6d42;\
- else echo "CMSIS already cloned"; echo "";\
- fi
-
-build: output pal_lib $(VLIB) tbsa.bin
-
-tbsa_val_src :=$(wildcard val/src/*.c)
-tbsa_val_src_s :=$(wildcard val/src/asm/val_secure_$(ARCH).s)
-tbsa_val_src_s +=$(wildcard val/src/asm/val_pe_support.s)
-
-tbsa_val_obj :=$(tbsa_val_src:.c=.o)
-tbsa_val_obj +=$(tbsa_val_src_s:.s=.o)
-
-output:
- mkdir -p $(OUT_DIR)
-
-pal_lib:
- cd platform/board/$(TARGET) && make ODIR=$(OUT_DIR) LIBNAME=$(PLIB) ENV=$(ENV) ARCH=$(ARCH)
-
-$(VLIB): $(tbsa_val_obj)
- $(AR) -rc $(OUT_DIR)/$@ $^
- find $(ROOT_DIR) -iname '*.o' -delete
-
-clean:
- rm -rf $(OUT_DIR)
- find $(ROOT_DIR) -iname '*.o' -delete
- cd test_pool && make clean
- echo $(CLEAN_DIR)
- $(foreach d, $(CLEAN_DIR), rm -rf $dinclude/;)
- $(foreach d, $(CLEAN_DIR), rm -rf $dlinker/;)
-
-tbsa.bin:tbsa.elf
- $(OBJCOPY) $< -O binary $@
- mv tbsa.asm $(OUT_DIR)
- mv tbsa.bin $(OUT_DIR)
- mv tbsa.elf $(OUT_DIR)
- mv tbsa.hex $(OUT_DIR)
- mv tbsa.map $(OUT_DIR)
- cd test_pool && make VLIB=$(OUT_DIR)/$(VLIB) PLIB=$(OUT_DIR)/$(PLIB) ARCH=$(ARCH)
-
-tbsa.elf:tbsa_app/tbsa_main.c
- $(CC) $(CFLAGS) -Tplatform/board/$(TARGET)/linker/tbsa.linker $(LDFLAGS) -o $@ tbsa_app/tbsa_main.c $(SYSLIBS)
- $(OBJDUMP) -d $@ > tbsa.asm
- hexdump -v -e ' 1/4 "%08X" "\n"' tbsa.elf > tbsa.hex
diff --git a/tbsa-v8m/README.md b/tbsa-v8m/README.md
index e0af77b8..688f50e6 100755
--- a/tbsa-v8m/README.md
+++ b/tbsa-v8m/README.md
@@ -21,7 +21,7 @@ The tests are available as open source. The tests and the corresponding abstract
## Release details
- - Release Version - 0.7
+ - Release Version - 0.9
- Code Quality: Beta
The suite is in development. This indicates that the suite contains tests which have not been validated on any platform. Please use this opportunity to suggest enhancements and point out errors.
@@ -61,10 +61,10 @@ See User guide document to get details on the steps involved in Porting the test
Before starting the test suite build, ensure that the following requirements are met:
-- Host Operating System : Ubuntu 16.04.4
-- Scripting tools : Perl 5.22.1
-- Other open-source tools : GCC 6.3.1
-
+- Host Operating System : Ubuntu 16.04.4, Windows 10
+- Scripting tools : Python3 3
+- Other open-source tools : GNUARM 6.3.1, GCC 5.4.0 32-Bit (Linux Host), mingw 6.3.0 32-Bit (Windows Host)
+ CMake 3.10
## Download source
@@ -81,29 +81,45 @@ Refer to the [User Guide](docs/Arm_TBSA-v8M_Arch_Test_Validation_Methodology_and
## Build steps
To build TBSA-v8M test suite for a given platform, execute the following commands:
- 1. cd tbsa-v8m
- 2. make TARGET= ARCH=
- Example: make TARGET=fvp ARCH=main
-
-To build only certain test for a given platform, execute the following commands:
- 1. cd tbsa-v8m
- 2. make TARGET= ARCH= SUITE=
- Example: make TARGET=fvp ARCH=main SUITE=boot,crypto,mem
-
-To build for CMSIS environment, execute the following commands:
- 1. cd tbsa-v8m
- 2. make TARGET= ARCH= SUITE= ENV=
- Example: make TARGET=fvp ARCH=main SUITE=boot,crypto,mem ENV=cmsis
- Note: Default environment is baremetal
-
-
where is the same as the name of the target specific directory created in the platform/board directory.
-
+ cd psa-arch-tests/tbsa-v8m
+ mkdir cmake_build
+ cd cmake_build
+ cmake ../ -G -DTARGET= -DCOMPILER= -DSUITE= -DCMSIS_REPO_PATH= -DCMAKE_VERBOSE_MAKEFILE=OFF -DCMSIS_DRIVER=OFF
+ where:
+ : "Unix Makefiles" - to generate Makefiles for Linux and Cygwin
+ "MinGW Makefiles" - to generate Makefiles for cmd.exe on Windows
+ : target to build, as created in the platform/board directory
+ : GNUARM
+ Defaults to GNUARM if not specified
+ : ALL - builds all test_pool components
+ "::..:" - for selective component build or
+ \:\:..\: - for selective component build or
+ Defaults to ALL if not specified
+ : Absolute CMSIS repo path
+ If not specified CMake clones the CMSIS for itself
+ : ON - To get detailed build log on console
+ OFF - To get minimalistic log on console
+ Defaults to OFF
+ : ON - Build takes CMSIS drivers as specified in target specific target.cmake
+ OFF - Build takes non CMSIS drivers as specified in target specific target.cmake
+ Defaults to OFF
+ To build project
+ cmake --build .
+ To clean
+ cmake --build . -- clean
+
+~~~
+Note:
+ It is recommended to build each different build configurations in separate
+ directories.
+~~~
### Build output
-TBSA build generates two output binaries:
+TBSA build outputs are available under build directory: cmake_build - as created.
- - tbsa.elf
+ - tbsa.elf, tbsa.map
- tbsa_test_combined.bin
+ - test specific executables and Map files
## Test Suite Execution
The following steps describe the execution flow prior to the start of test execution.
@@ -126,4 +142,4 @@ Arm TBSA-v8M Architecture test suite is distributed under Apache v2.0 License.
--------------
-*Copyright (c) 2018, Arm Limited and Contributors. All rights reserved.*
+*Copyright (c) 2018-2019, Arm Limited and Contributors. All rights reserved.*
diff --git a/tbsa-v8m/cmake/common/CMakeSettings.cmake b/tbsa-v8m/cmake/common/CMakeSettings.cmake
new file mode 100644
index 00000000..eb812a9f
--- /dev/null
+++ b/tbsa-v8m/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.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/tbsa-v8m/cmake/common/Utils.cmake b/tbsa-v8m/cmake/common/Utils.cmake
new file mode 100644
index 00000000..ad082ebd
--- /dev/null
+++ b/tbsa-v8m/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 "[TBSA] : ${_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/tbsa-v8m/cmake/compiler/GNUARM.cmake b/tbsa-v8m/cmake/compiler/GNUARM.cmake
new file mode 100644
index 00000000..b6a57f59
--- /dev/null
+++ b/tbsa-v8m/cmake/compiler/GNUARM.cmake
@@ -0,0 +1,84 @@
+#/** @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 "[TBSA] : 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 "[TBSA] : ${_LNG} compiler used '${CMAKE_${_LNG}_COMPILER}'")
+endforeach()
+
+set(CMAKE_C_FLAGS "-march=armv8-m.${ARCH} -mcmse -mthumb -Wall -Werror -O0 -nostartfiles -fdata-sections -ffunction-sections")
+set(CMAKE_ASM_FLAGS "-march=armv8-m.${ARCH} -mthumb")
+set(CMAKE_EXE_LINKER_FLAGS "-Xlinker --fatal-warnings -Xlinker --gc-sections -z max-page-size=0x400 -lgcc -lc -lnosys")
+
+set(TBSA_LINKER_TEMPLATE ${CMAKE_CURRENT_SOURCE_DIR}/tools/gen_linker_scripts/tbsa.linker.template)
+set(TBSA_TEST_LINKER_TEMPLATE ${CMAKE_CURRENT_SOURCE_DIR}/tools/gen_linker_scripts/test.linker.template)
+set(TBSA_LINKER_SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/tbsa.linker)
+set(TBSA_TEST_S_LINKER_SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/test_s.linker)
+set(TBSA_TEST_NS_LINKER_SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/test_ns.linker)
+
+function(compiler_set_linker_options)
+ set(options)
+ set(oneValueArgs TARGET_NAME ENTRY_FUNCTION LINKER_SCRIPT MAP_FILE) #Single option arguments.
+ set(multiValueArgs) #List arguments
+ cmake_parse_arguments(_MY_PARAMS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+
+ # Check passed arguments
+ if(NOT _MY_PARAMS_TARGET_NAME)
+ message(FATAL_ERROR "[TBSA] : compiler_set_linker_options: mandatory parameter 'TARGET_NAME' is missing!")
+ endif()
+ if(NOT _MY_PARAMS_ENTRY_FUNCTION)
+ message(FATAL_ERROR "[TBSA] : compiler_set_linker_options: mandatory parameter 'ENTRY_FUNCTION' is missing!")
+ endif()
+ if(NOT _MY_PARAMS_LINKER_SCRIPT)
+ message(FATAL_ERROR "[TBSA] : compiler_set_linker_options: mandatory parameter 'LINKER_SCRIPT' is missing!")
+ endif()
+ if(NOT _MY_PARAMS_MAP_FILE)
+ message(FATAL_ERROR "[TBSA] : compiler_set_linker_options: mandatory parameter 'MAP_FILE' is missing!")
+ endif()
+
+ set_property(TARGET ${_MY_PARAMS_TARGET_NAME} APPEND_STRING PROPERTY LINK_FLAGS "--entry=${_MY_PARAMS_ENTRY_FUNCTION} -T${_MY_PARAMS_LINKER_SCRIPT} -Xlinker -Map=${_MY_PARAMS_MAP_FILE}")
+endfunction(compiler_set_linker_options)
diff --git a/tbsa-v8m/docs/Arm_TBSA-v8M_Arch_Test_Porting_Guide.md b/tbsa-v8m/docs/Arm_TBSA-v8M_Arch_Test_Porting_Guide.md
index e63e86ba..1dfa30ea 100644
--- a/tbsa-v8m/docs/Arm_TBSA-v8M_Arch_Test_Porting_Guide.md
+++ b/tbsa-v8m/docs/Arm_TBSA-v8M_Arch_Test_Porting_Guide.md
@@ -100,27 +100,30 @@ The NVIC functions are CMSIS compliant. The CMSIS repository on Github is cloned
| 35 | void pal_system_cold_reset(void); | Generates system cold reset | void
|
| 36 | int pal_is_cold_reset(void); | Reports whether the last reset is cold reset | void
|
| 37 | int pal_is_warm_reset(void); | Reports whether the last reset is warm reset | void
|
-| 38 | int pal_dpm_set_access_ns_only(uint32_t index, bool_t access_ns); | This function will set the debug permission based on the input arg | index : DPM index
access_ns : TRUE - allow debug access only for non-secure address
FALSE - allow debug access to both secure and non-secure addresses
|
-| 39 | int pal_mpc_configure_mem_region(addr_t mpc, addr_t start_addr,addr_t end_addr, uint32_t attr); | Allow a memory region to be configured as per attribute specified | mpc : MPC address
start_addr : Start of memory address to be configured by MPC
end_addr : End of memory address to be configured by MPC
attr : 0 - Secure, 1 - Non-secure, 2 - NSC, 3 - Configurable
|
-| 40 | int pal_fuse_read(addr_t addr, uint32_t *data, uint32_t size); | Read the value of given fuse address | addr : Address of the fuse
data : Buffer to store the data
size : Number of words to be read
|
-| 41 | int pal_fuse_write(addr_t addr, uint32_t *data, uint32_t size); | Write the value in given fuse address | addr : Address of the fuse
data : Data to be written
size : Number of words to write
|
-| 42 | int pal_fuse_count_zeros_in_rotpk(uint32_t *zero_cnt); | Count the number of Zeros in ROTPK | zero_cnt : Buffer to store the zero count
|
-| 43 | void pal_fuse_count_zeros(uint32_t value, uint32_t *zero_cnt); | Count the number of Zeros in the given value | value : Number of zeros to be determined
zero_cnt : Buffer to store the zero count
|
-| 44 | int pal_fuse_get_lcs(uint32_t *pLcs); | Reads the LCS register | pLcs : Buffer to store the LCS value
|
-| 45 | int pal_crypto_validate_certificate(addr_t certificate_base_addr, addr_t public_key_addr, uint32_t certificate_size, uint32_t public_key_size); | Validates the certificate using public key | certificate_base_addr : Base address of the certificate where it is stored in memory
public_key_addr : Base address of the public key where it is stored in memory
certificate_size : Certificate memory size
public_key_size : Public key memory size
|
-| 46 | int pal_crypto_get_uniqueID_from_certificate(addr_t certificate_base_addr, addr_t public_key_addr, uint32_t certificate_size, uint32_t public_key_size);| Get unique ID from valid certificate using public key | certificate_base_addr : Base address of the certificate where it is stored in memory
public_key_addr : Base address of the public key where it is stored in memory
certificate_size : Certificate memory size
public_key_size : Public key memory size
|
-| 47 | int pal_rtc_init(addr_t addr); | Initialize RTC | addr : Address of peripheral
|
-| 48 | int pal_is_rtc_trustable(addr_t addr); | RTC validity mechanism to indicate RTC is Trusted/Non-trusted | addr : Address of peripheral
|
-| 49 | int pal_is_rtc_synced_to_server(addr_t addr); | RTC validity mechanism to indicate RTC is synced with server or not | addr : Address of peripheral
|
-| 50 | int pal_crypto_get_dpm_from_key(addr_t public_key_addr, uint32_t public_key_size, uint32_t *dpm_field); | Get DPM field from public key | public_key_addr : Base address of the public key where it is stored in memory
public_key_size : Public key memory size
dpm_field : Buffer to store DPM number
|
-| 51 | int pal_crypto_get_dpm_from_certificate(addr_t certificate_base_addr, uint32_t certificate_size, uint32_t *dpm_field); | Get DPM field from certificate | certificate_base_addr : Base address of the certificate where it is stored in memory
certificate_size : certificate memory size
dpm_field : Buffer to store DPM number
|
-| 52 | int pal_firmware_version_update(uint32_t instance, uint32_t firmware_version_type, uint32_t fw_ver_cnt); | Update the firmware version | instance : Instance of the firmware
firmware_version_type : 0 - Trusted, 1 - Non-trusted
fw_ver_cnt : Version of the firmware
|
-| 53 | int pal_firmware_version_read(uint32_t instance, uint32_t firmware_version_type); | Read the firmware version | instance : Instance wf the firmware
firmware_version_type : 0 - Trusted, 1 - Non-trusted
|
-| 54 | int pal_crypto_revoke_key(uint32_t index, addr_t addr, uint32_t size); | Revoke the given key | index : Index of the key
addr : Address of the key
size : Size of the key
|
+| 38 | int pal_is_wdog_reset(void); | Reports whether the last reset is watch dog reset | void
|
+| 39 | int pal_dpm_set_access_ns_only(uint32_t index, bool_t access_ns); | This function will set the debug permission based on the input arg | index : DPM index
access_ns : TRUE - allow debug access only for non-secure address
FALSE - allow debug access to both secure and non-secure addresses
|
+| 40 | int pal_mpc_configure_mem_region(addr_t mpc, addr_t start_addr,addr_t end_addr, uint32_t attr); | Allow a memory region to be configured as per attribute specified | mpc : MPC address
start_addr : Start of memory address to be configured by MPC
end_addr : End of memory address to be configured by MPC
attr : 0 - Secure, 1 - Non-secure, 2 - NSC, 3 - Configurable
|
+| 41 | int pal_fuse_read(addr_t addr, uint32_t *data, uint32_t size); | Read the value of given fuse address | addr : Address of the fuse
data : Buffer to store the data
size : Number of words to be read
|
+| 42 | int pal_fuse_write(addr_t addr, uint32_t *data, uint32_t size); | Write the value in given fuse address | addr : Address of the fuse
data : Data to be written
size : Number of words to write
|
+| 43 | int pal_fuse_count_zeros_in_rotpk(uint32_t *zero_cnt); | Count the number of Zeros in ROTPK | zero_cnt : Buffer to store the zero count
|
+| 44 | void pal_fuse_count_zeros(uint32_t value, uint32_t *zero_cnt); | Count the number of Zeros in the given value | value : Number of zeros to be determined
zero_cnt : Buffer to store the zero count
|
+| 45 | int pal_fuse_get_lcs(uint32_t *pLcs); | Reads the LCS register | pLcs : Buffer to store the LCS value
|
+| 46 | int pal_crypto_validate_certificate(addr_t certificate_base_addr, addr_t public_key_addr, uint32_t certificate_size, uint32_t public_key_size); | Validates the certificate using public key | certificate_base_addr : Base address of the certificate where it is stored in memory
public_key_addr : Base address of the public key where it is stored in memory
certificate_size : Certificate memory size
public_key_size : Public key memory size
|
+| 47 | int pal_crypto_get_uniqueID_from_certificate(addr_t certificate_base_addr, addr_t public_key_addr, uint32_t certificate_size, uint32_t public_key_size);| Get unique ID from valid certificate using public key | certificate_base_addr : Base address of the certificate where it is stored in memory
public_key_addr : Base address of the public key where it is stored in memory
certificate_size : Certificate memory size
public_key_size : Public key memory size
|
+| 48 | int pal_rtc_init(addr_t addr); | Initialize RTC | addr : Address of peripheral
|
+| 49 | int pal_is_rtc_trustable(addr_t addr); | RTC validity mechanism to indicate RTC is Trusted/Non-trusted | addr : Address of peripheral
|
+| 50 | int pal_is_rtc_synced_to_server(addr_t addr); | RTC validity mechanism to indicate RTC is synced with server or not | addr : Address of peripheral
|
+| 51 | int pal_crypto_get_dpm_from_key(addr_t public_key_addr, uint32_t public_key_size, uint32_t *dpm_field); | Get DPM field from public key | public_key_addr : Base address of the public key where it is stored in memory
public_key_size : Public key memory size
dpm_field : Buffer to store DPM number
|
+| 52 | int pal_crypto_get_dpm_from_certificate(addr_t certificate_base_addr, uint32_t certificate_size, uint32_t *dpm_field); | Get DPM field from certificate | certificate_base_addr : Base address of the certificate where it is stored in memory
certificate_size : certificate memory size
dpm_field : Buffer to store DPM number
|
+| 53 | int pal_firmware_version_update(uint32_t instance, uint32_t firmware_version_type, uint32_t fw_ver_cnt); | Update the firmware version | instance : Instance of the firmware
firmware_version_type : 0 - Trusted, 1 - Non-trusted
fw_ver_cnt : Version of the firmware
|
+| 54 | int pal_firmware_version_read(uint32_t instance, uint32_t firmware_version_type); | Read the firmware version | instance : Instance wf the firmware
firmware_version_type : 0 - Trusted, 1 - Non-trusted
|
+| 55 | int pal_crypto_revoke_key(uint32_t index, addr_t addr, uint32_t size); | Revoke the given key | index : Index of the key
addr : Address of the key
size : Size of the key
|
+| 56 | int pal_dpm_set_state(uint32_t index, uint32_t dpm_status, uint32_t unlock_token, void *token); | This function will set the DPM state | index : DPM index
dpm_status : DPM status as per TBSA spec, can returned as logical OR of in relevant cases
DPM_LOCK_IMPLEMENTED/DPM_LOCK_VALUE
DPM_EN_IMPLEMENTED/DPM_EN_VALUE
unlock_token : unlock token in case of unlocking the DPM state
token : Pointer to passowrd or certificate or challenge response
|
+| 57 | int pal_dpm_get_state(uint32_t index, uint32_t *dpm_status); | This function will get the DPM state | index : DPM index
dpm_status : DPM status as per TBSA spec, defined in dpm_status_t
|
## License
Arm TBSA-v8M Architecture test suite is distributed under Apache v2.0 License.
--------------
-*Copyright (c) 2018, Arm Limited and Contributors. All rights reserved.*
+*Copyright (c) 2018-2019, Arm Limited and Contributors. All rights reserved.*
diff --git a/tbsa-v8m/docs/Arm_TBSA-v8M_Arch_Test_Scenario_Document.pdf b/tbsa-v8m/docs/Arm_TBSA-v8M_Arch_Test_Scenario_Document.pdf
index e26bd9f2..c6828e62 100755
Binary files a/tbsa-v8m/docs/Arm_TBSA-v8M_Arch_Test_Scenario_Document.pdf and b/tbsa-v8m/docs/Arm_TBSA-v8M_Arch_Test_Scenario_Document.pdf differ
diff --git a/tbsa-v8m/docs/Arm_TBSA-v8M_Arch_Test_Validation_Methodology_and_User_Guide.pdf b/tbsa-v8m/docs/Arm_TBSA-v8M_Arch_Test_Validation_Methodology_and_User_Guide.pdf
deleted file mode 100644
index c05f4e48..00000000
Binary files a/tbsa-v8m/docs/Arm_TBSA-v8M_Arch_Test_Validation_Methodology_and_User_Guide.pdf and /dev/null differ
diff --git a/tbsa-v8m/docs/Arm_TBSAv8-M_Validation_Methodology_and_User_Guide.pdf b/tbsa-v8m/docs/Arm_TBSAv8-M_Validation_Methodology_and_User_Guide.pdf
new file mode 100755
index 00000000..102a3e53
Binary files /dev/null and b/tbsa-v8m/docs/Arm_TBSAv8-M_Validation_Methodology_and_User_Guide.pdf differ
diff --git a/tbsa-v8m/platform/board/fvp/Makefile b/tbsa-v8m/platform/board/fvp/Makefile
deleted file mode 100644
index 222ed7d4..00000000
--- a/tbsa-v8m/platform/board/fvp/Makefile
+++ /dev/null
@@ -1,82 +0,0 @@
-#/** @file
-# * Copyright (c) 2018, 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
-PREFIX:=arm-none-eabi-
-CC:=$(PREFIX)gcc
-CXX:=$(PREFIX)g++
-OBJCOPY:=$(PREFIX)objcopy
-OBJDUMP:=$(PREFIX)objdump
-AS:=$(PREFIX)as
-
-# Root folder
-ROOT_DIR:=.
-
-PALTARDIR :=../../../platform/board/${TARGET}/include/
-FRAMEINCDIR :=../../../platform/include/
-DPMINCDIR :=../../../platform/peripherals/dpm/fvp_basic/include/
-NVRAMINCDIR :=../../../platform/peripherals/nvram/nv_sim/include/
-TIMERINCDIR :=../../../platform/peripherals/timer/arm/include/
-ifeq ($(ENV), cmsis)
-UARTINCDIR :=../../../platform/peripherals/uart/cmsis/include/
-else
-UARTINCDIR :=../../../platform/peripherals/uart/arm/include/
-endif
-WDTIMERINCDIR :=../../../platform/peripherals/watchdog/arm/include/
-CMSISINCDIR :=../../../platform/CMSIS_5/CMSIS/Core/Include/
-CMSISDRVINCDIR:=../../../platform/CMSIS_5/CMSIS/Driver/Include/
-DEVINCDIR :=../../../platform/CMSIS_5/Device/ARM/ARMv8MML/Include/
-CFLAGS :=-march=armv8-m.$(ARCH) -mcmse -mthumb -Wall -Werror -O0 -fdata-sections -ffunction-sections \
- -I${PALTARDIR} \
- -I${FRAMEINCDIR} \
- -I${DPMINCDIR} \
- -I${NVRAMINCDIR} \
- -I${TIMERINCDIR} \
- -I${UARTINCDIR} \
- -I${WDTIMERINCDIR} \
- -I${CMSISINCDIR} \
- -I${CMSISDRVINCDIR} \
- -I${DEVINCDIR}
-
-.PHONY: all
-
-all: build
-
-build: $(LIBNAME)
-ifeq ($(ENV), cmsis)
-tbsa_pal_src :=$(wildcard ../../../platform/board/${TARGET}/src/pal_cmsis_intf.c)
-else
-tbsa_pal_src :=$(wildcard ../../../platform/board/${TARGET}/src/pal_baremetal_intf.c)
-endif
-tbsa_pal_src +=$(wildcard ../../../platform/peripherals/dpm/fvp_basic/src/*.c)
-tbsa_pal_src +=$(wildcard ../../../platform/peripherals/nvram/nv_sim/src/*.c)
-tbsa_pal_src +=$(wildcard ../../../platform/peripherals/timer/arm/src/*.c)
-ifeq ($(ENV), cmsis)
-tbsa_pal_src +=$(wildcard ../../../platform/peripherals/uart/cmsis/src/*.c)
-else
-tbsa_pal_src +=$(wildcard ../../../platform/peripherals/uart/arm/src/*.c)
-endif
-tbsa_pal_src +=$(wildcard ../../../platform/peripherals/watchdog/arm/src/*.c)
-tbsa_pal_src_s:=$(wildcard ../../../platform/board/${TARGET}/src/*.s)
-
-tbsa_pal_obj :=$(tbsa_pal_src:.c=.o)
-tbsa_pal_obj +=$(tbsa_pal_src_s:.s=.o)
-
-$(LIBNAME): $(tbsa_pal_obj)
- $(AR) -rc $@ $^
- mv $@ ../../../$(ODIR)/.
- find $(ROOT_DIR) -iname '*.o' -delete
diff --git a/tbsa-v8m/platform/board/fvp/src/pal_baremetal_intf.c b/tbsa-v8m/platform/board/fvp/src/pal_baremetal_intf.c
index 283629ed..d94c1ed1 100644
--- a/tbsa-v8m/platform/board/fvp/src/pal_baremetal_intf.c
+++ b/tbsa-v8m/platform/board/fvp/src/pal_baremetal_intf.c
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -242,6 +242,11 @@ int pal_is_warm_reset(void)
return x;
}
+int pal_is_wdog_reset(void)
+{
+ return 0;
+}
+
int pal_fuse_get_lcs(uint32_t *pLcs)
{
return PAL_STATUS_ERROR;
@@ -296,3 +301,13 @@ int pal_crypto_revoke_key(uint32_t index, addr_t addr, uint32_t size)
{
return PAL_STATUS_ERROR;
}
+
+int pal_dpm_set_state(uint32_t index, uint32_t dpm_status, uint32_t unlock_token, void *token)
+{
+ return PAL_STATUS_ERROR;
+}
+
+int pal_dpm_get_state(uint32_t index, uint32_t *dpm_status)
+{
+ return PAL_STATUS_ERROR;
+}
diff --git a/tbsa-v8m/platform/board/fvp/src/pal_cmsis_intf.c b/tbsa-v8m/platform/board/fvp/src/pal_cmsis_intf.c
index 136a9499..27f5f0bc 100644
--- a/tbsa-v8m/platform/board/fvp/src/pal_cmsis_intf.c
+++ b/tbsa-v8m/platform/board/fvp/src/pal_cmsis_intf.c
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -293,6 +293,11 @@ int pal_is_warm_reset(void)
return x;
}
+int pal_is_wdog_reset(void)
+{
+ return 0;
+}
+
int pal_fuse_get_lcs(uint32_t *pLcs)
{
return PAL_STATUS_ERROR;
@@ -347,3 +352,13 @@ int pal_crypto_revoke_key(uint32_t index, addr_t addr, uint32_t size)
{
return PAL_STATUS_ERROR;
}
+
+int pal_dpm_set_state(uint32_t index, uint32_t dpm_status, uint32_t unlock_token, void *token)
+{
+ return PAL_STATUS_ERROR;
+}
+
+int pal_dpm_get_state(uint32_t index, uint32_t *dpm_status)
+{
+ return PAL_STATUS_ERROR;
+}
\ No newline at end of file
diff --git a/tbsa-v8m/platform/board/fvp/target.cmake b/tbsa-v8m/platform/board/fvp/target.cmake
new file mode 100644
index 00000000..1a04630e
--- /dev/null
+++ b/tbsa-v8m/platform/board/fvp/target.cmake
@@ -0,0 +1,83 @@
+#/** @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.
+#**/
+
+# Listing all the sources required for given target
+FILE(GLOB PAL_CRYPTO_SRC_C ${TBSA_ROOT_DIR}/platform/peripherals/crypto/cc312/src/*.c)
+FILE(GLOB PAL_DPM_SRC_C ${TBSA_ROOT_DIR}/platform/peripherals/dpm/fvp_basic/src/*.c)
+FILE(GLOB PAL_I2C_SRC_C ${TBSA_ROOT_DIR}/platform/peripherals/i2c/c6510/src/*.c)
+FILE(GLOB PAL_MPC_SRC_C ${TBSA_ROOT_DIR}/platform/peripherals/mpc/sie200/src/*.c)
+FILE(GLOB PAL_NVRAM_SRC_C ${TBSA_ROOT_DIR}/platform/peripherals/nvram/nv_sim/src/*.c)
+FILE(GLOB PAL_SPI_SRC_C ${TBSA_ROOT_DIR}/platform/peripherals/spi/c6524/src/*.c)
+FILE(GLOB PAL_TIMER_SRC_C ${TBSA_ROOT_DIR}/platform/peripherals/timer/arm/src/*.c)
+FILE(GLOB PAL_WDOG_SRC_C ${TBSA_ROOT_DIR}/platform/peripherals/watchdog/arm/src/*.c)
+
+list(APPEND PAL_SRC_C
+ ${PAL_CRYPTO_SRC_C}
+ ${PAL_DPM_SRC_C}
+ ${PAL_I2C_SRC_C}
+ ${PAL_MPC_SRC_C}
+ ${PAL_NVRAM_SRC_C}
+ ${PAL_SPI_SRC_C}
+ ${PAL_TIMER_SRC_C}
+ ${PAL_WDOG_SRC_C}
+ )
+
+if(${CMSIS_DRIVER})
+FILE(GLOB PAL_UART_SRC_C ${TBSA_ROOT_DIR}/platform/peripherals/uart/cmsis/src/*.c)
+else()
+FILE(GLOB PAL_UART_SRC_C ${TBSA_ROOT_DIR}/platform/peripherals/uart/arm/src/*.c)
+endif()
+
+if(${CMSIS_DRIVER})
+list(APPEND PAL_SRC_C
+ ${PAL_UART_SRC_C}
+ "${TBSA_ROOT_DIR}/platform/board/${TARGET}/src/pal_cmsis_intf.c"
+ )
+else()
+list(APPEND PAL_SRC_C
+ ${PAL_UART_SRC_C}
+ "${TBSA_ROOT_DIR}/platform/board/${TARGET}/src/pal_baremetal_intf.c"
+ )
+endif()
+
+# Create Platform static library
+add_library(${TBSA_TARGET_PAL_LIB} STATIC ${PAL_SRC_C})
+
+target_include_directories(${TBSA_TARGET_PAL_LIB} PRIVATE
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${TBSA_ROOT_DIR}/platform/include
+ ${TBSA_ROOT_DIR}/platform/peripherals/crypto/cc312/include
+ ${TBSA_ROOT_DIR}/platform/peripherals/dpm/fvp_basic/include
+ ${TBSA_ROOT_DIR}/platform/peripherals/i2c/c6510/include
+ ${TBSA_ROOT_DIR}/platform/peripherals/mpc/sie200/include
+ ${TBSA_ROOT_DIR}/platform/peripherals/nvram/nv_sim/include
+ ${TBSA_ROOT_DIR}/platform/peripherals/spi/c6524/include
+ ${TBSA_ROOT_DIR}/platform/peripherals/timer/arm/include
+ ${TBSA_ROOT_DIR}/platform/peripherals/watchdog/arm/include
+ ${CMSIS_5_DIR}/CMSIS/Core/Include
+ ${CMSIS_5_DIR}/CMSIS/Driver/Include
+ ${CMSIS_5_DIR}/Device/ARM/ARMv8MML/Include
+)
+if(${CMSIS_DRIVER})
+target_include_directories(${TBSA_TARGET_PAL_LIB} PRIVATE
+ ${TBSA_ROOT_DIR}/platform/peripherals/uart/cmsis/include
+)
+else()
+target_include_directories(${TBSA_TARGET_PAL_LIB} PRIVATE
+ ${TBSA_ROOT_DIR}/platform/peripherals/uart/arm/include
+)
+endif()
diff --git a/tbsa-v8m/tbsa_app/tbsa.h b/tbsa-v8m/tbsa_app/tbsa.h
index 30cd1669..b84a5689 100644
--- a/tbsa-v8m/tbsa_app/tbsa.h
+++ b/tbsa-v8m/tbsa_app/tbsa.h
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -22,7 +22,7 @@
#include "val_infra.h"
#define TBSA_ACS_MAJOR_VER 0
-#define TBSA_ACS_MINOR_VER 7
+#define TBSA_ACS_MINOR_VER 9
uint32_t __tbsa_text_start__;
uint32_t __tbsa_text_end__;
diff --git a/tbsa-v8m/test_pool/Makefile b/tbsa-v8m/test_pool/Makefile
deleted file mode 100644
index 5770c5d7..00000000
--- a/tbsa-v8m/test_pool/Makefile
+++ /dev/null
@@ -1,44 +0,0 @@
-#/** @file
-# * Copyright (c) 2018, 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.
-#**/
-
-.PHONY: all clean
-
-# Root folder
-ROOT_DIR:=.
-
-DIRECTORY := $(dir $(wildcard $(ROOT_DIR)/*/))
-DIRECTORY := $(filter-out ./, $(DIRECTORY))
-DIRECTORY := $(sort $(filter-out ./include/, $(DIRECTORY)))
-CLEAN_DIRECTORY :=$(DIRECTORY)
-
-comma := ,
-
-all: check build
- ./tbsa_elf_combine.pl $(ROOT_DIR)/
- mv ./tbsa_test_combined.bin ../out/$(TARGET)/.
- hexdump -v -e ' 1/4 "%08X" "\n"' ../out/$(TARGET)/tbsa_test_combined.bin > ../out/$(TARGET)/tbsa_test_combined.hex
-
-check:
-ifneq ($(SUITE), )
-DIRECTORY := $(subst $(comma), , $(SUITE))
-endif
-
-build:
- $(foreach d, $(DIRECTORY), cd $d && $(MAKE) TARGET=$(TARGET) ARCH=$(ARCH) && cd ..;)
-
-clean:
- $(foreach d, $(CLEAN_DIRECTORY), cd $d && $(MAKE) clean && cd ..;)
diff --git a/tbsa-v8m/test_pool/base/Makefile b/tbsa-v8m/test_pool/base/Makefile
deleted file mode 100644
index 7cfe1de7..00000000
--- a/tbsa-v8m/test_pool/base/Makefile
+++ /dev/null
@@ -1,77 +0,0 @@
-#/** @file
-# * Copyright (c) 2018, 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
-PREFIX:=arm-none-eabi-
-CC:=$(PREFIX)gcc
-CXX:=$(PREFIX)g++
-AS:=$(PREFIX)as
-OBJCOPY:=$(PREFIX)objcopy
-OBJDUMP:=$(PREFIX)objdump
-
-# Test specific macros
-OUT_DIR:=./out
-
-# Root folder
-ROOT_DIR:=.
-
-.PHONY: all clean
-
-VAL_LIB :=../../out/$(TARGET)/tbsa_val.a
-PAL_LIB :=../../out/$(TARGET)/tbsa_pal.a
-SYSLIBS :=$(VAL_LIB) $(PAL_LIB) -lgcc -lc -lnosys
-INCDIR := ../../val/include/
-CFLAGS :=-march=armv8-m.$(ARCH) -mthumb -Wall -Werror -O0 -I$(INCDIR)
-SBUILD :=-mcmse
-
-LDFLAGS :=\
- -Xlinker --fatal-warnings \
- -Xlinker --gc-sections \
- -z max-page-size=0x400
-
-SFLAGS :=\
- $(CFLAGS) \
- $(SBUILD) \
- -nostartfiles \
- -T../../platform/board/${TARGET}/linker/test_s.linker \
- $(LDFLAGS)
-
-NSFLAGS :=\
- $(CFLAGS) \
- -nostartfiles \
- -T../../platform/board/${TARGET}/linker/test_ns.linker \
- $(LDFLAGS)
-
-s_src :=secure.c
-ns_src :=non_secure.c
-
-DIR :=$(dir $(wildcard $(ROOT_DIR)/*/))
-DIR :=$(filter-out ./, $(DIR))
-
-all: build
-
-build:
- $(foreach d, $(DIR), mkdir -p $(d)$(OUT_DIR); \
- $(CC) $(SFLAGS) -Xlinker -Map=$(d)$(OUT_DIR)/$(s_src).map -o $(d)$(OUT_DIR)/$(s_src).elf $(d)$(s_src) $(SYSLIBS); \
- $(OBJCOPY) $(d)$(OUT_DIR)/$(s_src).elf -O binary $(d)$(OUT_DIR)/$(s_src).bin; \
- $(OBJDUMP) -d $(d)$(OUT_DIR)/$(s_src).elf > $(d)$(OUT_DIR)/$(s_src).asm; \
- $(CC) $(NSFLAGS) -Xlinker -Map=$(d)$(OUT_DIR)/$(ns_src).map -o $(d)$(OUT_DIR)/$(ns_src).elf $(d)$(ns_src) $(SYSLIBS); \
- $(OBJCOPY) $(d)$(OUT_DIR)/$(ns_src).elf -O binary $(d)$(OUT_DIR)/$(ns_src).bin; \
- $(OBJDUMP) -d $(d)$(OUT_DIR)/$(ns_src).elf > $(d)$(OUT_DIR)/$(ns_src).asm;)
-
-clean:
- $(foreach d, $(DIR), rm -rf $(d)$(OUT_DIR))
diff --git a/tbsa-v8m/test_pool/base/test_b001/non_secure.c b/tbsa-v8m/test_pool/base/test_b001/non_secure.c
index cea89dd5..a8b74193 100644
--- a/tbsa-v8m/test_pool/base/test_b001/non_secure.c
+++ b/tbsa-v8m/test_pool/base/test_b001/non_secure.c
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -19,7 +19,7 @@
/* Publish these functions to the external world as associated to this test ID */
TBSA_TEST_PUBLISH(CREATE_TEST_ID(TBSA_BASE_BASE, 1),
CREATE_TEST_TITLE("Check Trusted and Non-trusted world asset access"),
- CREATE_REF_TAG("R010/R020_TBSA_BASE-R010/R020/R030/R220_TBSA_INFRA-R040_TBSA_EIP"),
+ CREATE_REF_TAG("R010/R020_TBSA_BASE-R010/R020/R030/R170/R220_TBSA_INFRA-R040_TBSA_EIP"),
entry_hook,
test_payload,
exit_hook);
@@ -71,7 +71,7 @@ void test_payload(tbsa_val_api_t *val)
/* Perform read access on all address regions, and a write access only when the region is
marked as normal read-write */
- for (region_num = 0; region_num < memory_hdr->num; region_num++) {
+ for (region_num = 0; region_num < memory_hdr->num;) {
instance = 0;
do {
status = val->target_get_config(TARGET_CONFIG_CREATE_ID(GROUP_MEMORY, minor_id, instance),
@@ -95,7 +95,7 @@ void test_payload(tbsa_val_api_t *val)
/* Check the status updated by handler in case a securefault occurs */
if (IS_TEST_FAIL(val->get_status())) {
- val->print(PRINT_ERROR, "\n Securefault occured on reads at address 0x%x", (uint32_t)(memory_desc->start));
+ val->print(PRINT_ERROR, "\n\r\tSecurefault occured on reads at address 0x%x", (uint32_t)(memory_desc->start));
return;
}
if (memory_desc->mem_type == TYPE_NORMAL_READ_WRITE) {
@@ -103,7 +103,7 @@ void test_payload(tbsa_val_api_t *val)
/* Check the status updated by handler in case a securefault occurs */
if (IS_TEST_FAIL(val->get_status())) {
- val->print(PRINT_ERROR, "\n Securefault occured on writes at address 0x%x", (uint32_t)(memory_desc->start));
+ val->print(PRINT_ERROR, "\n\r\tSecurefault occured on writes at address 0x%x", (uint32_t)(memory_desc->start));
return;
}
}
@@ -111,20 +111,20 @@ void test_payload(tbsa_val_api_t *val)
instance++;
} while (instance < GET_NUM_INSTANCE(memory_desc));
minor_id++;
- if (status == TBSA_STATUS_NOT_FOUND)
- region_num -= 1;
- else
- region_num += (GET_NUM_INSTANCE(memory_desc) - 1);
+ if (status != TBSA_STATUS_NOT_FOUND) {
+ region_num += GET_NUM_INSTANCE(memory_desc);
+ }
}
status = val->target_get_config(TARGET_CONFIG_CREATE_ID(GROUP_SOC_PERIPHERAL, 0, 0),
(uint8_t **)&soc_peripheral_hdr,
(uint32_t *)sizeof(soc_peripheral_hdr_t));
- if (val->err_check_set(TEST_CHECKPOINT_A, status))
+ if (val->err_check_set(TEST_CHECKPOINT_A, status)) {
return;
+ }
minor_id = 1;
- for (per_num = 0; per_num < soc_peripheral_hdr->num; per_num++) {
+ for (per_num = 0; per_num < soc_peripheral_hdr->num;) {
instance = 0;
do {
status = val->target_get_config(TARGET_CONFIG_CREATE_ID(GROUP_SOC_PERIPHERAL, minor_id, instance),
@@ -146,16 +146,15 @@ void test_payload(tbsa_val_api_t *val)
/* Check the status updated by handler in case a securefault occurs */
if (IS_TEST_FAIL(val->get_status())) {
- val->print(PRINT_ERROR, "\n Securefault occured at peripheral address 0x%x", (uint32_t)(soc_peripheral_desc->base));
+ val->print(PRINT_ERROR, "\n\r\tSecurefault occured at peripheral address 0x%x", (uint32_t)(soc_peripheral_desc->base));
return;
}
instance++;
} while (instance < GET_NUM_INSTANCE(soc_peripheral_desc));
minor_id++;
- if (status == TBSA_STATUS_NOT_FOUND)
- per_num -= 1;
- else
- per_num += (GET_NUM_INSTANCE(soc_peripheral_desc)- 1);
+ if (status != TBSA_STATUS_NOT_FOUND) {
+ per_num += GET_NUM_INSTANCE(soc_peripheral_desc);
+ }
}
val->set_status(RESULT_PASS(TBSA_STATUS_SUCCESS));
@@ -171,6 +170,8 @@ void exit_hook(tbsa_val_api_t *val)
return;
}
- val->interrupt_restore_handler(EXCP_NUM_HF);
+ status = val->interrupt_restore_handler(EXCP_NUM_HF);
+ if (val->err_check_set(TEST_CHECKPOINT_D, status)) {
+ return;
+ }
}
-
diff --git a/tbsa-v8m/test_pool/base/test_b001/secure.c b/tbsa-v8m/test_pool/base/test_b001/secure.c
index 5c38f8b1..7c2dad4a 100644
--- a/tbsa-v8m/test_pool/base/test_b001/secure.c
+++ b/tbsa-v8m/test_pool/base/test_b001/secure.c
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -20,7 +20,7 @@
/* Publish these functions to the external world as associated to this test ID */
TBSA_TEST_PUBLISH(CREATE_TEST_ID(TBSA_BASE_BASE, 1),
CREATE_TEST_TITLE("Check Trusted and Non-trusted world asset access"),
- CREATE_REF_TAG("R010/R020_TBSA_BASE-R010/R020/R030/R220_TBSA_INFRA-R040_TBSA_EIP"),
+ CREATE_REF_TAG("R010/R020_TBSA_BASE-R010/R020/R030/R170/R220_TBSA_INFRA-R040_TBSA_EIP"),
entry_hook,
test_payload,
exit_hook);
@@ -89,7 +89,7 @@ void test_payload(tbsa_val_api_t *val)
/* Perform read access on all address regions, and a write access only when the region is
marked as normal read-write */
- for (region_num = 0; region_num < memory_hdr->num; region_num++) {
+ for (region_num = 0; region_num < memory_hdr->num;) {
instance = 0;
do {
status = val->target_get_config(TARGET_CONFIG_CREATE_ID(GROUP_MEMORY, minor_id, instance),
@@ -112,20 +112,20 @@ void test_payload(tbsa_val_api_t *val)
instance++;
} while (instance < GET_NUM_INSTANCE(memory_desc));
minor_id++;
- if (status == TBSA_STATUS_NOT_FOUND)
- region_num -= 1;
- else
- region_num += (GET_NUM_INSTANCE(memory_desc) - 1);
+ if (status != TBSA_STATUS_NOT_FOUND) {
+ region_num += GET_NUM_INSTANCE(memory_desc);
+ }
}
status = val->target_get_config(TARGET_CONFIG_CREATE_ID(GROUP_SOC_PERIPHERAL, 0, 0),
(uint8_t **)&soc_peripheral_hdr,
(uint32_t *)sizeof(soc_peripheral_hdr_t));
- if (val->err_check_set(TEST_CHECKPOINT_3, status))
+ if (val->err_check_set(TEST_CHECKPOINT_3, status)) {
return;
+ }
minor_id = 1;
- for (per_num = 0; per_num < soc_peripheral_hdr->num; per_num++) {
+ for (per_num = 0; per_num < soc_peripheral_hdr->num;) {
instance = 0;
do {
status = val->target_get_config(TARGET_CONFIG_CREATE_ID(GROUP_SOC_PERIPHERAL, minor_id, instance),
@@ -141,10 +141,9 @@ void test_payload(tbsa_val_api_t *val)
instance++;
} while (instance < GET_NUM_INSTANCE(soc_peripheral_desc));
minor_id++;
- if (status == TBSA_STATUS_NOT_FOUND)
- per_num -= 1;
- else
- per_num += (GET_NUM_INSTANCE(soc_peripheral_desc) - 1);
+ if(status != TBSA_STATUS_NOT_FOUND) {
+ per_num += GET_NUM_INSTANCE(soc_peripheral_desc);
+ }
}
status = setup_ns_env();
diff --git a/tbsa-v8m/test_pool/base/test_b002/non_secure.c b/tbsa-v8m/test_pool/base/test_b002/non_secure.c
index 4749c19c..974df69c 100644
--- a/tbsa-v8m/test_pool/base/test_b002/non_secure.c
+++ b/tbsa-v8m/test_pool/base/test_b002/non_secure.c
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -22,24 +22,20 @@
**/
TBSA_TEST_PUBLISH(CREATE_TEST_ID(TBSA_BASE_BASE, 2),
CREATE_TEST_TITLE("Check Arm v8M security extensions and MPU implemented"),
- CREATE_REF_TAG("R030_TBSA_BASE"),
+ CREATE_REF_TAG("R001/R002/R030_TBSA_BASE"),
entry_hook,
test_payload,
exit_hook);
-void
-entry_hook(tbsa_val_api_t *val)
+void entry_hook(tbsa_val_api_t *val)
{
val->set_status(RESULT_PASS(TBSA_STATUS_SUCCESS));
}
-void
-test_payload(tbsa_val_api_t *val)
+void test_payload(tbsa_val_api_t *val)
{
- val->set_status(RESULT_PASS(TBSA_STATUS_SUCCESS));
}
-void
-exit_hook(tbsa_val_api_t *val)
+void exit_hook(tbsa_val_api_t *val)
{
}
diff --git a/tbsa-v8m/test_pool/base/test_b002/secure.c b/tbsa-v8m/test_pool/base/test_b002/secure.c
index 3df4df8e..2b12e56a 100644
--- a/tbsa-v8m/test_pool/base/test_b002/secure.c
+++ b/tbsa-v8m/test_pool/base/test_b002/secure.c
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -22,19 +22,17 @@
**/
TBSA_TEST_PUBLISH(CREATE_TEST_ID(TBSA_BASE_BASE, 2),
CREATE_TEST_TITLE("Check Arm v8M security extensions and MPU implemented"),
- CREATE_REF_TAG("R030_TBSA_BASE"),
+ CREATE_REF_TAG("R001/R002/R030_TBSA_BASE"),
entry_hook,
test_payload,
exit_hook);
-void
-entry_hook(tbsa_val_api_t *val)
+void entry_hook(tbsa_val_api_t *val)
{
val->set_status(RESULT_PASS(TBSA_STATUS_SUCCESS));
}
-void
-test_payload(tbsa_val_api_t *val)
+void test_payload(tbsa_val_api_t *val)
{
uint32_t read_val;
cpuid_t cpuid;
@@ -91,7 +89,6 @@ test_payload(tbsa_val_api_t *val)
}
}
-void
-exit_hook(tbsa_val_api_t *val)
+void exit_hook(tbsa_val_api_t *val)
{
}
diff --git a/tbsa-v8m/test_pool/base/test_b005/non_secure.c b/tbsa-v8m/test_pool/base/test_b005/non_secure.c
index 31559227..0da69b89 100644
--- a/tbsa-v8m/test_pool/base/test_b005/non_secure.c
+++ b/tbsa-v8m/test_pool/base/test_b005/non_secure.c
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -17,6 +17,8 @@
#include "val_test_common.h"
+#define TIMEOUT (0xFFFFFFFFUL)
+
/**
Publish these functions to the external world as associated to this test ID
**/
@@ -28,6 +30,7 @@ TBSA_TEST_PUBLISH(CREATE_TEST_ID(TBSA_BASE_BASE, 5),
exit_hook);
protection_units_desc_t *prot_units_desc;
+uint32_t shcsr;
void entry_hook(tbsa_val_api_t *val)
{
@@ -40,9 +43,9 @@ void test_payload(tbsa_val_api_t *val)
uint32_t data;
uint32_t ppc_instance = 0UL;
uint32_t mpc_instance = 0UL;
+ uint32_t timeout = TIMEOUT;
bool_t ppc_block_found = FALSE;
bool_t mpc_block_found = FALSE;
- uint32_t shcsr = 0UL;
/* Disabling SecureFault, UsageFault, BusFault, MemFault temporarily */
status = val->mem_reg_read(SHCSR, &shcsr);
@@ -73,8 +76,15 @@ void test_payload(tbsa_val_api_t *val)
/* Trying to read the device base address of a given PPC, expect fault? */
val_mem_read_wide((uint32_t *)prot_units_desc->device_base, &data);
- while (IS_TEST_PENDING(val->get_status()));
+ while (IS_TEST_PENDING(val->get_status()) && --timeout);
+
+ if(!timeout) {
+ val->print(PRINT_ERROR, "\n\r\tNo fault occurred when accessing PPC 0x%X from NT world!", (uint32_t)(prot_units_desc->device_base));
+ val->err_check_set(TEST_CHECKPOINT_4, TBSA_STATUS_TIMEOUT);
+ return;
+ }
+ timeout = TIMEOUT;
} while(TRUE);
do {
@@ -95,15 +105,16 @@ void test_payload(tbsa_val_api_t *val)
/* Trying to read the device base address of a given MPC, expect fault? */
val_mem_read_wide((uint32_t *)prot_units_desc->device_base, &data);
- while (IS_TEST_PENDING(val->get_status()));
+ while (IS_TEST_PENDING(val->get_status()) && --timeout);
- } while(TRUE);
+ if(!timeout) {
+ val->print(PRINT_ERROR, "\n\r\tNo fault occurred when accessing MPC 0x%X from NT world!", (uint32_t)(prot_units_desc->device_base));
+ val->err_check_set(TEST_CHECKPOINT_5, TBSA_STATUS_TIMEOUT);
+ return;
+ }
- /* Restoring faults */
- status = val->mem_reg_write(SHCSR, shcsr);
- if (val->err_check_set(TEST_CHECKPOINT_4, status)) {
- return;
- }
+ timeout = TIMEOUT;
+ } while(TRUE);
if (!ppc_block_found && !mpc_block_found) {
val->set_status(RESULT_SKIP(status));
@@ -116,9 +127,15 @@ void exit_hook(tbsa_val_api_t *val)
{
tbsa_status_t status;
+ /* Restoring faults */
+ status = val->mem_reg_write(SHCSR, shcsr);
+ if (val->err_check_set(TEST_CHECKPOINT_6, status)) {
+ return;
+ }
+
/* Restoring default Handler */
status = val->interrupt_restore_handler(EXCP_NUM_HF);
- if (val->err_check_set(TEST_CHECKPOINT_5, status)) {
+ if (val->err_check_set(TEST_CHECKPOINT_7, status)) {
return;
}
}
diff --git a/tbsa-v8m/test_pool/base/test_b005/secure.c b/tbsa-v8m/test_pool/base/test_b005/secure.c
index 51e76b76..fac6b8a7 100644
--- a/tbsa-v8m/test_pool/base/test_b005/secure.c
+++ b/tbsa-v8m/test_pool/base/test_b005/secure.c
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -33,8 +33,6 @@ void hard_fault_esr (unsigned long *sf_args)
{
if (IS_TEST_PENDING(g_val->get_status())) {
g_val->set_status(RESULT_PASS(TBSA_STATUS_SUCCESS));
- } else {
- g_val->set_status(RESULT_FAIL(TBSA_STATUS_INVALID));
}
/* Updating the return address in the stack frame in order to avoid periodic fault */
diff --git a/tbsa-v8m/test_pool/base/test_b006/non_secure.c b/tbsa-v8m/test_pool/base/test_b006/non_secure.c
index 3cb63893..ac621eea 100644
--- a/tbsa-v8m/test_pool/base/test_b006/non_secure.c
+++ b/tbsa-v8m/test_pool/base/test_b006/non_secure.c
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -17,6 +17,8 @@
#include "val_test_common.h"
+#define TIMEOUT (0xFFFFFFFFUL)
+
/**
Publish these functions to the external world as associated to this test ID
**/
@@ -48,8 +50,9 @@ void test_payload(tbsa_val_api_t *val)
uint32_t data, shcsr = 0, index = 0;
bool_t intrcnt_remap_found = FALSE;
uint32_t intrcnt_num_inst = 0;
+ uint32_t timeout = TIMEOUT;
- status = val->target_get_config(TARGET_CONFIG_CREATE_ID(GROUP_SOC_PERIPHERAL, SOC_PERIPHERAL_INTRCNT, 0),
+ status = val->target_get_config(TARGET_CONFIG_CREATE_ID(GROUP_SOC_PERIPHERAL, 0, 0),
(uint8_t **)&soc_peripheral_hdr,
(uint32_t *)sizeof(soc_peripheral_hdr_t));
if (val->err_check_set(TEST_CHECKPOINT_1, status)) {
@@ -81,19 +84,27 @@ void test_payload(tbsa_val_api_t *val)
index++;
intrcnt_remap_found = TRUE;
- val->set_status(RESULT_PENDING(1));
+ val->set_status(RESULT_PENDING(status));
/* Trying to read the remap logic register in the interconnect */
val_mem_read_wide((uint32_t *)soc_peripheral_desc->base, &data);
- while (IS_TEST_PENDING(val->get_status()));
+ while (IS_TEST_PENDING(val->get_status()) && --timeout);
+
+ if(!timeout) {
+ val->print(PRINT_ERROR, "\n\r\tNo fault occurred when accessing Interconnect 0x%X from NT world!", \
+ (uint32_t)(soc_peripheral_desc->base));
+ val->err_check_set(TEST_CHECKPOINT_5, TBSA_STATUS_TIMEOUT);
+ return;
+ }
+ timeout = TIMEOUT;
}
restore:
- /* Restoring faults */
+ /* Restoring faults */
status = val->mem_reg_write(SHCSR, shcsr);
- if (val->err_check_set(TEST_CHECKPOINT_5, status)) {
+ if (val->err_check_set(TEST_CHECKPOINT_6, status)) {
return;
}
@@ -110,7 +121,7 @@ void exit_hook(tbsa_val_api_t *val)
/* Restoring default Handler */
status = val->interrupt_restore_handler(EXCP_NUM_HF);
- if (val->err_check_set(TEST_CHECKPOINT_6, status)) {
+ if (val->err_check_set(TEST_CHECKPOINT_7, status)) {
return;
}
}
diff --git a/tbsa-v8m/test_pool/base/test_b006/secure.c b/tbsa-v8m/test_pool/base/test_b006/secure.c
index 277921db..1ed5a45a 100644
--- a/tbsa-v8m/test_pool/base/test_b006/secure.c
+++ b/tbsa-v8m/test_pool/base/test_b006/secure.c
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -33,8 +33,6 @@ void hard_fault_esr (unsigned long *sf_args)
{
if (IS_TEST_PENDING(g_val->get_status())) {
g_val->set_status(RESULT_PASS(TBSA_STATUS_SUCCESS));
- } else {
- g_val->set_status(RESULT_FAIL(TBSA_STATUS_INVALID));
}
/* Updating the return address in the stack frame in order to avoid periodic fault */
diff --git a/tbsa-v8m/test_pool/base/test_b008/non_secure.c b/tbsa-v8m/test_pool/base/test_b008/non_secure.c
new file mode 100644
index 00000000..87da230e
--- /dev/null
+++ b/tbsa-v8m/test_pool/base/test_b008/non_secure.c
@@ -0,0 +1,40 @@
+/** @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.
+**/
+
+#include "val_test_common.h"
+
+/**
+ Publish these functions to the external world as associated to this test ID
+**/
+TBSA_TEST_PUBLISH(CREATE_TEST_ID(TBSA_BASE_BASE, 8),
+ CREATE_TEST_TITLE("Check from default T target for IRQ originating from TW operation"),
+ CREATE_REF_TAG("R120_TBSA_INFRA"),
+ entry_hook,
+ test_payload,
+ exit_hook);
+
+void entry_hook(tbsa_val_api_t *val)
+{
+}
+
+void test_payload(tbsa_val_api_t *val)
+{
+}
+
+void exit_hook(tbsa_val_api_t *val)
+{
+}
diff --git a/tbsa-v8m/test_pool/base/test_b008/secure.c b/tbsa-v8m/test_pool/base/test_b008/secure.c
new file mode 100644
index 00000000..d96b3b68
--- /dev/null
+++ b/tbsa-v8m/test_pool/base/test_b008/secure.c
@@ -0,0 +1,125 @@
+/** @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.
+**/
+
+#include "val_test_common.h"
+
+#define TIMEOUT (0xFFFFFFFFUL)
+
+/**
+ Publish these functions to the external world as associated to this test ID
+**/
+TBSA_TEST_PUBLISH(CREATE_TEST_ID(TBSA_BASE_BASE, 8),
+ CREATE_TEST_TITLE("Check from default T target for IRQ originating from TW operation"),
+ CREATE_REF_TAG("R120_TBSA_INFRA"),
+ entry_hook,
+ test_payload,
+ exit_hook);
+
+tbsa_val_api_t *g_val;
+soc_peripheral_hdr_t *per_hdr;
+soc_peripheral_desc_t *per_desc;
+
+void trusted_target (void)
+{
+ if (IS_TEST_PENDING(g_val->get_status())) {
+ g_val->set_status(RESULT_PASS(TBSA_STATUS_SUCCESS));
+ }
+
+ g_val->print(PRINT_DEBUG, "\n\r\tIn Trusted target for IRQ 0x%X", per_desc->intr_id);
+}
+
+void entry_hook(tbsa_val_api_t *val)
+{
+ g_val = val;
+
+ val->set_status(RESULT_PASS(TBSA_STATUS_SUCCESS));
+}
+
+void test_payload(tbsa_val_api_t *val)
+{
+ tbsa_status_t status;
+ uint32_t instance;
+ uint32_t per_num;
+ uint32_t timeout = TIMEOUT;
+ uint32_t minor_id = 0x1;
+
+ status = val->target_get_config(TARGET_CONFIG_CREATE_ID(GROUP_SOC_PERIPHERAL, 0, 0),
+ (uint8_t **)&per_hdr,
+ (uint32_t *)sizeof(soc_peripheral_hdr_t));
+ if (val->err_check_set(TEST_CHECKPOINT_1, status)) {
+ return;
+ }
+
+ for(per_num = 0; per_num < per_hdr->num;) {
+ instance = 0;
+ do {
+ status = val->target_get_config(TARGET_CONFIG_CREATE_ID(GROUP_SOC_PERIPHERAL, minor_id, instance),
+ (uint8_t **)&per_desc,
+ (uint32_t *)sizeof(soc_peripheral_desc_t));
+ if (val->err_check_set(TEST_CHECKPOINT_2, status)) {
+ return;
+ }
+
+ if (per_desc->attribute == SECURE_PROGRAMMABLE) {
+
+ /* Installing Trusted Handler */
+ status = val->interrupt_setup_handler(EXCP_NUM_EXT_INT(per_desc->intr_id), 0, trusted_target);
+ if (val->err_check_set(TEST_CHECKPOINT_3, status)) {
+ return;
+ }
+
+ /* Write control bit */
+ val->set_status(RESULT_PENDING(status));
+
+ /* SET pending bit for a given trusted timer IRQ(trusted mode) */
+ status = val->interrupt_set_pending(EXCP_NUM_EXT_INT(per_desc->intr_id));
+ if (val->err_check_set(TEST_CHECKPOINT_4, status)) {
+ return;
+ }
+
+ /* stay here till trsuted target entered or timeout occurs, whichever comes early */
+ while (IS_TEST_PENDING(val->get_status()) && (--timeout));
+
+ /* Restoring default Handler */
+ status = val->interrupt_restore_handler(EXCP_NUM_EXT_INT(per_desc->intr_id));
+ if (val->err_check_set(TEST_CHECKPOINT_5, status)) {
+ return;
+ }
+
+ if(!timeout) {
+ val->print(PRINT_ERROR, "\n\r\tInterrupt did not reach Trusted target in its default state for IRQ : 0x%X", per_desc->intr_id);
+ val->err_check_set(TEST_CHECKPOINT_6, TBSA_STATUS_TIMEOUT);
+ return;
+ }
+
+ timeout = TIMEOUT;
+ }
+
+ instance++;
+ } while (instance < GET_NUM_INSTANCE(per_desc));
+ minor_id++;
+ if (status != TBSA_STATUS_NOT_FOUND) {
+ per_num += GET_NUM_INSTANCE(per_desc);
+ }
+ }
+
+ val->set_status(RESULT_PASS(TBSA_STATUS_SUCCESS));
+}
+
+void exit_hook(tbsa_val_api_t *val)
+{
+}
diff --git a/tbsa-v8m/test_pool/boot/Makefile b/tbsa-v8m/test_pool/boot/Makefile
deleted file mode 100644
index 7cfe1de7..00000000
--- a/tbsa-v8m/test_pool/boot/Makefile
+++ /dev/null
@@ -1,77 +0,0 @@
-#/** @file
-# * Copyright (c) 2018, 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
-PREFIX:=arm-none-eabi-
-CC:=$(PREFIX)gcc
-CXX:=$(PREFIX)g++
-AS:=$(PREFIX)as
-OBJCOPY:=$(PREFIX)objcopy
-OBJDUMP:=$(PREFIX)objdump
-
-# Test specific macros
-OUT_DIR:=./out
-
-# Root folder
-ROOT_DIR:=.
-
-.PHONY: all clean
-
-VAL_LIB :=../../out/$(TARGET)/tbsa_val.a
-PAL_LIB :=../../out/$(TARGET)/tbsa_pal.a
-SYSLIBS :=$(VAL_LIB) $(PAL_LIB) -lgcc -lc -lnosys
-INCDIR := ../../val/include/
-CFLAGS :=-march=armv8-m.$(ARCH) -mthumb -Wall -Werror -O0 -I$(INCDIR)
-SBUILD :=-mcmse
-
-LDFLAGS :=\
- -Xlinker --fatal-warnings \
- -Xlinker --gc-sections \
- -z max-page-size=0x400
-
-SFLAGS :=\
- $(CFLAGS) \
- $(SBUILD) \
- -nostartfiles \
- -T../../platform/board/${TARGET}/linker/test_s.linker \
- $(LDFLAGS)
-
-NSFLAGS :=\
- $(CFLAGS) \
- -nostartfiles \
- -T../../platform/board/${TARGET}/linker/test_ns.linker \
- $(LDFLAGS)
-
-s_src :=secure.c
-ns_src :=non_secure.c
-
-DIR :=$(dir $(wildcard $(ROOT_DIR)/*/))
-DIR :=$(filter-out ./, $(DIR))
-
-all: build
-
-build:
- $(foreach d, $(DIR), mkdir -p $(d)$(OUT_DIR); \
- $(CC) $(SFLAGS) -Xlinker -Map=$(d)$(OUT_DIR)/$(s_src).map -o $(d)$(OUT_DIR)/$(s_src).elf $(d)$(s_src) $(SYSLIBS); \
- $(OBJCOPY) $(d)$(OUT_DIR)/$(s_src).elf -O binary $(d)$(OUT_DIR)/$(s_src).bin; \
- $(OBJDUMP) -d $(d)$(OUT_DIR)/$(s_src).elf > $(d)$(OUT_DIR)/$(s_src).asm; \
- $(CC) $(NSFLAGS) -Xlinker -Map=$(d)$(OUT_DIR)/$(ns_src).map -o $(d)$(OUT_DIR)/$(ns_src).elf $(d)$(ns_src) $(SYSLIBS); \
- $(OBJCOPY) $(d)$(OUT_DIR)/$(ns_src).elf -O binary $(d)$(OUT_DIR)/$(ns_src).bin; \
- $(OBJDUMP) -d $(d)$(OUT_DIR)/$(ns_src).elf > $(d)$(OUT_DIR)/$(ns_src).asm;)
-
-clean:
- $(foreach d, $(DIR), rm -rf $(d)$(OUT_DIR))
diff --git a/tbsa-v8m/test_pool/crypto/Makefile b/tbsa-v8m/test_pool/crypto/Makefile
deleted file mode 100644
index 5879537f..00000000
--- a/tbsa-v8m/test_pool/crypto/Makefile
+++ /dev/null
@@ -1,76 +0,0 @@
-#/** @file
-# * Copyright (c) 2018, 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
-PREFIX:=arm-none-eabi-
-CC:=$(PREFIX)gcc
-CXX:=$(PREFIX)g++
-AS:=$(PREFIX)as
-OBJCOPY:=$(PREFIX)objcopy
-OBJDUMP:=$(PREFIX)objdump
-
-# Test specific macros
-OUT_DIR:=./out
-
-# Root folder
-ROOT_DIR:=.
-
-.PHONY: all clean
-
-VAL_LIB :=../../out/$(TARGET)/tbsa_val.a
-PAL_LIB :=../../out/$(TARGET)/tbsa_pal.a
-SYSLIBS :=$(VAL_LIB) $(PAL_LIB) -lgcc -lc -lnosys
-INCDIR := ../../val/include/
-CFLAGS :=-march=armv8-m.$(ARCH) -mthumb -Wall -Werror -O0 -I$(INCDIR)
-SBUILD :=-mcmse
-
-LDFLAGS :=\
- -Xlinker --fatal-warnings \
- -Xlinker --gc-sections \
- -z max-page-size=0x400
-
-SFLAGS :=\
- $(CFLAGS) \
- $(SBUILD) \
- -nostartfiles \
- -T../../platform/board/${TARGET}/linker/test_s.linker \
- $(LDFLAGS)
-
-NSFLAGS :=\
- $(CFLAGS) \
- -nostartfiles \
- -T../../platform/board/${TARGET}/linker/test_ns.linker \
- $(LDFLAGS)
-
-s_src :=secure.c
-ns_src :=non_secure.c
-
-DIR :=$(dir $(wildcard $(ROOT_DIR)/*/))
-DIR :=$(filter-out ./, $(DIR))
-all: build
-
-build:
- $(foreach d, $(DIR), mkdir -p $(d)$(OUT_DIR); \
- $(CC) $(SFLAGS) -Xlinker -Map=$(d)$(OUT_DIR)/$(s_src).map -o $(d)$(OUT_DIR)/$(s_src).elf $(d)$(s_src) $(SYSLIBS); \
- $(OBJCOPY) $(d)$(OUT_DIR)/$(s_src).elf -O binary $(d)$(OUT_DIR)/$(s_src).bin; \
- $(OBJDUMP) -d $(d)$(OUT_DIR)/$(s_src).elf > $(d)$(OUT_DIR)/$(s_src).asm; \
- $(CC) $(NSFLAGS) -Xlinker -Map=$(d)$(OUT_DIR)/$(ns_src).map -o $(d)$(OUT_DIR)/$(ns_src).elf $(d)$(ns_src) $(SYSLIBS); \
- $(OBJCOPY) $(d)$(OUT_DIR)/$(ns_src).elf -O binary $(d)$(OUT_DIR)/$(ns_src).bin; \
- $(OBJDUMP) -d $(d)$(OUT_DIR)/$(ns_src).elf > $(d)$(OUT_DIR)/$(ns_src).asm;)
-
-clean:
- $(foreach d, $(DIR), rm -rf $(d)$(OUT_DIR))
diff --git a/tbsa-v8m/test_pool/crypto/test_c001/secure.c b/tbsa-v8m/test_pool/crypto/test_c001/secure.c
index 9ec5444c..eb611eab 100644
--- a/tbsa-v8m/test_pool/crypto/test_c001/secure.c
+++ b/tbsa-v8m/test_pool/crypto/test_c001/secure.c
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -23,7 +23,7 @@
tbsa_val_api_t *g_val;
uint8_t g_key[KEY_SIZE] = {0}, g_key_save[KEY_SIZE] = {0};
soc_peripheral_hdr_t *soc_peripheral_hdr;
-soc_peripheral_desc_t *soc_peripheral_desc;
+soc_peripheral_desc_t *soc_peripheral_desc = NULL;
bool_t s_timer_present = 0;
int g_exception_taken = 0, g_reinit_taken = 0;
clocks_desc_t *clocks_desc;
@@ -201,7 +201,7 @@ void test_payload(tbsa_val_api_t *val)
} else {
val->set_status(RESULT_SKIP(1));
- val->print(PRINT_ERROR, "\nUnable to receive any interrupts", 0);
+ val->print(PRINT_ERROR, "\n\r\tUnable to receive any interrupts", 0);
return;
}
}
@@ -211,7 +211,7 @@ void test_payload(tbsa_val_api_t *val)
for(i=0; ierr_check_set(TEST_CHECKPOINT_E, TBSA_STATUS_ERROR);
- val->print(PRINT_ERROR, "\nKey generation from secure state was interrupted", 0);
+ val->print(PRINT_ERROR, "\n\r\tKey generation from secure state was interrupted", 0);
return;
} else {
val->set_status(RESULT_PASS(TBSA_STATUS_SUCCESS));
@@ -223,6 +223,8 @@ void test_payload(tbsa_val_api_t *val)
void exit_hook(tbsa_val_api_t *val)
{
- val->interrupt_disable(EXCP_NUM_EXT_INT(soc_peripheral_desc->intr_id));
- val->timer_disable(soc_peripheral_desc->base);
+ if (soc_peripheral_desc != NULL) {
+ val->interrupt_disable(EXCP_NUM_EXT_INT(soc_peripheral_desc->intr_id));
+ val->timer_disable(soc_peripheral_desc->base);
+ }
}
diff --git a/tbsa-v8m/test_pool/crypto/test_c002/secure.c b/tbsa-v8m/test_pool/crypto/test_c002/secure.c
index 565a2444..b3690aa4 100644
--- a/tbsa-v8m/test_pool/crypto/test_c002/secure.c
+++ b/tbsa-v8m/test_pool/crypto/test_c002/secure.c
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -65,12 +65,12 @@ void test_payload(tbsa_val_api_t *val)
case ECC:
if (key_desc->size >= TBSA_ROTPK_ECC_SIZE) {
- status = val->fuse_ops(FUSE_READ, key_desc->addr, key, key_desc->size);
+ status = val->fuse_ops(FUSE_READ, key_desc->addr, key, MIN(TBSA_ROTPK_RSA_SIZE, key_desc->size));
if (val->err_check_set(TEST_CHECKPOINT_3, status)) {
return;
}
- status = val->crypto_validate_public_key(ECC, key, key_desc->size, key_desc->addr, &key_valid);
+ status = val->crypto_validate_public_key(ECC, key, MIN(TBSA_ROTPK_RSA_SIZE, key_desc->size), key_desc->addr, &key_valid);
if (val->err_check_set(TEST_CHECKPOINT_4, status)) {
return;
}
@@ -80,8 +80,9 @@ void test_payload(tbsa_val_api_t *val)
else
val->err_check_set(TEST_CHECKPOINT_5, TBSA_STATUS_ZERO_COUNT_ERROR);
- } else
+ } else {
val->err_check_set(TEST_CHECKPOINT_6, TBSA_STATUS_INCORRECT_KEY_SIZE);
+ }
break;
case RSA:
if (key_desc->size >= TBSA_ROTPK_RSA_SIZE) {
@@ -105,38 +106,33 @@ void test_payload(tbsa_val_api_t *val)
break;
default:
switch (key_desc->type & SYM_MSK) {
- case HASH:
- status = val->fuse_ops(FUSE_READ, key_desc->addr, data1, key_desc->size);
- if (val->err_check_set(TEST_CHECKPOINT_B, status)) {
- return;
- }
-
- /*Try corrupting the hash by writing some random data.*/
- status = val->fuse_ops(FUSE_WRITE, key_desc->addr, data2, key_desc->size);
- if (val->err_check_set(TEST_CHECKPOINT_C, status)) {
- val->print(PRINT_ERROR, "\n Write Failed", 0);
- return;
- }
+ case HASH:
+ status = val->fuse_ops(FUSE_READ, key_desc->addr, data1, MIN(MAX_HASH_SIZE, key_desc->size));
+ if (val->err_check_set(TEST_CHECKPOINT_B, status)) {
+ return;
+ }
- status = val->fuse_ops(FUSE_READ, key_desc->addr, data2, key_desc->size);
- if (val->err_check_set(TEST_CHECKPOINT_D, status)) {
- val->print(PRINT_ERROR, "\n Read Failed", 0);
- return;
- }
+ /* Try corrupting the hash by writing some random data.*/
+ val->fuse_ops(FUSE_WRITE, key_desc->addr, data2, MIN(MAX_HASH_SIZE, key_desc->size));
- for(i=0; isize; i++) {
- if(data1[i] != data2[i]) {
- val->err_check_set(TEST_CHECKPOINT_E, TBSA_STATUS_ERROR);
- val->print(PRINT_ERROR, "\n HASH of ROTPK was not immutable", 0);
+ status = val->fuse_ops(FUSE_READ, key_desc->addr, data2, MIN(MAX_HASH_SIZE, key_desc->size));
+ if (val->err_check_set(TEST_CHECKPOINT_C, status)) {
return;
- } else {
- val->set_status(RESULT_PASS(TBSA_STATUS_SUCCESS));
}
- }
- break;
- default:
- val->print(PRINT_ERROR, "\n No ROTPK was found in the system", 0);
- val->err_check_set(TEST_CHECKPOINT_F, TBSA_STATUS_NOT_FOUND);
+
+ for(i=0; i< MIN(MAX_HASH_SIZE, key_desc->size); i++) {
+ if(data1[i] != data2[i]) {
+ val->err_check_set(TEST_CHECKPOINT_D, TBSA_STATUS_ERROR);
+ val->print(PRINT_ERROR, "\n\r\tHASH of ROTPK was not immutable", 0);
+ return;
+ } else {
+ val->set_status(RESULT_PASS(TBSA_STATUS_SUCCESS));
+ }
+ }
+ break;
+ default:
+ val->print(PRINT_ERROR, "\n\r\tNo ROTPK was found in the system", 0);
+ val->err_check_set(TEST_CHECKPOINT_E, TBSA_STATUS_NOT_FOUND);
}
}
return;
@@ -145,4 +141,3 @@ void test_payload(tbsa_val_api_t *val)
void exit_hook(tbsa_val_api_t *val)
{
}
-
diff --git a/tbsa-v8m/test_pool/crypto/test_c003/non_secure.c b/tbsa-v8m/test_pool/crypto/test_c003/non_secure.c
index 8409ec89..8ac3c52f 100644
--- a/tbsa-v8m/test_pool/crypto/test_c003/non_secure.c
+++ b/tbsa-v8m/test_pool/crypto/test_c003/non_secure.c
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -18,6 +18,7 @@
#include "val_test_common.h"
#define KEY_SIZE 32
+
/* Publish these functions to the external world as associated to this test ID */
TBSA_TEST_PUBLISH(CREATE_TEST_ID(TBSA_CRYPTO_BASE, 3),
CREATE_TEST_TITLE("HUK should be in Confidential-Lockable-Bulk fuses, accessible only to TW"),
@@ -26,7 +27,8 @@ TBSA_TEST_PUBLISH(CREATE_TEST_ID(TBSA_CRYPTO_BASE, 3),
test_payload,
exit_hook);
-uint32_t shcsr;
+memory_desc_t *nvram_desc;
+uint32_t shcsr;
void entry_hook(tbsa_val_api_t *val)
{
@@ -56,61 +58,95 @@ void entry_hook(tbsa_val_api_t *val)
void test_payload(tbsa_val_api_t *val)
{
tbsa_status_t status;
- uint32_t i, instance = 0;
- uint32_t key[KEY_SIZE] = {0}, key_ns[KEY_SIZE] = {0};
key_desc_t *key_info_huk;
+ boot_t boot;
+ uint32_t instance = 0;
+ uint32_t key[KEY_SIZE];
- status = val->crypto_set_base_addr(SECURE_PROGRAMMABLE);
+ status = val->target_get_config(TARGET_CONFIG_CREATE_ID(GROUP_MEMORY, MEMORY_NVRAM, 0),
+ (uint8_t **)&nvram_desc,
+ (uint32_t *)sizeof(memory_desc_t));
if (val->err_check_set(TEST_CHECKPOINT_A, status)) {
- goto exit;
+ return;
}
- status = val->crypto_get_key_info((key_desc_t **)&key_info_huk, HUK, &instance);
+ status = val->nvram_read(nvram_desc->start, TBSA_NVRAM_OFFSET(NV_BOOT), &boot, sizeof(boot_t));
if (val->err_check_set(TEST_CHECKPOINT_B, status)) {
- goto exit;
+ return;
}
- if ((key_info_huk->state & FUSE_OPEN) == FUSE_OPEN) {
- status = val->fuse_ops(FUSE_READ, key_info_huk->addr, key, key_info_huk->size);
+ if (boot.wb != WARM_BOOT_REQUESTED) {
+
+ boot.wb = WARM_BOOT_REQUESTED;
+ status = val->nvram_write(nvram_desc->start, TBSA_NVRAM_OFFSET(NV_BOOT), &boot, sizeof(boot_t));
if (val->err_check_set(TEST_CHECKPOINT_C, status)) {
- goto exit;
+ return;
}
- val_crypto_set_base_addr(NONSECURE_PROGRAMMABLE);
-
- /* Setup secure fault handler is setup, in secure version of the test to recover from
- exception caused by accessing Trusted only accessible key.*/
- status = val_fuse_ops(FUSE_READ, key_info_huk->addr, key_ns, key_info_huk->size);
+ status = val->crypto_set_base_addr(SECURE_PROGRAMMABLE);
if (val->err_check_set(TEST_CHECKPOINT_D, status)) {
- goto exit;
+ return;
}
- for(i = 0; i < key_info_huk->size; i++) {
- if (key[i] == key_ns[i]) {
- val->print(PRINT_ERROR, "\n HUK was accessible by non-Trusted code", 0);
- val->err_check_set(TEST_CHECKPOINT_E, TBSA_STATUS_ERROR);
- goto exit;
- }
+ status = val->crypto_get_key_info((key_desc_t **)&key_info_huk, HUK, &instance);
+ if (val->err_check_set(TEST_CHECKPOINT_E, status)) {
+ return;
}
- } else {
- val->print(PRINT_INFO, "\n HUK is not open", 0);
- val->set_status(RESULT_SKIP(1));
- goto exit;
+
+ /* Setup secure fault handler is setup, in secure version of the test to recover from
+ exception caused by accessing Trusted only accessible key.*/
+ status = val_fuse_ops(FUSE_READ, key_info_huk->addr, key, MIN(KEY_SIZE, key_info_huk->size));
+
+ /* Shouldn't come here */
+ val->print(PRINT_ERROR, "\n\r\tFault didn't occur when HUK accessed from Non-secure world!", 0);
+ asm volatile ("DSB");
+ asm volatile ("ISB");
+ val->system_reset(WARM_RESET);
}
+}
- val->set_status(RESULT_PASS(TBSA_STATUS_SUCCESS));
+void exit_hook(tbsa_val_api_t *val)
+{
+ tbsa_status_t status;
+ boot_t boot;
+ uint32_t active_test;
-exit:
- /* Restoring faults */
- status = val->mem_reg_write(SHCSR, shcsr);
+ status = val->target_get_config(TARGET_CONFIG_CREATE_ID(GROUP_MEMORY, MEMORY_NVRAM, 0),
+ (uint8_t **)&nvram_desc,
+ (uint32_t *)sizeof(memory_desc_t));
if (val->err_check_set(TEST_CHECKPOINT_F, status)) {
return;
}
-}
+ active_test = 0xFFFFFFFFUL;
+ status = val->nvram_write(nvram_desc->start, TBSA_NVRAM_OFFSET(NV_ACT_TST), &active_test, sizeof(active_test));
+ if (val->err_check_set(TEST_CHECKPOINT_10, status)) {
+ return;
+ }
-void exit_hook(tbsa_val_api_t *val)
-{
- val->interrupt_restore_handler(EXCP_NUM_HF);
-}
+ boot.wb = BOOT_UNKNOWN;
+ status = val->nvram_write(nvram_desc->start, TBSA_NVRAM_OFFSET(NV_BOOT), &boot, sizeof(boot_t));
+ if (val->err_check_set(TEST_CHECKPOINT_11, status)) {
+ return;
+ }
+ if (IS_TEST_PASS(val->get_status()))
+ {
+ status = val->nvram_read(nvram_desc->start, TBSA_NVRAM_OFFSET(NV_SHCSR), &shcsr, sizeof(shcsr));
+ if (val->err_check_set(TEST_CHECKPOINT_12, status)) {
+ return;
+ }
+
+ /* Restoring faults */
+ status = val->mem_reg_write(SHCSR, shcsr);
+ if (val->err_check_set(TEST_CHECKPOINT_13, status)) {
+ return;
+ }
+ }
+
+ /* Restoring default Handler */
+ status = val->interrupt_restore_handler(EXCP_NUM_HF);
+ if (val->err_check_set(TEST_CHECKPOINT_14, status)) {
+ return;
+ }
+}
diff --git a/tbsa-v8m/test_pool/crypto/test_c003/secure.c b/tbsa-v8m/test_pool/crypto/test_c003/secure.c
index 52f0660c..213004f0 100644
--- a/tbsa-v8m/test_pool/crypto/test_c003/secure.c
+++ b/tbsa-v8m/test_pool/crypto/test_c003/secure.c
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -18,6 +18,7 @@
#include "val_test_common.h"
#define KEY_SIZE 32
+
/* Publish these functions to the external world as associated to this test ID */
TBSA_TEST_PUBLISH(CREATE_TEST_ID(TBSA_CRYPTO_BASE, 3),
CREATE_TEST_TITLE("HUK should be in Confidential-Lockable-Bulk fuses, accessible only to TW"),
@@ -28,6 +29,7 @@ TBSA_TEST_PUBLISH(CREATE_TEST_ID(TBSA_CRYPTO_BASE, 3),
tbsa_val_api_t *g_val;
+memory_desc_t *nvram_desc;
void entry_hook(tbsa_val_api_t *val)
{
@@ -43,11 +45,15 @@ void entry_hook(tbsa_val_api_t *val)
void hard_fault_esr (unsigned long *sf_args)
{
- g_val->print(PRINT_INFO, "\nHardFault triggered when HUK was accessed from"
+ g_val->print(PRINT_DEBUG, "\n\r\tHardFault triggered when HUK was accessed from"
"non-Trusted world", 0);
- /* Updating the return address in the stack frame in order to avoid periodic fault */
- sf_args[6] = sf_args[6] + 4;
+ asm volatile("DSB");
+ asm volatile("ISB");
+
+ g_val->system_reset(WARM_RESET);
+
+ while(1);
}
__attribute__((naked))
@@ -65,59 +71,83 @@ void HF_Handler(void)
"b hard_fault_esr \n");
}
-tbsa_status_t setup_ns_env(void)
-{
- return g_val->interrupt_setup_handler(EXCP_NUM_HF, 0, HF_Handler);
-}
-
void test_payload(tbsa_val_api_t *val)
{
tbsa_status_t status;
- uint32_t expected_fuse_type, i, instance = 0;
- uint32_t key[KEY_SIZE];
key_desc_t *key_info_huk;
+ uint32_t expected_fuse_type, instance = 0;
+ uint32_t key[KEY_SIZE];
+ uint32_t active_test;
+ uint32_t key_mask;
+ uint32_t result;
+ uint32_t i;
g_val = val;
- status = setup_ns_env();
- if (val->err_check_set(TEST_CHECKPOINT_7, status)) {
+
+ status = val->target_get_config(TARGET_CONFIG_CREATE_ID(GROUP_MEMORY, MEMORY_NVRAM, 0),
+ (uint8_t **)&nvram_desc,
+ (uint32_t *)sizeof(memory_desc_t));
+ if (val->err_check_set(TEST_CHECKPOINT_1, status)) {
return;
}
- status = val->crypto_set_base_addr(SECURE_PROGRAMMABLE);
+ status = val->nvram_read(nvram_desc->start, TBSA_NVRAM_OFFSET(NV_ACT_TST), &active_test, sizeof(active_test));
if (val->err_check_set(TEST_CHECKPOINT_1, status)) {
return;
}
- status = val->crypto_get_key_info(&key_info_huk, HUK, &instance);
+ if (active_test == TBSA_NS_TEST_ACTIVE) {
+ /* Non-secure is active - so skipping Secure test */
+ return;
+ }
+
+ status = val->interrupt_setup_handler(EXCP_NUM_HF, 0, HF_Handler);
if (val->err_check_set(TEST_CHECKPOINT_2, status)) {
return;
}
+ status = val->crypto_set_base_addr(SECURE_PROGRAMMABLE);
+ if (val->err_check_set(TEST_CHECKPOINT_3, status)) {
+ return;
+ }
+
+ status = val->crypto_get_key_info(&key_info_huk, HUK, &instance);
+ if (val->err_check_set(TEST_CHECKPOINT_4, status)) {
+ return;
+ }
+
expected_fuse_type = FUSE_CONFIDENTIAL | FUSE_BULK | FUSE_LOCKABLE;
if ((key_info_huk->type & expected_fuse_type) != expected_fuse_type) {
- val->print(PRINT_ERROR, "\n Fuse type in which HUK stored is non-compliant", 0);
- val->print(PRINT_ERROR, "\n Fuse type %x", key_info_huk->type);
- val->print(PRINT_ERROR, "\n Expected Fuse type %x", expected_fuse_type);
- val->err_check_set(TEST_CHECKPOINT_3, TBSA_STATUS_ERROR);
+ val->print(PRINT_ERROR, "\n\r\tFuse type in which HUK stored is non-compliant", 0);
+ val->print(PRINT_ERROR, "\n\r\tFuse type %x", key_info_huk->type);
+ val->print(PRINT_ERROR, "\n\r\tExpected Fuse type %x", expected_fuse_type);
+ val->err_check_set(TEST_CHECKPOINT_5, TBSA_STATUS_ERROR);
return;
}
if ((key_info_huk->state & FUSE_OPEN) == FUSE_OPEN) {
- status = val->fuse_ops(FUSE_READ, key_info_huk->addr, key, key_info_huk->size);
- if (val->err_check_set(TEST_CHECKPOINT_4, status)) {
+ status = val->fuse_ops(FUSE_READ, key_info_huk->addr, key, MIN(KEY_SIZE, key_info_huk->size));
+ if (val->err_check_set(TEST_CHECKPOINT_6, status)) {
return;
}
- for (i = 0; i < key_info_huk->size; i++) {
+ result = 0;
+ key_mask = 0;
+ /* check whether key holds the default value, if so warn ! */
+ for (i = 0; i < MIN(KEY_SIZE, key_info_huk->size); i++) {
if (key[i] == key_info_huk->def_val) {
- val->print(PRINT_ERROR, "\n Incorrect HUK", 0);
- val->err_check_set(TEST_CHECKPOINT_6, TBSA_STATUS_ERROR);
- return;
+ result |= (1U << i);
}
+ key_mask |= (1U << i);
+ }
+
+ if (result == key_mask) {
+ val->print(PRINT_ALWAYS, "\n\r\tHUK having the default value : %X", key_info_huk->def_val);
}
+
} else {
- val->print(PRINT_ERROR, "\n HUK is not open", 0);
+ val->print(PRINT_ALWAYS, "\n\r\tHUK is not open", 0);
val->set_status(RESULT_SKIP(1));
return;
}
@@ -127,5 +157,12 @@ void test_payload(tbsa_val_api_t *val)
void exit_hook(tbsa_val_api_t *val)
{
-}
+ tbsa_status_t status;
+ uint32_t active_test;
+ active_test = TBSA_NS_TEST_ACTIVE;
+ status = val->nvram_write(nvram_desc->start, TBSA_NVRAM_OFFSET(NV_ACT_TST), &active_test, sizeof(active_test));
+ if (val->err_check_set(TEST_CHECKPOINT_7, status)) {
+ return;
+ }
+}
diff --git a/tbsa-v8m/test_pool/crypto/test_c004/secure.c b/tbsa-v8m/test_pool/crypto/test_c004/secure.c
index 935bb8c0..be9c5c46 100644
--- a/tbsa-v8m/test_pool/crypto/test_c004/secure.c
+++ b/tbsa-v8m/test_pool/crypto/test_c004/secure.c
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -44,9 +44,10 @@ void entry_hook(tbsa_val_api_t *val)
void test_payload(tbsa_val_api_t *val)
{
tbsa_status_t status;
- uint32_t data, expected_fuse_type, i, instance = 0;
+ uint32_t expected_fuse_type, i, instance = 0;
uint32_t key[KEY_SIZE];
- uint32_t rd_data[KEY_SIZE], wr_data[KEY_SIZE] = {0xFFFFFFFF};
+ uint32_t rd_data[KEY_SIZE], wr_data[KEY_SIZE];
+ uint32_t key_mask, result;
key_desc_t *key_info_static;
bool_t key_present = FALSE;
@@ -55,10 +56,13 @@ void test_payload(tbsa_val_api_t *val)
return;
}
+ val->memset(wr_data, 0xFF, sizeof(wr_data)/sizeof(uint32_t));
+
do {
status = val->crypto_get_key_info(&key_info_static, STATIC, &instance);
if (status != TBSA_STATUS_SUCCESS && key_present == FALSE) {
- val->err_check_set(TEST_CHECKPOINT_2, status);
+ val->print(PRINT_ALWAYS, "\n\r\tStatic key is not available to check", 0);
+ val->set_status(RESULT_SKIP(status));
return;
}
@@ -69,61 +73,53 @@ void test_payload(tbsa_val_api_t *val)
key_present = TRUE;
expected_fuse_type = FUSE_BULK | FUSE_LOCKABLE;
if ((key_info_static->type & expected_fuse_type) != expected_fuse_type) {
- val->print(PRINT_ERROR, "\n Fuse type in which static key stored is non-compliant", 0);
- val->print(PRINT_ERROR, "\n Fuse type %x", key_info_static->type);
- val->print(PRINT_ERROR, "\n Expected Fuse type %x", expected_fuse_type);
- val->err_check_set(TEST_CHECKPOINT_3, TBSA_STATUS_ERROR);
+ val->print(PRINT_ERROR, "\n\r\tFuse type in which static key stored is non-compliant", 0);
+ val->print(PRINT_ERROR, "\n\r\tFuse type %x", key_info_static->type);
+ val->print(PRINT_ERROR, "\n\r\tExpected Fuse type %x", expected_fuse_type);
+ val->err_check_set(TEST_CHECKPOINT_2, TBSA_STATUS_ERROR);
return;
}
if ((key_info_static->state & FUSE_OPEN) == FUSE_OPEN) {
- status = val->fuse_ops(FUSE_READ, key_info_static->addr, key, key_info_static->size);
- if (val->err_check_set(TEST_CHECKPOINT_4, status)) {
+ status = val->fuse_ops(FUSE_READ, key_info_static->addr, key, MIN(KEY_SIZE, key_info_static->size));
+ if (val->err_check_set(TEST_CHECKPOINT_3, status)) {
return;
}
- if (key_info_static->def_val == 0) {
- data = 0;
- /* Check that the static key is non-zero*/
- for(i = 0; i < key_info_static->size; i++)
- data += key[i];
-
- if (!data) {
- val->print(PRINT_ERROR, "\n Incorrect Static Key", 0);
- val->err_check_set(TEST_CHECKPOINT_5, TBSA_STATUS_ERROR);
- return;
- }
- } else {
- for (i = 0; i < key_info_static->size; i++) {
- wr_data[i] = 0;
- /* Check that the static key is not equal to default value */
- if (key[i] == key_info_static->def_val) {
- val->print(PRINT_ERROR, "\n Incorrect HUK", 0);
- val->err_check_set(TEST_CHECKPOINT_6, TBSA_STATUS_ERROR);
- return;
- }
+ result = 0;
+ key_mask = 0;
+ /* check whether key holds the default value, if so warn ! */
+ for (i = 0; i < MIN(KEY_SIZE, key_info_static->size); i++) {
+ if (key[i] == key_info_static->def_val) {
+ result |= (1U << i);
}
+ key_mask |= (1U << i);
+ }
+
+ if (result == key_mask) {
+ val->print(PRINT_ALWAYS, "\n\r\tStatic key having the default value : %X", key_info_static->def_val);
}
- status = val->fuse_ops(FUSE_WRITE, key_info_static->addr, wr_data, key_info_static->size);
- if (val->err_check_set(TEST_CHECKPOINT_7, status)) {
+ status = val->fuse_ops(FUSE_WRITE, key_info_static->addr, wr_data, MIN(KEY_SIZE, key_info_static->size));
+ if (val->err_check_set(TEST_CHECKPOINT_4, status)) {
return;
}
- status = val->fuse_ops(FUSE_READ, key_info_static->addr, rd_data, key_info_static->size);
- if (val->err_check_set(TEST_CHECKPOINT_8, status)) {
+ status = val->fuse_ops(FUSE_READ, key_info_static->addr, rd_data, MIN(KEY_SIZE, key_info_static->size));
+ if (val->err_check_set(TEST_CHECKPOINT_5, status)) {
return;
}
- for (i = 0; i < key_info_static->size; i++) {
+ for (i = 0; i < MIN(KEY_SIZE, key_info_static->size); i++) {
if (key[i] != rd_data[i]) {
- val->print(PRINT_ERROR, "\n Able to modify static key", 0);
- val->err_check_set(TEST_CHECKPOINT_9, TBSA_STATUS_ERROR);
+ val->print(PRINT_ERROR, "\n\r\tAble to modify static key", 0);
+ val->err_check_set(TEST_CHECKPOINT_6, TBSA_STATUS_ERROR);
return;
}
}
} else {
- val->print(PRINT_INFO, "\n Static key is not open", 0);
+ val->set_status(RESULT_SKIP(status));
+ val->print(PRINT_ALWAYS, "\n\r\tStatic key %d is not open", instance);
}
instance++;
diff --git a/tbsa-v8m/test_pool/crypto/test_c005/non_secure.c b/tbsa-v8m/test_pool/crypto/test_c005/non_secure.c
index 24922dad..55d8bb01 100644
--- a/tbsa-v8m/test_pool/crypto/test_c005/non_secure.c
+++ b/tbsa-v8m/test_pool/crypto/test_c005/non_secure.c
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -36,4 +36,3 @@ void test_payload(tbsa_val_api_t *val)
void exit_hook(tbsa_val_api_t *val)
{
}
-
diff --git a/tbsa-v8m/test_pool/crypto/test_c005/secure.c b/tbsa-v8m/test_pool/crypto/test_c005/secure.c
index 9369d586..1aad5b53 100644
--- a/tbsa-v8m/test_pool/crypto/test_c005/secure.c
+++ b/tbsa-v8m/test_pool/crypto/test_c005/secure.c
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -17,7 +17,7 @@
#include "val_test_common.h"
-#define KEY_SIZE 32
+#define KEY_SIZE 32 /* 32*32 = 1024 bits = 1K */
/* Publish these functions to the external world as associated to this test ID */
TBSA_TEST_PUBLISH(CREATE_TEST_ID(TBSA_CRYPTO_BASE, 5),
@@ -45,8 +45,13 @@ void test_payload(tbsa_val_api_t *val)
tbsa_status_t status;
fuse_desc_t *fuse_desc;
uint32_t i;
- uint32_t rd_data1[KEY_SIZE] = {0}, rd_data2[KEY_SIZE] = {0};
- uint32_t wr_data1[KEY_SIZE] = {0}, wr_data2[KEY_SIZE] = {0xF0F0F0F0};
+ uint32_t rd_data1[KEY_SIZE], rd_data2[KEY_SIZE];
+ uint32_t wr_data1[KEY_SIZE], wr_data2[KEY_SIZE];
+
+ val->memset(rd_data1, 0x0, sizeof(rd_data1)/sizeof(uint32_t));
+ val->memset(rd_data2, 0x0, sizeof(rd_data2)/sizeof(uint32_t));
+ val->memset(wr_data1, 0x0, sizeof(wr_data1)/sizeof(uint32_t));
+ val->memset(wr_data2, 0xF0, sizeof(wr_data2)/sizeof(uint32_t));
status = val->crypto_set_base_addr(SECURE_PROGRAMMABLE);
if (val->err_check_set(TEST_CHECKPOINT_1, status)) {
@@ -59,41 +64,41 @@ void test_payload(tbsa_val_api_t *val)
}
if (fuse_desc->def_val == 0) {
- for (i = 0; i < fuse_desc->size; i++)
+ for (i = 0; i < MIN(KEY_SIZE, fuse_desc->size); i++)
wr_data1[i] = 0xFFFFFFFF;
}
- status = val->fuse_ops(FUSE_WRITE, fuse_desc->addr, wr_data1, fuse_desc->size);
+ status = val->fuse_ops(FUSE_WRITE, fuse_desc->addr, wr_data1, MIN(KEY_SIZE, fuse_desc->size));
if (val->err_check_set(TEST_CHECKPOINT_3, status)) {
return;
}
- status = val->fuse_ops(FUSE_READ, fuse_desc->addr, rd_data1, fuse_desc->size);
+ status = val->fuse_ops(FUSE_READ, fuse_desc->addr, rd_data1, MIN(KEY_SIZE, fuse_desc->size));
if (val->err_check_set(TEST_CHECKPOINT_4, status)) {
return;
}
- for (i = 0; i < fuse_desc->size; i++) {
+ for (i = 0; i < MIN(KEY_SIZE, fuse_desc->size); i++) {
if (rd_data1[i] != wr_data1[i]) {
val->err_check_set(TEST_CHECKPOINT_5, TBSA_STATUS_WRITE_ERROR);
return;
}
}
- status = val->fuse_ops(FUSE_WRITE, fuse_desc->addr, wr_data2, fuse_desc->size);
+ status = val->fuse_ops(FUSE_WRITE, fuse_desc->addr, wr_data2, MIN(KEY_SIZE, fuse_desc->size));
if (val->err_check_set(TEST_CHECKPOINT_6, status)) {
return;
}
- status = val->fuse_ops(FUSE_READ, fuse_desc->addr, rd_data2, fuse_desc->size);
+ status = val->fuse_ops(FUSE_READ, fuse_desc->addr, rd_data2, MIN(KEY_SIZE, fuse_desc->size));
if (val->err_check_set(TEST_CHECKPOINT_7, status)) {
return;
}
- for (i = 0; i < fuse_desc->size; i++) {
+ for (i = 0; i < MIN(KEY_SIZE, fuse_desc->size); i++) {
if (rd_data2[i] != rd_data1[i])
{
- val->print(PRINT_ERROR, "\n Able to modify programmable bits", 0);
+ val->print(PRINT_ERROR, "\n\r\tAble to modify programmed bits", 0);
val->err_check_set(TEST_CHECKPOINT_8, TBSA_STATUS_ERROR);
return;
}
@@ -105,4 +110,3 @@ void test_payload(tbsa_val_api_t *val)
void exit_hook(tbsa_val_api_t *val)
{
}
-
diff --git a/tbsa-v8m/test_pool/crypto/test_c006/non_secure.c b/tbsa-v8m/test_pool/crypto/test_c006/non_secure.c
index 0e7e4e5c..e29faf5b 100644
--- a/tbsa-v8m/test_pool/crypto/test_c006/non_secure.c
+++ b/tbsa-v8m/test_pool/crypto/test_c006/non_secure.c
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -17,6 +17,8 @@
#include "val_test_common.h"
+#define KEY_SIZE 32
+
/* Publish these functions to the external world as associated to this test ID */
TBSA_TEST_PUBLISH(CREATE_TEST_ID(TBSA_CRYPTO_BASE, 6),
CREATE_TEST_TITLE("A Trusted HK must not be directly accessible by any software."),
@@ -25,15 +27,190 @@ TBSA_TEST_PUBLISH(CREATE_TEST_ID(TBSA_CRYPTO_BASE, 6),
test_payload,
exit_hook);
+memory_desc_t *nvram_desc;
+
void entry_hook(tbsa_val_api_t *val)
{
+ tbsa_test_init_t init = {
+ .bss_start = &__tbsa_test_bss_start__,
+ .bss_end = &__tbsa_test_bss_end__
+ };
+
+ val->test_initialize(&init);
+
+ val->set_status(RESULT_PASS(TBSA_STATUS_SUCCESS));
}
void test_payload(tbsa_val_api_t *val)
{
+ tbsa_status_t status;
+ key_desc_t *key_info_trust;
+ boot_t boot;
+ uint32_t key[KEY_SIZE];
+ uint32_t instance;
+ uint32_t trusted_hw_key_found;
+ uint32_t shcsr;
+
+ status = val->target_get_config(TARGET_CONFIG_CREATE_ID(GROUP_MEMORY, MEMORY_NVRAM, 0),
+ (uint8_t **)&nvram_desc,
+ (uint32_t *)sizeof(memory_desc_t));
+ if (val->err_check_set(TEST_CHECKPOINT_1, status)) {
+ return;
+ }
+
+ status = val->nvram_read(nvram_desc->start, TBSA_NVRAM_OFFSET(NV_BOOT), &boot, sizeof(boot_t));
+ if (val->err_check_set(TEST_CHECKPOINT_2, status)) {
+ return;
+ }
+
+ if (boot.wb != WARM_BOOT_REQUESTED) {
+
+ instance = 0x0;
+ status = val->nvram_write(nvram_desc->start, TBSA_NVRAM_OFFSET(NV_SPAD1), &instance, sizeof(instance));
+ if (val->err_check_set(TEST_CHECKPOINT_3, status)) {
+ return;
+ }
+
+ trusted_hw_key_found = 0x0;
+ status = val->nvram_write(nvram_desc->start, TBSA_NVRAM_OFFSET(NV_SPAD2), &trusted_hw_key_found, sizeof(trusted_hw_key_found));
+ if (val->err_check_set(TEST_CHECKPOINT_4, status)) {
+ return;
+ }
+ }
+
+ status = val->crypto_set_base_addr(SECURE_PROGRAMMABLE);
+ if (val->err_check_set(TEST_CHECKPOINT_5, status)) {
+ return;
+ }
+
+ status = val->nvram_read(nvram_desc->start, TBSA_NVRAM_OFFSET(NV_SPAD1), &instance, sizeof(instance));
+ if (val->err_check_set(TEST_CHECKPOINT_6, status)) {
+ return;
+ }
+
+ status = val->nvram_read(nvram_desc->start, TBSA_NVRAM_OFFSET(NV_SPAD2), &trusted_hw_key_found, sizeof(trusted_hw_key_found));
+ if (val->err_check_set(TEST_CHECKPOINT_7, status)) {
+ return;
+ }
+
+ status = val->crypto_get_key_info((key_desc_t **)&key_info_trust, TRUST, &instance);
+ if ((status != TBSA_STATUS_SUCCESS) && (!trusted_hw_key_found)) {
+ val->err_check_set(TEST_CHECKPOINT_8, status);
+ return;
+ }
+ if (status != TBSA_STATUS_SUCCESS) {
+ return;
+ }
+
+ /* Writing next instance value into nvram */
+ ++instance;
+ status = val->nvram_write(nvram_desc->start, TBSA_NVRAM_OFFSET(NV_SPAD1), &instance, sizeof(instance));
+ if (val->err_check_set(TEST_CHECKPOINT_9, status)) {
+ return;
+ }
+
+ status = val->mem_reg_read(SHCSR, &shcsr);
+ if (val->err_check_set(TEST_CHECKPOINT_A, status)) {
+ return;
+ }
+
+ if (boot.wb != WARM_BOOT_REQUESTED) {
+ /* Write WARM_BOOT_REQUESTED only for the first instance found */
+ boot.wb = WARM_BOOT_REQUESTED;
+ /* Saving the boot state */
+ status = val->nvram_write(nvram_desc->start, TBSA_NVRAM_OFFSET(NV_BOOT), &boot, sizeof(boot_t));
+ if (val->err_check_set(TEST_CHECKPOINT_B, status)) {
+ return;
+ }
+
+ trusted_hw_key_found = 0x1;
+ status = val->nvram_write(nvram_desc->start, TBSA_NVRAM_OFFSET(NV_SPAD2), &trusted_hw_key_found, sizeof(trusted_hw_key_found));
+ if (val->err_check_set(TEST_CHECKPOINT_C, status)) {
+ return;
+ }
+
+
+ status = val->nvram_write(nvram_desc->start, TBSA_NVRAM_OFFSET(NV_SHCSR), &shcsr, sizeof(shcsr));
+ if (val->err_check_set(TEST_CHECKPOINT_D, status)) {
+ return;
+ }
+ }
+
+ /* Disabling SecureFault, UsageFault, BusFault, MemFault temporarily */
+ status = val->mem_reg_write(SHCSR, (shcsr & ~0xF0000));
+ if (val->err_check_set(TEST_CHECKPOINT_E, status)) {
+ return;
+ }
+
+ /* Read key in Non-secure mode - exepct fault ? */
+ status = val_fuse_ops(FUSE_READ, key_info_trust->addr, key, MIN(KEY_SIZE, key_info_trust->size));
+ if (val->err_check_set(TEST_CHECKPOINT_F, status)) {
+ return;
+ }
+
+ /* Control shouldn't come here */
+ val->print(PRINT_ERROR, "\n\r\tFault didn't occur when Trusted HW Key accessed from Non-secure world!", 0);
+ asm volatile ("DSB");
+ asm volatile ("ISB");
+ val->system_reset(WARM_RESET);
}
void exit_hook(tbsa_val_api_t *val)
{
-}
+ tbsa_status_t status;
+ boot_t boot;
+ uint32_t active_test;
+ uint32_t default_val;
+ uint32_t shcsr;
+
+ status = val->target_get_config(TARGET_CONFIG_CREATE_ID(GROUP_MEMORY, MEMORY_NVRAM, 0),
+ (uint8_t **)&nvram_desc,
+ (uint32_t *)sizeof(memory_desc_t));
+ if (val->err_check_set(TEST_CHECKPOINT_10, status)) {
+ return;
+ }
+ active_test = 0xFFFFFFFFUL;
+ status = val->nvram_write(nvram_desc->start, TBSA_NVRAM_OFFSET(NV_ACT_TST), &active_test, sizeof(active_test));
+ if (val->err_check_set(TEST_CHECKPOINT_11, status)) {
+ return;
+ }
+
+ /* Restoring the state */
+ boot.wb = BOOT_UNKNOWN;
+ status = val->nvram_write(nvram_desc->start, TBSA_NVRAM_OFFSET(NV_BOOT), &boot, sizeof(boot_t));
+ if (val->err_check_set(TEST_CHECKPOINT_12, status)) {
+ return;
+ }
+
+ if (IS_TEST_PASS(val->get_status()))
+ {
+ status = val->nvram_read(nvram_desc->start, TBSA_NVRAM_OFFSET(NV_SHCSR), &shcsr, sizeof(shcsr));
+ if (val->err_check_set(TEST_CHECKPOINT_13, status)) {
+ return;
+ }
+
+ /* Restoring faults */
+ status = val->mem_reg_write(SHCSR, shcsr);
+ if (val->err_check_set(TEST_CHECKPOINT_14, status)) {
+ return;
+ }
+ }
+
+ /* Restoring default Handler */
+ status = val->interrupt_restore_handler(EXCP_NUM_HF);
+ if (val->err_check_set(TEST_CHECKPOINT_15, status)) {
+ return;
+ }
+
+ default_val = 0xFFFFFFFFUL;
+ status = val->nvram_write(nvram_desc->start, TBSA_NVRAM_OFFSET(NV_SPAD1), &default_val, sizeof(default_val));
+ if (val->err_check_set(TEST_CHECKPOINT_16, status)) {
+ return;
+ }
+
+ status = val->nvram_write(nvram_desc->start, TBSA_NVRAM_OFFSET(NV_SPAD2), &default_val, sizeof(default_val));
+ if (val->err_check_set(TEST_CHECKPOINT_17, status)) {
+ return;
+ }
+}
diff --git a/tbsa-v8m/test_pool/crypto/test_c006/secure.c b/tbsa-v8m/test_pool/crypto/test_c006/secure.c
index e90f52f8..28060e57 100644
--- a/tbsa-v8m/test_pool/crypto/test_c006/secure.c
+++ b/tbsa-v8m/test_pool/crypto/test_c006/secure.c
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -27,6 +27,36 @@ TBSA_TEST_PUBLISH(CREATE_TEST_ID(TBSA_CRYPTO_BASE, 6),
test_payload,
exit_hook);
+tbsa_val_api_t *g_val;
+memory_desc_t *nvram_desc;
+
+void hard_fault_esr (unsigned long *sf_args)
+{
+ /* check agianst case 3 */
+ g_val->print(PRINT_ALWAYS, "\n\r\tHardFault triggered when HUK was accessed from software", 0);
+
+ /* Issue system warm reset */
+ g_val->system_reset(WARM_RESET);
+
+ /* Shouldn't come here */
+ while(1);
+}
+
+__attribute__((naked))
+void HF_Handler(void)
+{
+ asm volatile("mrs r0, control_ns \n"
+ "mov r1, #0x2 \n"
+ "and r0, r1 \n"
+ "cmp r0, r1 \n"
+ "beq _psp_ns \n"
+ "mrs r0, msp_ns \n"
+ "b hard_fault_esr \n"
+ "_psp_ns: \n"
+ "mrs r0, psp_ns \n"
+ "b hard_fault_esr \n");
+}
+
void entry_hook(tbsa_val_api_t *val)
{
tbsa_test_init_t init = {
@@ -34,6 +64,8 @@ void entry_hook(tbsa_val_api_t *val)
.bss_end = &__tbsa_test_bss_end__
};
+ g_val = val;
+
val->test_initialize(&init);
val->set_status(RESULT_PASS(TBSA_STATUS_SUCCESS));
@@ -43,47 +75,203 @@ void entry_hook(tbsa_val_api_t *val)
void test_payload(tbsa_val_api_t *val)
{
tbsa_status_t status;
+ key_desc_t *key_info_trust;
uint32_t i, instance = 0;
uint32_t key[KEY_SIZE];
- key_desc_t *key_info_trust;
- bool_t key_present = FALSE;
+ uint32_t shcsr;
+ uint32_t trusted_hw_key_found;
+ uint32_t active_test;
+ boot_t boot;
+ bool_t check_done = FALSE;
- status = val->crypto_set_base_addr(SECURE_PROGRAMMABLE);
+ status = val->target_get_config(TARGET_CONFIG_CREATE_ID(GROUP_MEMORY, MEMORY_NVRAM, 0),
+ (uint8_t **)&nvram_desc,
+ (uint32_t *)sizeof(memory_desc_t));
if (val->err_check_set(TEST_CHECKPOINT_1, status)) {
return;
}
do {
+ status = val->nvram_read(nvram_desc->start, TBSA_NVRAM_OFFSET(NV_BOOT), &boot, sizeof(boot_t));
+ if (val->err_check_set(TEST_CHECKPOINT_2, status)) {
+ return;
+ }
+
+ status = val->nvram_read(nvram_desc->start, TBSA_NVRAM_OFFSET(NV_ACT_TST), &active_test, sizeof(active_test));
+ if (val->err_check_set(TEST_CHECKPOINT_3, status)) {
+ return;
+ }
+
+ if (active_test == TBSA_NS_TEST_ACTIVE) {
+ /* Non-secure is active - so skipping Secure test */
+ return;
+ }
+
+ if (boot.wb != WARM_BOOT_REQUESTED) {
+ instance = 0x0;
+ status = val->nvram_write(nvram_desc->start, TBSA_NVRAM_OFFSET(NV_SPAD1), &instance, sizeof(instance));
+ if (val->err_check_set(TEST_CHECKPOINT_4, status)) {
+ return;
+ }
+
+ trusted_hw_key_found = 0x0;
+ status = val->nvram_write(nvram_desc->start, TBSA_NVRAM_OFFSET(NV_SPAD2), &trusted_hw_key_found, sizeof(trusted_hw_key_found));
+ if (val->err_check_set(TEST_CHECKPOINT_5, status)) {
+ return;
+ }
+
+ status = val->interrupt_setup_handler(EXCP_NUM_HF, 0, HF_Handler);
+ if (val->err_check_set(TEST_CHECKPOINT_6, status)) {
+ return;
+ }
+
+ active_test = TBSA_S_TEST_ACTIVE;
+ status = val->nvram_write(nvram_desc->start, TBSA_NVRAM_OFFSET(NV_ACT_TST), &active_test, sizeof(active_test));
+ if (val->err_check_set(TEST_CHECKPOINT_7, status)) {
+ return;
+ }
+ }
+
+ status = val->crypto_set_base_addr(SECURE_PROGRAMMABLE);
+ if (val->err_check_set(TEST_CHECKPOINT_8, status)) {
+ return;
+ }
+
+ status = val->nvram_read(nvram_desc->start, TBSA_NVRAM_OFFSET(NV_SPAD1), &instance, sizeof(instance));
+ if (val->err_check_set(TEST_CHECKPOINT_9, status)) {
+ return;
+ }
+
+ status = val->nvram_read(nvram_desc->start, TBSA_NVRAM_OFFSET(NV_SPAD2), &trusted_hw_key_found, sizeof(trusted_hw_key_found));
+ if (val->err_check_set(TEST_CHECKPOINT_A, status)) {
+ return;
+ }
+
status = val->crypto_get_key_info((key_desc_t **)&key_info_trust, TRUST, &instance);
- if (status != TBSA_STATUS_SUCCESS && key_present == FALSE) {
- val->err_check_set(TEST_CHECKPOINT_2, status);
+ if ((status != TBSA_STATUS_SUCCESS) && (!trusted_hw_key_found)) {
+ val->print(PRINT_ALWAYS, "\n\r\tTrusted HW Key is not available to check", 0);
+ val->set_status(RESULT_SKIP(status));
+ return;
+ }
+ if (status != TBSA_STATUS_SUCCESS) {
return;
}
- if (status != TBSA_STATUS_SUCCESS)
+ /* Writing next instance value into nvram */
+ ++instance;
+ status = val->nvram_write(nvram_desc->start, TBSA_NVRAM_OFFSET(NV_SPAD1), &instance, sizeof(instance));
+ if (val->err_check_set(TEST_CHECKPOINT_B, status)) {
return;
+ }
- key_present = TRUE;
- status = val->fuse_ops(FUSE_READ, key_info_trust->addr, key, key_info_trust->size);
- if (val->err_check_set(TEST_CHECKPOINT_3, status)) {
+ status = val->mem_reg_read(SHCSR, &shcsr);
+ if (val->err_check_set(TEST_CHECKPOINT_C, status)) {
return;
}
- for (i = 0; i < key_info_trust->size; i++) {
- if (key[i] != key_info_trust->def_val) {
- val->print(PRINT_ERROR, "\n Trusted key is accessible", 0);
- val->err_check_set(TEST_CHECKPOINT_5, TBSA_STATUS_ERROR);
+ if (boot.wb != WARM_BOOT_REQUESTED) {
+ /* Write WARM_BOOT_REQUESTED only for the first instance found */
+ boot.wb = WARM_BOOT_REQUESTED;
+ /* Saving the boot state */
+ status = val->nvram_write(nvram_desc->start, TBSA_NVRAM_OFFSET(NV_BOOT), &boot, sizeof(boot_t));
+ if (val->err_check_set(TEST_CHECKPOINT_D, status)) {
return;
}
+
+ trusted_hw_key_found = 0x1;
+ status = val->nvram_write(nvram_desc->start, TBSA_NVRAM_OFFSET(NV_SPAD2), &trusted_hw_key_found, sizeof(trusted_hw_key_found));
+ if (val->err_check_set(TEST_CHECKPOINT_E, status)) {
+ return;
+ }
+
+
+ status = val->nvram_write(nvram_desc->start, TBSA_NVRAM_OFFSET(NV_SHCSR), &shcsr, sizeof(shcsr));
+ if (val->err_check_set(TEST_CHECKPOINT_F, status)) {
+ return;
+ }
+ }
+
+ /* Disabling SecureFault, UsageFault, BusFault, MemFault temporarily */
+ status = val->mem_reg_write(SHCSR, (shcsr & ~0xF0000));
+ if (val->err_check_set(TEST_CHECKPOINT_10, status)) {
+ return;
+ }
+
+
+ /* Initializing the key buffer with known value - zero */
+ val->memset((void*)key, 0x0, MIN(KEY_SIZE, key_info_trust->size));
+
+ /* Three things can happen:
+ * 1. Returns error status
+ * 2. Reads the key
+ * 3. Fault may occur
+ */
+ status = val->fuse_ops(FUSE_READ, key_info_trust->addr, key, MIN(KEY_SIZE, key_info_trust->size));
+ if (status != TBSA_STATUS_SUCCESS) {
+ for (i=0; i < MIN(KEY_SIZE, key_info_trust->size); i++) {
+ if(key[i] != 0) {
+ /* Checks against case 1 */
+ val->print(PRINT_ERROR, "\n\r\tTrusted key is accessible", 0);
+ val->err_check_set(TEST_CHECKPOINT_11, TBSA_STATUS_ERROR);
+ return;
+ }
+ }
+ check_done = TRUE;
+ val->print(PRINT_DEBUG, "\n\r\tfuse_read returned error status without updating the key buffer", 0);
}
- instance++;
- } while (instance < GET_NUM_INSTANCE(key_info_trust));
+ if(!check_done) {
+ for (i = 0; i < MIN(KEY_SIZE, key_info_trust->size); i++) {
+ if (key[i] != 0x0) {
+ /* Checks against case 2 */
+ val->print(PRINT_ERROR, "\n\r\tTrusted key is accessible", 0);
+ val->err_check_set(TEST_CHECKPOINT_12, TBSA_STATUS_ERROR);
+ return;
+ }
+ }
+ val->print(PRINT_DEBUG, "\n\r\tfuse_read returned success status and key buffer is zero", 0);
+ }
+ }while(instance < GET_NUM_INSTANCE(key_info_trust));
val->set_status(RESULT_PASS(TBSA_STATUS_SUCCESS));
}
void exit_hook(tbsa_val_api_t *val)
{
-}
+ tbsa_status_t status;
+ uint32_t shcsr = 0UL;
+ uint32_t active_test;
+ boot_t boot;
+
+ status = val->nvram_read(nvram_desc->start, TBSA_NVRAM_OFFSET(NV_ACT_TST), &active_test, sizeof(active_test));
+ if (val->err_check_set(TEST_CHECKPOINT_13, status)) {
+ return;
+ }
+
+ if (active_test == TBSA_S_TEST_ACTIVE) {
+
+ active_test = TBSA_NS_TEST_ACTIVE;
+ status = val->nvram_write(nvram_desc->start, TBSA_NVRAM_OFFSET(NV_ACT_TST), &active_test, sizeof(active_test));
+ if (val->err_check_set(TEST_CHECKPOINT_14, status)) {
+ return;
+ }
+ /* Restoring the state */
+ boot.wb = BOOT_UNKNOWN;
+ status = val->nvram_write(nvram_desc->start, TBSA_NVRAM_OFFSET(NV_BOOT), &boot, sizeof(boot_t));
+ if (val->err_check_set(TEST_CHECKPOINT_15, status)) {
+ return;
+ }
+
+ status = val->nvram_read(nvram_desc->start, TBSA_NVRAM_OFFSET(NV_SHCSR), &shcsr, sizeof(shcsr));
+ if (val->err_check_set(TEST_CHECKPOINT_16, status)) {
+ return;
+ }
+
+ /* Restoring faults */
+ status = val->mem_reg_write(SHCSR, shcsr);
+ if (val->err_check_set(TEST_CHECKPOINT_17, status)) {
+ return;
+ }
+ }
+}
diff --git a/tbsa-v8m/test_pool/crypto/test_c007/non_secure.c b/tbsa-v8m/test_pool/crypto/test_c007/non_secure.c
index d63db46a..9a1caff8 100644
--- a/tbsa-v8m/test_pool/crypto/test_c007/non_secure.c
+++ b/tbsa-v8m/test_pool/crypto/test_c007/non_secure.c
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -20,7 +20,7 @@
/* Publish these functions to the external world as associated to this test ID */
TBSA_TEST_PUBLISH(CREATE_TEST_ID(TBSA_CRYPTO_BASE, 7),
CREATE_TEST_TITLE("A confidential hardware IP fuse must not be readable by any software"),
- CREATE_REF_TAG("R080/R090_TBSA_KEY"),
+ CREATE_REF_TAG("R080/R090_TBSA_FUSE"),
entry_hook,
test_payload,
exit_hook);
diff --git a/tbsa-v8m/test_pool/crypto/test_c007/secure.c b/tbsa-v8m/test_pool/crypto/test_c007/secure.c
index ddb7f52b..9a39b69c 100644
--- a/tbsa-v8m/test_pool/crypto/test_c007/secure.c
+++ b/tbsa-v8m/test_pool/crypto/test_c007/secure.c
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -68,6 +68,8 @@ void test_payload(tbsa_val_api_t *val)
boot_t boot;
uint32_t shcsr = 0UL;
+ val->memset(key, 0x0, sizeof(key)/sizeof(uint32_t));
+
status = val->target_get_config(TARGET_CONFIG_CREATE_ID(GROUP_MEMORY, MEMORY_NVRAM, 0),
(uint8_t **)&memory_desc,
(uint32_t *)sizeof(memory_desc_t));
@@ -113,14 +115,14 @@ void test_payload(tbsa_val_api_t *val)
return;
}
- status = val->fuse_ops(FUSE_READ, fuse_desc->addr, key, fuse_desc->size);
+ status = val->fuse_ops(FUSE_READ, fuse_desc->addr, key, MIN(KEY_SIZE, fuse_desc->size));
if (val->err_check_set(TEST_CHECKPOINT_A, status)) {
return;
}
- for (i = 0; i < fuse_desc->size; i++) {
+ for (i = 0; i < MIN(KEY_SIZE, fuse_desc->size); i++) {
if (key[i] != fuse_desc->def_val) {
- val->print(PRINT_ERROR, "\n Able to read the confidential fuse", 0);
+ val->print(PRINT_ERROR, "\n\r\tAble to read the confidential fuse", 0);
val->err_check_set(TEST_CHECKPOINT_C, TBSA_STATUS_ERROR);
return;
}
diff --git a/tbsa-v8m/test_pool/crypto/test_c008/secure.c b/tbsa-v8m/test_pool/crypto/test_c008/secure.c
index 134826e3..f1ea5af6 100644
--- a/tbsa-v8m/test_pool/crypto/test_c008/secure.c
+++ b/tbsa-v8m/test_pool/crypto/test_c008/secure.c
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -63,7 +63,7 @@ void test_payload(tbsa_val_api_t *val)
return;
key_present = TRUE;
- status = val->fuse_ops(FUSE_READ, key_info_rev->addr, key, key_info_rev->size);
+ status = val->fuse_ops(FUSE_READ, key_info_rev->addr, key, MIN(KEY_SIZE, key_info_rev->size));
if (val->err_check_set(TEST_CHECKPOINT_3, status)) {
return;
}
@@ -71,18 +71,18 @@ void test_payload(tbsa_val_api_t *val)
if (key_info_rev->def_val == 0) {
data = 0;
/* Check that if Key is non-zero*/
- for(i = 0; i < key_info_rev->size; i++)
+ for(i = 0; i < MIN(KEY_SIZE, key_info_rev->size); i++)
data += key[i];
if (!data) {
- val->print(PRINT_ERROR, "\n Incorrect key", 0);
+ val->print(PRINT_ERROR, "\n\r\tIncorrect key - all bits are zero", 0);
val->err_check_set(TEST_CHECKPOINT_4, TBSA_STATUS_INCORRECT_VALUE);
return;
}
} else {
- for (i = 0; i < key_info_rev->size; i++) {
+ for (i = 0; i < MIN(KEY_SIZE, key_info_rev->size); i++) {
if (key[i] == key_info_rev->def_val) {
- val->print(PRINT_ERROR, "\n Incorrect key", 0);
+ val->print(PRINT_ERROR, "\n\r\tIncorrect key - insufficient entropy/unprogrammed word", 0);
val->err_check_set(TEST_CHECKPOINT_5, TBSA_STATUS_INCORRECT_VALUE);
return;
}
@@ -94,15 +94,15 @@ void test_payload(tbsa_val_api_t *val)
return;
}
- status = val->fuse_ops(FUSE_READ, key_info_rev->addr, rev_key, key_info_rev->size);
+ status = val->fuse_ops(FUSE_READ, key_info_rev->addr, rev_key, MIN(KEY_SIZE, key_info_rev->size));
if (val->err_check_set(TEST_CHECKPOINT_7, status)) {
return;
}
/* Check that if Key is not same after it is revoked*/
- for(i = 0; i < key_info_rev->size; i++) {
+ for(i = 0; i < MIN(KEY_SIZE, key_info_rev->size); i++) {
if(key[i] == rev_key[i]) {
- val->print(PRINT_ERROR, "\n Key is not revoked", 0);
+ val->print(PRINT_ERROR, "\n\r\tKey is not revoked", 0);
val->err_check_set(TEST_CHECKPOINT_8, TBSA_STATUS_ERROR);
return;
}
diff --git a/tbsa-v8m/test_pool/crypto/test_c009/non_secure.c b/tbsa-v8m/test_pool/crypto/test_c009/non_secure.c
index 86b098c3..6bf93367 100644
--- a/tbsa-v8m/test_pool/crypto/test_c009/non_secure.c
+++ b/tbsa-v8m/test_pool/crypto/test_c009/non_secure.c
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -20,7 +20,7 @@
/* Publish these functions to the external world as associated to this test ID */
TBSA_TEST_PUBLISH(CREATE_TEST_ID(TBSA_CRYPTO_BASE, 9),
CREATE_TEST_TITLE("Check if a lockable fuse is fixed in its current state"),
- CREATE_REF_TAG("R120/R140_TBSA_KEY"),
+ CREATE_REF_TAG("R120/R140_TBSA_FUSE"),
entry_hook,
test_payload,
exit_hook);
diff --git a/tbsa-v8m/test_pool/crypto/test_c009/secure.c b/tbsa-v8m/test_pool/crypto/test_c009/secure.c
index 5d8e6854..97a6bde9 100644
--- a/tbsa-v8m/test_pool/crypto/test_c009/secure.c
+++ b/tbsa-v8m/test_pool/crypto/test_c009/secure.c
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -18,9 +18,10 @@
#include "val_test_common.h"
#define FUSE_SIZE 32
+
/* Publish these functions to the external world as associated to this test ID */
TBSA_TEST_PUBLISH(CREATE_TEST_ID(TBSA_CRYPTO_BASE, 9),
- CREATE_TEST_TITLE("Check if a lockable fuse is fixed in its current state"),
+ CREATE_TEST_TITLE("Check if a lockable fuse is fixed in its current state"),
CREATE_REF_TAG("R120/R140_TBSA_FUSE"),
entry_hook,
test_payload,
@@ -58,32 +59,32 @@ void test_payload(tbsa_val_api_t *val)
}
if (fuse_desc->def_val == 0) {
- for (i = 0; i < fuse_desc->size; i++)
+ for (i = 0; i < MIN(FUSE_SIZE, fuse_desc->size); i++)
wr_data[i] = 0xFFFFFFFF;
} else {
- for (i = 0; i < fuse_desc->size; i++)
+ for (i = 0; i < MIN(FUSE_SIZE, fuse_desc->size); i++)
wr_data[i] = 0;
}
- status = val->fuse_ops(FUSE_READ, fuse_desc->addr, fuse_data, fuse_desc->size);
+ status = val->fuse_ops(FUSE_READ, fuse_desc->addr, fuse_data, MIN(FUSE_SIZE, fuse_desc->size));
if (val->err_check_set(TEST_CHECKPOINT_3, status)) {
return;
}
- status = val->fuse_ops(FUSE_WRITE, fuse_desc->addr, wr_data, fuse_desc->size);
+ status = val->fuse_ops(FUSE_WRITE, fuse_desc->addr, wr_data, MIN(FUSE_SIZE, fuse_desc->size));
if (val->err_check_set(TEST_CHECKPOINT_4, status)) {
return;
}
- status = val->fuse_ops(FUSE_READ, fuse_desc->addr, rd_data, fuse_desc->size);
+ status = val->fuse_ops(FUSE_READ, fuse_desc->addr, rd_data, MIN(FUSE_SIZE, fuse_desc->size));
if (val->err_check_set(TEST_CHECKPOINT_5, status)) {
return;
}
/* Check that the fuse is not modified */
- for (i = 0; i < fuse_desc->size; i++) {
+ for (i = 0; i < MIN(FUSE_SIZE, fuse_desc->size); i++) {
if (fuse_data[i] != rd_data[i]) {
- val->print(PRINT_ERROR, "\n Able to modify locked fuse", 0);
+ val->print(PRINT_ERROR, "\n\r\tAble to modify locked fuse", 0);
val->err_check_set(TEST_CHECKPOINT_6, TBSA_STATUS_ERROR);
return;
}
diff --git a/tbsa-v8m/test_pool/crypto/test_c010/secure.c b/tbsa-v8m/test_pool/crypto/test_c010/secure.c
index 28e65855..de4e6af3 100644
--- a/tbsa-v8m/test_pool/crypto/test_c010/secure.c
+++ b/tbsa-v8m/test_pool/crypto/test_c010/secure.c
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -18,6 +18,7 @@
#include "val_test_common.h"
#define FUSE_SIZE 32
+
/* Publish these functions to the external world as associated to this test ID */
TBSA_TEST_PUBLISH(CREATE_TEST_ID(TBSA_CRYPTO_BASE, 10),
CREATE_TEST_TITLE("Check blowing fuses when the device has left the manufacturing facility."),
@@ -40,13 +41,16 @@ void entry_hook(tbsa_val_api_t *val)
void test_payload(tbsa_val_api_t *val)
{
- tbsa_status_t status;
- uint32_t crypto_lcs;
- uint32_t i, index = 0;
- crypto_hdr_t *crypto_hdr;
- crypto_desc_t *crypto_desc;
- fuse_desc_t *fuse_desc;
- uint32_t rd_data[FUSE_SIZE], wr_data[FUSE_SIZE] = {0xFFFFFFFF};
+ tbsa_status_t status;
+ uint32_t crypto_lcs;
+ uint32_t i, index = 0;
+ crypto_hdr_t *crypto_hdr;
+ crypto_desc_t *crypto_desc;
+ fuse_desc_t *fuse_desc;
+ uint32_t rd_data[FUSE_SIZE], wr_data[FUSE_SIZE];
+ bool_t secure_crypto_found = FALSE;
+
+ val->memset(wr_data, 0xFF, sizeof(wr_data)/sizeof(uint32_t));
status = val->crypto_set_base_addr(SECURE_PROGRAMMABLE);
if (val->err_check_set(TEST_CHECKPOINT_1, status)) {
@@ -80,11 +84,13 @@ void test_payload(tbsa_val_api_t *val)
continue;
}
+ secure_crypto_found = TRUE;
+
break;
}
- if (!(crypto_desc->lcs == LCS_SEC_ENABLED || crypto_lcs == LCS_SEC_ENABLED)) {
- val->print(PRINT_ERROR, "\n Device has not left the manufacturing facility", 0);
+ if (secure_crypto_found && (!(crypto_desc->lcs == LCS_SEC_ENABLED || crypto_lcs == LCS_SEC_ENABLED))) {
+ val->print(PRINT_ERROR, "\n\r\tDevice has not left the manufacturing facility", 0);
val->set_status(RESULT_SKIP(1));
return;
}
@@ -94,42 +100,41 @@ void test_payload(tbsa_val_api_t *val)
return;
}
- status = val->fuse_ops(FUSE_READ, fuse_desc->addr, rd_data, fuse_desc->size);
+ status = val->fuse_ops(FUSE_READ, fuse_desc->addr, rd_data, MIN(FUSE_READ, fuse_desc->size));
if (val->err_check_set(TEST_CHECKPOINT_6, status)) {
return;
}
if (fuse_desc->def_val != 0) {
- for (i = 0; i < fuse_desc->size; i++)
+ for (i = 0; i < MIN(FUSE_READ, fuse_desc->size); i++)
wr_data[i] = 0;
}
- for (i = 0; i < fuse_desc->size; i++) {
+ for (i = 0; i < MIN(FUSE_READ, fuse_desc->size); i++) {
if (rd_data[i] != fuse_desc->def_val) {
- val->print(PRINT_ERROR, "\n Given fuse is not empty", 0);
+ val->print(PRINT_ERROR, "\n\r\tGiven fuse is not empty", 0);
val->err_check_set(TEST_CHECKPOINT_7, TBSA_STATUS_INVALID);
return;
}
}
- status = val->fuse_ops(FUSE_WRITE, fuse_desc->addr, wr_data, fuse_desc->size);
+ status = val->fuse_ops(FUSE_WRITE, fuse_desc->addr, wr_data, MIN(FUSE_READ, fuse_desc->size));
if (val->err_check_set(TEST_CHECKPOINT_8, status)) {
return;
}
- status = val->fuse_ops(FUSE_READ, fuse_desc->addr, rd_data, fuse_desc->size);
+ status = val->fuse_ops(FUSE_READ, fuse_desc->addr, rd_data, MIN(FUSE_READ, fuse_desc->size));
if (val->err_check_set(TEST_CHECKPOINT_9, status)) {
return;
}
- for (i = 0; i < fuse_desc->size; i++) {
+ for (i = 0; i < MIN(FUSE_READ, fuse_desc->size); i++) {
if (rd_data[i] != wr_data[i]) {
- val->print(PRINT_ERROR, "\n Not able to program the fuse", 0);
+ val->print(PRINT_ERROR, "\n\r\tNot able to program the fuse", 0);
val->err_check_set(TEST_CHECKPOINT_A, status);
return;
}
}
-
}
void exit_hook(tbsa_val_api_t *val)
diff --git a/tbsa-v8m/test_pool/crypto/test_c011/secure.c b/tbsa-v8m/test_pool/crypto/test_c011/secure.c
index 87756a2d..ef5ddfbe 100644
--- a/tbsa-v8m/test_pool/crypto/test_c011/secure.c
+++ b/tbsa-v8m/test_pool/crypto/test_c011/secure.c
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -18,6 +18,7 @@
#include "val_test_common.h"
#define FUSE_SIZE 32
+
/* Publish these functions to the external world as associated to this test ID */
TBSA_TEST_PUBLISH(CREATE_TEST_ID(TBSA_CRYPTO_BASE, 11),
CREATE_TEST_TITLE("Check a confidential SW receipient fuse is readable by privileged software."),
@@ -55,11 +56,13 @@ void test_payload(tbsa_val_api_t *val)
{
tbsa_status_t status;
fuse_desc_t *fuse_desc;
- uint32_t data[FUSE_SIZE], data1[FUSE_SIZE] = {0};
+ uint32_t data[FUSE_SIZE], data1[FUSE_SIZE];
boot_t boot;
uint32_t shcsr = 0UL;
uint32_t control, i;
+ val->memset(data1, 0x0, sizeof(data1)/sizeof(uint32_t));
+
status = val->target_get_config(TARGET_CONFIG_CREATE_ID(GROUP_MEMORY, MEMORY_NVRAM, 0),
(uint8_t **)&memory_desc,
(uint32_t *)sizeof(memory_desc_t));
@@ -72,13 +75,13 @@ void test_payload(tbsa_val_api_t *val)
return;
}
- status = val->interrupt_setup_handler(EXCP_NUM_HF, 0, HF_Handler);
- if(val->err_check_set(TEST_CHECKPOINT_3, status)) {
- return;
- }
-
if (boot.wb != WARM_BOOT_REQUESTED) {
+ status = val->interrupt_setup_handler(EXCP_NUM_HF, 0, HF_Handler);
+ if (val->err_check_set(TEST_CHECKPOINT_3, status)) {
+ return;
+ }
+
status = val->crypto_set_base_addr(SECURE_PROGRAMMABLE);
if (val->err_check_set(TEST_CHECKPOINT_4, status)) {
return;
@@ -113,14 +116,14 @@ void test_payload(tbsa_val_api_t *val)
return;
}
- status = val->fuse_ops(FUSE_READ, fuse_desc->addr, data, fuse_desc->size);
+ status = val->fuse_ops(FUSE_READ, fuse_desc->addr, data, MIN(FUSE_SIZE, fuse_desc->size));
if (val->err_check_set(TEST_CHECKPOINT_A, status)) {
return;
}
- for (i = 0; i < fuse_desc->size; i++) {
+ for (i = 0; i < MIN(FUSE_SIZE, fuse_desc->size); i++) {
if (data[i] == fuse_desc->def_val) {
- val->print(PRINT_ERROR, "\n The given fuse is empty", 0);
+ val->print(PRINT_ERROR, "\n\r\tThe given fuse is empty", 0);
val->err_check_set(TEST_CHECKPOINT_B, TBSA_STATUS_ERROR);
return;
}
@@ -132,20 +135,29 @@ void test_payload(tbsa_val_api_t *val)
asm volatile ("MSR control, %0" : : "r" (control) : "memory");
/* Performing unprivilege access to Confidential fuse */
- status = val->fuse_ops(FUSE_READ, fuse_desc->addr, data1, fuse_desc->size);
+ status = val->fuse_ops(FUSE_READ, fuse_desc->addr, data1, MIN(FUSE_SIZE, fuse_desc->size));
if (val->err_check_set(TEST_CHECKPOINT_C, status)) {
return;
}
- for (i = 0; i < fuse_desc->size; i++) {
+ for (i = 0; i < MIN(FUSE_SIZE, fuse_desc->size); i++) {
if (data1[i] == data[i]) {
- val->print(PRINT_ERROR, "\n Able to access confidential fuse in unprivilege mode", 0);
+ val->print(PRINT_ERROR, "\n\r\tAble to access confidential fuse in unprivilege mode", 0);
val->err_check_set(TEST_CHECKPOINT_D, TBSA_STATUS_ERROR);
return;
}
}
}
+ val->set_status(RESULT_PASS(TBSA_STATUS_SUCCESS));
+}
+
+void exit_hook(tbsa_val_api_t *val)
+{
+ tbsa_status_t status;
+ boot_t boot;
+ uint32_t shcsr = 0UL;
+
/* Restoring the state */
boot.wb = BOOT_UNKNOWN;
status = val->nvram_write(memory_desc->start, TBSA_NVRAM_OFFSET(NV_BOOT), &boot, sizeof(boot_t));
@@ -164,13 +176,6 @@ void test_payload(tbsa_val_api_t *val)
return;
}
- val->set_status(RESULT_PASS(TBSA_STATUS_SUCCESS));
-}
-
-void exit_hook(tbsa_val_api_t *val)
-{
- tbsa_status_t status;
-
/* Restoring default Handler */
status = val->interrupt_restore_handler(EXCP_NUM_HF);
if (val->err_check_set(TEST_CHECKPOINT_11, status)) {
diff --git a/tbsa-v8m/test_pool/debug/Makefile b/tbsa-v8m/test_pool/debug/Makefile
deleted file mode 100644
index 7cfe1de7..00000000
--- a/tbsa-v8m/test_pool/debug/Makefile
+++ /dev/null
@@ -1,77 +0,0 @@
-#/** @file
-# * Copyright (c) 2018, 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
-PREFIX:=arm-none-eabi-
-CC:=$(PREFIX)gcc
-CXX:=$(PREFIX)g++
-AS:=$(PREFIX)as
-OBJCOPY:=$(PREFIX)objcopy
-OBJDUMP:=$(PREFIX)objdump
-
-# Test specific macros
-OUT_DIR:=./out
-
-# Root folder
-ROOT_DIR:=.
-
-.PHONY: all clean
-
-VAL_LIB :=../../out/$(TARGET)/tbsa_val.a
-PAL_LIB :=../../out/$(TARGET)/tbsa_pal.a
-SYSLIBS :=$(VAL_LIB) $(PAL_LIB) -lgcc -lc -lnosys
-INCDIR := ../../val/include/
-CFLAGS :=-march=armv8-m.$(ARCH) -mthumb -Wall -Werror -O0 -I$(INCDIR)
-SBUILD :=-mcmse
-
-LDFLAGS :=\
- -Xlinker --fatal-warnings \
- -Xlinker --gc-sections \
- -z max-page-size=0x400
-
-SFLAGS :=\
- $(CFLAGS) \
- $(SBUILD) \
- -nostartfiles \
- -T../../platform/board/${TARGET}/linker/test_s.linker \
- $(LDFLAGS)
-
-NSFLAGS :=\
- $(CFLAGS) \
- -nostartfiles \
- -T../../platform/board/${TARGET}/linker/test_ns.linker \
- $(LDFLAGS)
-
-s_src :=secure.c
-ns_src :=non_secure.c
-
-DIR :=$(dir $(wildcard $(ROOT_DIR)/*/))
-DIR :=$(filter-out ./, $(DIR))
-
-all: build
-
-build:
- $(foreach d, $(DIR), mkdir -p $(d)$(OUT_DIR); \
- $(CC) $(SFLAGS) -Xlinker -Map=$(d)$(OUT_DIR)/$(s_src).map -o $(d)$(OUT_DIR)/$(s_src).elf $(d)$(s_src) $(SYSLIBS); \
- $(OBJCOPY) $(d)$(OUT_DIR)/$(s_src).elf -O binary $(d)$(OUT_DIR)/$(s_src).bin; \
- $(OBJDUMP) -d $(d)$(OUT_DIR)/$(s_src).elf > $(d)$(OUT_DIR)/$(s_src).asm; \
- $(CC) $(NSFLAGS) -Xlinker -Map=$(d)$(OUT_DIR)/$(ns_src).map -o $(d)$(OUT_DIR)/$(ns_src).elf $(d)$(ns_src) $(SYSLIBS); \
- $(OBJCOPY) $(d)$(OUT_DIR)/$(ns_src).elf -O binary $(d)$(OUT_DIR)/$(ns_src).bin; \
- $(OBJDUMP) -d $(d)$(OUT_DIR)/$(ns_src).elf > $(d)$(OUT_DIR)/$(ns_src).asm;)
-
-clean:
- $(foreach d, $(DIR), rm -rf $(d)$(OUT_DIR))
diff --git a/tbsa-v8m/test_pool/debug/test_d001/secure.c b/tbsa-v8m/test_pool/debug/test_d001/secure.c
index e2ed2dc1..c7d316f0 100644
--- a/tbsa-v8m/test_pool/debug/test_d001/secure.c
+++ b/tbsa-v8m/test_pool/debug/test_d001/secure.c
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -17,7 +17,8 @@
#include "val_test_common.h"
-#define TEST_DATA 0x12DEED21
+#define TEST_DATA 0x12DEED21
+
tbsa_val_api_t *g_val;
dpm_desc_t *dpm_desc;
@@ -80,8 +81,8 @@ tbsa_status_t test_dbg_seq_read(uint32_t *addr, dbg_seq_status_t seq_status)
void test_payload(tbsa_val_api_t *val)
{
tbsa_status_t status;
- uint32_t data, dpm_instance, s_addr=0, ns_addr=0;
- uint32_t region_num = 0, instance = 0, minor_id = 1, region_num_inst;
+ uint32_t data, dpm_instance;
+ uint32_t region_num = 0, instance = 0, minor_id = MEMORY_SRAM;
dpm_hdr_t *dpm_hdr;
memory_hdr_t *memory_hdr;
memory_desc_t *memory_desc;
@@ -94,7 +95,7 @@ void test_payload(tbsa_val_api_t *val)
/* Check if DPM is present.*/
if (!dpm_hdr->num) {
- val->print(PRINT_ERROR, "\nNo DPM present in the platform", 0);
+ val->print(PRINT_ERROR, "\n\r\tNo DPM present in the platform", 0);
val->err_check_set(TEST_CHECKPOINT_2, TBSA_STATUS_NOT_FOUND);
return;
}
@@ -115,7 +116,7 @@ void test_payload(tbsa_val_api_t *val)
}
/* Set the DPM state to Open.*/
- status = val->dpm_set_state(dpm_desc->index, DPM_OPEN_STATE, dpm_desc->unlock_token);
+ status = val->dpm_set_state(dpm_desc, DPM_OPEN_STATE);
if (val->err_check_set(TEST_CHECKPOINT_5, status)) {
goto clean_up;
}
@@ -126,23 +127,16 @@ void test_payload(tbsa_val_api_t *val)
goto clean_up;
}
/*Check for R/W address controlled by DPM under check, and access*/
- for (region_num = 0; region_num < memory_hdr->num; region_num++) {
+ for (region_num = 0; region_num < memory_hdr->num;) {
instance = 0;
do {
status = val->target_get_config(TARGET_CONFIG_CREATE_ID(GROUP_MEMORY, minor_id, instance),
(uint8_t **)&memory_desc, (uint32_t *)sizeof(memory_desc_t));
- if (status == TBSA_STATUS_NOT_FOUND) {
- break;
- } else if (val->err_check_set(TEST_CHECKPOINT_7, status)) {
+ if (val->err_check_set(TEST_CHECKPOINT_7, status)) {
goto clean_up;
}
- region_num_inst = GET_NUM_INSTANCE(memory_desc);
if ((memory_desc->dpm_index == dpm_desc->index) && (memory_desc->mem_type == TYPE_NORMAL_READ_WRITE)) {
- if (memory_desc->attribute == MEM_NONSECURE)
- ns_addr++;
- else
- s_addr++;
/*Initialize the memory with known data*/
val->mem_write((uint32_t *)memory_desc->start, WORD, TEST_DATA);
@@ -156,7 +150,7 @@ void test_payload(tbsa_val_api_t *val)
if (data != TEST_DATA) {
val->err_check_set(TEST_CHECKPOINT_8, TBSA_STATUS_ERROR);
- val->print(PRINT_ERROR, "\nIncorrect data returned by debugger, actual = 0x%x", data);
+ val->print(PRINT_ERROR, "\n\r\tIncorrect data returned by debugger, actual = 0x%x", data);
val->print(PRINT_ERROR, " expected = 0x%x", TEST_DATA);
goto clean_up;
}
@@ -164,42 +158,30 @@ void test_payload(tbsa_val_api_t *val)
/*Initialize the memory with known data*/
val->mem_write((uint32_t *)memory_desc->start, WORD, ~TEST_DATA);
- if (test_dbg_seq_write((uint32_t)(memory_desc->start), SEQ_OPEN_STATE_WRITE))
- goto clean_up;
-
- if (test_dbg_seq_write(TEST_DATA, SEQ_OPEN_STATE_WRITE))
+ if (test_dbg_seq_write((uint32_t)(memory_desc->start), SEQ_OPEN_STATE_WRITE)) {
goto clean_up;
+ }
- /* Read the data returned by debugger and compare to get the results.*/
- if(test_dbg_seq_read(&data, SEQ_OPEN_STATE_WRITE))
+ if (test_dbg_seq_write(TEST_DATA, SEQ_OPEN_STATE_WRITE)) {
goto clean_up;
+ }
val->mem_read((uint32_t *)memory_desc->start, WORD, &data);
if (data != TEST_DATA) {
val->err_check_set(TEST_CHECKPOINT_9, TBSA_STATUS_ERROR);
- val->print(PRINT_ERROR, "\nIncorrect data returned by debugger, actual = 0x%x", data);
+ val->print(PRINT_ERROR, "\n\r\tIncorrect data returned by debugger, actual = 0x%x", data);
val->print(PRINT_ERROR, " expected = 0x%x", TEST_DATA);
goto clean_up;
}
}
instance++;
- } while (instance < region_num_inst);
+ } while (instance < GET_NUM_INSTANCE(memory_desc));
minor_id++;
- if (status == TBSA_STATUS_NOT_FOUND)
- region_num -= 1;
- else
- region_num += region_num_inst - 1;
+ region_num += GET_NUM_INSTANCE(memory_desc);
}
}
- if (!ns_addr) {
- val->print(PRINT_WARN, "\n No non-secure address were accessed", 0);
- }
- if (!s_addr) {
- val->print(PRINT_WARN, "\n No secure address were accessed", 0);
- }
-
/*Signal the debugger that the test is complete*/
status = val->debug_set_status(DBG_INIT, SEQ_NEXT_TEST);
if (val->err_check_set(TEST_CHECKPOINT_A, status)) {
@@ -214,7 +196,6 @@ void test_payload(tbsa_val_api_t *val)
if (val->err_check_set(TEST_CHECKPOINT_B, status)) {
return;
}
-
}
void exit_hook(tbsa_val_api_t *val)
diff --git a/tbsa-v8m/test_pool/debug/test_d002/non_secure.c b/tbsa-v8m/test_pool/debug/test_d002/non_secure.c
index 7c0c163b..8bd3dc57 100644
--- a/tbsa-v8m/test_pool/debug/test_d002/non_secure.c
+++ b/tbsa-v8m/test_pool/debug/test_d002/non_secure.c
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -111,8 +111,8 @@ void entry_hook(tbsa_val_api_t *val)
void test_payload(tbsa_val_api_t *val)
{
tbsa_status_t status;
- uint32_t data, dpm_instance, s_addr=0, ns_addr=0;
- uint32_t region_num = 0, instance = 0, minor_id = 1, region_num_inst;
+ uint32_t data, dpm_instance;
+ uint32_t region_num = 0, instance = 0, minor_id = MEMORY_SRAM;
memory_hdr_t *memory_hdr;
memory_desc_t *memory_desc;
@@ -124,7 +124,7 @@ void test_payload(tbsa_val_api_t *val)
/* Check if DPM is present.*/
if (!dpm_hdr->num) {
- val->print(PRINT_ERROR, "\nNo DPM present in the platform", 0);
+ val->print(PRINT_ERROR, "\n\r\tNo DPM present in the platform", 0);
val->err_check_set(TEST_CHECKPOINT_2, TBSA_STATUS_NOT_FOUND);
return;
}
@@ -145,7 +145,7 @@ void test_payload(tbsa_val_api_t *val)
}
/* Set the DPM state to Open.*/
- status = val->dpm_set_state(dpm_desc->index, DPM_OPEN_STATE, dpm_desc->unlock_token);
+ status = val->dpm_set_state(dpm_desc, DPM_OPEN_STATE);
if (val->err_check_set(TEST_CHECKPOINT_5, status)) {
return;
}
@@ -162,23 +162,16 @@ void test_payload(tbsa_val_api_t *val)
goto clean_up;
}
/*Check for R/W address controlled by DPM under check, and access*/
- for (region_num = 0; region_num < memory_hdr->num; region_num++) {
+ for (region_num = 0; region_num < memory_hdr->num;) {
instance = 0;
do {
status = val->target_get_config(TARGET_CONFIG_CREATE_ID(GROUP_MEMORY, minor_id, instance),
(uint8_t **)&memory_desc, (uint32_t *)sizeof(memory_desc_t));
- if (status == TBSA_STATUS_NOT_FOUND) {
- break;
- } else if (val->err_check_set(TEST_CHECKPOINT_8, status)) {
+ if (val->err_check_set(TEST_CHECKPOINT_8, status)) {
goto clean_up;
}
- region_num_inst = GET_NUM_INSTANCE(memory_desc);
if ((memory_desc->dpm_index == dpm_desc->index) && (memory_desc->mem_type == TYPE_NORMAL_READ_WRITE)) {
- if (memory_desc->attribute == MEM_NONSECURE)
- ns_addr++;
- else
- s_addr++;
/*Initialize the memory with known data*/
val->mem_write((uint32_t *)memory_desc->start, WORD, TEST_DATA);
@@ -193,47 +186,45 @@ void test_payload(tbsa_val_api_t *val)
if (memory_desc->attribute == MEM_NONSECURE) {
if (data != TEST_DATA) {
val->err_check_set(TEST_CHECKPOINT_9, TBSA_STATUS_ERROR);
- val->print(PRINT_ERROR, "\nIncorrect data returned by debugger, actual = 0x%x", data);
+ val->print(PRINT_ERROR, "\n\r\tIncorrect data returned by debugger, actual = 0x%x", data);
val->print(PRINT_ERROR, " expected = 0x%x", TEST_DATA);
goto clean_up;
}
} else {
if (data == TEST_DATA) {
val->err_check_set(TEST_CHECKPOINT_A, TBSA_STATUS_ERROR);
- val->print(PRINT_ERROR, "\nDPM could not restrict access to Trusted assets", 0);
- val->print(PRINT_ERROR, "\nDebugger read the actual data = 0x%x", TEST_DATA);
+ val->print(PRINT_ERROR, "\n\r\tDPM could not restrict access to Trusted assets", 0);
+ val->print(PRINT_ERROR, "\n\r\tDebugger read the actual data = 0x%x", TEST_DATA);
val->print(PRINT_ERROR, " at address = 0x%x", (uint32_t)(memory_desc->start));
goto clean_up;
}
}
- /*Initialize the memory with known data*/
+ /* Initialize the memory with known data */
val->mem_write((uint32_t *)memory_desc->start, WORD, ~TEST_DATA);
- if (test_dbg_seq_write((uint32_t)(memory_desc->start), SEQ_OPEN_STATE_WRITE))
+ if (test_dbg_seq_write((uint32_t)(memory_desc->start), SEQ_OPEN_STATE_WRITE)) {
goto clean_up;
+ }
- if (test_dbg_seq_write(TEST_DATA, SEQ_OPEN_STATE_WRITE))
- goto clean_up;
-
- /* Read the data returned by debugger and compare to get the results.*/
- if(test_dbg_seq_read(&data, SEQ_OPEN_STATE_WRITE))
+ if (test_dbg_seq_write(TEST_DATA, SEQ_OPEN_STATE_WRITE)) {
goto clean_up;
+ }
val->mem_read((uint32_t *)memory_desc->start, WORD, &data);
if (memory_desc->attribute == MEM_NONSECURE) {
if (data != TEST_DATA) {
val->err_check_set(TEST_CHECKPOINT_B, TBSA_STATUS_ERROR);
- val->print(PRINT_ERROR, "\nIncorrect data returned by debugger, actual = 0x%x", data);
+ val->print(PRINT_ERROR, "\n\r\tIncorrect data returned by debugger, actual = 0x%x", data);
val->print(PRINT_ERROR, " expected = 0x%x", TEST_DATA);
goto clean_up;
}
} else {
if (data != ~TEST_DATA) {
val->err_check_set(TEST_CHECKPOINT_C, TBSA_STATUS_ERROR);
- val->print(PRINT_ERROR, "\nDPM could not restrict access to Trusted assets", 0);
- val->print(PRINT_ERROR, "\nDebugger read the actual data = 0x%x", TEST_DATA);
+ val->print(PRINT_ERROR, "\n\r\tDPM could not restrict access to Trusted assets", 0);
+ val->print(PRINT_ERROR, "\n\r\tDebugger read the actual data = 0x%x", TEST_DATA);
val->print(PRINT_ERROR, " at address = 0x%x", (uint32_t)(memory_desc->start));
goto clean_up;
}
@@ -241,22 +232,12 @@ void test_payload(tbsa_val_api_t *val)
}
instance++;
- } while (instance < region_num_inst);
+ } while (instance < GET_NUM_INSTANCE(memory_desc));
minor_id++;
- if (status == TBSA_STATUS_NOT_FOUND)
- region_num -= 1;
- else
- region_num += region_num_inst - 1;
+ region_num += GET_NUM_INSTANCE(memory_desc);;
}
}
- if (!ns_addr) {
- val->print(PRINT_WARN, "\n No non-secure address were accessed", 0);
- }
- if (!s_addr) {
- val->print(PRINT_WARN, "\n No secure address were accessed", 0);
- }
-
if (test_env_reset())
return;
@@ -271,5 +252,10 @@ void test_payload(tbsa_val_api_t *val)
void exit_hook(tbsa_val_api_t *val)
{
-}
+ tbsa_status_t status;
+ status = val->debug_set_status(DBG_INIT, SEQ_NEXT_TEST);
+ if (val->err_check_set(TEST_CHECKPOINT_14, status)) {
+ return;
+ }
+}
diff --git a/tbsa-v8m/test_pool/debug/test_d003/secure.c b/tbsa-v8m/test_pool/debug/test_d003/secure.c
index f8036ad9..7d06acb5 100644
--- a/tbsa-v8m/test_pool/debug/test_d003/secure.c
+++ b/tbsa-v8m/test_pool/debug/test_d003/secure.c
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -24,7 +24,8 @@
tbsa_val_api_t *g_val;
dpm_desc_t *dpm_desc;
-#define TEST_DATA 0x12DEED21
+#define TEST_DATA 0x12DEED21
+#define TEST_TIMEOUT 0xFFFFFF
/* Publish these functions to the external world as associated to this test ID */
TBSA_TEST_PUBLISH(CREATE_TEST_ID(TBSA_DEBUG_BASE, 3),
@@ -34,6 +35,14 @@ TBSA_TEST_PUBLISH(CREATE_TEST_ID(TBSA_DEBUG_BASE, 3),
test_payload,
exit_hook);
+void delay (uint32_t delay_cnt)
+{
+ while(delay_cnt--)
+ {
+ asm volatile("NOP");
+ }
+}
+
void entry_hook(tbsa_val_api_t *val)
{
tbsa_test_init_t init = {
@@ -56,7 +65,7 @@ tbsa_status_t test_env_reset(void)
if (g_val->err_check_set(TEST_CHECKPOINT_F, status)) {
return status;
}
- return TBSA_STATUS_SUCCESS;
+ return TBSA_STATUS_SUCCESS;
}
tbsa_status_t test_dbg_seq_write(uint32_t addr, dbg_seq_status_t seq_status)
@@ -96,8 +105,14 @@ tbsa_status_t test_dbg_seq_read(uint32_t *addr, dbg_seq_status_t seq_status)
void test_payload(tbsa_val_api_t *val)
{
tbsa_status_t status;
- uint32_t data, dpm_instance, timeout, dpm_lock, dpm_enable, dpm_status;
- uint32_t region_num = 0, instance = 0, minor_id = 1, region_num_inst, s_addr=0, ns_addr=0;
+ uint32_t data;
+ uint32_t dpm_instance;
+ uint32_t dpm_lock;
+ uint32_t dpm_enable;
+ uint32_t dpm_status;
+ uint32_t region_num = 0;
+ uint32_t instance = 0;
+ uint32_t minor_id = MEMORY_SRAM;
memory_hdr_t *memory_hdr;
memory_desc_t *memory_desc;
dpm_hdr_t *dpm_hdr;
@@ -110,7 +125,7 @@ void test_payload(tbsa_val_api_t *val)
/* Check if DPM is present.*/
if (!dpm_hdr->num) {
- val->print(PRINT_ERROR, "\nNo DPM present in the platform", 0);
+ val->print(PRINT_ERROR, "\n\r\tNo DPM present in the platform", 0);
val->err_check_set(TEST_CHECKPOINT_2, TBSA_STATUS_NOT_FOUND);
return;
}
@@ -137,14 +152,16 @@ void test_payload(tbsa_val_api_t *val)
goto clean_up;
}
- dpm_lock = DPM_LOCK_IMPLEMENTED|DPM_LOCK_VALUE;
- dpm_enable = DPM_EN_IMPLEMENTED|DPM_EN_VALUE;
+ dpm_lock = DPM_LOCK_IMPLEMENTED|DPM_LOCK_STATE;
+ dpm_enable = DPM_EN_IMPLEMENTED|DPM_EN_STATE;
- if ((dpm_status & dpm_lock) == dpm_lock)
+ if ((dpm_status & dpm_lock) == dpm_lock) {
+ val->print(PRINT_ALWAYS, "\n\r\tDPM with index %x is in locked state", dpm_desc->index);
continue;
+ }
else if ((dpm_status & dpm_enable) == dpm_enable) {
/* Set the DPM state to Open.*/
- status = val->dpm_set_state(dpm_desc->index, DPM_OPEN_STATE, dpm_desc->unlock_token);
+ status = val->dpm_set_state(dpm_desc, DPM_OPEN_STATE);
if (val->err_check_set(TEST_CHECKPOINT_6, status)) {
goto clean_up;
}
@@ -156,107 +173,115 @@ void test_payload(tbsa_val_api_t *val)
goto clean_up;
}
/*Check for R/W address controlled by DPM under check, and access*/
- for (region_num = 0; region_num < memory_hdr->num; region_num++) {
+ for (region_num = 0; region_num < memory_hdr->num;) {
instance = 0;
do {
status = val->target_get_config(TARGET_CONFIG_CREATE_ID(GROUP_MEMORY, minor_id, instance),
(uint8_t **)&memory_desc, (uint32_t *)sizeof(memory_desc_t));
- if (status == TBSA_STATUS_NOT_FOUND) {
- break;
- } else if (val->err_check_set(TEST_CHECKPOINT_8, status)) {
+ if (val->err_check_set(TEST_CHECKPOINT_8, status)) {
goto clean_up;
}
- region_num_inst = GET_NUM_INSTANCE(memory_desc);
if ((memory_desc->dpm_index == dpm_desc->index) && (memory_desc->mem_type == TYPE_NORMAL_READ_WRITE)) {
- if (memory_desc->attribute == MEM_NONSECURE)
- ns_addr++;
- else
- s_addr++;
+
/*Initialize the memory with known data*/
val->mem_write((uint32_t *)memory_desc->start, WORD, TEST_DATA);
- if (test_dbg_seq_write((uint32_t)(memory_desc->start), SEQ_CLOSED_STATE_READ))
+ if (test_dbg_seq_write((uint32_t)(memory_desc->start), SEQ_CLOSED_STATE_READ)) {
goto clean_up;
+ }
- /* Set the DPM state to Closed.*/
- status = val->dpm_set_state(dpm_desc->index, DPM_CLOSED_STATE, 0);
+ /* Set the DPM to CLOSED state */
+ status = val->dpm_set_state(dpm_desc, DPM_CLOSED_STATE);
if (val->err_check_set(TEST_CHECKPOINT_9, status)) {
goto clean_up;
}
- /* Wait until debugger has completed the access whilst DPM is in Closed state.*/
- timeout = 0x1000000;
- while(--timeout);
+ asm volatile("DSB");
+ asm volatile("ISB");
- /* Set the DPM state to Open.*/
- status = val->dpm_set_state(dpm_desc->index, DPM_OPEN_STATE, dpm_desc->unlock_token);
- if (val->err_check_set(TEST_CHECKPOINT_A, status)) {
+ /* Indicate the debugger about the transition to CLOSED state */
+ if (test_dbg_seq_write((uint32_t)(memory_desc->start), SEQ_CLOSED_STATE_READ)) {
goto clean_up;
}
+
+ /* We don not read TEST_DATA at dpm_desc->data_addr if OPEN to CLOSED state transition is successful */
+ /* Wait until debugger has completed the access whilst DPM is in CLOSED state */
+ delay(TEST_TIMEOUT);
+
+
/* Read the data returned by debugger and compare to get the results.*/
- if(test_dbg_seq_read(&data, SEQ_CLOSED_STATE_READ))
- goto clean_up;
+ data = 0;
+ val->mem_read((uint32_t *)dpm_desc->data_addr, WORD, &data);
if (data == TEST_DATA) {
- val->err_check_set(TEST_CHECKPOINT_B, TBSA_STATUS_ERROR);
- val->print(PRINT_ERROR, "\nDPM could not restrict access in Closed State", 0);
- val->print(PRINT_ERROR, "\nDebugger read the actual data = 0x%x", TEST_DATA);
+ val->err_check_set(TEST_CHECKPOINT_A, TBSA_STATUS_ERROR);
+ val->print(PRINT_ERROR, "\n\r\tDPM could not restrict access in Closed State", 0);
+ val->print(PRINT_ERROR, "\n\r\tDebugger read the actual data = 0x%x", TEST_DATA);
val->print(PRINT_ERROR, " at address = 0x%x", (uint32_t)(memory_desc->start));
goto clean_up;
}
+
+ /* Set the DPM state to Open.*/
+ status = val->dpm_set_state(dpm_desc, DPM_OPEN_STATE);
+ if (val->err_check_set(TEST_CHECKPOINT_B, status)) {
+ goto clean_up;
+ }
+ asm volatile("DSB");
+ asm volatile("ISB");
+
/*Initialize the memory with known data*/
val->mem_write((uint32_t *)memory_desc->start, WORD, ~TEST_DATA);
- if (test_dbg_seq_write((uint32_t)(memory_desc->start), SEQ_CLOSED_STATE_WRITE))
+ if (test_dbg_seq_write((uint32_t)(memory_desc->start), SEQ_CLOSED_STATE_WRITE)) {
goto clean_up;
+ }
- if (test_dbg_seq_write(TEST_DATA, SEQ_CLOSED_STATE_WRITE))
+ if (test_dbg_seq_write(TEST_DATA, SEQ_CLOSED_STATE_WRITE)) {
goto clean_up;
+ }
/* Set the DPM state to Closed.*/
- status = val->dpm_set_state(dpm_desc->index, DPM_CLOSED_STATE, 0);
+ status = val->dpm_set_state(dpm_desc, DPM_CLOSED_STATE);
if (val->err_check_set(TEST_CHECKPOINT_C, status)) {
goto clean_up;
}
- /* Wait until debugger has completed the access whilst DPM is in Closed state.*/
- timeout = 0x1000000;
- while(--timeout);
+ asm volatile("DSB");
+ asm volatile("ISB");
- /* Set the DPM state to Open.*/
- status = val->dpm_set_state(dpm_desc->index, DPM_OPEN_STATE, dpm_desc->unlock_token);
- if (val->err_check_set(TEST_CHECKPOINT_D, status)) {
+ /* Indicate the debugger about the transition to CLOSED state */
+ if (test_dbg_seq_write((uint32_t)(memory_desc->start), SEQ_CLOSED_STATE_WRITE)) {
goto clean_up;
}
- /* Read the data returned by debugger and compare to get the results.*/
- if(test_dbg_seq_read(&data, SEQ_CLOSED_STATE_WRITE))
- goto clean_up;
+ /* Wait until debugger has completed the access whilst DPM is in Closed state.*/
+ delay(TEST_TIMEOUT);
+
+ /* Read the data returned by debugger and compare to get the results.*/
+ data = 0;
val->mem_read((uint32_t *)memory_desc->start, WORD, &data);
if (data != ~TEST_DATA) {
- val->err_check_set(TEST_CHECKPOINT_E, TBSA_STATUS_ERROR);
- val->print(PRINT_ERROR, "\nDPM could not restrict access in Closed State", 0);
- val->print(PRINT_ERROR, "\nDebugger updated the data at address = 0x%x", (uint32_t)(memory_desc->start));
+ val->err_check_set(TEST_CHECKPOINT_D, TBSA_STATUS_ERROR);
+ val->print(PRINT_ERROR, "\n\r\tDPM could not restrict access in Closed State", 0);
+ val->print(PRINT_ERROR, "\n\r\tDebugger updated the data at address = 0x%x", (uint32_t)(memory_desc->start));
goto clean_up;
}
+
+ /* Set the DPM state to Open.*/
+ status = val->dpm_set_state(dpm_desc, DPM_OPEN_STATE);
+ if (val->err_check_set(TEST_CHECKPOINT_E, status)) {
+ goto clean_up;
+ }
+ asm volatile("DSB");
+ asm volatile("ISB");
}
instance++;
- } while (instance < region_num_inst);
+ } while (instance < GET_NUM_INSTANCE(memory_desc));
minor_id++;
- if (status == TBSA_STATUS_NOT_FOUND)
- region_num -= 1;
- else
- region_num += region_num_inst - 1;
+ region_num += GET_NUM_INSTANCE(memory_desc);
}
}
- if (!ns_addr) {
- val->print(PRINT_WARN, "\n No non-secure address were accessed", 0);
- }
- if (!s_addr) {
- val->print(PRINT_WARN, "\n No secure address were accessed", 0);
- }
-
if (test_env_reset())
return;
diff --git a/tbsa-v8m/test_pool/debug/test_d004/secure.c b/tbsa-v8m/test_pool/debug/test_d004/secure.c
index f44f31b2..46c24b03 100644
--- a/tbsa-v8m/test_pool/debug/test_d004/secure.c
+++ b/tbsa-v8m/test_pool/debug/test_d004/secure.c
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -60,7 +60,7 @@ tbsa_status_t test_env_reset(void)
if (g_val->err_check_set(TEST_CHECKPOINT_18, status)) {
return status;
}
- return TBSA_STATUS_SUCCESS;
+ return TBSA_STATUS_SUCCESS;
}
tbsa_status_t test_dbg_seq_write(uint32_t addr, dbg_seq_status_t seq_status)
@@ -114,7 +114,7 @@ void test_payload(tbsa_val_api_t *val)
{
tbsa_status_t status;
uint32_t data, dpm_instance, timeout, dpm_lock, reset_done=0, dpm_status;
- uint32_t region_num = 0, instance = 0, minor_id = 1, region_num_inst;
+ uint32_t region_num = 0, instance = 0, minor_id = MEMORY_SRAM, region_num_inst;
dpm_hdr_t *dpm_hdr;
memory_hdr_t *memory_hdr;
memory_desc_t *memory_desc;
@@ -144,7 +144,7 @@ void test_payload(tbsa_val_api_t *val)
if (!reset_done) {
/* Check if DPM is present.*/
if (!dpm_hdr->num) {
- val->print(PRINT_ERROR, "\nNo DPM present in the platform", 0);
+ val->print(PRINT_ERROR, "\n\t\rNo DPM present in the platform", 0);
val->err_check_set(TEST_CHECKPOINT_4, TBSA_STATUS_NOT_FOUND);
return;
}
@@ -189,10 +189,10 @@ void test_payload(tbsa_val_api_t *val)
lock implemented.
*/
dpm_not_locked = FALSE;
- dpm_lock = DPM_LOCK_IMPLEMENTED|DPM_LOCK_VALUE;
+ dpm_lock = DPM_LOCK_IMPLEMENTED|DPM_LOCK_STATE;
if ((dpm_status & dpm_lock) == dpm_lock) {
if (dpm_hdr->num == 1) {
- val->print(PRINT_WARN, "\n The only DPM in the system is in locked state, cannot check access.", 0);
+ val->print(PRINT_WARN, "\n\t\rThe only DPM in the system is in locked state, cannot check access.", 0);
val->set_status(RESULT_SKIP(1));
goto clean_up;
}
@@ -207,7 +207,7 @@ void test_payload(tbsa_val_api_t *val)
goto clean_up;
}
/*Check for R/W address controlled by DPM under check, and access*/
- for (region_num = 0; region_num < memory_hdr->num; region_num++) {
+ for (region_num = 0; region_num < memory_hdr->num;) {
instance = 0;
/* If reset was done then over-write loop variables from stored NV RAM*/
if(reset_done) {
@@ -221,9 +221,7 @@ void test_payload(tbsa_val_api_t *val)
do {
status = val->target_get_config(TARGET_CONFIG_CREATE_ID(GROUP_MEMORY, minor_id, instance),
(uint8_t **)&memory_desc, (uint32_t *)sizeof(memory_desc_t));
- if (status == TBSA_STATUS_NOT_FOUND) {
- break;
- } else if (val->err_check_set(TEST_CHECKPOINT_B, status)) {
+ if (val->err_check_set(TEST_CHECKPOINT_B, status)) {
goto clean_up;
}
if(!reset_done)
@@ -240,7 +238,7 @@ void test_payload(tbsa_val_api_t *val)
/* Reset will only be triggered in case if DPM was not locked at reset*/
if (dpm_not_locked) {
/* Set the DPM state to Locked.*/
- status = val->dpm_set_state(dpm_desc->index, DPM_LOCKED_STATE, 0);
+ status = val->dpm_set_state(dpm_desc, DPM_LOCKED_STATE);
if (val->err_check_set(TEST_CHECKPOINT_C, status)) {
goto clean_up;
}
@@ -280,24 +278,20 @@ void test_payload(tbsa_val_api_t *val)
if (data == TEST_DATA) {
val->err_check_set(TEST_CHECKPOINT_11, TBSA_STATUS_ERROR);
- val->print(PRINT_ERROR, "\nDPM could not restrict access in Locked State", 0);
- val->print(PRINT_ERROR, "\nDebugger read the actual data = 0x%x", TEST_DATA);
+ val->print(PRINT_ERROR, "\n\t\rDPM could not restrict access in Locked State", 0);
+ val->print(PRINT_ERROR, "\n\t\rDebugger read the actual data = 0x%x", TEST_DATA);
val->print(PRINT_ERROR, " at address = 0x%x", (uint32_t)(memory_desc->start));
goto clean_up;
}
}
instance++;
- } while (instance < region_num_inst);
+ } while (instance < GET_NUM_INSTANCE(memory_desc));
minor_id++;
- if (status == TBSA_STATUS_NOT_FOUND)
- region_num -= 1;
- else
- region_num += region_num_inst - 1;
+ region_num += GET_NUM_INSTANCE(memory_desc);
}
reset_done = 0;
}
-
if (test_env_reset())
return;
diff --git a/tbsa-v8m/test_pool/debug/test_d005/secure.c b/tbsa-v8m/test_pool/debug/test_d005/secure.c
index 31f36c87..add91f07 100644
--- a/tbsa-v8m/test_pool/debug/test_d005/secure.c
+++ b/tbsa-v8m/test_pool/debug/test_d005/secure.c
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -82,8 +82,8 @@ void test_payload(tbsa_val_api_t *val)
val->set_status(RESULT_FAIL(TBSA_STATUS_ERROR));
return;
}
- dpm_enable = DPM_EN_IMPLEMENTED|DPM_EN_VALUE;
- if (((dpm_status & DPM_LOCK_VALUE) != DPM_LOCK_VALUE) || ((dpm_status & dpm_enable) != dpm_enable)) {
+ dpm_enable = DPM_EN_IMPLEMENTED|DPM_EN_STATE;
+ if (((dpm_status & DPM_LOCK_STATE) != DPM_LOCK_STATE) || ((dpm_status & dpm_enable) != dpm_enable)) {
val->print(PRINT_ERROR, "\n DPM default state is not closed or locked for DPM %d", dpm_desc->index);
val->set_status(RESULT_FAIL(TBSA_STATUS_ERROR));
return;
diff --git a/tbsa-v8m/test_pool/debug/test_d006/secure.c b/tbsa-v8m/test_pool/debug/test_d006/secure.c
index 0f14f8b1..a83778e4 100644
--- a/tbsa-v8m/test_pool/debug/test_d006/secure.c
+++ b/tbsa-v8m/test_pool/debug/test_d006/secure.c
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -76,7 +76,7 @@ void test_payload(tbsa_val_api_t *val)
return;
}
if (dpm_hdr->num == 1) {
- val->print(PRINT_DEBUG, "\n\r\tUnique password unlock token since only one DPM is present", 0);
+ val->print(PRINT_ALWAYS, "\n\r\tUnique password unlock token since only one DPM is present", 0);
val->set_status(RESULT_PASS(TBSA_STATUS_SUCCESS));
return;
}
@@ -95,8 +95,8 @@ void test_payload(tbsa_val_api_t *val)
if (val->err_check_set(TEST_CHECKPOINT_5, status)) {
return;
}
- dpm_enable = DPM_EN_IMPLEMENTED|DPM_EN_VALUE;
- dpm_lock = DPM_LOCK_IMPLEMENTED|DPM_LOCK_VALUE;
+ dpm_enable = DPM_EN_IMPLEMENTED|DPM_EN_STATE;
+ dpm_lock = DPM_LOCK_IMPLEMENTED|DPM_LOCK_STATE;
/* If the DPM state is locked then continue with other DPMs*/
if ((dpm_status & dpm_lock) == dpm_lock)
@@ -104,14 +104,14 @@ void test_payload(tbsa_val_api_t *val)
else if ((dpm_status & dpm_enable) != dpm_enable) {
/* Set the DPM state to Closed, to check if the unlocking can be done by using
other DPM's password.*/
- status = val->dpm_set_state(target_dpm_desc->index, DPM_CLOSED_STATE, 0);
+ status = val->dpm_set_state(target_dpm_desc, DPM_CLOSED_STATE);
if (val->err_check_set(TEST_CHECKPOINT_6, status)) {
return;
}
}
/* Try to unlock DPM using other DPM's password.*/
- status = val->dpm_set_state(target_dpm_desc->index, DPM_OPEN_STATE, dpm_desc->unlock_token);
+ status = val->dpm_set_state(target_dpm_desc, DPM_OPEN_STATE);
if (val->err_check_set(TEST_CHECKPOINT_7, status)) {
return;
}
diff --git a/tbsa-v8m/test_pool/interrupts/Makefile b/tbsa-v8m/test_pool/interrupts/Makefile
deleted file mode 100644
index 7cfe1de7..00000000
--- a/tbsa-v8m/test_pool/interrupts/Makefile
+++ /dev/null
@@ -1,77 +0,0 @@
-#/** @file
-# * Copyright (c) 2018, 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
-PREFIX:=arm-none-eabi-
-CC:=$(PREFIX)gcc
-CXX:=$(PREFIX)g++
-AS:=$(PREFIX)as
-OBJCOPY:=$(PREFIX)objcopy
-OBJDUMP:=$(PREFIX)objdump
-
-# Test specific macros
-OUT_DIR:=./out
-
-# Root folder
-ROOT_DIR:=.
-
-.PHONY: all clean
-
-VAL_LIB :=../../out/$(TARGET)/tbsa_val.a
-PAL_LIB :=../../out/$(TARGET)/tbsa_pal.a
-SYSLIBS :=$(VAL_LIB) $(PAL_LIB) -lgcc -lc -lnosys
-INCDIR := ../../val/include/
-CFLAGS :=-march=armv8-m.$(ARCH) -mthumb -Wall -Werror -O0 -I$(INCDIR)
-SBUILD :=-mcmse
-
-LDFLAGS :=\
- -Xlinker --fatal-warnings \
- -Xlinker --gc-sections \
- -z max-page-size=0x400
-
-SFLAGS :=\
- $(CFLAGS) \
- $(SBUILD) \
- -nostartfiles \
- -T../../platform/board/${TARGET}/linker/test_s.linker \
- $(LDFLAGS)
-
-NSFLAGS :=\
- $(CFLAGS) \
- -nostartfiles \
- -T../../platform/board/${TARGET}/linker/test_ns.linker \
- $(LDFLAGS)
-
-s_src :=secure.c
-ns_src :=non_secure.c
-
-DIR :=$(dir $(wildcard $(ROOT_DIR)/*/))
-DIR :=$(filter-out ./, $(DIR))
-
-all: build
-
-build:
- $(foreach d, $(DIR), mkdir -p $(d)$(OUT_DIR); \
- $(CC) $(SFLAGS) -Xlinker -Map=$(d)$(OUT_DIR)/$(s_src).map -o $(d)$(OUT_DIR)/$(s_src).elf $(d)$(s_src) $(SYSLIBS); \
- $(OBJCOPY) $(d)$(OUT_DIR)/$(s_src).elf -O binary $(d)$(OUT_DIR)/$(s_src).bin; \
- $(OBJDUMP) -d $(d)$(OUT_DIR)/$(s_src).elf > $(d)$(OUT_DIR)/$(s_src).asm; \
- $(CC) $(NSFLAGS) -Xlinker -Map=$(d)$(OUT_DIR)/$(ns_src).map -o $(d)$(OUT_DIR)/$(ns_src).elf $(d)$(ns_src) $(SYSLIBS); \
- $(OBJCOPY) $(d)$(OUT_DIR)/$(ns_src).elf -O binary $(d)$(OUT_DIR)/$(ns_src).bin; \
- $(OBJDUMP) -d $(d)$(OUT_DIR)/$(ns_src).elf > $(d)$(OUT_DIR)/$(ns_src).asm;)
-
-clean:
- $(foreach d, $(DIR), rm -rf $(d)$(OUT_DIR))
diff --git a/tbsa-v8m/test_pool/mem/Makefile b/tbsa-v8m/test_pool/mem/Makefile
deleted file mode 100644
index 7cfe1de7..00000000
--- a/tbsa-v8m/test_pool/mem/Makefile
+++ /dev/null
@@ -1,77 +0,0 @@
-#/** @file
-# * Copyright (c) 2018, 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
-PREFIX:=arm-none-eabi-
-CC:=$(PREFIX)gcc
-CXX:=$(PREFIX)g++
-AS:=$(PREFIX)as
-OBJCOPY:=$(PREFIX)objcopy
-OBJDUMP:=$(PREFIX)objdump
-
-# Test specific macros
-OUT_DIR:=./out
-
-# Root folder
-ROOT_DIR:=.
-
-.PHONY: all clean
-
-VAL_LIB :=../../out/$(TARGET)/tbsa_val.a
-PAL_LIB :=../../out/$(TARGET)/tbsa_pal.a
-SYSLIBS :=$(VAL_LIB) $(PAL_LIB) -lgcc -lc -lnosys
-INCDIR := ../../val/include/
-CFLAGS :=-march=armv8-m.$(ARCH) -mthumb -Wall -Werror -O0 -I$(INCDIR)
-SBUILD :=-mcmse
-
-LDFLAGS :=\
- -Xlinker --fatal-warnings \
- -Xlinker --gc-sections \
- -z max-page-size=0x400
-
-SFLAGS :=\
- $(CFLAGS) \
- $(SBUILD) \
- -nostartfiles \
- -T../../platform/board/${TARGET}/linker/test_s.linker \
- $(LDFLAGS)
-
-NSFLAGS :=\
- $(CFLAGS) \
- -nostartfiles \
- -T../../platform/board/${TARGET}/linker/test_ns.linker \
- $(LDFLAGS)
-
-s_src :=secure.c
-ns_src :=non_secure.c
-
-DIR :=$(dir $(wildcard $(ROOT_DIR)/*/))
-DIR :=$(filter-out ./, $(DIR))
-
-all: build
-
-build:
- $(foreach d, $(DIR), mkdir -p $(d)$(OUT_DIR); \
- $(CC) $(SFLAGS) -Xlinker -Map=$(d)$(OUT_DIR)/$(s_src).map -o $(d)$(OUT_DIR)/$(s_src).elf $(d)$(s_src) $(SYSLIBS); \
- $(OBJCOPY) $(d)$(OUT_DIR)/$(s_src).elf -O binary $(d)$(OUT_DIR)/$(s_src).bin; \
- $(OBJDUMP) -d $(d)$(OUT_DIR)/$(s_src).elf > $(d)$(OUT_DIR)/$(s_src).asm; \
- $(CC) $(NSFLAGS) -Xlinker -Map=$(d)$(OUT_DIR)/$(ns_src).map -o $(d)$(OUT_DIR)/$(ns_src).elf $(d)$(ns_src) $(SYSLIBS); \
- $(OBJCOPY) $(d)$(OUT_DIR)/$(ns_src).elf -O binary $(d)$(OUT_DIR)/$(ns_src).bin; \
- $(OBJDUMP) -d $(d)$(OUT_DIR)/$(ns_src).elf > $(d)$(OUT_DIR)/$(ns_src).asm;)
-
-clean:
- $(foreach d, $(DIR), rm -rf $(d)$(OUT_DIR))
diff --git a/tbsa-v8m/test_pool/mem/test_m001/non_secure.c b/tbsa-v8m/test_pool/mem/test_m001/non_secure.c
index 9d3f48c0..1c022e97 100644
--- a/tbsa-v8m/test_pool/mem/test_m001/non_secure.c
+++ b/tbsa-v8m/test_pool/mem/test_m001/non_secure.c
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -24,7 +24,7 @@
**/
TBSA_TEST_PUBLISH(CREATE_TEST_ID(TBSA_SECURE_RAM_BASE, 1),
CREATE_TEST_TITLE("Secure RAM access from Trusted world only"),
- CREATE_REF_TAG("R160/R170/R180_TBSA_INFRA"),
+ CREATE_REF_TAG("R160/R180_TBSA_INFRA"),
entry_hook,
test_payload,
exit_hook);
@@ -65,9 +65,8 @@ void test_payload(tbsa_val_api_t *val)
uint32_t instance = 0;
protection_units_desc_t *prot_unit_desc;
tbsa_status_t status;
- uint32_t timeout = TIMEOUT_VALUE;
+ uint32_t timeout = TIMEOUT_VALUE;
bool_t mpc_found = FALSE;
- bool_t timeout_flag = FALSE;
do {
status = val->target_get_config(TARGET_CONFIG_CREATE_ID(GROUP_PROTECTION_UNITS, PROTECTION_UNITS_MPC, instance),
@@ -79,47 +78,45 @@ void test_payload(tbsa_val_api_t *val)
mpc_found = TRUE;
- val->set_status(RESULT_PENDING(status));
+ val->set_status(RESULT_PENDING(status));
- /* Try to access MPC from Non-Secure */
- val_mem_read_wide((uint32_t *)prot_unit_desc->device_base, &data);
+ /* Try to access MPC from Non-Secure */
+ val_mem_read_wide((uint32_t *)prot_unit_desc->device_base, &data);
/* Wait here till pending status is cleared by secure fault or timeout occurs, whichever comes early */
while (IS_TEST_PENDING(val->get_status()) && (--timeout));
if(!timeout) {
+ val->print(PRINT_ERROR, "\n\r\tNo fault occurred when accessing MPC 0x%X from NT world!", (uint32_t)(prot_unit_desc->device_base));
val->err_check_set(TEST_CHECKPOINT_8, TBSA_STATUS_TIMEOUT);
- timeout_flag = TRUE;
+ return;
}
}
instance++;
+ timeout = TIMEOUT_VALUE;
} while(instance < GET_NUM_INSTANCE(prot_unit_desc));
- /* Restoring default Handler */
- status = val->interrupt_restore_handler(EXCP_NUM_HF);
- if (val->err_check_set(TEST_CHECKPOINT_9, status)) {
- return;
- }
-
- /* Restoring faults */
- status = val->mem_reg_write(SHCSR, shcsr);
- if (val->err_check_set(TEST_CHECKPOINT_A, status)) {
- return;
- }
-
- if (timeout_flag == TRUE) {
- val->err_check_set(TEST_CHECKPOINT_B, TBSA_STATUS_TIMEOUT);
- return;
- }
-
if (mpc_found) {
val->set_status(RESULT_PASS(TBSA_STATUS_SUCCESS));
} else {
- val->err_check_set(TEST_CHECKPOINT_C, TBSA_STATUS_NOT_FOUND);
+ val->err_check_set(TEST_CHECKPOINT_9, TBSA_STATUS_NOT_FOUND);
return;
}
}
void exit_hook(tbsa_val_api_t *val)
{
+ tbsa_status_t status;
+
+ /* Restoring default Handler */
+ status = val->interrupt_restore_handler(EXCP_NUM_HF);
+ if (val->err_check_set(TEST_CHECKPOINT_A, status)) {
+ return;
+ }
+
+ /* Restoring faults */
+ status = val->mem_reg_write(SHCSR, shcsr);
+ if (val->err_check_set(TEST_CHECKPOINT_B, status)) {
+ return;
+ }
}
diff --git a/tbsa-v8m/test_pool/mem/test_m001/secure.c b/tbsa-v8m/test_pool/mem/test_m001/secure.c
index 65d17312..61f24fa8 100644
--- a/tbsa-v8m/test_pool/mem/test_m001/secure.c
+++ b/tbsa-v8m/test_pool/mem/test_m001/secure.c
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -24,7 +24,7 @@
**/
TBSA_TEST_PUBLISH(CREATE_TEST_ID(TBSA_SECURE_RAM_BASE, 1),
CREATE_TEST_TITLE("Secure RAM access from Trusted world only"),
- CREATE_REF_TAG("R160/R170/R180_TBSA_INFRA"),
+ CREATE_REF_TAG("R160/R180_TBSA_INFRA"),
entry_hook,
test_payload,
exit_hook);
@@ -37,8 +37,6 @@ void hard_fault_esr (unsigned long *sf_args)
if (IS_TEST_PENDING(g_val->get_status())) {
g_val->set_status(RESULT_PASS(TBSA_STATUS_SUCCESS));
- } else {
- g_val->set_status(RESULT_FAIL(TBSA_STATUS_INVALID));
}
/* Updating the return address in the stack frame in order to avoid periodic fault */
@@ -60,13 +58,17 @@ void HF_Handler(void)
"b hard_fault_esr \n");
}
-void setup_ns_env(void)
+tbsa_status_t setup_ns_env(void)
{
tbsa_status_t status;
/* Installing Trusted Fault Handler for NS test */
status = g_val->interrupt_setup_handler(EXCP_NUM_HF, 0, HF_Handler);
- g_val->err_check_set(TEST_CHECKPOINT_5, status);
+ if(g_val->err_check_set(TEST_CHECKPOINT_4, status)) {
+ return status;
+ }
+
+ return TBSA_STATUS_SUCCESS;
}
@@ -87,50 +89,39 @@ void entry_hook(tbsa_val_api_t *val)
void test_payload(tbsa_val_api_t *val)
{
uint32_t instance = 0;
- uint32_t mem_num;
- uint32_t minor_id = MEMORY_SRAM;
- memory_hdr_t *mem;
memory_desc_t *mem_desc;
tbsa_status_t status;
secure_range_found = FALSE;
/* Read all the memory ranges given to us and ensure at least 1 range is secure */
- status = val->target_get_config(TARGET_CONFIG_CREATE_ID(GROUP_MEMORY, 0, 0),
- (uint8_t **)&mem, (uint32_t *)sizeof(memory_hdr_t));
- if (val->err_check_set(TEST_CHECKPOINT_1, status))
- return;
-
- for (mem_num = 0; mem_num < mem->num;)
- {
- instance = 0;
- do {
- status = val->target_get_config(TARGET_CONFIG_CREATE_ID(GROUP_MEMORY, MEMORY_SRAM, instance),
- (uint8_t **)&mem_desc, (uint32_t *)sizeof(memory_desc_t));
- if (val->err_check_set(TEST_CHECKPOINT_2, status)) {
+ do {
+ status = val->target_get_config(TARGET_CONFIG_CREATE_ID(GROUP_MEMORY, MEMORY_SRAM, instance),
+ (uint8_t **)&mem_desc, (uint32_t *)sizeof(memory_desc_t));
+ if (val->err_check_set(TEST_CHECKPOINT_1, status)) {
+ return;
+ }
+
+ if (mem_desc->attribute == MEM_SECURE) {
+ if (val->is_secure_address(mem_desc->start)) {
+ secure_range_found = TRUE;
+ break;
+ } else {
+ val->err_check_set(TEST_CHECKPOINT_2, TBSA_STATUS_ERROR);
return;
}
-
- if (mem_desc->attribute == MEM_SECURE) {
- if (val->is_secure_address(mem_desc->start)) {
- secure_range_found = TRUE;
- } else {
- val->err_check_set(TEST_CHECKPOINT_3, TBSA_STATUS_ERROR);
- return;
- }
- }
- instance++;
- }while (instance < GET_NUM_INSTANCE(mem_desc));
- minor_id++;
- mem_num += GET_NUM_INSTANCE(mem_desc);
- }
+ }
+ instance++;
+ }while (instance < GET_NUM_INSTANCE(mem_desc));
if (secure_range_found != TRUE) {
- val->err_check_set(TEST_CHECKPOINT_4, TBSA_STATUS_NOT_FOUND);
+ val->err_check_set(TEST_CHECKPOINT_3, TBSA_STATUS_NOT_FOUND);
return;
}
- setup_ns_env();
+ if(setup_ns_env()) {
+ return;
+ }
val->set_status(RESULT_PASS(TBSA_STATUS_SUCCESS));
}
diff --git a/tbsa-v8m/test_pool/peripherals/Makefile b/tbsa-v8m/test_pool/peripherals/Makefile
deleted file mode 100644
index 7cfe1de7..00000000
--- a/tbsa-v8m/test_pool/peripherals/Makefile
+++ /dev/null
@@ -1,77 +0,0 @@
-#/** @file
-# * Copyright (c) 2018, 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
-PREFIX:=arm-none-eabi-
-CC:=$(PREFIX)gcc
-CXX:=$(PREFIX)g++
-AS:=$(PREFIX)as
-OBJCOPY:=$(PREFIX)objcopy
-OBJDUMP:=$(PREFIX)objdump
-
-# Test specific macros
-OUT_DIR:=./out
-
-# Root folder
-ROOT_DIR:=.
-
-.PHONY: all clean
-
-VAL_LIB :=../../out/$(TARGET)/tbsa_val.a
-PAL_LIB :=../../out/$(TARGET)/tbsa_pal.a
-SYSLIBS :=$(VAL_LIB) $(PAL_LIB) -lgcc -lc -lnosys
-INCDIR := ../../val/include/
-CFLAGS :=-march=armv8-m.$(ARCH) -mthumb -Wall -Werror -O0 -I$(INCDIR)
-SBUILD :=-mcmse
-
-LDFLAGS :=\
- -Xlinker --fatal-warnings \
- -Xlinker --gc-sections \
- -z max-page-size=0x400
-
-SFLAGS :=\
- $(CFLAGS) \
- $(SBUILD) \
- -nostartfiles \
- -T../../platform/board/${TARGET}/linker/test_s.linker \
- $(LDFLAGS)
-
-NSFLAGS :=\
- $(CFLAGS) \
- -nostartfiles \
- -T../../platform/board/${TARGET}/linker/test_ns.linker \
- $(LDFLAGS)
-
-s_src :=secure.c
-ns_src :=non_secure.c
-
-DIR :=$(dir $(wildcard $(ROOT_DIR)/*/))
-DIR :=$(filter-out ./, $(DIR))
-
-all: build
-
-build:
- $(foreach d, $(DIR), mkdir -p $(d)$(OUT_DIR); \
- $(CC) $(SFLAGS) -Xlinker -Map=$(d)$(OUT_DIR)/$(s_src).map -o $(d)$(OUT_DIR)/$(s_src).elf $(d)$(s_src) $(SYSLIBS); \
- $(OBJCOPY) $(d)$(OUT_DIR)/$(s_src).elf -O binary $(d)$(OUT_DIR)/$(s_src).bin; \
- $(OBJDUMP) -d $(d)$(OUT_DIR)/$(s_src).elf > $(d)$(OUT_DIR)/$(s_src).asm; \
- $(CC) $(NSFLAGS) -Xlinker -Map=$(d)$(OUT_DIR)/$(ns_src).map -o $(d)$(OUT_DIR)/$(ns_src).elf $(d)$(ns_src) $(SYSLIBS); \
- $(OBJCOPY) $(d)$(OUT_DIR)/$(ns_src).elf -O binary $(d)$(OUT_DIR)/$(ns_src).bin; \
- $(OBJDUMP) -d $(d)$(OUT_DIR)/$(ns_src).elf > $(d)$(OUT_DIR)/$(ns_src).asm;)
-
-clean:
- $(foreach d, $(DIR), rm -rf $(d)$(OUT_DIR))
diff --git a/tbsa-v8m/test_pool/peripherals/test_p001/non_secure.c b/tbsa-v8m/test_pool/peripherals/test_p001/non_secure.c
index ca3ffd10..110a0149 100644
--- a/tbsa-v8m/test_pool/peripherals/test_p001/non_secure.c
+++ b/tbsa-v8m/test_pool/peripherals/test_p001/non_secure.c
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -17,6 +17,8 @@
#include "val_test_common.h"
+#define TIMEOUT (0xFFFFFFFFUL)
+
/**
Publish these functions to the external world as associated to this test ID
**/
@@ -59,6 +61,7 @@ void test_payload(tbsa_val_api_t *val)
{
tbsa_status_t status;
uint32_t data;
+ uint32_t timeout = TIMEOUT;
status = val->target_get_config(TARGET_CONFIG_CREATE_ID(GROUP_CLOCKS, CLOCKS_SYS_FREQ, 0),
(uint8_t **)&clocks_desc,
@@ -73,13 +76,21 @@ void test_payload(tbsa_val_api_t *val)
val_mem_read_wide((uint32_t *)(clocks_desc->pll_base + clocks_desc->offset), &data);
/* wait here till pending status is cleared by secure fault */
- while (IS_TEST_PENDING(val->get_status()));
+ while (IS_TEST_PENDING(val->get_status()) && --timeout);
/* Restoring default Handler */
status = val->interrupt_restore_handler(EXCP_NUM_HF);
if (val->err_check_set(TEST_CHECKPOINT_5, status)) {
return;
}
+
+ if(!timeout) {
+ val->print(PRINT_ERROR, "\n\r\tNo fault occurred when accessing clock source from NT world!", (uint32_t)(clocks_desc->pll_base + clocks_desc->offset));
+ val->err_check_set(TEST_CHECKPOINT_6, TBSA_STATUS_TIMEOUT);
+ return;
+ }
+
+ val->set_status(RESULT_PASS(TBSA_STATUS_SUCCESS));
}
void exit_hook(tbsa_val_api_t *val)
diff --git a/tbsa-v8m/test_pool/peripherals/test_p001/secure.c b/tbsa-v8m/test_pool/peripherals/test_p001/secure.c
index 262d98c4..fa190fec 100644
--- a/tbsa-v8m/test_pool/peripherals/test_p001/secure.c
+++ b/tbsa-v8m/test_pool/peripherals/test_p001/secure.c
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -33,8 +33,6 @@ void hard_fault_esr (unsigned long *sf_args)
{
if (IS_TEST_PENDING(g_val->get_status())) {
g_val->set_status(RESULT_PASS(TBSA_STATUS_SUCCESS));
- } else {
- g_val->set_status(RESULT_FAIL(TBSA_STATUS_INVALID));
}
/* Updating the return address in the stack frame in order to avoid periodic fault */
@@ -56,15 +54,6 @@ void HF_Handler(void)
"b hard_fault_esr \n");
}
-void setup_ns_env(void)
-{
- tbsa_status_t status;
-
- /* Installing Trusted Fault Handler for NS test */
- status = g_val->interrupt_setup_handler(EXCP_NUM_HF, 0, HF_Handler);
- g_val->err_check_set(TEST_CHECKPOINT_1, status);
-}
-
void entry_hook(tbsa_val_api_t *val)
{
tbsa_test_init_t init = {
@@ -79,8 +68,13 @@ void entry_hook(tbsa_val_api_t *val)
void test_payload(tbsa_val_api_t *val)
{
+ tbsa_status_t status;
+
/* setup environment for NS test */
- setup_ns_env();
+ status = val->interrupt_setup_handler(EXCP_NUM_HF, 0, HF_Handler);
+ if(val->err_check_set(TEST_CHECKPOINT_1, status)) {
+ return;
+ }
val->set_status(RESULT_PASS(TBSA_STATUS_SUCCESS));
}
diff --git a/tbsa-v8m/test_pool/tbsa_elf_combine.pl b/tbsa-v8m/test_pool/tbsa_elf_combine.pl
deleted file mode 100755
index 8a28c622..00000000
--- a/tbsa-v8m/test_pool/tbsa_elf_combine.pl
+++ /dev/null
@@ -1,120 +0,0 @@
-#!/usr/bin/perl
-#/** @file
-# * Copyright (c) 2018, 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;
-
-$test_pool_path = $ARGV[0];
-$output_elf = 'tbsa_test_combined.bin';
-my @all_elf_paths;
-
-sub uniq {
- my %seen;
- grep !$seen{$_}++, @_;
-}
-
-print "Combining test ELFs\n";
-
-# Final output elf file
-open(OUT, '>:raw', $output_elf) or die "Unable to open: $!";
-
-# Collecting all elf file paths
-find sub {
- return if -d;
- if($File::Find::name =~ /\.c\.(elf)$/) {
- # Store directory of elf for each test
- push @all_elf_paths, dirname($File::Find::name);
- }
-}, $test_pool_path;
-
-# Remove duplicate elf folders since they were loaded twice for NS & S
-@all_elf_paths = uniq(@all_elf_paths);
-
-@all_elf_paths = sort @all_elf_paths;
-
-foreach $thispath(@all_elf_paths) {
- # Clear array consisting of ELFs for this test
- undef @this_test_elfs;
-
- # Find ELFs for this test
- find sub {
- return if -d;
- if($File::Find::name =~ /.(elf)$/) {
- push @this_test_elfs, $File::Find::name;
- }
- }, $thispath;
-
- # Segregate NS and S ELFs
- foreach $thiself(@this_test_elfs) {
- if($thiself =~ /non_secure(\S+)elf/) {
- $this_ns_elf = $thiself;
- }
- else {
- $this_s_elf = $thiself;
- }
- }
-
- # Find elf sizes
- $this_ns_elf_size = -s $this_ns_elf;
- $this_s_elf_size = -s $this_s_elf;
-
- # Get readelf program header info from either elf and process it
- $out = `readelf -l $this_ns_elf`;
- if($out =~ /LOAD(\s+)(0[xX][0-9a-fA-F]+)/) {
- $program_ns_header = hex($2);
- }
- $out = `readelf -l $this_s_elf`;
- if($out =~ /LOAD(\s+)(0[xX][0-9a-fA-F]+)/) {
- $program_s_header = hex($2);
- }
-
- # Determining test_id from elf at location pointed by program header
- open(TEST_NS_ID, '<:raw', $this_ns_elf) or die "Unable to open: $!";
- seek(TEST_NS_ID, $program_ns_header, 0);
- read TEST_NS_ID, $test_id_ns_raw, 4;
- open(TEST_S_ID, '<:raw', $this_s_elf) or die "Unable to open: $!";
- seek(TEST_S_ID, $program_s_header, 0);
- read TEST_S_ID, $test_id_s_raw, 4;
-
- if($test_id_s_raw ne $test_id_ns_raw) {
- die "\nTest ID creation is not same in $this_s_elf and $this_ns_elf!!!\n\n";
- } else {
- $test_id = unpack('L<', $test_id_s_raw);
- close TEST_S_ID;
- close TEST_NS_ID;
- }
-
- printf("test_id\t%4d : ", $test_id);
- print "$this_s_elf\t$this_s_elf_size\t: $this_ns_elf\t$this_ns_elf_size\n";
-
- # 'L' unsigned-32 ; '<' Little endian
- print OUT pack('L<', 0xFACEFACE);
- print OUT pack('L<', $test_id);
- print OUT pack('L<', $this_s_elf_size);
- print OUT pack('L<', $this_ns_elf_size);
-
- # Temporarily closing final ELF to concatenate ELFs
- close OUT;
- system("cat $this_s_elf >> $output_elf");
- system("cat $this_ns_elf >> $output_elf");
- # Open final ELF again
- open(OUT, '>>:raw', $output_elf) or die "Unable to open: $!";
-}
-print OUT pack('L<', 0xC3C3C3C3);
-close OUT;
diff --git a/tbsa-v8m/test_pool/timer/Makefile b/tbsa-v8m/test_pool/timer/Makefile
deleted file mode 100644
index 7cfe1de7..00000000
--- a/tbsa-v8m/test_pool/timer/Makefile
+++ /dev/null
@@ -1,77 +0,0 @@
-#/** @file
-# * Copyright (c) 2018, 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
-PREFIX:=arm-none-eabi-
-CC:=$(PREFIX)gcc
-CXX:=$(PREFIX)g++
-AS:=$(PREFIX)as
-OBJCOPY:=$(PREFIX)objcopy
-OBJDUMP:=$(PREFIX)objdump
-
-# Test specific macros
-OUT_DIR:=./out
-
-# Root folder
-ROOT_DIR:=.
-
-.PHONY: all clean
-
-VAL_LIB :=../../out/$(TARGET)/tbsa_val.a
-PAL_LIB :=../../out/$(TARGET)/tbsa_pal.a
-SYSLIBS :=$(VAL_LIB) $(PAL_LIB) -lgcc -lc -lnosys
-INCDIR := ../../val/include/
-CFLAGS :=-march=armv8-m.$(ARCH) -mthumb -Wall -Werror -O0 -I$(INCDIR)
-SBUILD :=-mcmse
-
-LDFLAGS :=\
- -Xlinker --fatal-warnings \
- -Xlinker --gc-sections \
- -z max-page-size=0x400
-
-SFLAGS :=\
- $(CFLAGS) \
- $(SBUILD) \
- -nostartfiles \
- -T../../platform/board/${TARGET}/linker/test_s.linker \
- $(LDFLAGS)
-
-NSFLAGS :=\
- $(CFLAGS) \
- -nostartfiles \
- -T../../platform/board/${TARGET}/linker/test_ns.linker \
- $(LDFLAGS)
-
-s_src :=secure.c
-ns_src :=non_secure.c
-
-DIR :=$(dir $(wildcard $(ROOT_DIR)/*/))
-DIR :=$(filter-out ./, $(DIR))
-
-all: build
-
-build:
- $(foreach d, $(DIR), mkdir -p $(d)$(OUT_DIR); \
- $(CC) $(SFLAGS) -Xlinker -Map=$(d)$(OUT_DIR)/$(s_src).map -o $(d)$(OUT_DIR)/$(s_src).elf $(d)$(s_src) $(SYSLIBS); \
- $(OBJCOPY) $(d)$(OUT_DIR)/$(s_src).elf -O binary $(d)$(OUT_DIR)/$(s_src).bin; \
- $(OBJDUMP) -d $(d)$(OUT_DIR)/$(s_src).elf > $(d)$(OUT_DIR)/$(s_src).asm; \
- $(CC) $(NSFLAGS) -Xlinker -Map=$(d)$(OUT_DIR)/$(ns_src).map -o $(d)$(OUT_DIR)/$(ns_src).elf $(d)$(ns_src) $(SYSLIBS); \
- $(OBJCOPY) $(d)$(OUT_DIR)/$(ns_src).elf -O binary $(d)$(OUT_DIR)/$(ns_src).bin; \
- $(OBJDUMP) -d $(d)$(OUT_DIR)/$(ns_src).elf > $(d)$(OUT_DIR)/$(ns_src).asm;)
-
-clean:
- $(foreach d, $(DIR), rm -rf $(d)$(OUT_DIR))
diff --git a/tbsa-v8m/test_pool/timer/test_t001/non_secure.c b/tbsa-v8m/test_pool/timer/test_t001/non_secure.c
index 8224bd4c..30ce2b25 100644
--- a/tbsa-v8m/test_pool/timer/test_t001/non_secure.c
+++ b/tbsa-v8m/test_pool/timer/test_t001/non_secure.c
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -22,7 +22,7 @@
**/
TBSA_TEST_PUBLISH(CREATE_TEST_ID(TBSA_TRUSTED_TIMERS_BASE, 1),
CREATE_TEST_TITLE("Trusted and Non-trusted world operation to trusted timer"),
- CREATE_REF_TAG("R030/R040/R050_TBSA_TIME-R120_TBSA_INFRA"),
+ CREATE_REF_TAG("R030/R040/R050_TBSA_TIME"),
entry_hook,
test_payload,
exit_hook);
diff --git a/tbsa-v8m/test_pool/timer/test_t001/secure.c b/tbsa-v8m/test_pool/timer/test_t001/secure.c
index 71dec14d..abd8fe90 100644
--- a/tbsa-v8m/test_pool/timer/test_t001/secure.c
+++ b/tbsa-v8m/test_pool/timer/test_t001/secure.c
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -24,7 +24,7 @@
**/
TBSA_TEST_PUBLISH(CREATE_TEST_ID(TBSA_TRUSTED_TIMERS_BASE, 1),
CREATE_TEST_TITLE("Trusted and Non-trusted world operation to trusted timer"),
- CREATE_REF_TAG("R030/R040/R050_TBSA_TIME-R120_TBSA_INFRA"),
+ CREATE_REF_TAG("R030/R040/R050_TBSA_TIME"),
entry_hook,
test_payload,
exit_hook);
@@ -39,8 +39,6 @@ void timer_isr (void)
{
if (IS_TEST_PENDING(g_val->get_status())) {
g_val->set_status(RESULT_PASS(TBSA_STATUS_SUCCESS));
- } else {
- g_val->set_status(RESULT_FAIL(TBSA_STATUS_INVALID));
}
/* Disable Timer */
@@ -51,8 +49,6 @@ void hard_fault_esr (unsigned long *sf_args)
{
if (IS_TEST_PENDING(g_val->get_status())) {
g_val->set_status(RESULT_PASS(TBSA_STATUS_SUCCESS));
- } else {
- g_val->set_status(RESULT_FAIL(TBSA_STATUS_INVALID));
}
/* Updating the return address in the stack frame in order to avoid periodic fault */
@@ -126,7 +122,7 @@ void test_payload(tbsa_val_api_t *val)
/* Initialise the timer */
status = val->timer_init(timer_desc->base, TIMER_VALUE_US, ((clocks_desc->sys_freq)/1000000));
- // Timeout value assignment - a better strategy needed?
+ /* Timeout value assignment */
timeout = 4 * TIMER_VALUE_US * ((clocks_desc->sys_freq)/1000000);
/* Enable Timer */
@@ -136,14 +132,15 @@ void test_payload(tbsa_val_api_t *val)
/* stay here till timer isr entered or timeout occurs, whichever comes early */
while (IS_TEST_PENDING(val->get_status()) && (--timeout));
- if(!timeout) {
- val->err_check_set(TEST_CHECKPOINT_5, TBSA_STATUS_TIMEOUT);
- timeout_flag = TRUE;
- }
-
/* Restoring default Handler */
status = val->interrupt_restore_handler(EXCP_NUM_EXT_INT(timer_desc->intr_id));
- if (val->err_check_set(TEST_CHECKPOINT_6, status)) {
+ if (val->err_check_set(TEST_CHECKPOINT_5, status)) {
+ return;
+ }
+
+ if(!timeout) {
+ val->print(PRINT_ERROR, "\n\r\tInterrupt not reached target for Timer 0x%X!", (uint32_t)(timer_desc->base));
+ val->err_check_set(TEST_CHECKPOINT_6, TBSA_STATUS_TIMEOUT);
return;
}
}
@@ -151,17 +148,13 @@ void test_payload(tbsa_val_api_t *val)
} while(instance < GET_NUM_INSTANCE(timer_desc));
if (trusted_timer_found) {
- if (timeout_flag) {
- val->err_check_set(TEST_CHECKPOINT_7, TBSA_STATUS_TIMEOUT);
- return;
- }
/* Installing Trusted Fault Handler for NS test */
status = val->interrupt_setup_handler(EXCP_NUM_HF, 0, HF_Handler);
- if (val->err_check_set(TEST_CHECKPOINT_8, status)) {
+ if (val->err_check_set(TEST_CHECKPOINT_7, status)) {
return;
}
} else {
- val->err_check_set(TEST_CHECKPOINT_9, TBSA_STATUS_NOT_FOUND);
+ val->err_check_set(TEST_CHECKPOINT_8, TBSA_STATUS_NOT_FOUND);
return;
}
diff --git a/tbsa-v8m/test_pool/timer/test_t002/non_secure.c b/tbsa-v8m/test_pool/timer/test_t002/non_secure.c
index 79bb84d1..5b52b4a1 100644
--- a/tbsa-v8m/test_pool/timer/test_t002/non_secure.c
+++ b/tbsa-v8m/test_pool/timer/test_t002/non_secure.c
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -17,7 +17,7 @@
#include "val_test_common.h"
-#define TIMEOUT_VALUE 0xFFFFFFFF
+#define TIMEOUT_VALUE (0xFFFFFFFFUL)
/**
Publish these functions to the external world as associated to this test ID
@@ -48,12 +48,12 @@ void entry_hook(tbsa_val_api_t *val)
/* Disabling SecureFault, UsageFault, BusFault, MemFault temporarily */
status = val->mem_reg_read(SHCSR, &shcsr);
- if (val->err_check_set(TEST_CHECKPOINT_B, status)) {
+ if (val->err_check_set(TEST_CHECKPOINT_A, status)) {
return;
}
status = val->mem_reg_write(SHCSR, (shcsr & ~0xF0000));
- if (val->err_check_set(TEST_CHECKPOINT_C, status)) {
+ if (val->err_check_set(TEST_CHECKPOINT_B, status)) {
return;
}
@@ -73,10 +73,12 @@ void test_payload(tbsa_val_api_t *val)
status = val->target_get_config(TARGET_CONFIG_CREATE_ID(GROUP_SOC_PERIPHERAL, 0, 0),
(uint8_t **)&soc_per,
(uint32_t *)sizeof(soc_peripheral_hdr_t));
- if (val->err_check_set(TEST_CHECKPOINT_D, status)) {
+ if (val->err_check_set(TEST_CHECKPOINT_C, status)) {
return;
}
+ trusted_wd_timer_found = FALSE;
+
/* Check we have at least one trusted watch dog timer */
while (per_num < soc_per->num) {
status = val->target_get_config(TARGET_CONFIG_CREATE_ID(GROUP_SOC_PERIPHERAL, SOC_PERIPHERAL_WATCHDOG, instance),
@@ -86,7 +88,7 @@ void test_payload(tbsa_val_api_t *val)
break;
}
- if (val->err_check_set(TEST_CHECKPOINT_E, status)) {
+ if (status == TBSA_STATUS_NOT_FOUND) {
return;
}
@@ -109,23 +111,38 @@ void test_payload(tbsa_val_api_t *val)
/* Wait here till pending status is cleared by secure fault or timeout occurs, whichever comes early */
while (IS_TEST_PENDING(val->get_status()) && (--timeout));
+ if(!timeout) {
+ val->print(PRINT_ERROR, "\n\r\tNo fault occurred when accessing Secure WDOG 0x%X from NT world!", (uint32_t)(soc_per_desc->base));
+ val->err_check_set(TEST_CHECKPOINT_D, TBSA_STATUS_TIMEOUT);
+ return;
+ }
+
trusted_wd_timer_found = TRUE;
val->set_status(RESULT_PENDING(status));
+ timeout = TIMEOUT_VALUE;
/* Trying to read the clock source base address for a given trusted wd timer, expect secure fault? */
val_mem_read_wide((uint32_t *)soc_per_desc->clk_src, &data);
/* wait here till pending status is cleared by secure fault */
- while (IS_TEST_PENDING(val->get_status()));
+ while (IS_TEST_PENDING(val->get_status()) && --timeout);
+
+ if(!timeout) {
+ val->print(PRINT_ERROR, "\n\r\tNo fault occurred when accessing clock source for Secure WDOG 0x%X from NT world!", (uint32_t)(soc_per_desc->base));
+ val->err_check_set(TEST_CHECKPOINT_E, TBSA_STATUS_TIMEOUT);
+ return;
+ }
/* moving to next watchdog instance */
instance++;
+ timeout = TIMEOUT_VALUE;
}
if (!trusted_wd_timer_found) {
/* We did not find any trusted watch dog */
- val->set_status(RESULT_FAIL(status));
+ val->err_check_set(TEST_CHECKPOINT_F, TBSA_STATUS_TIMEOUT);
+ return;
}
}
@@ -135,13 +152,13 @@ void exit_hook(tbsa_val_api_t *val)
/* Restoring default Handler */
status = val->interrupt_restore_handler(EXCP_NUM_HF);
- if (val->err_check_set(TEST_CHECKPOINT_F, status)) {
+ if (val->err_check_set(TEST_CHECKPOINT_10, status)) {
return;
}
/* Restoring faults */
status = val->mem_reg_write(SHCSR, shcsr);
- if (val->err_check_set(TEST_CHECKPOINT_10, status)) {
+ if (val->err_check_set(TEST_CHECKPOINT_11, status)) {
return;
}
}
diff --git a/tbsa-v8m/test_pool/timer/test_t002/secure.c b/tbsa-v8m/test_pool/timer/test_t002/secure.c
index 5486573c..d7cdad50 100644
--- a/tbsa-v8m/test_pool/timer/test_t002/secure.c
+++ b/tbsa-v8m/test_pool/timer/test_t002/secure.c
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -41,10 +41,10 @@ void hard_fault_esr (unsigned long *sf_args)
{
if (IS_TEST_PENDING(g_val->get_status())) {
g_val->set_status(RESULT_PASS(TBSA_STATUS_SUCCESS));
- } else {
- g_val->set_status(RESULT_FAIL(TBSA_STATUS_INVALID));
}
+ g_val->print(PRINT_DEBUG, "\n\r\tFault triggered while accessing S WDOG from NS world!", 0);
+
/* Updating the return address in the stack frame in order to avoid periodic fault */
sf_args[6] = sf_args[6] + 4;
}
@@ -64,15 +64,6 @@ void HF_Handler(void)
"b hard_fault_esr \n");
}
-void setup_ns_env(void)
-{
- tbsa_status_t status;
-
- /* Installing Trusted Fault Handler for NS test */
- status = g_val->interrupt_setup_handler(EXCP_NUM_HF, 0, HF_Handler);
- g_val->err_check_set(TEST_CHECKPOINT_9, status);
-}
-
void entry_hook(tbsa_val_api_t *val)
{
tbsa_test_init_t init = {
@@ -110,9 +101,20 @@ void test_payload(tbsa_val_api_t *val)
}
if (boot.wdogb == WDOG_BOOT_REQUESTED) {
+
+ if (val->system_reset_type(WDOG_RESET) == FALSE) {
+ val->err_check_set(TEST_CHECKPOINT_B, status);
+ return;
+ }
/* There was watchdog reset previously */
+
+ /* Installing Trusted Fault Handler for NS test */
+ status = val->interrupt_setup_handler(EXCP_NUM_HF, 0, HF_Handler);
+ if (val->err_check_set(TEST_CHECKPOINT_C, status)) {
+ return;
+ }
+
val->set_status(RESULT_PASS(TBSA_STATUS_SUCCESS));
- setup_ns_env();
} else {
/*
* Ensure there exist at least one trusted watchdog timer
@@ -133,8 +135,8 @@ void test_payload(tbsa_val_api_t *val)
break;
}
- if (val->err_check_set(TEST_CHECKPOINT_4, status)) {
- return;
+ if (status == TBSA_STATUS_NOT_FOUND) {
+ break;
}
if (soc_per_desc->attribute != SECURE_PROGRAMMABLE) {
@@ -150,14 +152,14 @@ void test_payload(tbsa_val_api_t *val)
*/
/* Check whether trusted watchdog timer is enabled ? */
status = val->is_wd_timer_enabled(soc_per_desc->base);
- if (val->err_check_set(TEST_CHECKPOINT_5, status)) {
+ if (val->err_check_set(TEST_CHECKPOINT_4, status)) {
val->print(PRINT_ERROR, "\n\r\tWatchdog not enabled when control reached tbsa_entry()", 0);
return;
}
/* Disable the watchdog now */
status = val->wd_timer_disable(soc_per_desc->base);
- if (val->err_check_set(TEST_CHECKPOINT_6, status)) {
+ if (val->err_check_set(TEST_CHECKPOINT_5, status)) {
return;
}
@@ -167,7 +169,7 @@ void test_payload(tbsa_val_api_t *val)
if (!trusted_wd_timer_found) {
/* We did not find any trusted watchdog */
- val->err_check_set(TEST_CHECKPOINT_7, status);
+ val->err_check_set(TEST_CHECKPOINT_6, status);
val->set_status(RESULT_FAIL(status));
return;
}
@@ -183,7 +185,7 @@ void test_payload(tbsa_val_api_t *val)
status = val->target_get_config(TARGET_CONFIG_CREATE_ID(GROUP_CLOCKS, CLOCKS_SYS_FREQ, 0),
(uint8_t **)&clocks_desc,
(uint32_t *)sizeof(clocks_desc_t));
- if (val->err_check_set(TEST_CHECKPOINT_8, status)) {
+ if (val->err_check_set(TEST_CHECKPOINT_7, status)) {
return;
}
@@ -192,7 +194,7 @@ void test_payload(tbsa_val_api_t *val)
while (per_num < soc_per->num) {
boot.wdogb = WDOG_BOOT_REQUESTED;
status = val->nvram_write(memory_desc->start, TBSA_NVRAM_OFFSET(NV_BOOT), &boot, sizeof(boot_t));
- if (val->err_check_set(TEST_CHECKPOINT_9, status)) {
+ if (val->err_check_set(TEST_CHECKPOINT_8, status)) {
return;
}
@@ -229,7 +231,7 @@ void exit_hook(tbsa_val_api_t *val)
boot.wdogb = BOOT_UNKNOWN;
status = val->nvram_write(memory_desc->start, TBSA_NVRAM_OFFSET(NV_BOOT), &boot, sizeof(boot_t));
- if (val->err_check_set(TEST_CHECKPOINT_A, status)) {
+ if (val->err_check_set(TEST_CHECKPOINT_9, status)) {
return;
}
}
diff --git a/tbsa-v8m/test_pool/timer/test_t003/non_secure.c b/tbsa-v8m/test_pool/timer/test_t003/non_secure.c
index e222349c..3589113a 100644
--- a/tbsa-v8m/test_pool/timer/test_t003/non_secure.c
+++ b/tbsa-v8m/test_pool/timer/test_t003/non_secure.c
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -17,6 +17,8 @@
#include "val_test_common.h"
+#define TIMEOUT (0xFFFFFFFFUL)
+
/**
Publish these functions to the external world as associated to this test ID
**/
@@ -30,6 +32,7 @@ TBSA_TEST_PUBLISH(CREATE_TEST_ID(TBSA_TRUSTED_TIMERS_BASE, 3),
soc_peripheral_hdr_t *soc_per;
soc_peripheral_desc_t *soc_per_desc;
memory_desc_t *memory_desc;
+uint32_t shcsr;
void entry_hook(tbsa_val_api_t *val)
{
@@ -46,9 +49,9 @@ void test_payload(tbsa_val_api_t *val)
tbsa_status_t status;
uint32_t instance;
uint32_t data;
- bool_t trtc_found = FALSE;
+ bool_t trtc_found = FALSE;
boot_t boot;
- uint32_t shcsr;
+ uint32_t timeout = TIMEOUT;
status = val->target_get_config(TARGET_CONFIG_CREATE_ID(GROUP_MEMORY, MEMORY_NVRAM, 0),
(uint8_t **)&memory_desc,
@@ -64,13 +67,13 @@ void test_payload(tbsa_val_api_t *val)
if (boot.cb != COLD_BOOT_REQUESTED) {
instance = 0UL;
- status = val->nvram_write(memory_desc->start, TBSA_NVRAM_OFFSET(NV_SPAD), &instance, sizeof(instance));
+ status = val->nvram_write(memory_desc->start, TBSA_NVRAM_OFFSET(NV_SPAD1), &instance, sizeof(instance));
if (val->err_check_set(TEST_CHECKPOINT_4, status)) {
return;
}
} else {
/* Getting instance value from NVRAM */
- status = val->nvram_read(memory_desc->start, TBSA_NVRAM_OFFSET(NV_SPAD), &instance, sizeof(instance));
+ status = val->nvram_read(memory_desc->start, TBSA_NVRAM_OFFSET(NV_SPAD1), &instance, sizeof(instance));
if (val->err_check_set(TEST_CHECKPOINT_5, status)) {
return;
}
@@ -93,14 +96,14 @@ void test_payload(tbsa_val_api_t *val)
return;
}
/* Writing instance value into NVRAM so that we go to next instance of TRTC in next run after reset */
- status = val->nvram_write(memory_desc->start, TBSA_NVRAM_OFFSET(NV_SPAD), &instance, sizeof(instance));
+ status = val->nvram_write(memory_desc->start, TBSA_NVRAM_OFFSET(NV_SPAD1), &instance, sizeof(instance));
if (val->err_check_set(TEST_CHECKPOINT_8, status)) {
return;
}
/* Issuing cold boot request */
val->system_reset(COLD_RESET);
/* Shouldn't come here */
- val->print(PRINT_ERROR, "\n\t Shouldn't comer here", 0);
+ val->print(PRINT_ERROR, "\n\r\tShouldn't comer here", 0);
val->err_check_set(TEST_CHECKPOINT_9, TBSA_STATUS_ERROR);
return;
}
@@ -127,6 +130,7 @@ void test_payload(tbsa_val_api_t *val)
}
break;
}
+ val->print(PRINT_DEBUG, "\n\r\tRTC is not trustable - not synced with server!", 0);
}
/* Indicates TRTC is not Trusted when there is outage of power to TRTC */
boot.cb = COLD_BOOT_COMPLETED;
@@ -166,25 +170,33 @@ void test_payload(tbsa_val_api_t *val)
val_mem_read_wide((uint32_t *)(soc_per_desc->base + soc_per_desc->offset), &data);
/* wait here till pending status is cleared by secure fault */
- while (IS_TEST_PENDING(val->get_status()));
+ while (IS_TEST_PENDING(val->get_status()) && --timeout);
+
+ if(!timeout) {
+ val->print(PRINT_ERROR, "\n\r\tNo fault occurred when accessing TRTC address 0x%X from NT world!", (uint32_t)(soc_per_desc->base));
+ val->err_check_set(TEST_CHECKPOINT_11, TBSA_STATUS_TIMEOUT);
+ return;
+ }
val->set_status(RESULT_PENDING(status));
+ timeout = TIMEOUT;
/* Trying to read the clock source base address for a given TRTC, expect secure fault? */
val_mem_read_wide((uint32_t *)soc_per_desc->clk_src, &data);
/* wait here till pending status is cleared by secure fault */
- while (IS_TEST_PENDING(val->get_status()));
+ while (IS_TEST_PENDING(val->get_status()) && --timeout);
+
+ if(!timeout) {
+ val->print(PRINT_ERROR, "\n\r\tNo fault occurred when accessing clock source for TRTC 0x%X from NT world!", (uint32_t)(soc_per_desc->base));
+ val->err_check_set(TEST_CHECKPOINT_12, TBSA_STATUS_TIMEOUT);
+ return;
+ }
}
instance++;
+ timeout = TIMEOUT;
} while(instance < GET_NUM_INSTANCE(soc_per_desc));
- /* Restoring faults */
- status = val->mem_reg_write(SHCSR, shcsr);
- if (val->err_check_set(TEST_CHECKPOINT_11, status)) {
- return;
- }
-
val->set_status(RESULT_PASS(TBSA_STATUS_SUCCESS));
}
@@ -192,16 +204,29 @@ void exit_hook(tbsa_val_api_t *val)
{
tbsa_status_t status;
boot_t boot;
+ uint32_t default_val;
+
+ /* Restoring faults */
+ status = val->mem_reg_write(SHCSR, shcsr);
+ if (val->err_check_set(TEST_CHECKPOINT_13, status)) {
+ return;
+ }
/* Restoring default Handler */
status = val->interrupt_restore_handler(EXCP_NUM_HF);
- if (val->err_check_set(TEST_CHECKPOINT_12, status)) {
+ if (val->err_check_set(TEST_CHECKPOINT_14, status)) {
return;
}
boot.cb = BOOT_UNKNOWN;
status = val->nvram_write(memory_desc->start, TBSA_NVRAM_OFFSET(NV_BOOT), &boot, sizeof(boot));
- if (val->err_check_set(TEST_CHECKPOINT_13, status)) {
+ if (val->err_check_set(TEST_CHECKPOINT_15, status)) {
+ return;
+ }
+
+ default_val = 0xFFFFFFFFUL;
+ status = val->nvram_write(memory_desc->start, TBSA_NVRAM_OFFSET(NV_SPAD1), &default_val, sizeof(default_val));
+ if (val->err_check_set(TEST_CHECKPOINT_16, status)) {
return;
}
}
diff --git a/tbsa-v8m/test_pool/timer/test_t003/secure.c b/tbsa-v8m/test_pool/timer/test_t003/secure.c
index 901ae313..d40e8500 100644
--- a/tbsa-v8m/test_pool/timer/test_t003/secure.c
+++ b/tbsa-v8m/test_pool/timer/test_t003/secure.c
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -35,8 +35,6 @@ void hard_fault_esr (unsigned long *sf_args)
{
if (IS_TEST_PENDING(g_val->get_status())) {
g_val->set_status(RESULT_PASS(TBSA_STATUS_SUCCESS));
- } else {
- g_val->set_status(RESULT_FAIL(TBSA_STATUS_INVALID));
}
/* Updating the return address in the stack frame in order to avoid periodic fault */
diff --git a/tbsa-v8m/test_pool/version_counters/Makefile b/tbsa-v8m/test_pool/version_counters/Makefile
deleted file mode 100644
index 7cfe1de7..00000000
--- a/tbsa-v8m/test_pool/version_counters/Makefile
+++ /dev/null
@@ -1,77 +0,0 @@
-#/** @file
-# * Copyright (c) 2018, 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
-PREFIX:=arm-none-eabi-
-CC:=$(PREFIX)gcc
-CXX:=$(PREFIX)g++
-AS:=$(PREFIX)as
-OBJCOPY:=$(PREFIX)objcopy
-OBJDUMP:=$(PREFIX)objdump
-
-# Test specific macros
-OUT_DIR:=./out
-
-# Root folder
-ROOT_DIR:=.
-
-.PHONY: all clean
-
-VAL_LIB :=../../out/$(TARGET)/tbsa_val.a
-PAL_LIB :=../../out/$(TARGET)/tbsa_pal.a
-SYSLIBS :=$(VAL_LIB) $(PAL_LIB) -lgcc -lc -lnosys
-INCDIR := ../../val/include/
-CFLAGS :=-march=armv8-m.$(ARCH) -mthumb -Wall -Werror -O0 -I$(INCDIR)
-SBUILD :=-mcmse
-
-LDFLAGS :=\
- -Xlinker --fatal-warnings \
- -Xlinker --gc-sections \
- -z max-page-size=0x400
-
-SFLAGS :=\
- $(CFLAGS) \
- $(SBUILD) \
- -nostartfiles \
- -T../../platform/board/${TARGET}/linker/test_s.linker \
- $(LDFLAGS)
-
-NSFLAGS :=\
- $(CFLAGS) \
- -nostartfiles \
- -T../../platform/board/${TARGET}/linker/test_ns.linker \
- $(LDFLAGS)
-
-s_src :=secure.c
-ns_src :=non_secure.c
-
-DIR :=$(dir $(wildcard $(ROOT_DIR)/*/))
-DIR :=$(filter-out ./, $(DIR))
-
-all: build
-
-build:
- $(foreach d, $(DIR), mkdir -p $(d)$(OUT_DIR); \
- $(CC) $(SFLAGS) -Xlinker -Map=$(d)$(OUT_DIR)/$(s_src).map -o $(d)$(OUT_DIR)/$(s_src).elf $(d)$(s_src) $(SYSLIBS); \
- $(OBJCOPY) $(d)$(OUT_DIR)/$(s_src).elf -O binary $(d)$(OUT_DIR)/$(s_src).bin; \
- $(OBJDUMP) -d $(d)$(OUT_DIR)/$(s_src).elf > $(d)$(OUT_DIR)/$(s_src).asm; \
- $(CC) $(NSFLAGS) -Xlinker -Map=$(d)$(OUT_DIR)/$(ns_src).map -o $(d)$(OUT_DIR)/$(ns_src).elf $(d)$(ns_src) $(SYSLIBS); \
- $(OBJCOPY) $(d)$(OUT_DIR)/$(ns_src).elf -O binary $(d)$(OUT_DIR)/$(ns_src).bin; \
- $(OBJDUMP) -d $(d)$(OUT_DIR)/$(ns_src).elf > $(d)$(OUT_DIR)/$(ns_src).asm;)
-
-clean:
- $(foreach d, $(DIR), rm -rf $(d)$(OUT_DIR))
diff --git a/tbsa-v8m/test_pool/version_counters/test_v001/non_secure.c b/tbsa-v8m/test_pool/version_counters/test_v001/non_secure.c
index 76ac7ca4..e3c73cf7 100644
--- a/tbsa-v8m/test_pool/version_counters/test_v001/non_secure.c
+++ b/tbsa-v8m/test_pool/version_counters/test_v001/non_secure.c
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -19,6 +19,7 @@
#define TF_MIN_VER_CNT 64
#define NTF_MIN_VER_CNT 256
+
/**
Publish these functions to the external world as associated to this test ID
**/
@@ -49,25 +50,25 @@ void test_payload(tbsa_val_api_t *val)
{
tbsa_status_t status;
uint32_t instance = 0;
- uint32_t fw_ver_count;
+ uint32_t fw_ver_count, fused_ver_count = 0;
boot_t boot;
uint32_t shcsr = 0;
status = val->crypto_set_base_addr(SECURE_PROGRAMMABLE);
- if (val->err_check_set(TEST_CHECKPOINT_1, status)) {
+ if (val->err_check_set(TEST_CHECKPOINT_2, status)) {
return;
}
status = val->target_get_config(TARGET_CONFIG_CREATE_ID(GROUP_MEMORY, MEMORY_NVRAM, 0),
(uint8_t **)&memory_desc,
(uint32_t *)sizeof(memory_desc_t));
- if (val->err_check_set(TEST_CHECKPOINT_2, status)) {
- goto cleanup;
+ if (val->err_check_set(TEST_CHECKPOINT_3, status)) {
+ return;
}
status = val->nvram_read(memory_desc->start, TBSA_NVRAM_OFFSET(NV_BOOT), &boot, sizeof(boot_t));
- if (val->err_check_set(TEST_CHECKPOINT_3, status)) {
- goto cleanup;
+ if (val->err_check_set(TEST_CHECKPOINT_4, status)) {
+ return;
}
if (boot.cb != COLD_BOOT_REQUESTED) {
@@ -75,23 +76,23 @@ void test_payload(tbsa_val_api_t *val)
status = val->target_get_config(TARGET_CONFIG_CREATE_ID(GROUP_MISCELLANEOUS, MISCELLANEOUS_VER_COUNT, instance),
(uint8_t **)&misc_desc,
(uint32_t *)sizeof(miscellaneous_desc_t));
- if (val->err_check_set(TEST_CHECKPOINT_4, status)) {
- goto cleanup;
+ if (val->err_check_set(TEST_CHECKPOINT_5, status)) {
+ return;
}
/* Checking for on-chip non-volatile version counter range */
if ((misc_desc->fw_ver_type == TRUSTED) || (misc_desc->fw_ver_type == NON_TRUSTED)) {
if (misc_desc->fw_ver_type == TRUSTED) {
if (misc_desc->fw_ver_cnt_max < TF_MIN_VER_CNT) {
- val->print(PRINT_DEBUG, "\nTrusted firmware version counter max should be >= %d", TF_MIN_VER_CNT);
- val->err_check_set(TEST_CHECKPOINT_5, TBSA_STATUS_INCORRECT_VALUE);
- goto cleanup;
+ val->print(PRINT_DEBUG, "\n\r\tTrusted firmware version counter max should be >= %d", TF_MIN_VER_CNT);
+ val->err_check_set(TEST_CHECKPOINT_6, TBSA_STATUS_INCORRECT_VALUE);
+ return;
}
} else {
if (misc_desc->fw_ver_cnt_max < NTF_MIN_VER_CNT) {
- val->print(PRINT_DEBUG, "\nNon-trusted firmware version counter max should be >= %d", NTF_MIN_VER_CNT);
- val->err_check_set(TEST_CHECKPOINT_6, TBSA_STATUS_INCORRECT_VALUE);
- goto cleanup;
+ val->print(PRINT_DEBUG, "\n\r\tNon-trusted firmware version counter max should be >= %d", NTF_MIN_VER_CNT);
+ val->err_check_set(TEST_CHECKPOINT_7, TBSA_STATUS_INCORRECT_VALUE);
+ return;
}
}
}
@@ -99,40 +100,48 @@ void test_payload(tbsa_val_api_t *val)
/* Reading the current firmware version counter */
fw_ver_count = val->firmware_version_read(instance, misc_desc->fw_ver_type);
- /* Updating the firmware version count(trusted mode) */
- status = val->firmware_version_update(instance, misc_desc->fw_ver_type, ++fw_ver_count);
- if (val->err_check_set(TEST_CHECKPOINT_7, status)) {
- goto cleanup;
+ /* Skip the test if max version was already fused */
+ if (fw_ver_count == misc_desc->fw_ver_cnt_max) {
+ val->set_status(RESULT_SKIP(status));
+ return;
}
- /* Updating firmware version(lower than previous counter), expecting failure ! */
- status = val->firmware_version_update(instance, misc_desc->fw_ver_type, --fw_ver_count);
- if (status == TBSA_STATUS_SUCCESS) {
+ /* Updating the firmware version count(trusted mode) */
+ val->firmware_version_update(instance, misc_desc->fw_ver_type, ++fw_ver_count);
+
+ /* Check if the versoin is incremented */
+ fused_ver_count = val->firmware_version_read(instance, misc_desc->fw_ver_type);
+ if (fused_ver_count != (fw_ver_count)) {
val->err_check_set(TEST_CHECKPOINT_8, TBSA_STATUS_INVALID);
- goto cleanup;
+ return;
}
- /* which confirms we cannot decrement firmware version counter */
-
- /* When a version counter reaches its maximum value, it must not roll over,
- * and no further changes must be possible
+ /* Updating firmware version(lower than previous counter)
+ * which confirms we cannot decrement firmware version counter
*/
- status = val->firmware_version_update(instance, misc_desc->fw_ver_type, misc_desc->fw_ver_cnt_max);
- if (status != TBSA_STATUS_SUCCESS) {
- val->err_check_set(TEST_CHECKPOINT_9, TBSA_STATUS_INVALID);
- goto cleanup;
+ val->firmware_version_update(instance, misc_desc->fw_ver_type, --fw_ver_count);
+ fused_ver_count = val->firmware_version_read(instance, misc_desc->fw_ver_type);
+ if (fused_ver_count != (++fw_ver_count)) {
+ val->err_check_set(TEST_CHECKPOINT_9, TBSA_STATUS_INVALID);
+ return;
}
- status = val->firmware_version_update(instance, misc_desc->fw_ver_type, (misc_desc->fw_ver_cnt_max + 1));
- if (status == TBSA_STATUS_SUCCESS) {
+ /* Updating the firmware version count to max */
+ val->firmware_version_update(instance, misc_desc->fw_ver_type, misc_desc->fw_ver_cnt_max);
+ fused_ver_count = val->firmware_version_read(instance, misc_desc->fw_ver_type);
+ if (fused_ver_count != misc_desc->fw_ver_cnt_max) {
val->err_check_set(TEST_CHECKPOINT_A, TBSA_STATUS_INVALID);
- goto cleanup;
+ return;
}
- /* Reading trusted firmware version counter */
- if(misc_desc->fw_ver_cnt_max != val->firmware_version_read(instance, misc_desc->fw_ver_type)) {
+ /* When a version counter reaches its maximum value, it must not roll over,
+ * and no further changes must be possible
+ */
+ status = val->firmware_version_update(instance, misc_desc->fw_ver_type, (misc_desc->fw_ver_cnt_max + 1));
+ fused_ver_count = val->firmware_version_read(instance, misc_desc->fw_ver_type);
+ if (misc_desc->fw_ver_cnt_max != fused_ver_count) {
val->err_check_set(TEST_CHECKPOINT_B, TBSA_STATUS_INVALID);
- goto cleanup;
+ return;
}
/* Updating the firmware version count(non-trusted mode) */
@@ -140,7 +149,7 @@ void test_payload(tbsa_val_api_t *val)
boot.cb = COLD_BOOT_REQUESTED;
status = val->nvram_write(memory_desc->start, TBSA_NVRAM_OFFSET(NV_BOOT), &boot, sizeof(boot_t));
if (val->err_check_set(TEST_CHECKPOINT_C, status)) {
- goto cleanup;
+ return;
}
/* Disabling SecureFault, UsageFault, BusFault, MemFault temporarily */
@@ -159,13 +168,15 @@ void test_payload(tbsa_val_api_t *val)
return;
}
+ val_crypto_set_base_addr(SECURE_PROGRAMMABLE);
+
/* Updating the firmware version count(non-trusted mode), secure-fault is expected! */
- val_firmware_version_update(instance, misc_desc->fw_ver_type, fw_ver_count);
+ val_firmware_version_update(instance, misc_desc->fw_ver_type, ++fw_ver_count);
/* Test shouldn't come here */
- val->print(PRINT_ERROR, "\n\t Error: able to update the version counter from NTW", 0);
+ val->print(PRINT_ERROR, "\n\r\t Error: able to update the version counter from NTW", 0);
val->err_check_set(TEST_CHECKPOINT_10, TBSA_STATUS_ERROR);
- goto cleanup;
+ return;
}
/* confirms roll over didn't happen */
@@ -176,18 +187,18 @@ void test_payload(tbsa_val_api_t *val)
boot.cb = BOOT_UNKNOWN;
status = val->nvram_write(memory_desc->start, TBSA_NVRAM_OFFSET(NV_BOOT), &boot, sizeof(boot_t));
if (val->err_check_set(TEST_CHECKPOINT_11, status)) {
- goto cleanup;
+ return;
}
status = val->nvram_read(memory_desc->start, TBSA_NVRAM_OFFSET(NV_SHCSR), &shcsr, sizeof(shcsr));
if (val->err_check_set(TEST_CHECKPOINT_12, status)) {
- goto cleanup;
+ return;
}
/* Restoring faults */
status = val->mem_reg_write(SHCSR, shcsr);
if (val->err_check_set(TEST_CHECKPOINT_13, status)) {
- goto cleanup;
+ return;
}
do {
@@ -195,29 +206,28 @@ void test_payload(tbsa_val_api_t *val)
(uint8_t **)&misc_desc,
(uint32_t *)sizeof(miscellaneous_desc_t));
if (val->err_check_set(TEST_CHECKPOINT_14, status)) {
- goto cleanup;
+ return;
}
/* Check if version is preserved across reset */
if(misc_desc->fw_ver_cnt_max != val->firmware_version_read(instance, misc_desc->fw_ver_type)) {
val->err_check_set(TEST_CHECKPOINT_15, TBSA_STATUS_INVALID);
- goto cleanup;
+ return;
}
instance++;
} while (instance < GET_NUM_INSTANCE(misc_desc));
-
}
val->set_status(RESULT_PASS(TBSA_STATUS_SUCCESS));
+}
+
+void exit_hook(tbsa_val_api_t *val)
+{
+ tbsa_status_t status;
-cleanup:
/* Restoring default Handler */
status = val->interrupt_restore_handler(EXCP_NUM_HF);
if (val->err_check_set(TEST_CHECKPOINT_16, status)) {
return;
}
}
-
-void exit_hook(tbsa_val_api_t *val)
-{
-}
diff --git a/tbsa-v8m/test_pool/version_counters/test_v001/secure.c b/tbsa-v8m/test_pool/version_counters/test_v001/secure.c
index 132a26e1..021f6281 100644
--- a/tbsa-v8m/test_pool/version_counters/test_v001/secure.c
+++ b/tbsa-v8m/test_pool/version_counters/test_v001/secure.c
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -29,8 +29,7 @@ TBSA_TEST_PUBLISH(CREATE_TEST_ID(TBSA_VERSION_COUNTERS_BASE, 1),
tbsa_val_api_t *g_val;
-void
-hard_fault_esr (unsigned long *sf_args)
+void hard_fault_esr (unsigned long *sf_args)
{
/* Issue system warm reset */
g_val->system_reset(COLD_RESET);
@@ -40,8 +39,7 @@ hard_fault_esr (unsigned long *sf_args)
}
__attribute__((naked))
-void
-HF_Handler(void)
+void HF_Handler(void)
{
asm volatile("mrs r0, control_ns \n"
"mov r1, #0x2 \n"
@@ -55,16 +53,6 @@ HF_Handler(void)
"b hard_fault_esr \n");
}
-void
-setup_ns_env(void)
-{
- tbsa_status_t status;
-
- /* Installing Trusted Fault Handler for NS test */
- status = g_val->interrupt_setup_handler(EXCP_NUM_HF, 0, HF_Handler);
- g_val->err_check_set(TEST_CHECKPOINT_1, status);
-}
-
void entry_hook(tbsa_val_api_t *val)
{
tbsa_test_init_t init = {
@@ -79,8 +67,14 @@ void entry_hook(tbsa_val_api_t *val)
void test_payload(tbsa_val_api_t *val)
{
+ tbsa_status_t status;
+
/* setup environment for NS test */
- setup_ns_env();
+ /* Installing Trusted Fault Handler for NS test */
+ status = val->interrupt_setup_handler(EXCP_NUM_HF, 0, HF_Handler);
+ if (val->err_check_set(TEST_CHECKPOINT_1, status)) {
+ return;
+ }
val->set_status(RESULT_PASS(TBSA_STATUS_SUCCESS));
}
diff --git a/tbsa-v8m/tools/debug/debugger_script.ini b/tbsa-v8m/tools/debug/debugger_script.ini
new file mode 100755
index 00000000..9187c668
--- /dev/null
+++ b/tbsa-v8m/tools/debug/debugger_script.ini
@@ -0,0 +1,255 @@
+/** @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.
+**/
+
+
+/*
+ DPM debugger script
+
+ SEQ_TEST_END 0
+ SEQ_OPEN_STATE_READ 1
+ SEQ_OPEN_STATE_WRITE 2
+ SEQ_CLOSED_STATE_READ 3
+ SEQ_CLOSED_STATE_WRITE 4
+ SEQ_LOCKED_STATE_READ 5
+ SEQ_NEXT_TEST 6
+
+
+*/
+
+
+
+FUNC void f1 (void)
+{
+ unsigned int flagAddr;
+ unsigned int dataAddr;
+ int flag_register;
+ int data;
+ int run_status;
+ int output;
+ int addr;
+ int debug;
+ unsigned int debugAddr;
+ int i;
+
+/* #defines for sequences to be executed */
+ int SEQ_OPEN_STATE_READ;
+ int SEQ_OPEN_STATE_WRITE;
+ int SEQ_CLOSED_STATE_READ;
+ int SEQ_CLOSED_STATE_WRITE;
+ int SEQ_LOCKED_STATE_READ;
+//#SEQ_LOCKED_STATE_WRITE = 0x60
+ int SEQ_NEXT_TEST;
+ int SEQ_TEST_END;
+
+//#defines for indicating signature to PE
+ unsigned int DBG_INIT_SIGNATURE;
+ unsigned int DBG_NEXT_SIGNATURE;
+
+//#defines for status handshake between core and debugger
+ int DBG_FLAG_TXFULL;
+ int DBG_FLAG_RXFULL;
+ int DBG_FLAG_READY;
+
+/* #defines for sequences to be executed */
+ SEQ_OPEN_STATE_READ=0x10;
+ SEQ_OPEN_STATE_WRITE=0x20;
+ SEQ_CLOSED_STATE_READ=0x30;
+ SEQ_CLOSED_STATE_WRITE=0x40;
+ SEQ_LOCKED_STATE_READ=0x50;
+//#SEQ_LOCKED_STATE_WRITE = 0x60
+ SEQ_NEXT_TEST = 0xE0;
+ SEQ_TEST_END = 0xF0;
+
+//#defines for indicating signature to PE
+ DBG_INIT_SIGNATURE = 0xDEED007;
+ DBG_NEXT_SIGNATURE = 0xDEED008;
+
+//#defines for status handshake between core and debugger
+ DBG_FLAG_TXFULL = 0x1;
+ DBG_FLAG_RXFULL = 0x2;
+ DBG_FLAG_READY = 0x4;
+
+ flagAddr = 0x30017FF0;//flagAddr = &gFlag;
+ dataAddr = 0x30017FF4;//dataAddr = &gData;
+
+ printf("0x%08x 0x%08x\n", flagAddr, dataAddr);
+
+ _WDWORD(dataAddr,DBG_INIT_SIGNATURE);
+ _WDWORD(flagAddr,DBG_FLAG_READY);
+ printf("0x%08x 0x%08x\n", _RDWORD(flagAddr), _RDWORD(dataAddr));
+
+ _break_ = 0;
+
+ run_status = 0;
+ while(run_status != SEQ_TEST_END)
+ {
+ flag_register = _RDWORD(flagAddr);
+ run_status = flag_register & 0xf0;
+
+ if((flag_register & 0xff) == 0x0)
+ {
+ _WDWORD(flagAddr,DBG_FLAG_READY);
+ _sleep_(100);
+ _break_=0;
+ exec("g");
+ continue;
+ }
+
+ if(run_status == SEQ_OPEN_STATE_READ)
+ {
+ //printf("SEQ_OPEN_STATE_READ : 0x%x\n", _RDWORD(flagAddr));
+ _WDWORD(flagAddr,0);
+ data = _RDWORD(dataAddr);
+ output = _RDWORD(data);
+ _WDWORD(dataAddr,output);
+ _WDWORD(flagAddr,DBG_FLAG_READY|DBG_FLAG_RXFULL);
+
+ _sleep_(10);
+ _break_=0;
+ //printf("SEQ_OPEN_STATE_READ is finished\n");
+ exec("g");
+ }
+ else if(run_status == SEQ_OPEN_STATE_WRITE)
+ {
+ //printf("SEQ_OPEN_STATE_WRITE : 0x%x\n", _RDWORD(flagAddr));
+ _WDWORD(flagAddr,0);
+ addr = _RDWORD(dataAddr);
+ _WDWORD(flagAddr,DBG_FLAG_READY|DBG_FLAG_RXFULL);
+
+ _sleep_(10);
+ _break_ = 0;
+ exec("g");
+
+ //while(!_break_);
+ while((_RDWORD(flagAddr) & DBG_FLAG_TXFULL) == 0x0);
+
+ _WDWORD(flagAddr,0);
+ data = _RDWORD(dataAddr);
+ _WDWORD(addr, data);
+ _WDWORD(flagAddr,DBG_FLAG_READY|DBG_FLAG_RXFULL);
+
+ _sleep_(10);
+ _break_=0;
+ //printf("SEQ_OPEN_STATE_WRITE is finished\n");
+ exec("g");
+ }
+ else if(run_status == SEQ_CLOSED_STATE_READ)
+ {
+ //printf("SEQ_CLOSED_STATE_READ : 0x%x\n", _RDWORD(flagAddr));
+ // DPM in OPEN state
+ _WDWORD(flagAddr,0);
+ data = _RDWORD(dataAddr);
+ printf("SEQ_CLOSED_STATE_READ = %X\n", data);
+ _WDWORD(flagAddr, DBG_FLAG_READY);
+
+ _sleep_(10);
+ _break_=0;
+ exec("g");
+
+ // DPM shall move to CLOSED state
+ while((_RDWORD(flagAddr) & 0xf0) != SEQ_CLOSED_STATE_READ);
+ _WDWORD(flagAddr, 0);
+ output = _RDWORD(data);
+ printf("SEQ_CLOSED_STATE_READ = %X\n", output);
+
+ _WDWORD(dataAddr,output);
+ printf("SEQ_CLOSED_STATE_READ = %X\n", _RDWORD(dataAddr));
+ _WDWORD(flagAddr,DBG_FLAG_READY|DBG_FLAG_RXFULL);
+
+ _sleep_(10);
+ _break_=0;
+ printf("SEQ_CLOSED_STATE_READ finished\n");
+ exec("g");
+
+ }
+ //# Add the code : check if still getting DAP error, to ensure that read access happened in closed state
+ else if(run_status == SEQ_CLOSED_STATE_WRITE)
+ {
+ //printf("SEQ_CLOSED_STATE_WRITE : 0x%x\n", _RDWORD(flagAddr));
+ _WDWORD(flagAddr,0);
+ addr = _RDWORD(dataAddr);
+ _WDWORD(flagAddr,DBG_FLAG_READY|DBG_FLAG_RXFULL);
+
+ _sleep_(10);
+ _break_=0;
+ exec("g");
+
+ while((_RDWORD(flagAddr) & DBG_FLAG_TXFULL) == 0x0);
+
+ _WDWORD(flagAddr,0);
+ data = _RDWORD(dataAddr);
+ _WDWORD(addr, data);
+ _WDWORD(flagAddr,DBG_FLAG_READY|DBG_FLAG_RXFULL);
+
+ _sleep_(10);
+ _break_=0;
+ //printf("SEQ_CLOSED_STATE_WRITE finished\n");
+ exec("g");
+ }
+ //# Add the code : check if still getting DAP error, to ensure that read access happened in closed state
+ else if(run_status == SEQ_LOCKED_STATE_READ)
+ {
+ _WDWORD(flagAddr,0);
+ data = _RDWORD(dataAddr);
+ _WDWORD(flagAddr,DBG_FLAG_READY|DBG_FLAG_RXFULL);
+
+ _sleep_(10);
+ _break_=0;
+ exec("g");
+
+ //# Add the code : wait for DAP error
+ //output = ec.getMemoryService().readMemory32(data) # this read must happen while still getting DAP error.
+ output = _RDWORD(data);
+
+ //# Add the code : check if still getting DAP error, to ensure that read access happened in closed state
+ while(!_break_);
+
+ _WDWORD(flagAddr,0);
+ _WDWORD(dataAddr,output);
+
+ //#Set flag register appropriately so that CPU can proceed.
+ _WDWORD(flagAddr,DBG_FLAG_READY|DBG_FLAG_RXFULL);
+
+ _sleep_(10);
+ _break_=0;
+ exec("g");
+ }
+ //# This seq is to indicate to proceed to next test.
+ else if(run_status == SEQ_NEXT_TEST)
+ {
+ _WDWORD(dataAddr,DBG_NEXT_SIGNATURE);
+ printf("SEQ_NEXT_TEST dataAddr = %x", _RDWORD(dataAddr));
+ printf("proceed to next debug test\n");
+ _WDWORD(flagAddr,DBG_FLAG_READY);
+
+ _sleep_(100);
+ _break_=0;
+ exec("g");
+ }
+ }
+ printf("Debugger script Done!\n");
+}
+
+
+g,main
+
+bs WRITE 0x30017FF0, 1, "_break_=1"
+_sleep_(1000)
+g
+
+f1()
+
diff --git a/tbsa-v8m/tools/gen_linker_scripts/gen_linker_scripts.py b/tbsa-v8m/tools/gen_linker_scripts/gen_linker_scripts.py
index 67f16e8e..f79bd4a4 100644
--- a/tbsa-v8m/tools/gen_linker_scripts/gen_linker_scripts.py
+++ b/tbsa-v8m/tools/gen_linker_scripts/gen_linker_scripts.py
@@ -1,5 +1,5 @@
#/** @file
-# * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+# * 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");
@@ -22,17 +22,23 @@
from linker_address_length import *
num_args = len(sys.argv)
-if (num_args != 2):
- print("\nTarget string is required as second argument!")
+
+if (num_args != 7):
+ print("\nPkease provide following inputs")
+ print("\narg1 : <.../tbsa_tgt.cfg>")
+ print("\narg2 : <.../Linker script template for tbsa.elf>")
+ print("\narg3 : <.../Linker script template for test ELF>")
+ print("\narg4 : <.../tbsa.linker>")
+ print("\narg5 : <.../test_s.linker>")
+ print("\narg6 : <.../test_ns.linker>")
sys.exit(1)
-tbsa_linker_path = "../../platform/board/" + sys.argv[1] + "/linker"
-tbsa_tgt_cfg_file = "../../platform/board/" + sys.argv[1] + "/tbsa_tgt.cfg"
-src_tbsa_template = "./tbsa.linker.template"
-src_test_template = "./test.linker.template"
-dst_tbsa_linker = tbsa_linker_path + "/tbsa.linker"
-dst_test_s_linker = tbsa_linker_path + "/test_s.linker"
-dst_test_ns_linker= tbsa_linker_path + "/test_ns.linker"
+tbsa_tgt_cfg_file = sys.argv[1]
+src_tbsa_template = sys.argv[2]
+src_test_template = sys.argv[3]
+dst_tbsa_linker = sys.argv[4]
+dst_test_s_linker = sys.argv[5]
+dst_test_ns_linker= sys.argv[6]
s_addr = ""
ns_addr = ""
@@ -48,11 +54,6 @@
print("The Target Configuration File is not preset for a given target!!!")
sys.exit(1)
-# Create linker directory in the appropriate target path
-if os.path.exists(tbsa_linker_path):
- shutil.rmtree(tbsa_linker_path)
-os.makedirs(tbsa_linker_path)
-
# Subroutine which search and replaces the input strings in a given file
def update_addr(file_handle, replace_from, replace_to):
# Read the file
@@ -105,25 +106,25 @@ def update_addr(file_handle, replace_from, replace_to):
update_addr(dst_tbsa_linker, "TBSA_TEXT_START", \
s_addr)
update_addr(dst_tbsa_linker, "TBSA_TEXT_LENGTH", \
- TBSA_TEXT_LENGTH)
+ hex(int(TBSA_TEXT_LENGTH[:TBSA_TEXT_LENGTH.find("K")]) * 1024))
update_addr(dst_tbsa_linker, "TBSA_DATA_START", \
hex(int(s_addr, 16) + \
(int(TBSA_TEXT_LENGTH[:TBSA_TEXT_LENGTH.find("K")]) * 1024)))
update_addr(dst_tbsa_linker, "TBSA_DATA_LENGTH", \
- TBSA_DATA_LENGTH)
+ hex(int(TBSA_DATA_LENGTH[:TBSA_DATA_LENGTH.find("K")]) * 1024))
update_addr(dst_tbsa_linker, "TBSA_NS_DATA_START", \
ns_addr)
update_addr(dst_tbsa_linker, "TBSA_NS_DATA_LENGTH", \
- TBSA_NS_DATA_LENGTH)
+ hex(int(TBSA_NS_DATA_LENGTH[:TBSA_NS_DATA_LENGTH.find("K")]) * 1024))
update_addr(dst_tbsa_linker, "TBSA_NS_TEXT_START", \
hex(int(ns_addr, 16) + \
(int(TBSA_NS_DATA_LENGTH[:TBSA_NS_DATA_LENGTH.find("K")]) * 1024)))
update_addr(dst_tbsa_linker, "TBSA_NS_TEXT_LENGTH", \
- TBSA_NS_TEXT_LENGTH)
+ hex(int(TBSA_NS_TEXT_LENGTH[:TBSA_NS_TEXT_LENGTH.find("K")]) * 1024))
update_addr(dst_tbsa_linker, "TBSA_NSC_TEXT_START", \
nsc_addr)
update_addr(dst_tbsa_linker, "TBSA_NSC_TEXT_LENGTH", \
- TBSA_NSC_TEXT_LENGTH)
+ hex(int(TBSA_NSC_TEXT_LENGTH[:TBSA_NSC_TEXT_LENGTH.find("K")]) * 1024))
update_addr(dst_tbsa_linker, "TBSA_TEST_S_START", \
s_test_addr)
update_addr(dst_tbsa_linker, "TBSA_TEST_S_END", \
@@ -143,32 +144,32 @@ def update_addr(file_handle, replace_from, replace_to):
update_addr(dst_test_s_linker, "TBSA_TEST_INFO_START", \
s_test_addr)
update_addr(dst_test_s_linker, "TBSA_TEST_INFO_LENGTH", \
- TBSA_TEST_INFO_LENGTH)
+ hex(int(TBSA_TEST_INFO_LENGTH[:TBSA_TEST_INFO_LENGTH.find("K")]) * 1024))
update_addr(dst_test_s_linker, "TBSA_TEST_TEXT_START", \
hex(int(s_test_addr,16) + \
(int(TBSA_TEST_INFO_LENGTH[:TBSA_TEST_INFO_LENGTH.find("K")]) * 1024)))
update_addr(dst_test_s_linker, "TBSA_TEST_TEXT_LENGTH", \
- TBSA_TEST_TEXT_LENGTH)
+ hex(int(TBSA_TEST_TEXT_LENGTH[:TBSA_TEST_TEXT_LENGTH.find("K")]) * 1024))
update_addr(dst_test_s_linker, "TBSA_TEST_DATA_START", \
hex(int(s_test_addr, 16) + \
(int(TBSA_TEST_INFO_LENGTH[:TBSA_TEST_INFO_LENGTH.find("K")]) * 1024) + \
(int(TBSA_TEST_TEXT_LENGTH[:TBSA_TEST_TEXT_LENGTH.find("K")]) * 1024)))
update_addr(dst_test_s_linker, "TBSA_TEST_DATA_LENGTH", \
- TBSA_TEST_DATA_LENGTH)
+ hex(int(TBSA_TEST_DATA_LENGTH[:TBSA_TEST_DATA_LENGTH.find("K")]) * 1024))
# Updating NS test linker script with address from target configuration file
update_addr(dst_test_ns_linker, "TBSA_TEST_INFO_START", \
ns_test_addr)
update_addr(dst_test_ns_linker, "TBSA_TEST_INFO_LENGTH", \
- TBSA_TEST_INFO_LENGTH)
+ hex(int(TBSA_TEST_INFO_LENGTH[:TBSA_TEST_INFO_LENGTH.find("K")]) * 1024))
update_addr(dst_test_ns_linker, "TBSA_TEST_TEXT_START", \
hex(int(ns_test_addr,16) + \
(int(TBSA_TEST_INFO_LENGTH[:TBSA_TEST_INFO_LENGTH.find("K")]) * 1024)))
update_addr(dst_test_ns_linker, "TBSA_TEST_TEXT_LENGTH", \
- TBSA_TEST_TEXT_LENGTH)
+ hex(int(TBSA_TEST_TEXT_LENGTH[:TBSA_TEST_TEXT_LENGTH.find("K")]) * 1024))
update_addr(dst_test_ns_linker, "TBSA_TEST_DATA_START", \
hex(int(ns_test_addr, 16) + \
(int(TBSA_TEST_INFO_LENGTH[:TBSA_TEST_INFO_LENGTH.find("K")]) * 1024) + \
(int(TBSA_TEST_TEXT_LENGTH[:TBSA_TEST_TEXT_LENGTH.find("K")]) * 1024)))
update_addr(dst_test_ns_linker, "TBSA_TEST_DATA_LENGTH", \
- TBSA_TEST_DATA_LENGTH)
+ hex(int(TBSA_TEST_DATA_LENGTH[:TBSA_TEST_DATA_LENGTH.find("K")]) * 1024))
diff --git a/tbsa-v8m/tools/gen_linker_scripts/linker_address_length.py b/tbsa-v8m/tools/gen_linker_scripts/linker_address_length.py
index 452cadf1..65fed597 100644
--- a/tbsa-v8m/tools/gen_linker_scripts/linker_address_length.py
+++ b/tbsa-v8m/tools/gen_linker_scripts/linker_address_length.py
@@ -1,5 +1,5 @@
#/** @file
-# * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+# * 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");
@@ -15,7 +15,7 @@
# * limitations under the License.
#**/
-TBSA_TEXT_LENGTH = "60K"
+TBSA_TEXT_LENGTH = "32K"
TBSA_DATA_LENGTH = "3K"
TBSA_NS_DATA_LENGTH = "6K"
TBSA_NS_TEXT_LENGTH = "2K"
diff --git a/tbsa-v8m/tools/gen_linker_scripts/tbsa.linker.template b/tbsa-v8m/tools/gen_linker_scripts/tbsa.linker.template
index 549f5444..82980cfb 100644
--- a/tbsa-v8m/tools/gen_linker_scripts/tbsa.linker.template
+++ b/tbsa-v8m/tools/gen_linker_scripts/tbsa.linker.template
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -88,6 +88,7 @@ SECTIONS
*(.text*)
*(.rodata)
*(.rodata*)
+ KEEP(*(.tbsa_ns_text))
__tbsa_ns_text_end__ = .;
} > TBSA_NS_TEXT
diff --git a/tbsa-v8m/tools/gen_linker_scripts/test.linker.template b/tbsa-v8m/tools/gen_linker_scripts/test.linker.template
index eb25e9f8..6f9c438d 100644
--- a/tbsa-v8m/tools/gen_linker_scripts/test.linker.template
+++ b/tbsa-v8m/tools/gen_linker_scripts/test.linker.template
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * 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");
@@ -25,9 +25,9 @@ MEMORY
SECTIONS
{
- .tbsa_info :
+ .tbsa_test_info :
{
- KEEP(*(.tbsa_info))
+ KEEP(*(.tbsa_test_info))
} > TBSA_TEST_INFO
.text :
@@ -36,10 +36,6 @@ SECTIONS
*(.text*)
*(.rodata)
*(.rodata*)
- } > TBSA_TEST_TEXT
-
- .ns_target_database :
- {
. = ALIGN(4);
KEEP(*(.ns_target_database))
. = ALIGN(4);
diff --git a/tbsa-v8m/tools/test_elf_combine.py b/tbsa-v8m/tools/test_elf_combine.py
new file mode 100644
index 00000000..5d540c29
--- /dev/null
+++ b/tbsa-v8m/tools/test_elf_combine.py
@@ -0,0 +1,141 @@
+#!/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
+import os
+from fnmatch import fnmatch
+import shutil
+import binascii
+
+if (len(sys.argv) != 3):
+ print("\nPlease provide following inputs")
+ print("\narg1 : ")
+ print("\narg2 :