stlink-opencd-gdb调试程序

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


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值