Linux 使用STM32F1x和ST链路的OpenOCD连接

Linux 使用STM32F1x和ST链路的OpenOCD连接,linux,debugging,gdb,stm32,openocd,Linux,Debugging,Gdb,Stm32,Openocd,我使用的是STM32F103。我想用OpenOCD来闪存STM32。我正在使用keil,但我想转向arm gcc编译器。 我可以为控制器编译代码。但是现在我想用OpenOCD来刷新它。 我能够管理它的配置 以下是openocd连接的日志 X:\Work\OToggle>openocd -f led_Debug.cfg Open On-Chip Debugger 0.10.0+dev-00021-g524e8c8 (2019-04-12-08:48) Licensed under GNU G

我使用的是STM32F103。我想用OpenOCD来闪存STM32。我正在使用keil,但我想转向arm gcc编译器。 我可以为控制器编译代码。但是现在我想用OpenOCD来刷新它。 我能够管理它的配置

以下是openocd连接的日志

X:\Work\OToggle>openocd -f led_Debug.cfg
Open On-Chip Debugger 0.10.0+dev-00021-g524e8c8 (2019-04-12-08:48)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 1000 kHz
adapter_nsrst_delay: 100
srst_only separate srst_nogate srst_open_drain connect_assert_srst
none separate
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : clock speed 1000 kHz
Info : STLINK v2 JTAG v17 API v2 SWIM v4 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 3.245003
Error: BUG: can't assert SRST
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f1x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 100ms
Info : Previous state query failed, trying to reconnect
Polling target stm32f1x.cpu failed, trying to reexamine
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f1x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 100ms
Info : Previous state query failed, trying to reconnect
Polling target stm32f1x.cpu failed, trying to reexamine
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f1x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 100ms
Info : Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f1x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 300ms
Info : Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f1x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 700ms
Info : Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f1x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 1500ms
Info : Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f1x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 3100ms
Info : Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f1x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 6300ms
Info : Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f1x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 6300ms
Info : Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f1x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 6300ms
Info : Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f1x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 6300ms
Info : Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f1x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 6300ms
Info : Previous state query failed, trying to reconnect
Polling target stm32f1x.cpu failed, trying to reexamine
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f1x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 100ms
Info : Previous state query failed, trying to reconnect
Polling target stm32f1x.cpu failed, trying to reexamine
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f1x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 100ms
Info : Previous state query failed, trying to reconnect
Polling target stm32f1x.cpu failed, trying to reexamine
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f1x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 100ms
Info : Previous state query failed, trying to reconnect
Polling target stm32f1x.cpu failed, trying to reexamine
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f1x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 100ms
Info : Previous state query failed, trying to reconnect
Polling target stm32f1x.cpu failed, trying to reexamine
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f1x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 100ms
Info : Previous state query failed, trying to reconnect
Polling target stm32f1x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 100ms
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f1x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 300ms
Info : Previous state query failed, trying to reconnect
Polling target stm32f1x.cpu failed, trying to reexamine
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f1x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 100ms
Info : Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f1x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 300ms
Info : Previous state query failed, trying to reconnect
Polling target stm32f1x.cpu failed, trying to reexamine
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f1x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 100ms
Info : Previous state query failed, trying to reconnect
Polling target stm32f1x.cpu failed, trying to reexamine
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f1x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 100ms
Info : Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f1x.cpu failed, trying to reexamine
Info : stm32f1x.cpu: hardware has 6 breakpoints, 0 watchpoints
Error: mem2array: Read @ 0xe0042004, w=4, cnt=1, failed
mem_helper.tcl:6: Error:
in procedure 'mmw'
in procedure 'mrw' called at file "mem_helper.tcl", line 16
at file "mem_helper.tcl", line 6

