From bf5ae23fd40e01a5bbbfc646252b25f70e97a900 Mon Sep 17 00:00:00 2001 From: Tushar Khandelwal Date: Fri, 16 Aug 2019 12:31:35 +0100 Subject: add support for cortex a5 designstart Change-Id: Ib12eaba14b54b4e0d71c82de8476169499d07901 Signed-off-by: Tushar Khandelwal --- readme.txt | 10 ++- run_model.sh | 24 +++++- scripts/platforms/a5ds/a5ds_fvp.py | 122 ++++++++++++++++++++++++++++++ scripts/platforms/a5ds/a5ds_testrunner.py | 56 ++++++++++++++ 4 files changed, 207 insertions(+), 5 deletions(-) create mode 100644 scripts/platforms/a5ds/a5ds_fvp.py create mode 100644 scripts/platforms/a5ds/a5ds_testrunner.py diff --git a/readme.txt b/readme.txt index fac2e91..0d4c46c 100644 --- a/readme.txt +++ b/readme.txt @@ -2,15 +2,16 @@ There are 3 ways of running tests using the run_model.sh file. 1. ./run_model.sh - This will run the Corstone700 fast model and will allow user + This will run the Corstone700/CA5-DS fast model and will allow user to interact and run the tests manually.Once you get the linux prompt by entering user as "root" you can run test-app manually. + For Corstone700 Currently two test cases are supported - a. Test Boot Processor and Host MHU communication. + a. Test Boot Processor and Host MHU communication. This test sends message from non secure channel MHU1 from linux userspace using rpmsg framework. - b. Test REFCLK timer + b. Test REFCLK timer This test tests host peripheral access and routing its interrupt to boot processor using interrupt router and then sending it to Boot Processor NVIC using interrupt @@ -21,6 +22,9 @@ There are 3 ways of running tests using the run_model.sh file. 1 for MHU test 2 for Timer test + For CA5-DS + Curently Linux boot till prompt is supported. + 2. ./run_model.sh -u With model windows and logs visible This will pop up an interactive menu to run the automated diff --git a/run_model.sh b/run_model.sh index 27e3dab..9dfed62 100755 --- a/run_model.sh +++ b/run_model.sh @@ -12,7 +12,6 @@ pushd $(dirname "$0") BASEDIR=$(pwd) popd -OUTDIR=${BASEDIR}/../build-iota-tiny/tmp-iota_tiny/deploy/images/corstone700 help() { echo "usage: run_model.sh \${FVP executable path} [ -u ]" @@ -27,18 +26,39 @@ then help fi +cs700="Corstone-700" +a5ds="CA5DS" + +if [[ $1 =~ $cs700 ]]; then + OUTDIR=${BASEDIR}/../build-iota-tiny/tmp-iota_tiny/deploy/images/corstone700 + DIRNAME=corstone700 +else + OUTDIR=${BASEDIR}/../build-iota-tiny/tmp-iota_tiny/deploy/images/a5ds + DIRNAME=a5ds +fi + if [ -z "$2" ] then + if [[ $1 =~ $cs700 ]]; then echo "================== Launching Corstone700 Model ===============================" $1 \ -C se.trustedBootROMloader.fname="${OUTDIR}/se_romfw.bin" \ -C board.flashloader0.fname="${OUTDIR}/iota-tiny-image-corstone700.wic" + elif [[ $1 =~ $a5ds ]]; then + echo "================== Launching CA5-DS Model ===============================" + $1 \ + -C board.flashloader0.fname="${OUTDIR}/bl1.bin" \ + -C board.flashloader1.fname="${OUTDIR}/iota-tiny-image-a5ds.wic" \ + $2 + else + help + fi elif [ "$2" == "-u" ] then # We assume that the FVP library model is identically named to the FVP executable. python ${BASEDIR}/scripts/test/testselector.py \ - --corstone700 "--image_dir ${OUTDIR} --fvp ${1}.so" + --${DIRNAME} "--image_dir ${OUTDIR} --fvp ${1}.so" else help fi diff --git a/scripts/platforms/a5ds/a5ds_fvp.py b/scripts/platforms/a5ds/a5ds_fvp.py new file mode 100644 index 0000000..6f6fbab --- /dev/null +++ b/scripts/platforms/a5ds/a5ds_fvp.py @@ -0,0 +1,122 @@ +#!/usr/bin/env python2.7 +# Python 2.7 is for fm.debug + +__copyright__ = """ +Copyright (c) 2019, Arm Limited and Contributors. All rights reserved. + +SPDX-License-Identifier: BSD-3-Clause +""" + +import sys +import os +a5ds_dir = os.path.dirname(os.path.realpath(__file__)) +sys.path.append(os.path.join((a5ds_dir),'..','..', 'test')) +from fvp_wrapper import FVPWrapper, TelnetWatcher + +""" a5ds_fvp.py +This file contains the a5ds FVP subclass of the generic FVP wrapper class. +Upon instantiation, telnet watchers are created for each UART exposed by the +FVP, and - using the provided test specification - watchers are set up with their +respective stop and verification conditions. +""" + + +"""a5dsDefaultConfig +default a5ds configuration parameters. +Note that these are fully platform dependant, and are only specified in the +following map to provide a clear overview of what the configuration constants +of this script are. +""" +a5dsDefaultConfig = { + # =============== FVP Parameters =============== + # Stop condition + "stop_cnd" : "/OSCI/SystemC: Simulation stopped by user", + + # Flash loaders + "board_flashloader" : "board.flashloader1.fname", + "board_ROMloader" : "board.flashloader0.fname", + # UART logs + "host_uart0" : "css.uart_0.out_file", + + # Telnet parameters + "telnet_host" : 'localhost', + "host_telnet_port0" : 5000, + + # =============== Test parameters ============== + "linux_login_prompt" : "a5ds login:", + "linux_user" : "root", + "linux_shstring" : "root@a5ds:~# " +} + + +""" a5dsDefaultTestspec +Test-specification parameters for a5ds. +Note that this is fully platform-dependant, and only used during the +initialization of a5dsFVP. +""" +a5dsDefaultTestspec = { + "name" : None, # Test name + "commands" : [], # Commands to execute on Host + "board_flash" : None, # Board flash image + "host_stop_str" : None, # Stop condition string for Host + "host_ver_strs" : [], # Verification strings for Host +} + +class A5dsFVP(FVPWrapper): + def __init__(self, testspec, fvp_path, image_dir, usermode, fvp_timeout, stdin): + FVPWrapper.__init__( + self, + fvp_path=fvp_path, + fvp_name="A5ds", + usermode=usermode, + work_dir=a5ds_dir, + fvp_timeout=fvp_timeout, + testname=testspec['name'], + stdin=stdin + ) + + self.config = a5dsDefaultConfig + self.testspec = self.parseTestspec(testspec) + self.image_dir = image_dir + + # Define watchers for each terminal + # Host terminal 0 watcher + host0_watcher = TelnetWatcher( + name="host0", + termfile=os.path.join(self.work_dir, self.log_dir, self.testspec['name'] + "_host0.txt"), + stop_str=self.testspec['host_stop_str'], + fvp_uart=self.config['host_uart0'], + port=self.config['host_telnet_port0'], + sys_stop_str=self.config['stop_cnd'], + verification_strs=self.testspec['host_ver_strs'] + ) + # We define an initial command sequence for host0 which will login + # and await until a user can enter commands + host0_watcher.addCommand('r', self.config['linux_login_prompt']) + host0_watcher.addCommand('w', self.config['linux_user']) + host0_watcher.addCommand('r', self.config['linux_shstring']) + # Once the host is logged in, we add the user-provided test commands + for commandtype, command in self.testspec['commands']: + host0_watcher.addCommand(commandtype, command) + self.watchers.append(host0_watcher) + + + def getModelParameters(self): + # Assign images to FVP flashloaders + fvp_params = {} + fvp_params[self.config['board_flashloader']] = os.path.join(self.image_dir, "iota-tiny-image-a5ds.wic") + fvp_params[self.config['board_ROMloader']] = os.path.join(self.image_dir, "bl1.bin") + print(fvp_params) + return fvp_params + + def parseTestspec(self, testspec): + """ Function for parsing a test-specification in line with the arguments + made available by a5dsDefaultTestspec + """ + if 'name' not in testspec or 'commands' not in testspec: + sys.exit(1) + + # Merge user-specified arguments with default test specification + defaultTestspec = a5dsDefaultTestspec + defaultTestspec.update(testspec) + return defaultTestspec diff --git a/scripts/platforms/a5ds/a5ds_testrunner.py b/scripts/platforms/a5ds/a5ds_testrunner.py new file mode 100644 index 0000000..d728ebc --- /dev/null +++ b/scripts/platforms/a5ds/a5ds_testrunner.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python2.7 + +__copyright__ = """ +Copyright (c) 2019, Arm Limited and Contributors. All rights reserved. + +SPDX-License-Identifier: BSD-3-Clause +""" + +import sys +import os +sys.path.append(os.path.join((os.path.dirname(os.path.realpath(__file__))),'..','..','test')) +from testrunner import TestRunner +from a5ds_fvp import A5dsFVP + +class A5dsTestRunner(TestRunner): + def __init__(self): + TestRunner.__init__( + self, A5dsFVP + ) + + def setSpecializationArguments(self): + # a5ds_fvp requires an image_dir argument for its constructor + # to be able to locate various binaries. Add this as a command-line + # argument + self.parser.add_argument("--image_dir", type=str, + help="Directory containing the a5ds images") + + def parseSpecializationArguments(self, args): + def tryParseStringArg(arg, argstring): + if arg is None: + print("Argument {0} was not specified, but required. exiting...".format(argstring)) + sys.exit(1) + return arg + + # Set the arguments required for constructing an a5dsFVP object + # NOTE: the 'key' in FVPWrapperArgs is identical to the named argument + # 'image_dir' in the a5dsFVP constructor. This is important, given that + # the FVP Subclass is instantiated by the named arguments present in + # FVPWrapperArgs via kwargs expansion. + self.FVPWrapperArgs['image_dir'] = tryParseStringArg(args.image_dir, "--image_dir") + # The remainder of the arguments for a5dsFVP construction will be + # provided by the TestRunner base class + + def registerTestSpecifications(self): + self.registerTest({ + 'name' : "boot_test", + 'description' : "Test A5 Boot", + 'commands' : [ + ('w', "uname -srmn"), + ], + 'host_ver_strs' : ["Linux a5ds 5.2.0 armv7l"], + 'host_stop_str' : "Linux a5ds 5.2.0 armv7l" + }) + +if __name__ == "__main__": + A5dsTestRunner() -- cgit v1.2.3