openocd的用法(二) - minichao9901/TangNano-20k-Zynq-7020 GitHub Wiki

用openocd+arm-none-eabi-gdb调试stm32

参考文献
https://blog.csdn.net/zhengyangliu123/article/details/54934719/

首先创建my.cfg文件

source [find interface/stlink.cfg]
source [find target/stm32l4x.cfg]
#source [find target/stm32h7x.cfg]

其次执行openocd命令

注意,要确保这个时候板子插上电脑,并且stlink驱动正确安装了

openocd -f my.cfg

image

然后进入hello_world.elf文件的目录,执行arm-none-eabi-gdb命令

image

arm-none-eabi-gdb hello_world.elf
target remote localhost: 3333

常见操作

monitor reset
monitor halt
load

info r
info stack
info variables

x/nfu addr
help x

x/32xw 0x20000000

image image