blob: 424110b0bdcba2478645fc126bbdc3f1b8d43f2f (
plain)
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
|
#!/bin/sh
progname="$(basename "$(readlink -f "$0")")"
die() {
ec="$1"
shift
echo "$@"
exit "$ec"
}
GDB="arm-none-eabi-gdb"
[ $# -lt 1 ] && die 1 "usage: $progname DEVICE [gdb args...]"
DEVICE="$1"
shift
if [ $# -eq 0 ] ; then
# automatically add --se flag if executable can be found
exec="$(find . -maxdepth 3 -name '*.elf' | head -n1)"
[ -n "$exec" ] && set -- --se="$exec"
fi
[ -n "$(echo "$*" | grep -i zephyr)" ] && GDB="arm-zephyr-eabi-gdb"
fork JLinkGDBServerCLExe \
-device "$DEVICE" \
-select USB \
-endian little \
-if SWD \
-speed auto \
-singlerun \
-noir \
-nologtofile \
-silent
# append startup attach command to args
set -- --eval-command="target extended-remote :2331" "$@"
# launch gdb and forward any other args to it
exec "$GDB" "$@"
|