forked from asterios-technologies/corunners-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
executable file
·270 lines (254 loc) · 6.02 KB
/
run.sh
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
#! /usr/bin/env bash
set -e
set -u
###############################################################################
# Collect all input parameters via getopt
###############################################################################
PSYKO="${PSYKO:-}"
RTK_DIR="${RTK:-}"
RUN_TRACE32_HOOK="${HOOK:-}"
KDBV="${KDBV:-}"
TYPE="${TYPE:-}"
PRODUCT="${PRODUCT:-}"
P2020="${P2020:-power-qoriq-p2020-ds-p}"
MPC5777M="${MPC5777M:-power-mpc5777m-evb}"
ROOT=${ROOT:-`pwd`}
GENONLY=${GENONLY:-}
usage() {
echo "Usage: $0 -T H|G|U|flash|flash2|Hsram|places.<task>.<test>|cpuPri|l1 -P <psyko> -k <rtk_dir> -t <runner> -d <kdbv> -p <$P2020|$MPC5777M> [-g] [-h]
-P <psyko> Path to the PsyC compiler
-T H|U|G|flash|flash2|Hsram|places<task>.<test>|cpuPri|l1
Type of run (required choice)
-d <kdbv> Path to the kdbv program
-k <rtk_dir> Path to the ASTERIOS RTK
-t <runner> Path to the executable to control Trace32
-p <product> Target product
-g Do not run tests, generate results graphs only
-h Display this message
Alternatively you can use the following environment variables to set the required arguments:
PSYKO
TYPE
KDBV
RTK
HOOK
PRODUCT
GENONLY
For the 'places' test:
The differents tasks are:
H
G
U
flash
flash2
The differents tests are:
R05 for read at 0.5G of the DDR
R15 for read at 1.5G of the DDR
HL the first core has a higher priority than the second
LH the first core has a lower priority than the second
S001 the step is 1M
S005 the step is 5M
"
}
while getopts "P:k:c:t:d:T:p:gh" opt; do
case $opt in
h)
usage
exit 0
;;
g)
GENONLY=1
;;
P)
PSYKO="$OPTARG"
;;
k)
RTK_DIR="$OPTARG"
;;
t)
RUN_TRACE32_HOOK="$OPTARG"
;;
d)
KDBV="$OPTARG"
;;
T)
TYPE="$OPTARG"
;;
p)
[ "$OPTARG" != "$P2020" ] && [ "$OPTARG" != "$MPC5777M" ] && \
echo "Product error: currently, only power-mpc5777m-evb and power-qoriq-p2020-ds are supported" && exit 1
PRODUCT="$OPTARG"
;;
*)
usage
exit 1
;;
esac
done
if [ -z "$PSYKO" ]; then
echo "-P <psyko> is required"
exit 1
elif [ -z "$RTK_DIR" ]; then
echo "-k <rtk_dir> is required"
exit 1
elif [ -z "$RUN_TRACE32_HOOK" ]; then
echo "-t <runner> is required"
exit 1
elif [ -z "$KDBV" ]; then
echo "-d <kdbv> is required"
exit 1
elif [ -z "$PRODUCT" ]; then
echo "-p <$P2020|$MPC5777M> is required"
fi
source "$(pwd)/scripts/run.$PRODUCT.sh"
TRACES_DIR="$(pwd)/traces/${TYPE}"
BUILD_DIR="$(pwd)/build/${TYPE}"
OUTDIR="$ROOT/out_$PRODUCT"
NO_SEP=
sym="--symetric"
rm "$TRACES_DIR/times.log" || true
###############################################################################
echo "Make sure you have a Trace32 instance ready"
not_supported() {
echo "*** $1 is not supported for $PRODUCT" > /dev/stderr
exit 1
}
generate_R() {
extra_args=
script="mkdata.py"
echo $@
if [ "${TYPE%%.*}" = "places" ] || [ "$TYPE" = "cpuPri" ] || [ "$TYPE" = "l1" ] || { [ "$PRODUCT" = "$P2020" ] && [ "$TYPE" = "Hsram" ]; }; then
bins="
--traces-dir '$TRACES_DIR' \\
"
extra_args="
--core $2
"
script="mkplaces.py"
ref="$3"
sym=
else
bins="
--c0-off '$TRACES_DIR/c0-off.bin' \\
--c0-on '$TRACES_DIR/c0-on.bin' \\
--c1-off '$TRACES_DIR/c1-off.bin' \\
--c1-on '$TRACES_DIR/c1-on.bin' \\
--stats \\
"
ref="c0-off"
case "$1" in
"FLASH")
extra_args="
--c0-on-local '$TRACES_DIR/c0-on-local.bin' \\
--c1-on-local '$TRACES_DIR/c1-on-local.bin'
"
script="mkcontrol.py"
;;
"H")
extra_args="
--output-json '$TRACES_DIR/$TYPE.json'
"
;;
esac
fi
eval "
'./scripts/$script' \\
\\$bins \\
--kdbv '$KDBV' \\
--kcfg '$BUILD_DIR/$1/$ref/gen/app/partos/0/dbs/task_$1_kcfg.ks' \\
--kapp '$BUILD_DIR/$1/$ref/gen/app/config/kapp.ks' \\
--output-dir '$OUTDIR/$TYPE' --task=$1 \\
--product '$PRODUCT'\\
--timer '$timer' \\
$sym \\
\\$extra_args
"
cd "$OUTDIR/$TYPE"
R --no-save < plot.R
}
if [ "x$TYPE" = x"flash" ]; then
cmd='run_flash'
r_args='FLASH'
elif [ "x$TYPE" = x"flash2" ]; then
cmd='run_flash2'
r_args='FLASH'
elif [ "x$TYPE" = x"G" ]; then
cmd='run_G'
r_args='G'
elif [ "x$TYPE" = x"U" ]; then
STUBBORN_MAX_MEASURES=512
cmd='run_U'
r_args='U'
elif [ "x$TYPE" = x"H" ]; then
cmd='run_H'
r_args='H'
elif [ "x$TYPE" = x"Hsram" ]; then
STUBBORN_MAX_MEASURES=256
NO_SEP=ON
t='U'
ref="${t}SRAM-COFF"
cmd='run_Hsram'
if [ "$PRODUCT" = "$P2020" ]; then
cmd+=" 0 $t"
r_args="$t 0 $ref"
else
r_args='H'
fi
elif [ "x${TYPE%%.*}" = x"places" ]; then
STUBBORN_MAX_MEASURES=256
t=${TYPE#*.}
spec=${t#*.}
t=${t%.*}
case $spec in
"R05")
#Default value
#CORUNNER_READ_0="0x20000000"
#CORUNNER_READ_1="0x20000000"
;;
"R15")
CORUNNER_READ_0="0x60000000"
CORUNNER_READ_1="0x60000000"
;;
"LH")
EEBPCR="03000002"
export EEBPCR
;;
"HL")
EEBPCR="03000020"
export EEBPCR
;;
"S001")
DDR_SIZE=268435456
STEP_START=125
LAST_ADDR=268435456
step=1073741.824
;;
"S005")
DDR_SIZE=268435456
STEP_START=25
LAST_ADDR=268435456
step=5368709.12
;;
esac
step=${step:-}
ref="${t}05-COFF"
cmd="run_places 0 $t $step"
r_args="$t 0 $ref"
elif [ "x$TYPE" = x"cpuPri" ]; then
STUBBORN_MAX_MEASURES=256
ref="ref-coff"
cmd="run_cpu_pri 0 H"
r_args="U 0 $ref"
elif [ "x$TYPE" = x"l1" ]; then
NO_SEP=ON
STUBBORN_MAX_MEASURES=256
ref="H-COFF"
cmd="run_l1 0 H"
r_args="H 0 $ref"
else
echo "*** Unknown argument '$TYPE'"
exit 1
fi
export NO_SEP
export STUBBORN_MAX_MEASURES
[ -z "$GENONLY" ] && eval "$cmd"
generate_R $r_args