2023-05-06 23:26:00 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
MSPDEBUG="$1"
|
|
|
|
MSPDEBUG_PROGRAMMER="$2"
|
|
|
|
PROTOCOL="$3"
|
|
|
|
MSPDEBUG_TTY="$4"
|
|
|
|
DEBUG_ADAPTER_ID="$5"
|
2024-02-06 15:23:02 +01:00
|
|
|
DEBUG_TARGET_ID="$6"
|
|
|
|
GDBPORT="$7"
|
2023-05-06 23:26:00 +02:00
|
|
|
|
|
|
|
if [ -z "${MSPDEBUG_PROGRAMMER}" ]; then
|
|
|
|
echo "MSPDEBUG_PROGRAMMER unset, cannot use mspdebug"
|
|
|
|
fi
|
|
|
|
|
|
|
|
args=()
|
2024-02-06 15:23:02 +01:00
|
|
|
args+=("--expect-id" "$DEBUG_TARGET_ID")
|
2023-05-06 23:26:00 +02:00
|
|
|
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[@]}"
|