UPGRADE YOUR BROWSER
We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!
10-25-2019 07:08 AM - edited 10-25-2019 07:09 AM
I have a XCKU040 design with two MicroBlazes connected to one MDM core. In GDB, "target remote :3002" successfully connects to MicroBlaze #0. How can I connect to MicroBlaze #1 in GDB? In xsdb, "target 3" and "target 4" can select either MB, and subsequent stop/con/rrd commands go to the selected processor. But doing the "target" command in a xsdb terminal has no effect on which processor GDB connects to in the other terminal. Has anyone used GDB to debug multiple MicroBlaze processors on the same FPGA?
10-31-2019 01:25 PM
Eureka! The key is to connect to hw_server with "target extended-remote". In full:
bash$ winpty mb-gdb -q CoreManager.elf (gdb) target extended-remote :3002 Remote debugging using :3002 0x00013674 in RingBuffer_getByte (<redacted>) at ..../RingBuffer.c:78 78 if ((NULL == rb) || (NULL == outByte)) (gdb) add-inferior -exec ..../KeyManager.elf Added inferior 2 Reading symbols from ..../KeyManager.elf...done (gdb) inferior 2 [Switching to inferior 2 [<null>] (C:\msys64\home\....\KeyManager.elf)] (gdb) attach 2 Attaching to program: C:\msys64\home\....KeyManager.elf, process 2 0x00000a70 in memset ()
The "attach" command failed in plain old "remote" mode but it worked in extended-remote mode. Thank you very much!
10-25-2019 09:14 AM
do you have the one MDM, with multiple debug ports connected to each MB? If so, then this will be ok.
why are you using gdb? can you try the tcf debugger? here you can just select the target X.
So, in XSCT do a targets to see the chain. then targets X, where X is the ID of the MB you want to connect to
10-25-2019 09:39 AM
Yes, there is one MDM with two debugs ports, one port connected to each MicroBlaze. PG115, "MicroBlaze Debug Module Product Guide," says there is a "Which MicroBlaze" debug register in the MDM core. I have tried setting that in xsdb (mdm_drwr 13 0x2 8) in an attempt to select MB #1. But even after doing that in xsdb, GDB still connects to MB #0. I also tried values 0x0, 0x1, 0x4, 0x8, 0x10, 0x20, 0x40, and 0x80 in that register, but none of them changed GDB's behavior.
Is the TCF debugger the same as xsdb/xsct? In my post I said: "In xsdb, target 3 and target 4 can select either MB, and subsequent stop/con/rrd commands go to the selected processor." So, yes, I have tried xsdb; with it I am able to control either MicroBlaze. But I want to use GDB because GDB's interface and functionality is superior to XSDB. It is much easier to script GDB than to script XSDB. hw_server provides a GDB interface, so it seems Xilinx believes there is value in having both debugger interfaces available to users.
I gather that "TCF" and "System Debugger" and "XSCT" (which contains XSDB) are different terms for the same thing in the Xilinx toolkit. If "TCF debugger" means something else, I'll be happy to read some more documentation.
10-25-2019 09:41 AM
P.s. I clicked the "thumbs up" to give you kudos (thank you for replying to my post!) but clicking had no effect. If my corporate firewall is preventing that button from working, then I'm sorry that's the case. But please know that I intended to give kudos here. :)
10-28-2019 06:47 AM
Did you see my response to your question about TCF? Do you have any suggestions for using GDB with multiple MicroBlaze?
10-31-2019 04:46 AM
Hi @kennard,
This is supported thru 'inferior' command. You can use the sequence below
(gdb) monitor ps
# This will list the MB cores
(gdb) add-inferior
(gdb) inferior 2
(gdb) attach 2
# this will connect to core #2 listed under monitor ps
# all the regular debug commands will now go to #2
# repeat this to connect to more cores listed under monitor ps
# to switch between attached cores, run 'inferior ID'
10-31-2019 08:15 AM
Hello @sadanan ,
Thank you! That got me further, but not all the way.
FYI, I am using Vivado SDK 2018.3.
I had hoped there would be a "monitor" command for this, so thanks for pointing out "monitor ps". I know monitor commands are extensions provided by the target; are all the "monitor" commands provided by hw_server documented anywhere?
"monitor ps" listed both MicroBlazes, so that's good! "add-inferior" and "inferior 2" worked, but "attach" failed:
(gdb) add-inferior Added inferior 2 (gdb) inferior 2 [Switching to inferior 2 [<null>] (<noexec>)] (gdb) attach 2 Don't know how to attach. Try "help target".
For good measure, I tried printing a MicroBlaze register while inferior 2 was selected, but it failed:
(gdb) info inferiors Num Description Executable 1 process 1 C:\msys64\home\......\CoreManager.elf * 2 <null> (gdb) p $pc No registers.
If I select "inferior 1" then "p $pc" prints the program counter on MicroBlaze #0.
10-31-2019 01:25 PM
Eureka! The key is to connect to hw_server with "target extended-remote". In full:
bash$ winpty mb-gdb -q CoreManager.elf (gdb) target extended-remote :3002 Remote debugging using :3002 0x00013674 in RingBuffer_getByte (<redacted>) at ..../RingBuffer.c:78 78 if ((NULL == rb) || (NULL == outByte)) (gdb) add-inferior -exec ..../KeyManager.elf Added inferior 2 Reading symbols from ..../KeyManager.elf...done (gdb) inferior 2 [Switching to inferior 2 [<null>] (C:\msys64\home\....\KeyManager.elf)] (gdb) attach 2 Attaching to program: C:\msys64\home\....KeyManager.elf, process 2 0x00000a70 in memset ()
The "attach" command failed in plain old "remote" mode but it worked in extended-remote mode. Thank you very much!
10-31-2019 08:15 PM
Yes, you need to use 'tar ext' to connect. I was assuming that everyone would use this:) Sorry for my ignorance