Info : Previous state query failed, trying to reconnect
Info : accepting 'gdb' connection on tcp/3333
Error: TRST/SRST error
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0800115c msp: 0x20005000
Info : device id = 0x20036410
Info : flash size = 64kbytes
Warn : ignoring character 0xffffffff
Warn : ignoring character 0xfffffffb
Warn : ignoring character 0x1f
Warn : ignoring character 0xffffffff
Warn : ignoring character 0xfffffffb
Warn : ignoring character 0x20
Warn : ignoring character 0xffffffff
Warn : ignoring character 0xfffffffb
Warn : ignoring character 0x18
Warn : ignoring character 0xffffffff
Warn : ignoring character 0xfffffffb
Warn : ignoring character 0x27
Warn : ignoring character 0xffffffff
Warn : ignoring character 0xfffffffd
Warn : ignoring character 0x1
Warn : ignoring character 0xffffffff
Warn : ignoring character 0xfffffffb
Info : The target is not running when halt was requested, stopping GDB.
Warn : ignoring character 0xffffffff
Warn : ignoring character 0xfffffffd
Info : The target is not running when halt was requested, stopping GDB.
Warn : ignoring character 0xd
Warn : ignoring character 0xa
Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not sent! (1072). Workaround: increase "set remotetimeout" in GDB
Warn : ignoring character 0x77
Warn : ignoring character 0x72
Warn : ignoring character 0x69
Warn : ignoring character 0x74
Warn : ignoring character 0x65
Warn : ignoring character 0x20
Warn : ignoring character 0x66
Warn : ignoring character 0x6c
Warn : ignoring character 0x61
Warn : ignoring character 0x73
Warn : ignoring character 0x68
Warn : ignoring character 0xd
Warn : ignoring character 0xa
Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not sent! (1108). Workaround: increase "set remotetimeout" in GDB
我试过以下几件事:

  • 我打开了第二个命令提示符并给出了以下命令
    arm-none-eabi-gdb led.elf
    
    但随后它启动了gdb会话(我从未使用过它)
  • 我试图通过油灰连接目标(2-3年前,我使用这种方法连接nRF51)

  • 这一次,两种方法都不起作用。

    让您的生活更轻松,安装Atolic studio或STMCUBEMXIDE。这些IDE为您完成了枯燥的工作(比如调试配置),我使用Keil和CubeMx生成代码。但是我换了linux操作系统,在linux操作系统上没有keil。我正在使用STM的标准外设库。这也将帮助我使用nRF51。我在GNU/Linux下使用STM32 MCU-s。我使用(以前的texane/stlink)与gdb进行调试。试试看。@P_u_uj_u-最好的主意。我刚刚注意到STM32CubeMX/STM32CubeIDE和Atolic TrueStudio也可用于Linux。@dev_eng-如果您想知道是更喜欢TrueStudio还是STM32CubeIDE作为新的GUI,您应该从STM32CubeIDE开始,因为STM购买TrueStudio是为了将其合并到“它的”STM32CubeIDE中,并在某一天放弃它,我想。无论如何,在Windows上,这两个IDE对我来说都是开箱即用的,所以我想它们也可以在你的Linux机器上使用。让你的生活更轻松一点,安装Atolic studio或STMCUBEMXIDE。这些IDE为您完成了枯燥的工作(比如调试配置),我使用Keil和CubeMx生成代码。但是我换了linux操作系统,在linux操作系统上没有keil。我正在使用STM的标准外设库。这也将帮助我使用nRF51。我在GNU/Linux下使用STM32 MCU-s。我使用(以前的texane/stlink)与gdb进行调试。试试看。@P_u_uj_u-最好的主意。我刚刚注意到STM32CubeMX/STM32CubeIDE和Atolic TrueStudio也可用于Linux。@dev_eng-如果您想知道是更喜欢TrueStudio还是STM32CubeIDE作为新的GUI,您应该从STM32CubeIDE开始,因为STM购买TrueStudio是为了将其合并到“它的”STM32CubeIDE中,并在某一天放弃它,我想。无论如何,在Windows上,这两个IDE对我来说都是开箱即用的,所以我想它们在你的Linux机器上也可以。