Debugging with OpenOCD and GDB Server

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Debugging with OpenOCD and GDB Server

      New

      Is it possible to have a BIN file downloaded into flash as part of the debug process via gdb/OpenOCD, but then load the elf file subsequently via gdb?

      Also, where can I find what version of gdb is used when “GDB Server” is selected as the debugger?

      What arguments are sent to gdb and can these be inspected or changed?

      I have a custom target device (not supported by SES) however, using an external toolchain, I can compile and link as well as correctly launch OpenOCD however when it comes to debugging, downloading and ELF file is not supported (only binary) but I can manually load an ELF file via gdb (outside of SES) and step through the code.

      I hope that makes sense…

      Also, after an executable is successfully built, SES shows the amount of used/free flash and ram statistics graphically - how is this information derived? Is it from the memory map xml file?

      The post was edited 1 time, last by k3vlar ().

    • New

      > Is it possible to have a BIN file downloaded into flash as part of the debug process via gdb/OpenOCD, but then load the elf file subsequently via gdb?

      I think this doesn't make much sense, the *.bin and *.ELF file basically contain the same information, and produce the same result (i.e. Flash content).
      ELF files contain a lot of meta information reuired for debugging. Bin files do not.

      > Also, where can I find what version of gdb is used when “GDB Server” is selected as the debugger?
      > What arguments are sent to gdb and can these be inspected or changed?


      Right-click on your project, select "Options", and select Debug/GDB server in the window that opens.
      This should give you all the information you need.
      (A screenshot upload did not work, so it has to work without ...)

      I don't know if SES uses a pre-installed gdb or installs it's own version nonetheless.
      Perhaps someone from the Segger staff can answer that.
      To me, it looks like the former, i.e. using a preinstalled gdb.
      Emitting "gdb --version" on the command line yields "GNU gdb (Ubuntu 9.2-0ubuntu1~20.04.1) 9.2".
      And "which gdb" yields "/usr/bin/gdb".
    • New

      Thanks for your response.

      Yeah, I appreciate the bin/elf bit doesn't make much sense. However, if I try to download an ELF file to the target device using OpenOCD, it doesn't work and the target won't start. Downloading the bin version does. I've also proven this using the same toolchain using Eclipse (which I can get to work using the same set of tools).

      Unfortunately it's the GDB part which I'm struggling to get working and I can't quite figure out which version of gdb is being used by SES. I haven't yet been able to find a concrete answer to this.