summaryrefslogtreecommitdiffstats
path: root/sim-scripts/psim.in
blob: c01dd553ebace73e5d363757480d2c995e6f0ad2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#
#  PowerPC/psim Support 
#

runARGS()
{
  if [ ${doTrace} = "yes" ] ; then
    TRACEARGS="-t all"
  fi
  echo "-f ${bspTreeFile} ${TRACEARGS} ${1}"
}

checkBSPFaults()
{
  return 0
}

bspLimit()
{
  testname=$1
  case ${testname} in
    *stackchk*)limit=5 ;;
    *fatal*)   limit=1 ;;
    *minimum*) limit=1 ;;
    *psxtime*) limit=180 ;;
    *)         limit=60 ;;
  esac
  echo ${limit}
}

bspGeneratesGDBCommands="yes"

bspGenerateGDBCommands()
{
if [ ${doTrace} = "yes" ] ; then
  TRACEARGS="-t all"
fi
echo "tar sim -f ${bspTreeFile} ${TRACEARGS}"
echo "load"
}

bspSupportsSystemVIPC="yes"

bspGeneratesDeviceTree="yes"
bspTreeFile=psim_tree.${LOGNAME}

### Generate the PSIM device tree based upon the type of application being run
bspGenerateDeviceTree()
{
  enable_sysv_devices="yes"

  if [ X${use_sysv_ipc} = X"yes" ] ; then
    enable_sysv_devices="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

cat <<EOF
#
#  Device Tree for PSIM
#
/#address-cells 1
/openprom/init/register/pvr 0xfffe0000
/openprom/options/oea-memory-size 0x10000000
##### EEPROM @ 0xfc000000 for 512K
/eeprom@0xfc000000/reg 0xfc000000 0x80000
/eeprom@0xfc000000/nr-sectors 8
/eeprom@0xfc000000/sector-size 0x10000
/eeprom@0xfc000000/byte-write-delay 1000
/eeprom@0xfc000000/sector-start-delay 100
/eeprom@0xfc000000/erase-delay 1000
/eeprom@0xfc000000/manufacture-code 0x01
/eeprom@0xfc000000/device-code 0xa4

##### NVRAM/RTC NVRAM Portion is 0xfc080000 for 512K
##### NVRAM/RTC RTC   Portion is 0xfc100000 for 12
/nvram@0xfc080000/reg 0xfc080000 524300
/nvram@0xfc080000/timezone -3600

##### OPENPIC @ 0xfc130000 - 0xfc170000 (512K)
/opic@0xfc130000/reg              0xfc130000 0 0xfc130000 0x40000
/opic@0xfc130000/interrupt-ranges 0 0 0 16
/opic@0xfc130000/device_type      open-pic
## interupt out -> CPU's interrupt pin
/opic@0xfc130000 > intr0 int /cpus/cpu@0
EOF

  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
}