Debugger setup for Black Magic Probe?

Sysprogs forums Forums VisualGDB Debugger setup for Black Magic Probe?

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #9464
    schabtach
    Participant

    I wondered whether anyone here is using a Black Magic debugging probe with VisualGDB. I’m trying to get VisualGDB set up to use it and am having some trouble figuring out exactly how to pass the right commands to gdb. The probe uses a COM port for communication with gdb and does not need any middleware such as OpenOCD. I know which commands to send to it; that is all documented here: https://github.com/blacksphere/blackmagic/wiki/Useful-GDB-commands

    My trouble lies in figuring out how to set up VisualGDB, starting with the Debug Method options. Do I need to use “Full-custom mode” or will “Custom GDB Stub” suffice?

    As described on that wiki page referenced above, I need to enter two commands to connect to the target:

    target extended-remote COM3
    attach 1

    I can do this successfully by running arm-none-eabi-gdb in a command shell, but I’m having a hard time figuring out how to provide these commands to VisualGDB. It seems to have its own target-selection command which I cannot override.

    Thanks in advance for any help or suggestions.

    –Adam

     

    #9468
    support
    Keymaster

    Hi,

    Please try switching the debug method to full-custom mode. Then specify the following:

    Arguments –interpreter mi $(TargetPath)
    Working directory $(ProjectDir)
    Target selection command source connect.gdb
    Start command Assume the target is already stopped

    Then create a file called connect.gdb in your project directory and paste the attaching commands there:

    target extended-remote COM3
    attach 1

    Then finally go to the Additional GDB Commands page and add the following post-target command:

    load
    #12202
    Arowana
    Participant

    Hi,

    I tried configuring debugging with the settings above, I can set a breakpoint at the beginning of main.

    however if I step through I get an error. Given the logs, the program seems to have been loaded properly in flash.

    “Received a SIGTRAP: Trace/breakpoint trap”

    #12206
    support
    Keymaster

    Could you confirm that running the same gdb commands manually (in a gdb instance started from command line) works? If yes, please share the full gdb log (can be enabled on the Advanced GDB Settings page of VisualGDB Project Properties) and we will investigate.

    #23313
    Phisik
    Participant

    I confirm that BlackMagic Probe (made of blue pill) works fine with VisualGDB with v5.3r8. I use the following setup:

    Debug settings page
    Debug using:  Full-custom mode
    Arguments:  -i mi $(TargetPath)
    Working directory: $(ProjectDir)
    Target selection command: leave empty

    Additional GDB command page
    Commands after selecting targer:
      set mem inaccessible-by-default off
      target extended-remote COM4
      mon swdp_scan
      attach 1
      load

    Without “set mem inaccessible-by-default off” VisualGDB is not able to read Hardware Registers, without “mon swdp_scan” BMP sometimes fails to attach.

    The only feature I was not able to activate is Live Variables. In tutorial I found that this feature is for J-link only. But is there any way to activate this for BMP?

     

    Attachments:
    You must be logged in to view attached files.
    #23318
    support
    Keymaster

    Hi,

    Thanks for sharing this.

    The Live Variables rely on the debug probe’s ability to provide an independent interface (completely parallel to GDB) for accessing the memory. Last time we checked, BMP did provide such an interface.

    If anyone could patch the BMP sources to support a separate memory access interface, we will be happy to share instructions on creating a VisualGDB debug plugin to use it similarly to OpenOCD and J-Link.

    #23401
    Phisik
    Participant

    Are you going to implement Live Variable for Arduino in the latest version? BMP has separate uart port. Is it possible to make uart data as a source for Live Variables in Arduino style?

    #23404
    support
    Keymaster

    Just a separate UART port won’t be sufficient for live variables. Some logic on the BMP side would need to handle the “read memory at address XXX” commands via this port, do the actual reading via JTAG/SWD and return the result.

    Alternatively, we can add an API similar to the custom real-time watch that will let your program report arbitrary values via a connection such as a COM port, so VisualGDB will plot them.

    #23528
    Phisik
    Participant

    I suppose “Serial Plotter” feature, similar to that in Arduino IDE, would be useful. Especially for Arduino projects that you are currently implementing in VisualGDB.

    #23533
    support
    Keymaster

    Yes, we will try to add something similar in one of the next major releases.

    #30480
    Reneg973
    Participant

    I have a BlackMagic Probe V2.1 and want to use it with VisualGDB. I just found this entry but it won’t work. I have seen that there is a fork of OpenOCD with BlackMagic support. But I don’t know how to integrate this with VisualGDB.

    #30481
    support
    Keymaster

    We would advise first getting it working with an instance of gdb manually launched via command line. Once you can confirm that it works reliably, feel free to let us know the tools and commands lines involved, and we will help you configure VisualGDB to replicate that setup.

Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.