TREE_FILE=psim_tree.${LOGNAME} case $0 in *4.8*) rtemsTarget=powerpc-rtems4.8 ;; *4.9*) rtemsTarget=powerpc-rtems4.9 ;; *4.10*) rtemsTarget=powerpc-rtems4.10 ;; *) ;; esac ### Generate the PSIM device tree based upon the type of application being run gen_device_tree() { enable_sysv_ipc="yes" if [ ${use_sysv_ipc} = "yes" ] ; then enable_sysv_ipc="yes" value=-1 # for now assume we are slave in this mode else case ${1} in *node*) enable_sysv_devices="yes" case ${1} in *node1*) value=1 ;; *) value=-1 ;; esac ;; *) enable_sysv_devices="no" ;; esac fi if [ ${enable_sysv_devices} = "yes" ] ; then if [ X${RTEMS_SHM_SEMAPHORE_KEY} = X -o X${RTEMS_SHM_KEY} = X ] ; then fatal RTEMS_SHM_SEMAPHORE_KEY and/or RTEMS_SHM_KEY not set fi fi if [ X${RAM_SIZE} = X ] ; then if [ X${NM} = X ] ; then NM=${rtemsTarget}-nm fi RAM_SIZE=`$NM ${1} | awk '/\/{print "0x"$1}'` fi cat <= than linkcmds defined RamSize! /openprom/options/oea-memory-size $RAM_SIZE ##### EEPROM @ 0x0c000000 for 512K /eeprom@0x0c000000/reg 0x0c000000 0x80000 /eeprom@0x0c000000/nr-sectors 8 /eeprom@0x0c000000/sector-size 0x10000 /eeprom@0x0c000000/byte-write-delay 1000 /eeprom@0x0c000000/sector-start-delay 100 /eeprom@0x0c000000/erase-delay 1000 /eeprom@0x0c000000/manufacture-code 0x01 /eeprom@0x0c000000/device-code 0xa4 ##### NVRAM/RTC NVRAM Portion is 0x0c080000 for 512K ##### NVRAM/RTC RTC Portion is 0x0c100000 for 12 /nvram@0x0c080000/reg 0x0c080000 524300 /nvram@0x0c080000/timezone -3600 ##### OPENPIC @ 0x0c130000 - 0x0c170000 (512K) /opic@0x0c130000/reg 0x0c130000 0 0x0c130000 0x40000 /opic@0x0c130000/interrupt-ranges 0 0 0 16 /opic@0x0c130000/device_type open-pic # interupt out -> 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 EOF fi if [ ${enable_sysv_devices} = yes ] ; then echo "##### System V IPC (Semaphore) 0x0c100010 for 12" echo "/sem@0x0c100010/reg 0x0c100010 12" echo "/sem@0x0c100010/key ${RTEMS_SHM_SEMAPHORE_KEY}" echo "/sem@0x0c100010/value ${value}" echo echo "##### System V IPC (Shared Memory) 0x0c110000 for 128K" echo "/shm@0x0c110000/reg 0x0c110000 0x20000" echo "/shm@0x0c110000/key ${RTEMS_SHM_KEY}" fi } ### run the specified test with the time limit runone() { testname=${1} max_run_time=${2} if [ $# -eq 3 ] ; then treefile=${3} else treefile=${TREE_FILE} fi if [ ${max_run_time} -eq 0 ] ; then #echo run ${testname} forever ${RUN} -f ${treefile} ${RUN_DEBUG} ${testname} else log=`echo ${testname} | sed -e 's/.exe$/.log/' -e 's/.ralf$/.log/'` #echo run ${testname} for maximum ${max_run_time} seconds ${RUN} -f ${treefile} ${RUN_DEBUG} ${testname} >${log} 2>&1 & pid=$! # Make sure it won't run forever... time_run=0 while [ $time_run -lt $max_run_time ] do # sleep 1s at a time waiting for job to finish or timer to expire # if job has exited, then we exit, too. sleep 1 kill -0 $pid 2> /dev/null running=$? if [ $running -eq 0 ] ; then time_run=$((time_run + 5)) if [ $time_run -ge $max_run_time ]; then kill -9 $pid 2> /dev/null ran_too_long="yes" echo "${testname} killed after running ${max_run_time} seconds" fi grep "Suspending faulting task" ${log} >/dev/null 2>&1 Fault=$? grep "assertion failed" ${log} >/dev/null 2>&1 Assert=$? if [ $Fault -eq 0 -o $Assert -eq 0 ] ; then kill -9 $pid 2> /dev/null echo "${testname} failed after ${max_run_time} seconds" ran_too_long="no" break fi else ran_too_long="no" break fi done cat ${log} rm -f ${log} fi }