⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sa2sim-run

📁 移植到WLIT项目的redboot源代码
💻
字号:
#!/bin/sh##===========================================================================##    sa2sim-run#    Shell script to run the StrongARM2 simulator##===========================================================================#####COPYRIGHTBEGIN#####                                                                          # -------------------------------------------                              # The contents of this file are subject to the Red Hat eCos Public License # Version 1.1 (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.redhat.com/                                                   #                                                                          # Software distributed under the License is distributed on an "AS IS"      # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See the # License for the specific language governing rights and limitations under # the License.                                                             #                                                                          # The Original Code is eCos - Embedded Configurable Operating System,      # released September 30, 1998.                                             #                                                                          # The Initial Developer of the Original Code is Red Hat.                   # Portions created by Red Hat are                                          # Copyright (C) 1998, 1999, 2000 Red Hat, Inc.                             # All Rights Reserved.                                                     # -------------------------------------------                              #                                                                          #####COPYRIGHTEND#####===========================================================================######DESCRIPTIONBEGIN###### Author(s):      jlarmour# Contributors:# Date:           2000-02-23######DESCRIPTIONEND######===========================================================================COYSIMARGS="conf.hdl 0"helpmsg(){        echo 'Usage: sa2sim-run [--cfgdir <dir>] [--lilmon <file>]'        echo '                  [--sim <simulator>] [--local] [--nolog]'	echo '                  <executable> [sim-args]'        echo 'or     sa2sim-run --help'        echo ''        echo '  where:'        echo '        --cfgdir <dir>    specifies the directory containing the simulator'        echo '                          configuration files.'        echo '        --lilmon <file>   specifies a file to use instead of lilmon.elf'        echo '        --sim <simulator> gives the location of the simulator. The default'        echo '                          is to run it from your PATH.'	echo '        --local           if neither --cfgdir nor --lilmon is given, the'	echo '                          default is to infer them from <executable>; this'	echo '                          option looks for them near where this script is.'        echo '        --nolog           do not output the cpu.log file following the'	echo '                          simulator run.'        echo '        <executable>      is the name of the executable to run.'        echo '        [sim-args]        lists any options to be passed to the simulator.'        echo "                          The default is: \"$COYSIMARGS\""        echo ''}showhelp(){        helpmsg        exit 0}error(){        echo "sa2sim-run: $@" >&2        echo ""        helpmsg        exit 1}# alternative for `which`findonpath(){(        IFS=:        for i in $PATH ; do                if [ -x "$i/$1" ]; then                        echo "$i/$1"                        break                fi        done)}PROG=CFGDIR=LILMON=COYSIM=INFER=LOG=while [ $# -gt 0 ]; do        case "$1" in                --help|-h|/\?|\?)                        showhelp                        ;;		--local)			INFER="NO"			shift			;;		--nolog)			LOG="NO"			shift			;;                --cfgdir)                        if shift ; then : ; else                                error "No directory given for configuration files"                        fi			INFER="NO"                        CFGDIR="$1"                        shift                        ;;                --lilmon)                        if shift ; then : ; else                                error "No file name given for lilmon replacement"                        fi			INFER="NO"                        LILMON="$1"                        shift                        ;;                --sim)                        if shift ; then : ; else                                error "No simulator given"                        fi                        COYSIM="$1"                        shift                        ;;                -*)     error "Unknown option: $1"                        ;;                *)                        if [ -n "$PROG" ]; then                                error "Too many arguments"                        fi                        if [ -n "$1" ]; then                                PROG="$1"                                shift                        fi                        if [ -n "$1" ]; then                                COYSIMARGS="$@"                        fi                        break                        ;;        esacdoneif [ -z "$PROG" ]; then        error "No executable provided"fiif [ -x "`findonpath cygpath 2>/dev/null`" ]; then        PROG="`cygpath -u "$PROG"`"fiif [ -z "$COYSIM" ]; then# Guess the name - we may be on Solaris or NT, and it's best to avoid using uname        COYSIM="`findonpath coysimsun 2>/dev/null`"        if [ ! -x "$COYSIM" ]; then                COYSIM="`findonpath coysim 2>/dev/null`"                if [ ! -x "$COYSIM" ]; then                        error "Could not find coysim or coysimsun on your PATH"                fi        fifiif [ ! -x "$COYSIM" ]; then        error "Could not find simulator \"$COYSIM\""fiif [ ! -f "$PROG" ]; then        error "Could not find executable \"$PROG\""fi# Find the real directory name so that relative paths still work# even if we change directoryPROGDIR="`cd \"\`dirname \\"$PROG\\"\`\" ; pwd`"PROGFILE="`basename \"$PROG\"`"PROG="$PROGDIR/$PROGFILE"# unless told not to, infer the locations of other things from the path to# the test case.  this is for the test farm.if [ -z "$INFER" ]; then    # try inferring...    PLACE="$PROGDIR"    while [ ! -z "$PLACE" -a "/" != "$PLACE" ]; do	if [ -d "$PLACE/etc" -a -d "$PLACE/bin" ]; then	    LILMON="$PLACE/bin/lilmon.elf"	    CFGDIR="$PLACE/etc"	    PLACE=""	else	    PLACE="`cd "$PLACE/.." ; pwd`"	fi    donefi# if we don't exist in the right place from $0, we must have been run from # the pathif [ -x $0 ] ; then        # It's in the right place according to $0        BASEDIR="`dirname $0`"else        # otherwise we must have been run from the path        BASEDIR="`findonpath \`basename $0\``"fi# normalize the directoryBASEDIR=`cd "$BASEDIR" ; pwd`# lilmon should be in the same directory as the script, unless the user has# told us otherwiseif [ -z "$LILMON" ]; then        LILMON="$BASEDIR/lilmon.elf"fiif [ ! -f "$LILMON" ]; then        error "Could not find file $LILMON"fi# config scripts should be in ../etc relative to us, unless the user# has told us otherwiseif [ -z "$CFGDIR" ]; then        CFGDIR="$BASEDIR/../etc"	if [ -d "$CFGDIR" ]; then	    CFGDIR="`cd $CFGDIR; pwd`"	else	    CFGDIR="."	fificd "$CFGDIR" || error "Could not enter directory $CFGDIR"if [ ! -f ./cpu.pil ]; then        error "Could not find simulator configuration files in directory $CFGDIR"fi# If we're on cygwin, need to change the path to a dos path with short file names# We do this with the help of TCLif [ -x "`findonpath cygpath 2>/dev/null`" ]; then	# But tclsh wants backslashes to be escaped. Sigh.        # And what's worse coysim doesn't accept drive letters in the path        # names. Bummer. We just have to assume that it's the same drive :-(	LILMONW=`cygpath -w "$LILMON" | sed 's#\\\\#\\\\\\\\#g; s#^.:##g'`	LILMON=`echo "puts [ file attributes \"$LILMONW\" -shortname ]" | cygtclsh80 | tr -d '\n\r'`	PROGW=`cygpath -w "$PROG" | sed 's#\\\\#\\\\\\\\#g; s#^.:##g'`	PROG=`echo "puts [ file attributes \"$PROGW\" -shortname ]" | cygtclsh80 | tr -d '\n\r'`fiMEMFILES="$LILMON $PROG"export MEMFILES# For testing# echo "MEMFILES=$MEMFILES"# echo Running "$COYSIM" $COYSIMARGS# echo PWD is `pwd`if [ -z "$LOG" ]; then    "$COYSIM" $COYSIMARGS    if [ ! -f ./cpu.log ]; then	echo "No cpu.log file found"    else	cat cpu.log    fielse    exec "$COYSIM" $COYSIMARGSfi# EOF sa2sim-run

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -