aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmake/helpers.cmake4
-rwxr-xr-xscripts/run_ctest.py23
-rw-r--r--targets/corstone-300/CMakeLists.txt1
3 files changed, 27 insertions, 1 deletions
diff --git a/cmake/helpers.cmake b/cmake/helpers.cmake
index c8a4987..c12f427 100644
--- a/cmake/helpers.cmake
+++ b/cmake/helpers.cmake
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2020-2021 Arm Limited. All rights reserved.
+# Copyright (c) 2020-2022 Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
@@ -111,6 +111,8 @@ endfunction()
# Test
#############################################################################
+set(ETHOSU_CTEST_TARMAC_TRACE OFF CACHE BOOL "Enable to generate tarmac trace files when running ctest")
+
function(ethosu_add_test target)
if(NOT BUILD_TESTING)
return()
diff --git a/scripts/run_ctest.py b/scripts/run_ctest.py
index 1faf0e2..93a5427 100755
--- a/scripts/run_ctest.py
+++ b/scripts/run_ctest.py
@@ -21,6 +21,8 @@
import argparse
import subprocess
import sys
+import os
+from pathlib import Path
def __print_arguments(args):
if isinstance(args, list):
@@ -89,6 +91,25 @@ def run_corstone_300(args):
'-C', 'mps3_board.uart0.unbuffered_output=1',
'-C', 'mps3_board.uart0.shutdown_on_eot=1']
+ if args.tarmac:
+ try:
+ pvlib_home = Path(os.getenv('PVLIB_HOME'))
+ except:
+ raise Exception("Environment variable PVLIB_HOME not found. Needed to produce tarmac trace.")
+
+ if sys.platform == 'linux':
+ tarmac_trace_plugin = pvlib_home / Path('plugins/Linux64_GCC-7.3/TarmacTrace.so')
+ else:
+ raise Exception("tarmac trace: This feature is not currently supported on" + sys.platform)
+
+ if tarmac_trace_plugin.exists():
+ print("Tarmac trace will be created");
+ basename = [ e for e in args.args if e.endswith('.elf')][0][:-4]
+ cmd += ['--plugin', str(tarmac_trace_plugin)]
+ cmd += ['-C', f'TRACE.TarmacTrace.trace-file={basename}.trace']
+ else:
+ raise Exception("tarmac trace: Can't find TarmacTrace plugin in " + pvlib_home)
+
cmd += args.args
return run_fvp(cmd)
@@ -129,6 +150,8 @@ if __name__ == '__main__':
parser.add_argument('-t', '--target', choices=['corstone-300', 'corstone-polaris'], required=True, help='FVP target.')
parser.add_argument('-a', '--arch', choices=['ethos-u55', 'ethos-u65'], help='NPU architecture.')
parser.add_argument('-m', '--macs', type=int, choices=[32, 64, 128, 256, 512], default=128, help='NPU number of MACs.')
+ parser.add_argument('-c', '--tarmac', dest='tarmac', action='store_true', help='Collect tarmac traces when running FVP.')
+
parser.add_argument('args', nargs='+', help='Arguments.')
args = parser.parse_args()
diff --git a/targets/corstone-300/CMakeLists.txt b/targets/corstone-300/CMakeLists.txt
index 3a6f291..a409a97 100644
--- a/targets/corstone-300/CMakeLists.txt
+++ b/targets/corstone-300/CMakeLists.txt
@@ -64,6 +64,7 @@ set(ETHOSU_COMMAND_DEFAULT ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/../
-t corstone-300
-a ethos-${ETHOSU_ARCH}
-m ${ETHOSU_NUM_MACS}
+ $<$<BOOL:ETHOSU_CTEST_TARMAC_TRACE>:--tarmac>
CACHE INTERNAL "Default test command")
# Enable trustzone support in core_software