您的位置:首页 > 运维架构

stlink-opencd-gdb调试程序

2017-06-07 13:50 316 查看
1.
$ openocd -f interface/stlink-v2.cfg -f target/stm32f4x_stlink.cfg

启动openocd server

2. 编写.gdbinit脚本

target remote localhost:3333
monitor reset
monitor halt
load
3.
$ arm-none-eabi-gdb example.elf
4.
(gdb) source .gdbinit
5. 设置断点
b main
monitor reset halt
6.
continue   (这里没有run指令,只有c指令)

//注意设置断点后,一定要执行monitor reset halt指令,否则不会停在断点处!!!


 openocd 操作stm32 flash命令:

1. openocd -f interface/stlink-v2.cfg -f target/stm32f1x_stlink.cfg -c init -c "reset halt" -c "flash erase_address 0x08000000 0x40000" -c exit

     清空从0x80000000地址开始,长度为40000的flash地址

2.  openocd -f interface/stlink-v2.cfg -f target/stm32f1x_stlink.cfg -c init -c "reset run" -c "mdw 0x08000000 0x10000" -c "exit"

      将地址从0x80000000开始,长度为0x10000的内容打印到屏幕

20179.27
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: