Sysprogs forums › Forums › VisualGDB › Debugger setup for Black Magic Probe?
- This topic has 12 replies, 6 voices, and was last updated 6 days, 18 hours ago by
julieninnovel.
-
AuthorPosts
-
November 10, 2016 at 22:29 #9464
schabtach
ParticipantI 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
November 11, 2016 at 04:57 #9468support
KeymasterHi,
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
August 29, 2017 at 01:11 #12202Arowana
ParticipantHi,
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”
August 29, 2017 at 04:37 #12206support
KeymasterCould 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.
January 8, 2019 at 16:10 #23313Phisik
ParticipantI 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 emptyAdditional GDB command page
Commands after selecting targer:
set mem inaccessible-by-default off
target extended-remote COM4
mon swdp_scan
attach 1
loadWithout “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.January 8, 2019 at 21:46 #23318support
KeymasterHi,
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.
January 13, 2019 at 10:01 #23401Phisik
ParticipantAre 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?
January 13, 2019 at 19:15 #23404support
KeymasterJust 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.
January 18, 2019 at 11:32 #23528Phisik
ParticipantI suppose “Serial Plotter” feature, similar to that in Arduino IDE, would be useful. Especially for Arduino projects that you are currently implementing in VisualGDB.
January 18, 2019 at 21:16 #23533support
KeymasterYes, we will try to add something similar in one of the next major releases.
May 9, 2021 at 14:49 #30480Reneg973
ParticipantI 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.
May 9, 2021 at 17:47 #30481support
KeymasterWe 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.
February 12, 2025 at 06:03 #36404julieninnovel
ParticipantHello all,
I am trying to do the same thing but using a wifi connection.
I can use my BMP using USB and virtual COM port with the configuration described above.
But to use the wifi connection, it seems that just changing the connection port to the target is not enough…
I’ve attached some screen shot of my configuration.
When I want to debug, it seems that the “load” command is not sended to GDB.
Here is the GDB Session log :
<div>VisualGDB is licensed to xxxxx at xxxxxx</div>
<div>c:\sysgcc\arm-eabi\bin\arm-none-eabi-gdb.exe –interpreter mi E:\MesDocuments\Code_source\ST\VisualGDB\App\Debug\App</div>
<div>-gdb-version</div>
<div>=thread-group-added,id=”i1″</div>
<div>GNU gdb (GDB) 15.2</div>
<div>Copyright (C) 2024 Free Software Foundation, Inc.</div>
<div>License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html></div>
<div>This is free software: you are free to change and redistribute it.</div>
<div>There is NO WARRANTY, to the extent permitted by law.</div>
<div>Type “show copying” and “show warranty” for details.</div>
<div>This GDB was configured as “–host=i686-w64-mingw32 –target=arm-none-eabi”.</div>
<div>Type “show configuration” for configuration details.</div>
<div>For bug reporting instructions, please see:</div>
<div><https://www.gnu.org/software/gdb/bugs/>.</div>
<div>Find the GDB manual and other documentation resources online at:</div>
<div> <</div>
<div>http://www.gnu.org/software/gdb/documentation/>.</div>
<div>For help, type “help”.</div>
<div>Type “apropos word” to search for commands related to “word”…</div>
<div>Reading symbols from E:\MesDocuments\Code_source\ST\VisualGDB\App\Debug\App…</div>
<div>GNU gdb (GDB) 15.2</div>
<div>Copyright (C) 2024 Free Software Foundation, Inc.</div>
<div>License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html></div>
<div>This is free software: you are free to change and redistribute it.</div>
<div>There is NO WARRANTY, to the extent permitted by law.</div>
<div>Type “show copying” and “show warranty” for details.</div>
<div>This GDB was configured as “–host=i686-w64-mingw32 –target=arm-none-eabi”.</div>
<div>Type “show configuration” for configuration details.</div>
<div>For bug reporting instructions, please see:</div>
<div><https://www.gnu.org/software/gdb/bugs/>.</div>
<div>Find the GDB manual and other documentation resources online at:</div>
<div> <</div>
<div>http://www.gnu.org/software/gdb/documentation/>.</div>
<div>For help, type “help”.</div>
<div>Type “apropos word” to search for commands related to “word”.</div>
<div>OK</div>
<div>-list-features</div>
<div>^done,features=[“frozen-varobjs”,”pending-breakpoints”,”thread-info”,”data-read-memory-bytes”,”breakpoint-notifications”,”ada-task-info”,”language-option”,”info-gdb-mi-command”,”undefined-command-error-code”,”exec-run-start-option”,”data-disassemble-a-option”,”simple-values-ref-types”]</div>
<div>-gdb-set verbose on</div>
<div>OK</div>
<div>-gdb-set filename-display absolute</div>
<div>OK</div>
<div>-gdb-set disassembly-flavor intel</div>
<div>&”warning: could not convert ‘disassembly’ from the host encoding (CP1252) to UTF-32.\nThis normally should not happen, please file a bug report.”</div>
<div>&”\n”</div>
<div>No symbol “disassembly” in current context.</div>
<div>-gdb-set print demangle off</div>
<div>OK</div>
<div>set mem inaccessible-by-default off</div>
<div>&”set mem inaccessible-by-default off\n”</div>
<div>=cmd-param-changed,param=”mem inaccessible-by-default”,value=”off”</div>
<div>OK</div>
<div>target extended-remote blackmagic.local:2345</div>
<div>&”target extended-remote blackmagic.local:2345\n”</div>
<div>Remote debugging using blackmagic.local:2345</div>
<div>=thread-group-started,id=”i1″,pid=”42000″</div>
<div>=thread-created,id=”1″,group-id=”i1″</div>
<div>&”warning: platform-specific solib_create_inferior_hook did not load initial shared libraries.\n”</div>
<div>0x080229ba in teleinfo_save_etiquettes () at E:\MesDocuments\Code_source\ST\App\TeleInfo\TeleInfo.c:1109</div>
<div>1109 if (RechercheValTabNumEtq(oRecupTI_CONSO[i].ucNumEtq) != NON_TROUVE)</div>
<div>*stopped,frame={addr=”0x080229ba”,func=”teleinfo_save_etiquettes”,args=[],file=”E:\\MesDocuments\\Code_source\\ST\\BApp\\TeleInfo\\TeleInfo.c”,fullname=”E:\\MesDocuments\\Code_source\\ST\\App\\TeleInfo\\TeleInfo.c”,line=”1109″,arch=”armv6s-m”},thread-id=”1″,stopped-threads=”all”</div>
<div>OK</div>
<div>info shared</div>
<div>&”info shared\n”</div>
<div>No shared libraries loaded at this time.</div>
<div>OK</div>
<div>mon swdp_scan</div>
<div>&”mon swdp_scan\n”</div>
<div>You are now detached from the previous target.</div>
<div>Available Targets:</div>
<div>No. Att Driver</div>
<div> 1 STM32F09/F030xc M0</div>
<div>OK</div>
<div>attach 1</div>
<div>&”attach 1\n”</div>
<div>A program is being debugged already. Kill it? (y or n) [answered Y; input not from terminal]</div>
<div>=thread-exited,id=”1″,group-id=”i1″</div>
<div>=thread-group-exited,id=”i1″</div>
<div>Attaching to program: E:\MesDocuments\Code_source\ST\VisualGDB\App\Debug\App, Remote target</div>
<div>=thread-group-started,id=”i1″,pid=”1″</div>
<div>=thread-created,id=”1″,group-id=”i1″</div>
<div>*running,thread-id=”1″</div>
<div>OK</div>
<div>&”warning: platform-specific solib_create_inferior_hook did not load initial shared libraries.\n”</div>
<div>0x08022952 in teleinfo_save_etiquettes () at E:\MesDocuments\Code_source\ST\App\TeleInfo\TeleInfo.c:1094</div>
<div>1094 s_TIC_Data.u32_ValideData = VALIDITY_KEY;</div>
<div>*stopped,frame={addr=”0x08022952″,func=”teleinfo_save_etiquettes”,args=[],file=”E:\\MesDocuments\\Code_source\\ST\\App\\TeleInfo\\TeleInfo.c”,fullname=”E:\\MesDocuments\\Code_source\\ST\\App\\TeleInfo\\TeleInfo.c”,line=”1094″,arch=”armv6s-m”},thread-id=”1″,stopped-threads=”all”</div>
<div>info target</div>
<div>&”info target\n”</div>
<div>Symbols from “E:\MesDocuments\Code_source\ST\VisualGDB\App\Debug\App”.</div>
<div>Extended remote target using gdb-specific protocol:</div>
<div>`E:\MesDocuments\Code_source\ST\VisualGDB\App\Debug\App’, file type elf32-littlearm.</div>
<div>Entry point: 0x802dacc</div>
<div>0x08000000 – 0x080000bc @ 0x00001000 is .isr_vector</div>
<div>0x080000bc – 0x08037490 @ 0x000010bc is .text</div>
<div>0x08037490 – 0x0803c550 @ 0x00038490 is .rodata</div>
<div>0x0803c550 – 0x0803c558 @ 0x0003d550 is .ARM</div>
<div>0x0803c558 – 0x0803c558 @ 0x0003e7a8 is .preinit_array</div>
<div>0x0803c558 – 0x0803c55c @ 0x0003d558 is .init_array</div>
<div>0x0803c55c – 0x0803c560 @ 0x0003d55c is .fini_array</div>
<div>0x200000c0 – 0x200007a8 @ 0x0003e0c0 is .data</div>
<div>0x20007fe0 – 0x20007ff8 @ 0x0003efe0 is .btl_ram</div>
<div>0x200007a8 – 0x2000676c @ 0x0003e7a8 is .bss</div>
<div>0x2000676c – 0x20006d70 @ 0x0003e7a8 is ._user_heap_stack</div>
<div>While running this, GDB does not access memory from…</div>
<div>Local exec file:</div>
<div>`E:\MesDocuments\Code_source\ST\VisualGDB\App\Debug\App’, file type elf32-littlearm.</div>
<div>Entry point: 0x802dacc</div>
<div>0x08000000 – 0x080000bc @ 0x00001000 is .isr_vector</div>
<div>0x080000bc – 0x08037490 @ 0x000010bc is .text</div>
<div>0x08037490 – 0x0803c550 @ 0x00038490 is .rodata</div>
<div>0x0803c550 – 0x0803c558 @ 0x0003d550 is .ARM</div>
<div>0x0803c558 – 0x0803c558 @ 0x0003e7a8 is .preinit_array</div>
<div>0x0803c558 – 0x0803c55c @ 0x0003d558 is .init_array</div>
<div>0x0803c55c – 0x0803c560 @ 0x0003d55c is .fini_array</div>
<div>0x200000c0 – 0x200007a8 @ 0x0003e0c0 is .data</div>
<div>0x20007fe0 – 0x20007ff8 @ 0x0003efe0 is .btl_ram</div>
<div>0x200007a8 – 0x2000676c @ 0x0003e7a8 is .bss</div>
<div>0x2000676c – 0x20006d70 @ 0x0003e7a8 is ._user_heap_stack</div>
<div>OK</div>
<div>-data-evaluate-expression “&_estack”</div>
<div>^done,value=”0x20007fd0″</div>
<div>-data-evaluate-expression “sizeof(void *)”</div>
<div>^done,value=”4″</div>
<div>-data-evaluate-expression “sizeof(int)”</div>
<div>^done,value=”4″</div>
<div>-data-evaluate-expression “sizeof(short)”</div>
<div>^done,value=”2″</div>
<div>-data-evaluate-expression “sizeof(long)”</div>
<div>^done,value=”4″</div>
<div>-data-evaluate-expression “sizeof(long long)”</div>
<div>^done,value=”8″</div>
<div>-data-evaluate-expression “sizeof(char)”</div>
<div>^done,value=”1″</div>
<div>-data-evaluate-expression “sizeof(wchar_t)”</div>
<div>No symbol “wchar_t” in current context.</div>
<div>-data-evaluate-expression “sizeof(float)”</div>
<div>^done,value=”4″</div>
<div>-data-evaluate-expression “sizeof(double)”</div>
<div>^done,value=”8″</div>
<div>-data-evaluate-expression “sizeof(long double)”</div>
<div>^done,value=”8″</div>
<div>-var-create – * “*((void **)0x20007fcc)”</div>
<div>^done,name=”var1″,numchild=”0″,value=”0x802db03 <Reset_Handler+54>”,type=”void *”,has_more=”0″</div>
<div>-var-assign “var1” 0x36305ee2</div>
<div>^done,value=”0x36305ee2″</div>
<div>-data-evaluate-expression “\*\(\(void\ \*\*\)0x20007fcc\)”</div>
<div>^done,value=”0x36305ee2″</div>
<div>-break-insert -f main</div>
<div>Note: automatically using hardware breakpoints for read-only addresses.</div>
<div>^done,bkpt={number=”1″,type=”breakpoint”,disp=”keep”,enabled=”y”,addr=”0x08000cb6″,func=”main”,file=”E:\\MesDocuments\\Code_source\\ST\\App\\Core\\Src\\main.c”,fullname=”E:\\MesDocuments\\Code_source\\ST\\App\\Core\\Src\\main.c”,line=”166″,thread-groups=[“i1″],times=”0″,original-location=”main”}</div>
<div>-exec-run</div>
<div>=thread-exited,id=”1″,group-id=”i1″</div>
<div>=thread-group-exited,id=”i1″</div>
<div>=thread-group-started,id=”i1″,pid=”42000″</div>
<div>=thread-created,id=”1″,group-id=”i1″</div>
<div>&”warning: platform-specific solib_create_inferior_hook did not load initial shared libraries.\n”</div>
<div>^running</div>
<div>*running,thread-id=”all”</div>
<div>=breakpoint-modified,bkpt={number=”1″,type=”breakpoint”,disp=”keep”,enabled=”y”,addr=”0x08000cb6″,func=”main”,file=”E:\\MesDocuments\\Code_source\\ST\\App\\Core\\Src\\main.c”,fullname=”E:\\MesDocuments\\Code_source\\ST\\App\\Core\\Src\\main.c”,line=”166″,thread-groups=[“i1″],times=”1″,original-location=”main”}</div>
<div></div>
<div>Breakpoint 1, main () at E:\MesDocuments\Code_source\ST\App\Core\Src\main.c:166</div>
<div>166 int8_t i8_ret_code = 0;</div>
<div>*stopped,reason=”breakpoint-hit”,disp=”keep”,bkptno=”1″,frame={addr=”0x08000cb6″,func=”main”,args=[],file=”E:\\MesDocuments\\Code_source\\MonaBee\\B2B\\ST\\B2B_App\\Core\\Src\\main.c”,fullname=”E:\\MesDocuments\\Code_source\\ST\\App\\Core\\Src\\main.c”,line=”166″,arch=”armv6s-m”},thread-id=”1″,stopped-threads=”all”</div>
<div>-break-delete 1</div>
<div>OK</div>
<div>-exec-continue</div>
<div>^running</div>
<div>*running,thread-id=”all”</div>
<div></div>
<div></div>
<div></div>
<div></div>
<div>And if I do it manually with a command tool, all is OK.
Here is what I’m doing manually :
c:\sysgcc\arm-eabi\bin\arm-none-eabi-gdb.exe –interpreter mi E:\MesDocuments\Code_source\ST\VisualGDB\App\Debug\App
target extended-remote blackmagic.local:2345
mon swdp_scan
attach 1
load
run
</div>
Thanks for your help
Attachments:
You must be logged in to view attached files. -
AuthorPosts
- You must be logged in to reply to this topic.