DAP-LINK使用OpenOCD解锁STM32
使用脚本:
#!/usr/bin/env bash
SOURCE=/usr/share/openocd/
INTERFACE_CFG=${SOURCE}scripts/interface/cmsis-dap.cfg
TARGET_CFG=${SOURCE}scripts/target/stm32f1x.cfg
PWD=$(dirname "$(readlink -f "$0")")
echo "开始连接"
openocd -f ${INTERFACE_CFG} \
-f ${TARGET_CFG} \
-c "init" \
-c "halt" \
-c "stm32f1x unlock 0" \
-c "reset halt" \
-c "exit"
效果如下:
lizigarden@leeds-ThinkPad ~/p/S/HelloWorld> sudo ./unlock.sh
开始连接
Open On-Chip Debugger 0.11.0
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "swd". To override use 'transport select <transport>'.
Info : CMSIS-DAP: SWD Supported
Info : CMSIS-DAP: FW Version = 2.0.0
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 1 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 1000 kHz
Info : SWD DPIDR 0x1ba01477
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : starting gdb server for stm32f1x.cpu on 3333
Info : Listening on port 3333 for gdb connections
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08000234 msp: 0x2000fff8
Info : device id = 0x10036414
Info : flash size = 512kbytes
stm32x unlocked.
INFO: a reset or power cycle is required for the new settings to take effect.
target halted due to debug-request, current mode: Thread
xPSR: 0x61000000 pc: 0x2000003a msp: 0x2000fff8
开学到现在一个半月,终于解决了,呜呜呜。
差点就买了ST-LINK,我甚至加入了购物车QAQ。
参考链接:
作者:leedsgarden
出处:https://www.cnblogs.com/leedsgarden/p/16773640.html
版权:本作品采用「署名-非商业性使用-相同方式共享 4.0 国际」许可协议进行许可。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具