Error: timed out while waiting for target halted

本文分享了如何处理在嵌入式系统或运维过程中遇到的'Error: timed out while waiting for target halted'错误。通过分析问题原因和提供解决方案,帮助开发者顺利进行程序调试。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

/************************************************************************************
 *              Error: timed out while waiting for target halted
 * 说明:
 *     SW4STM32 STLINK 无法烧录问题。
 *
 *                                            2017-12-26 深圳 宝安西乡 曾剑锋
 ***********************************************************************************/


一、参考文档:
    STLink2 problems reseting
        https://forum.sparkfun.com/viewtopic.php?t=45260

二、报错信息:
    Open On-Chip Debugger 0.10.0-dev-00005-g4030e1c-dirty (2017-10-24-08:00)
    Licensed under GNU GPL v2
    For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
    srst_only separate srst_nogate srst_open_drain connect_assert_srst
    Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
    adapter_nsrst_delay: 100
    adapter speed: 950 kHz
    Info : clock speed 950 kHz
    Info : STL
Open On-Chip Debugger 0.12.0+dev-00623-g0ba753ca7 (2025-04-30-14:17) [https://github.com/STMicroelectronics/OpenOCD] Licensed under GNU GPL v2 For bug reports, read http://openocd.org/doc/doxygen/bugs.html Info : Listening on port 6666 for tcl connections Info : Listening on port 4444 for telnet connections Info : STLINK V2J46S7 (API v2) VID:PID 0483:3748 Info : Target voltage: 3.285562 Info : Unable to match requested speed 8000 kHz, using 4000 kHz Info : Unable to match requested speed 8000 kHz, using 4000 kHz Info : clock speed 4000 kHz Info : stlink_dap_op_connect(connect) Info : SWD DPIDR 0x1ba01477 Info : [STM32F103C8Tx.cpu] Cortex-M3 r1p1 processor detected Info : [STM32F103C8Tx.cpu] target has 6 breakpoints, 4 watchpoints Info : [STM32F103C8Tx.cpu] Examination succeed Info : starting gdb server for STM32F103C8Tx.cpu on 3333 Info : Listening on port 3333 for gdb connections Info : accepting 'gdb' connection on tcp/3333 Error: timed out while waiting for target halted Error executing event gdb-attach on target STM32F103C8Tx.cpu: C:/ST/STM32CubeIDE_1.19.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.debug.openocd_2.3.100.202501240831/resources/openocd/st_scripts/gdb_helper.tcl:18: Error: TARGET: STM32F103C8Tx.cpu - Not halted in procedure 'gdb_attach_hook' called at file "C:/ST/STM32CubeIDE_1.19.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.debug.openocd_2.3.100.202501240831/resources/openocd/st_scripts/target/stm32f1x.cfg", line 184 in procedure 'first_gdb_attach_hook' called at file "C:/ST/STM32CubeIDE_1.19.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.debug.openocd_2.3.100.202501240831/resources/openocd/st_scripts/gdb_helper.tcl", line 18 Info : device id = 0x00006410 Info : flash size = 128 KiB Warn : GDB connection 1 on target STM32F103C8Tx.cpu not halted undefined debug reason 8 (UNDEFINED) - target needs reset Info : accepting 'gdb' connection on tcp/3333 Warn : GDB connection 2 on target STM32F103C8Tx.cpu not halted undefined debug reason 8 (UNDEFINED) - target needs reset Error: timed out while waiting for target halted Error executing event gdb-flash-erase-start on target STM32F103C8Tx.cpu: TARGET: STM32F103C8Tx.cpu - Not halted Error: Target not halted Error: failed erasing sectors 0 to 4 Error: flash_erase returned -304 Info : dropped 'gdb' connection shutdown command invoked Info : dropped 'gdb' connection
最新发布
07-11
Open On-Chip Debugger 0.12.0+dev-00608-gd8ed48fef (2025-02-06-11:17) [https://github.com/STMicroelectronics/OpenOCD] Licensed under GNU GPL v2 For bug reports, read http://openocd.org/doc/doxygen/bugs.html Info : Listening on port 6666 for tcl connections Info : Listening on port 4444 for telnet connections Info : connected to stlink-server Info : stlink-server API v3, version 2.1.1 Info : STLINK V2J46S7 (API v2) VID:PID 0483:3748 Info : Target voltage: 2.522222 Info : Unable to match requested speed 8000 kHz, using 4000 kHz Info : Unable to match requested speed 8000 kHz, using 4000 kHz Info : clock speed 4000 kHz Info : stlink_dap_op_connect(connect) Info : SWD DPIDR 0x2ba01477 Info : [STM32F407IGTx.cpu] Cortex-M4 r0p1 processor detected Info : [STM32F407IGTx.cpu] target has 6 breakpoints, 4 watchpoints Info : [STM32F407IGTx.cpu] Examination succeed Info : starting gdb server for STM32F407IGTx.cpu on 3333 Info : Listening on port 3333 for gdb connections Info : accepting 'gdb' connection on tcp/3333 Error: timed out while waiting for target halted Error executing event gdb-attach on target STM32F407IGTx.cpu: C:/ST/STM32CubeIDE_1.18.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.debug.openocd_2.3.100.202501240831/resources/openocd/st_scripts/gdb_helper.tcl:18: Error: TARGET: STM32F407IGTx.cpu - Not halted in procedure 'gdb_attach_hook' called at file "C:/ST/STM32CubeIDE_1.18.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.debug.openocd_2.3.100.202501240831/resources/openocd/st_scripts/target/stm32f4x.cfg", line 192 in procedure 'first_gdb_attach_hook' called at file "C:/ST/STM32CubeIDE_1.18.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.debug.openocd_2.3.100.202501240831/resources/openocd/st_scripts/gdb_helper.tcl", line 18 Info : device id = 0x10076413 Info : flash size = 1024 KiB Warn : GDB connection 1 on target STM32F407IGTx.cpu not halted undefined debug reason 8 (UNDEFINED) - target needs reset Info : accepting 'gdb' connection on tcp/3333 Warn : GDB conne
03-21
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值