stlink-opencd-gdb调试程序

xiaoxiao2021-02-28  75

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

转载请注明原文地址: https://www.6miu.com/read-42763.html

最新回复(0)