blob: 42a6a8065f53627b26c984d4ebad5956ee5fb425 (
plain) (
tree)
|
|
#! /bin/bash
#
# Framework script tailored for the @CPU@/@BSP@
#
# NOTE: If the does not have the name of a specific CPU/BSP pair, then
# this is the source file. If it does have specific CPU/BSP pair,
# then this is generated output and should NOT be edited.
trap "test_exit 1" 1 2 3 13 14 15
inGDBScript=yes
progname=${0##*/} # fast basename hack for ksh, bash
USAGE=\
"usage: $progname [ -opts ] test
-i -- interactive (default=no time limit)
System V IPC and Coverage are not supported by all BSPs or simulators.
"
for v in 4.11 4.10 4.9 4.8 4.7 ""
do
type @CPU_TARGET@-rtems${v}-gdb >/dev/null 2>&1
if [ $? -eq 0 ] ; then
GDB=@CPU_TARGET@-rtems${v}-gdb
break
fi
done
if [ X${GDB} = X ] ; then
echo "Unable to find a GDB for @CPU_TARGET@ along your PATH"
exit 1
fi
test_exit()
{
exit_code=$1
rm -f @BSP@-cmds
exit $exit_code
}
# log an error to stderr
prerr()
{
echo "$*" >&2
}
fatal() {
[ "$1" ] && prerr $*
prerr "$USAGE"
exit 1
}
warn() {
[ "$1" ] && prerr $*
}
check_status()
{
if [ $1 -ne 0 ] ; then
shift
echo "FAILED: " "$*" >&2
test_exit 1
fi
}
type ${runBSP}
check_status $? "Path appears to be broken (cannot find ${runBSP})"
if [ $# -eq 0 ] ; then
echo "No arguments .. no executable specified"
exit 1
fi
use_sysv_ipc="no"
doTrace="no"
while getopts s OPT
do
case "$OPT" in
s) use_sysv_ipc="yes";;
*) ;;
esac
done
shiftcount=`expr $OPTIND - 1`
shift $shiftcount
args=$*
### Set BSP defaults. If BSP does not have default, it will override
bspGeneratesGDBCommands="no"
bspGeneratesDeviceTree="no"
bspSupportsLCD="no"
bspSupportsTCPIP="no"
bspDoTrace="no"
###################################################################
###################################################################
###################################################################
##INSERT BSP SUPPORT HERE
###################################################################
###################################################################
###################################################################
## Some BSPs must generate device trees to provide to the simulator
if [ ${bspGeneratesDeviceTree} = "yes" ] ; then
TREE_FILE=@BSP@_tree.${LOGNAME}
bspGenerateDeviceTree ${baseToRun} >${TREE_FILE}
fi
### generate bsp specific load command
if [ ${bspGeneratesGDBCommands} = "no" ] ; then
cat <<EOF
tar sim
load
EOF
else
bspGenerateGDBCommands
fi >@BSP@-cmds
### Add CPU specific commands
case @CPU_TARGET@ in
*powerpc*) echo "b C_exception_handler" ;;
*) ;;
esac >>@BSP@-cmds
### Add generic commands which break on known bad places
cat >>@BSP@-cmds <<EOF
b _Internal_error_Occurred
b _Terminate
condition 1 (the_source != RTEMS_FATAL_SOURCE_EXIT) || (the_error != 0)
b rtems_fatal_error_occurred
b __assert
printf "Use run to start the RTEMS application\\n"
EOF
### Now source the rtems gdb
vfile=`dirname $0`/rtems-gdb-macros-${v}
if [ ! -r ${vfile} ] ; then
echo WARNING!!! RTEMS GDB Macro files not found
else
echo "source ${vfile}" >>@BSP@-cmds
fi
${GDB} --command=@BSP@-cmds $*
if [ ${bspGeneratesDeviceTree} = "yes" ] ; then
rm -f @BSP@_tree.${LOGNAME}
fi
test_exit $?
|