31 lines
1.2 KiB
Bash
31 lines
1.2 KiB
Bash
#!/usr/bin/env bash
|
||
# ============================================================
|
||
# 启动 ST-LINK GDB Server,供 CLion 的 Embedded/Remote GDB Server 调试连接
|
||
#
|
||
# 用法:
|
||
# 1) 接好 ST-Link (SWD), 给板子供电
|
||
# 2) 运行本脚本 (CLion 里点 "Debug-Server" 运行配置, 或终端 bash tools/debug-server.sh)
|
||
# 3) 在 CLion 调试配置里用 target remote localhost:61234 连接
|
||
#
|
||
# GDB Server : ST-LINK_gdbserver (CubeCLT 自带)
|
||
# 连接模式 : under-reset (-m 0) —— 对 F103 最稳, 能抓复位/卡死态
|
||
# ============================================================
|
||
set -e
|
||
|
||
CLT="/c/ST/STM32CubeCLT_1.18.0"
|
||
GDBSERVER="$CLT/STLink-gdb-server/bin/ST-LINK_gdbserver.exe"
|
||
CP="$CLT/STM32CubeProgrammer/bin" # Connection Bridge: 提供 ST-LINK 驱动桥接, 必需
|
||
|
||
if [ ! -x "$GDBSERVER" ]; then
|
||
echo "找不到 ST-LINK_gdbserver.exe: $GDBSERVER" >&2
|
||
echo "请确认 STM32CubeCLT 已安装在 $CLT" >&2
|
||
exit 1
|
||
fi
|
||
|
||
echo "==[ ST-LINK GDB Server 启动 ]=="
|
||
echo "==[ 监听 :61234 连接模式 under-reset ]=="
|
||
echo "==[ 在 CLion 调试配置里 target remote localhost:61234 连接 ]=="
|
||
echo "==[ Ctrl+C 退出 ]=="
|
||
echo "----------------------------------------------------------------"
|
||
exec "$GDBSERVER" -cp "$CP" -p 61234 -m 0
|