summaryrefslogtreecommitdiff
path: root/scripts/debug
diff options
context:
space:
mode:
authorNathaniel Graff <nathaniel.graff@sifive.com>2018-12-13 14:02:52 -0800
committerPalmer Dabbelt <palmer@sifive.com>2018-12-13 18:14:36 -0800
commitcc139c77212bd1c8bf306048539eef20ad955f9a (patch)
tree3a759945686fa29a016883946bf2780ad29783a3 /scripts/debug
parentb38973e0327f79d1c2ca2f86872a0954b0ad4c79 (diff)
Support Building of MEE and MEE examples
Signed-off-by: Nathaniel Graff <nathaniel.graff@sifive.com>
Diffstat (limited to 'scripts/debug')
-rwxr-xr-xscripts/debug34
1 files changed, 34 insertions, 0 deletions
diff --git a/scripts/debug b/scripts/debug
new file mode 100755
index 0000000..d02c42c
--- /dev/null
+++ b/scripts/debug
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+set -e
+set -o pipefail
+
+unset elf
+unset cfg
+unset openocd
+unset gdb
+while [[ "$1" != "" ]]
+do
+ case "$1"
+ in
+ --elf) elf="$2"; shift 2;;
+ --openocd) openocd="$2"; shift 2;;
+ --openocd-config) cfg="$2"; shift 2;;
+ --gdb) gdb="$2"; shift 2;;
+ *) echo "$0: Unknown argument $1"; exit 1;;
+ esac
+done
+
+if [[ "$elf" == "" ]]
+then
+ echo "$0: --elf is required" >&2
+ exit 1
+fi
+
+export GDB_PORT=3333
+
+$openocd -f $cfg &
+
+$gdb $elf -ex "set remotetimeout 240" -ex "target extended-remote localhost:${GDB_PORT}"
+
+kill %1