1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/dist/tools/mspdebug/debug_srv.sh
Marian Buschsieweke ca15b1e1f8
tools/mspdebug: fix make debug and make debugserver
The semantics of `make debug` and `make debugserver` have changed in
the years since the MSP430 integration. This brings the implementation
back into line with the current semantics

- `make debug` now starts both mspdebug and GDB, no need to
  run `make debugserver` prior to `make debug` anymore
- `make debug` no longer flashes the target to not waste flash erase
  cycles
- GDB mutliarch support is added
- support for selecting a debug adapter by its serial is added
2023-05-24 17:00:38 +02:00

33 lines
695 B
Bash
Executable File

#!/usr/bin/env bash
MSPDEBUG="$1"
MSPDEBUG_PROGRAMMER="$2"
PROTOCOL="$3"
MSPDEBUG_TTY="$4"
DEBUG_ADAPTER_ID="$5"
GDBPORT="$6"
if [ -z "${MSPDEBUG_PROGRAMMER}" ]; then
echo "MSPDEBUG_PROGRAMMER unset, cannot use mspdebug"
fi
args=()
if [ "JTAG" = "${PROTOCOL}" ]; then
args+=("-j")
else
if [ "Spy-Bi-Wire" != "${PROTOCOL}" ]; then
echo "Debugger protocol \"${PROTOCOL}\" not supported, use JTAG or Spy-Bi-Wire"
exit 1
fi
fi
args+=("${MSPDEBUG_PROGRAMMER}")
if [ -n "${DEBUG_ADAPTER_ID}" ]; then
args+=("s" "{$DEBUG_ADAPTER_ID}")
fi
if [ -n "${MSPDEBUG_TTY}" ]; then
args+=("-d" "${MSPDEBUG_TTY}")
fi
args+=("gdb ${GDBPORT}")
"${MSPDEBUG}" "${args[@]}"