source: rtems/c/src/lib/libbsp/powerpc/psim/tools/psim-shared @ 1b290ce7

4.104.115
Last change on this file since 1b290ce7 was cb1b4060, checked in by Joel Sherrill <joel.sherrill@…>, on 01/05/09 at 19:48:15

2009-01-05 Joel Sherrill <joel.sherrill@…>

  • psim-shared: Add catching a hardware exception and assertion as reasons to kill simulator.
  • Property mode set to 100755
File size: 3.5 KB
Line 
1
2TREE_FILE=psim_tree.${LOGNAME}
3
4case $0 in
5  *4.8*)  rtemsTarget=powerpc-rtems4.8 ;;
6  *4.9*)  rtemsTarget=powerpc-rtems4.9 ;;
7  *4.10*) rtemsTarget=powerpc-rtems4.10 ;;
8  *) ;;
9esac
10
11### Generate the PSIM device tree based upon the type of application being run
12gen_device_tree()
13{
14  enable_sysv_ipc="yes"
15
16  if [ ${use_sysv_ipc} = "yes" ] ; then
17    enable_sysv_ipc="yes"
18    value=-1               # for now assume we are slave in this mode
19  else
20    case ${1} in
21      *node*)
22        enable_sysv_devices="yes"
23        case ${1} in
24          *node1*) value=1 ;;
25          *)       value=-1 ;;
26        esac
27        ;;
28      *)
29        enable_sysv_devices="no"
30        ;;
31    esac
32  fi
33
34  if [ ${enable_sysv_devices} = "yes" ] ; then
35    if [ X${RTEMS_SHM_SEMAPHORE_KEY} = X -o X${RTEMS_SHM_KEY} = X ] ; then
36      fatal  RTEMS_SHM_SEMAPHORE_KEY and/or RTEMS_SHM_KEY not set
37    fi
38  fi
39
40cat <<EOF
41#
42#  Device Tree for PSIM
43#
44#  Automatically Generated -- DO NOT EDIT!!
45#
46/#address-cells 1
47/openprom/init/register/pvr 0xfffe0000
48/openprom/options/oea-memory-size 8388608
49##### EEPROM @ 0x0c000000 for 512K
50/eeprom@0x0c000000/reg 0x0c000000 0x80000
51/eeprom@0x0c000000/nr-sectors 8
52/eeprom@0x0c000000/sector-size 0x10000
53/eeprom@0x0c000000/byte-write-delay 1000
54/eeprom@0x0c000000/sector-start-delay 100
55/eeprom@0x0c000000/erase-delay 1000
56/eeprom@0x0c000000/manufacture-code 0x01
57/eeprom@0x0c000000/device-code 0xa4
58
59##### NVRAM/RTC NVRAM Portion is 0x0c080000 for 512K
60##### NVRAM/RTC RTC   Portion is 0x0c100000 for 12
61/nvram@0x0c080000/reg 0x0c080000 524300
62/nvram@0x0c080000/timezone -3600
63EOF
64
65  if [ ${enable_sysv_devices} = yes ] ; then
66    echo "##### System V IPC (Semaphore) 0x0c100010 for 12"
67    echo "/sem@0x0c100010/reg 0x0c100010 12"
68    echo "/sem@0x0c100010/key ${RTEMS_SHM_SEMAPHORE_KEY}"
69    echo "/sem@0x0c100010/value ${value}"
70    echo
71    echo "##### System V IPC (Shared Memory) 0x0c110000 for 128K"
72    echo "/shm@0x0c110000/reg 0x0c110000 0x20000"
73    echo "/shm@0x0c110000/key ${RTEMS_SHM_KEY}"
74  fi
75}
76
77### run the specified test with the time limit
78runone()
79{
80  testname=${1}
81  max_run_time=${2}
82  if [ $# -eq 3 ] ; then
83    treefile=${3}
84  else
85    treefile=${TREE_FILE}
86  fi
87  if [ ${max_run_time} -eq 0 ] ; then
88    #echo run ${testname} forever
89    ${RUN} -f ${treefile} ${RUN_DEBUG} ${testname}
90  else
91    log=`echo ${testname} | sed -e 's/.exe$/.log/' -e 's/.ralf$/.log/'`
92    #echo run ${testname} for maximum ${max_run_time} seconds
93    ${RUN} -f ${treefile} ${RUN_DEBUG} ${testname} >${log} 2>&1 &
94    pid=$!
95
96    # Make sure it won't run forever...
97    time_run=0
98    while [ $time_run -lt $max_run_time ]
99    do
100      # sleep 1s at a time waiting for job to finish or timer to expire
101      # if job has exited, then we exit, too.
102      sleep 1
103      kill -0 $pid 2> /dev/null
104      running=$?
105      if [ $running -eq 0 ] ; then
106        time_run=$((time_run + 5))
107        if [ $time_run -ge $max_run_time ]; then
108          kill -9 $pid 2> /dev/null
109          ran_too_long="yes"
110          echo "${testname} killed after running ${max_run_time} seconds"
111        fi
112        grep "Suspending faulting task" ${log} >/dev/null 2>&1
113        Fault=$?
114        grep "assertion failed" ${log} >/dev/null 2>&1
115        Assert=$?
116        if [ $Fault -eq 0 -o $Assert -eq 0 ] ; then
117          kill -9 $pid 2> /dev/null
118          echo "${testname} failed after ${max_run_time} seconds"
119          ran_too_long="no"
120          break
121        fi
122      else
123        ran_too_long="no"
124        break
125      fi
126    done
127    cat ${log}
128    rm -f ${log}
129  fi
130
131}
132
Note: See TracBrowser for help on using the repository browser.