From 5a6d25fcd5ba727f1af1f68d5b0382e0541e929d Mon Sep 17 00:00:00 2001 From: Till Straumann Date: Fri, 11 Sep 2009 22:42:00 +0000 Subject: 2009-09-11 Till Straumann * psim-top.in, psim-bottom: Added support for options -d (print device tree and exit), -h (usage info) and -n (enable NIC support). * psim-gdb-bottom: Added support for options -s (force sysv IPC), -h (usage info) and -n (enable NIC support). Allow user to override GDB variable from environment. * psim-shared: cat NIC properties into device file if the user had specified '-n'. * runtest-top.in: removed unsupported options -o, -d from usage info. --- c/src/lib/libbsp/powerpc/psim/tools/ChangeLog | 16 ++++++ c/src/lib/libbsp/powerpc/psim/tools/psim-bottom | 18 +++++-- .../lib/libbsp/powerpc/psim/tools/psim-gdb-bottom | 29 ++++++++++- c/src/lib/libbsp/powerpc/psim/tools/psim-shared | 59 ++++++++++++---------- c/src/lib/libbsp/powerpc/psim/tools/psim-top.in | 9 ++-- c/src/lib/libbsp/powerpc/psim/tools/runtest-top.in | 6 +-- 6 files changed, 97 insertions(+), 40 deletions(-) (limited to 'c') diff --git a/c/src/lib/libbsp/powerpc/psim/tools/ChangeLog b/c/src/lib/libbsp/powerpc/psim/tools/ChangeLog index edb9313847..e1b6e0460a 100644 --- a/c/src/lib/libbsp/powerpc/psim/tools/ChangeLog +++ b/c/src/lib/libbsp/powerpc/psim/tools/ChangeLog @@ -1,3 +1,19 @@ +2009-09-11 Till Straumann + + * psim-top.in, psim-bottom: Added support for options + -d (print device tree and exit), -h (usage info) and + -n (enable NIC support). + + * psim-gdb-bottom: Added support for options -s (force sysv IPC), + -h (usage info) and -n (enable NIC support). + Allow user to override GDB variable from environment. + + * psim-shared: cat NIC properties into device file if the + user had specified '-n'. + + * runtest-top.in: removed unsupported options -o, -d from + usage info. + 2009-04-14 Thomas Doerfler * psim-gdb-bottom: Adapt name of assert function for breakpoint diff --git a/c/src/lib/libbsp/powerpc/psim/tools/psim-bottom b/c/src/lib/libbsp/powerpc/psim/tools/psim-bottom index cd7ede0009..e8cca83899 100755 --- a/c/src/lib/libbsp/powerpc/psim/tools/psim-bottom +++ b/c/src/lib/libbsp/powerpc/psim/tools/psim-bottom @@ -7,15 +7,20 @@ verbose="" limit="0" use_sysv_ipc="auto" +device_tree_only="" +enable_if_sim="" ## TODO: may want command line ability to turn on some psim tracing -while getopts vsl: OPT +while getopts vhsdnl: OPT do case "$OPT" in v) verbose="yes";; - l) limit="$OPTARG";; - s) use_sysv_ipc="yes";; - *) fatal;; + h) echo "$USAGE"; exit 0;; + l) limit="$OPTARG";; + s) use_sysv_ipc="yes";; + d) device_tree_only="yes";; + n) enable_if_sim="yes";; + *) fatal;; esac done shiftcount=`expr $OPTIND - 1` @@ -27,6 +32,11 @@ if [ $# -eq 0 ] ; then fatal fi +if [ X${device_tree_only} = Xyes ] ; then + gen_device_tree ${1} > "`basename ${1} .exe`".device + exit $? +fi + if [ X${RUN} = X ] ; then RUN=${rtemsTarget}-run fi diff --git a/c/src/lib/libbsp/powerpc/psim/tools/psim-gdb-bottom b/c/src/lib/libbsp/powerpc/psim/tools/psim-gdb-bottom index fc104270e7..4e030e5ccd 100755 --- a/c/src/lib/libbsp/powerpc/psim/tools/psim-gdb-bottom +++ b/c/src/lib/libbsp/powerpc/psim/tools/psim-gdb-bottom @@ -1,8 +1,31 @@ +progname=${0##*/} # fast basename hack for ksh, bash -## TODO: may want command line ability to turn on some psim tracing +USAGE=\ +"usage: $progname [ -opts ] [prog] + -s -- force System V IPC support on (default=auto) + -n -- enable NIC support ***REQUIRES PATCHED GDB/PSIM*** + -h -- this message +" # Recognize special argument to force System V IPC support on use_sysv_ipc="auto" +enable_if_sim="" + +## TODO: may want command line ability to turn on some psim tracing +while getopts snh OPT +do + case "$OPT" in + s) use_sysv_ipc="yes";; + n) enable_if_sim="yes";; + h) echo "$USAGE"; exit 0;; + *) echo "unknown option"; echo "$USAGE"; exit 0;; + esac +done +shiftcount=`expr $OPTIND - 1` +shift $shiftcount + +args=$* + if [ X${1} = "X-psim_sysv" ] ; then use_sysv_ipc="yes" shift @@ -20,7 +43,9 @@ gen_gdb_script() echo "printf \"Use run to start the RTEMS application\\n\"" } -GDB=${rtemsTarget}-gdb +if [ X${GDB} = X ] ; then + GDB=${rtemsTarget}-gdb +fi gen_device_tree ${1} >${TREE_FILE} gen_gdb_script >${GDB_FILE} diff --git a/c/src/lib/libbsp/powerpc/psim/tools/psim-shared b/c/src/lib/libbsp/powerpc/psim/tools/psim-shared index 11be980927..25addb7a5b 100755 --- a/c/src/lib/libbsp/powerpc/psim/tools/psim-shared +++ b/c/src/lib/libbsp/powerpc/psim/tools/psim-shared @@ -44,7 +44,7 @@ gen_device_tree() RAM_SIZE=`$NM ${1} | awk '/\/{print "0x"$1}'` fi -cat < CPU's interrupt pin /opic@0x0c130000 > intr0 int /cpus/cpu@0 +EOF + + if [ X${enable_if_sim} = Xyes ] ; then + cat < 0 irq0 /opic@0x0c130000 -## 'tun' device on host -#/ethtap@0x0c100020/tun-device "/dev/net/tun" -## name of 'tap' device to use -#/ethtap@0x0c100020/tap-ifname "tap0" -## ethernet address of simulated IF -#/ethtap@0x0c100020/hw-address "00:00:00:22:11:00" -## generate CRC and append to received packet before -## handing over to the simulation. This is mostly for -## debugging the rtems device driver. If unsure, leave 'false'. -#/ethtap@0x0c100020/enable-crc false +# NOTE 'ethtap' currently (200902) requires psim to +# be patched -- also, it is only supported on +# a linux host. +# the 'ethtap' device transfers data from/to the +# simulated network interface to/from a 'ethertap' +# interface on the linux host (consult tun/tap +# device documentation). +# A very useful tool is 'tunctl' which allows for +# configuring user-accessible, persistent 'tap' +# devices so that psim may be executed w/o special +# (root) privileges. + +/ethtap@0x0c100020/reg 0x0c100020 0x40 +# route interrupt to open-pic +/ethtap@0x0c100020 > 0 irq0 /opic@0x0c130000 +# 'tun' device on host +/ethtap@0x0c100020/tun-device "/dev/net/tun" +# name of 'tap' device to use +/ethtap@0x0c100020/tap-ifname "tap0" +# ethernet address of simulated IF +/ethtap@0x0c100020/hw-address "00:00:00:22:11:00" +# generate CRC and append to received packet before +# handing over to the simulation. This is mostly for +# debugging the rtems device driver. If unsure, leave 'false'. +/ethtap@0x0c100020/enable-crc false EOF + fi if [ ${enable_sysv_devices} = yes ] ; then echo "##### System V IPC (Semaphore) 0x0c100010 for 12" diff --git a/c/src/lib/libbsp/powerpc/psim/tools/psim-top.in b/c/src/lib/libbsp/powerpc/psim/tools/psim-top.in index 8e2a34c664..26796c3f37 100755 --- a/c/src/lib/libbsp/powerpc/psim/tools/psim-top.in +++ b/c/src/lib/libbsp/powerpc/psim/tools/psim-top.in @@ -20,9 +20,12 @@ progname=${0##*/} # fast basename hack for ksh, bash USAGE=\ "usage: $progname [ -opts ] test [ test ... ] - -v -- verbose - -s -- force System V IPC support on (default=auto) - -l limit -- specify time limit (default is 'no limit') + -v -- verbose + -h -- this message + -s -- force System V IPC support on (default=auto) + -l limit -- specify time limit (default is 'no limit') + -d -- generate device tree as 'test'.device and exit + -n -- enable NIC support ***REQUIRES PATCHED PSIM*** " # log an error to stderr diff --git a/c/src/lib/libbsp/powerpc/psim/tools/runtest-top.in b/c/src/lib/libbsp/powerpc/psim/tools/runtest-top.in index 1616b10f2d..faeb7860f4 100755 --- a/c/src/lib/libbsp/powerpc/psim/tools/runtest-top.in +++ b/c/src/lib/libbsp/powerpc/psim/tools/runtest-top.in @@ -23,10 +23,8 @@ fi USAGE=\ "usage: $progname [ -opts ] test [ test ... ] - -o options -- specify options to be passed to simulator - -v -- verbose - -d -- generate device tree file (as 'test'.device) and exit - -l logdir -- specify log directory (default is 'logdir') + -v -- verbose + -l logdir -- specify log directory (default is 'logdir') Specify test as 'test' or 'test.exe'. All multiprocessing tests *must* be specified simply as 'mp01', etc. -- cgit v1.2.3