-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathrun_helper.sh.in
executable file
·116 lines (99 loc) · 3.21 KB
/
run_helper.sh.in
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
#!/bin/bash
set -e
# Config
ETISS_DIR=@ETISS_DIR@
# Clear tmp file
DYN_INI=$(mktemp /tmp/etiss_dynamic_XXXXXXXXXX.ini)
echo "" > $DYN_INI
# Args
if [ "$#" -lt 1 ]; then
echo -e "Usage: $0 TargetELF [options] [vp VPExecutable]\n" \
"vp:\n" \
" Optional parameter to specify an executable to use as VP. Default is the bare_etiss_processor.\n" \
"options:\n" \
" gdb Run the VP on a debugger\n" \
" tgdb Run the target SW on a debugger\n" \
" noattach Do not automatically attach when using tgdb\n" \
" nodmi Disable DMI\n" \
" logpc Enable logging of the program counter\n" \
" v Set ETISS output to verbose\n" \
" trace Trace memory accesses\n" \
" gcc Use GCC as JIT instead of TCC\n" \
" llvm Use LLVM as JIT instead of TCC\n"
exit 1
fi
TARGETSW_PATH_ELF=$1
TARGET_ELFFILE=$(basename -- "$TARGETSW_PATH_ELF")
TARGET_ELFDIR=$(dirname -- "$TARGETSW_PATH_ELF")
VP_EXE="${ETISS_DIR}/bin/bare_etiss_processor"
CMD_OPTIONS=""
USE_GDB=0
USE_TGDB=0
DO_NOT_ATTACH=0
ENABLE_DMI="true"
LOG_PC="false"
LOG_LEVEL=4
DO_TRACE=0
JIT="TCCJIT"
shift
while [ "$#" -gt 0 ];
do
arg="$1"
if [ "$arg" = "gdb" ]; then
USE_GDB=1
elif [ "$arg" = "tgdb" ]; then
USE_TGDB=1
echo -e "[Plugin gdbserver]\n plugin.gdbserver.port=2222" >> $DYN_INI
elif [ "$arg" = "noattach" ]; then
DO_NOT_ATTACH=1
elif [ "$arg" = "nodmi" ]; then
ENABLE_DMI="false"
elif [ "$arg" = "logpc" ]; then
LOG_PC="true"
elif [ "$arg" = "v" ]; then
LOG_LEVEL=5
elif [ "$arg" = "trace" ]; then
DO_TRACE=1
elif [ "$arg" = "gcc" ]; then
JIT="GCCJIT"
elif [ "$arg" = "tcc" ]; then
JIT="TCCJIT"
elif [ "$arg" = "llvm" ]; then
JIT="LLVMJIT"
elif [ "$arg" = "vp" ]; then
VP_EXE="$2"
shift
else
CMD_OPTIONS="${CMD_OPTIONS} ${arg}"
fi
shift
done
echo -e "[StringConfigurations]\n" >> $DYN_INI
echo -e "vp.elf_file=$TARGETSW_PATH_ELF" >> $DYN_INI
echo -e "jit.type=${JIT}" >> $DYN_INI
echo -e "\n[BoolConfigurations]\n" >> $DYN_INI
echo -e "etiss.enable_dmi=${ENABLE_DMI}" >> $DYN_INI
echo -e "etiss.log_pc=${LOG_PC}" >> $DYN_INI
if [ "${DO_TRACE}" -eq 1 ]; then
echo -e "simple_mem_system.print_dbus_access=true" >> $DYN_INI
echo -e "simple_mem_system.print_to_file=true" >> $DYN_INI
fi
echo -e "\n[IntConfigurations]\n" >> $DYN_INI
echo -e "etiss.loglevel=${LOG_LEVEL}" >> $DYN_INI
echo -e "simple_mem_system.memseg_origin_00=0x00000000" >> $DYN_INI
echo -e "simple_mem_system.memseg_length_00=0x00080000" >> $DYN_INI
echo -e "simple_mem_system.memseg_origin_01=0x00080000" >> $DYN_INI
echo -e "simple_mem_system.memseg_length_01=0x00080000" >> $DYN_INI
# Call
ARGS="-i${ETISS_DIR}/examples/base.ini -i${DYN_INI} ${CMD_OPTIONS}"
if [ "${USE_TGDB}" -eq 1 ]; then
if [ "${DO_NOT_ATTACH}" -eq 0 ]; then
konsole --workdir $(pwd) -e "bash -c '/usr/local/research/projects/SystemDesign/tools/riscv/current/bin/riscv64-unknown-elf-gdb -ex \"tar rem :2222\" $TARGETSW_PATH_ELF'" &
fi
fi
if [ "${USE_GDB}" -eq 1 ]; then
gdb --args ${VP_EXE} ${ARGS}
else
${VP_EXE} ${ARGS}
fi
rm $DYN_INI