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

4.104.114.95
Last change on this file since ff90595 was 001b4162, checked in by Joel Sherrill <joel.sherrill@…>, on 09/03/08 at 18:37:51

2008-09-03 Joel Sherrill <joel.sherrill@…>

  • Makefile.am, configure.ac: Rework psim scripts to share code for creating device trees and actually running the tests. Overhaul the device tree generated to always include a block of Flash and a Real-Time Clock. When running MP tests enable the shared memory and semaphore devices.
  • psim-bottom, psim-gdb-bottom, psim-gdb-top.in, psim-shared, psim-top.in, runtest-bottom, runtest-top.in: New files.
  • psim, psim-gdb, runtest: Removed.
  • Property mode set to 100755
File size: 2.5 KB
Line 
1
2TREE_FILE=psim_tree.${LOGNAME}
3
4### Generate the PSIM device tree based upon the type of application being run
5gen_device_tree()
6{
7  case ${1} in
8    *mp*)
9      if [ X${RTEMS_SHM_SEMAPHORE_KEY} = X -o X${RTEMS_SHM_KEY} = X ] ; then
10        fatal  RTEMS_SHM_SEMAPHORE_KEY and/or RTEMS_SHM_KEY not set
11      fi
12
13      use_sysv_devices=yes
14      case ${1} in
15        *node1*) value=1 ;;
16        *)       value=-1 ;;
17      esac
18      ;;
19    *)
20      use_sysv_devices=no
21      ;;
22  esac
23
24cat <<EOF
25#
26#  Device Tree for PSIM
27#
28#  Automatically Generated -- DO NOT EDIT!!
29#
30/#address-cells 1
31/openprom/init/register/pvr 0xfffe0000
32/openprom/options/oea-memory-size 8388608
33##### EEPROM @ 0x0c000000 for 512K
34/eeprom@0x0c000000/reg 0x0c000000 0x80000
35/eeprom@0x0c000000/nr-sectors 8
36/eeprom@0x0c000000/sector-size 0x10000
37/eeprom@0x0c000000/byte-write-delay 1000
38/eeprom@0x0c000000/sector-start-delay 100
39/eeprom@0x0c000000/erase-delay 1000
40/eeprom@0x0c000000/manufacture-code 0x01
41/eeprom@0x0c000000/device-code 0xa4
42
43##### NVRAM/RTC NVRAM Portion is 0x0c080000 for 512K
44##### NVRAM/RTC RTC   Portion is 0x0c100000 for 12
45/nvram@0x0c080000/reg 0x0c080000 524300
46/nvram@0x0c080000/timezone -3600
47EOF
48
49  if [ ${use_sysv_devices} = yes ] ; then
50    echo "##### System V IPC (Semaphore) 0x0c100010 for 12"
51    echo "/sem@0x0c100010/reg 0x0c100010 12"
52    echo "/sem@0x0c100010/key ${RTEMS_SHM_SEMAPHORE_KEY}"
53    echo "/sem@0x0c100010/value ${value}"
54    $@
55    echo "##### System V IPC (Shared Memory) 0x0c110000 for 128K"
56    echo "/shm@0x0c110000/reg 0x0c110000 0x20000"
57    echo "/shm@0x0c110000/key ${RTEMS_SHM_KEY}"
58  fi
59
60}
61
62### run the specified test with the time limit
63runone()
64{
65  testname=${1}
66  max_run_time=${2}
67  if [ ${max_run_time} -eq 0 ] ; then
68    #echo run ${testname} forever
69    ${RUN} -f ${TREE_FILE} ${RUN_DEBUG} ${testname}
70  else
71    #echo run ${testname} for maximum ${max_run_time} seconds
72    ${RUN} -f ${TREE_FILE} ${RUN_DEBUG} ${testname} &
73    pid=$!
74
75    # Make sure it won't run forever...
76    time_run=0
77    while [ $time_run -lt $max_run_time ]
78    do
79      # sleep 5s at a time waiting for job to finish or timer to expire
80      # if job has exited, then we exit, too.
81      sleep 1
82      kill -0 $pid 2> /dev/null
83      running=$?
84      if [ $running -eq 0 ] ; then
85        time_run=$((time_run + 5))
86        if [ $time_run -ge $max_run_time ]; then
87          kill -9 $pid 2> /dev/null
88          ran_too_long="yes"
89          echo "${testname} killed after running ${max_run_time} seconds"
90        fi
91      else
92        ran_too_long="no"
93        break
94      fi
95    done
96  fi
97}
98
Note: See TracBrowser for help on using the repository browser.