DSO Nano/OpenOCD gdb


Debugging with OpenOCD and gdb

Please use openocd 4.0 or newer.
This example assumes you have a Segger J-Link compatible JTAG adapter between your computer and the device (or dev board) you are debugging. It is possible to use an SWD (ST-Link) adapter instead, for this use openocd 0.7 or newer.
Start the openocd server with configuration files matching your hardware:
openocd -f interface/jlink.cfg -f target/stm32.cfg
Or, if you are using SWD:
openocd -f interface/stlink-v2.cfg -f target/stm32f1x_stlink.cfg
In a second window, start an interactive session with openocd:
telnet localhost 4444
This seems to be necessary to avoid “target is not halted” errors and other trouble later:
reset_config trst_and_srst
Stop the target (the arm processor):
reset halt
If you have not already flashed the binary, using for instance dfu-util, you can do it over JTAG like this:
reset init
flash write_image erase dso-lib.hex 0 ihex
reset halt
In a third window, start gdb or gdbtui:
(gdb) file dso-lib.elf
(gdb) target remote localhost:3333"
(gdb) load dso-lib.elf
You should now be able to run and debug:
(gdb) set $pc = Reset_Handler
(gdb) display/i $pc
(gdb) stepi

Help us make it better

Thank you for choosing Seeed. A couple of months ago we initiated a project to improve our documentation system. What you are looking at now is the first edition of the new documentation system. Comparing to the old one, here is the progresses that we made:
  • Replaced the old documentation system with a new one that was developed from Mkdocs, a more widely used and cooler tool to develop documentation system.
  • Integrated the documentation system with our official website, now you can go to Bazaar and other section like Forum and Community more conveniently.
  • Reviewed and rewrote documents for hundreds of products for the system’s first edition, and will continue migrate documents from old wiki to the new one.
An easy-to-use instruction is as important as the product itself. We are expecting this new system will improve your experience when using Seeed’s products. However since this is the first edition, there are still many things need to improve, if you have any suggestions or findings, you are most welcome to submit the amended version as our contributor or give us suggestions in the survey below, Please don’t forget to leave your email address so that we can reply.
Happy hacking