Does the debugger work?

(Ty) #1

I’m trying to get the debugger to work in Freedom Studio and I thought I’d double check that someone else has done it.

I can build the hello world and upload it. I can even modify it and print out a loop of numbers ok. When I set a breakpoint and try to debug it I get this:

Comparing flash […] Done.
Verifying flash […] Done.
Writing register (PC = 0x20010000)
Reading 64 bytes @ address 0x20010180
Read 4 bytes @ address 0x20010188 (Data = 0x2001E7B7)
Read 2 bytes @ address 0x200101A6 (Data = 0x2783)
Received monitor command: clrbp
Received monitor command: reset
ERROR: Timeout while waiting for core to halt after reset and halt request
Resetting target
Received monitor command: halt
Halting target CPU…
…Target halted (PC = 0x200002DC)
Read 4 bytes @ address 0x20010188 (Data = 0x2001E7B7)
Received monitor command: regs
X0 = 00000000, X1 = 2000010E, X2 = 80003FE0, X3 = 80000D80
X4 = 00000000, X5 = 00000000, X6 = 00000000, X7 = 800005D0
X8 = 00000000, X9 = 02000080, X10= 00000111, X11= 00000000
X12= 00000B6B, X13= 00000000, X14= 00004111, X15= 00000000
X16= BED0BED0, X17= 0200C000, X18= 02000080, X19= 00000000
X20= 00000000, X21= 00000000, X22= 00000000, X23= 00000000
X24= 00000000, X25= 00000000, X26= 00000000, X27= 00000000
X28= 80000170, X29= 00000000, X30= 00000000, X31= 00000000
PC = 200002DC
Reading register (PC = 0x200002DC)
Setting breakpoint @ address 0x20010188, Size = 4, BPHandle = 0x0000
WARNING: No more breakpoint resources left
ERROR: Failed to set breakpoint at 0x20010188
Setting breakpoint @ address 0x200101A6, Size = 2, BPHandle = 0x0000
WARNING: No more breakpoint resources left
ERROR: Failed to set breakpoint at 0x200101A6
WARNING: Failed to read memory @ address 0x00000000

It seems to be telling me there are no hardware breakpoints but I only set 1 of them. Any suggestions on how to troubleshoot this; or try it from the command line, would be greatly appreciated.



have you got the debugger up and running in Freedom Studio?
I am struggling myself to get breakpoints working…

After I press the debugging button, the code is beeing uploaded, and the debugger seems to halt at entering main() (seen in breakpoint view).
But there is no button to step into the programm.
I even have to hit the onboard reset button to get my code running…
Setting my own breakpoint seems to have no effect at all.

Any suggestions? The lack of documentation is frustrating…

kind regards

(Ty) #3

I’m afraid I have not been able to get this working and I don’t know enough about command line debugging to try anything else. I think that this kit might be a pit of frustration for beginners like me so I have decided to leave it gather dust for a little while, then come back to it when I’ve recovered my patience. :cry:

It could also be that this stuff doesn’t really work… Perhaps SiFive could invest a few hours in a YouTube video walking through setup on a newly installed system and getting to debugging a program.



Basic debugging seems to be working now for me.
If you want to try again, you could try to set the number of HW break points explicitly.
There are a few ways described in this manual:

For initial testing, I set “set remote hardware-breakpoint-limit 2” in the debug configuration.
This works for me.
4 breakpoints should be possible, at least this is what the device tree file indicates, but it does not work for me. (same error you got)
I also had to shut off all the options under “Startup -> Run/Restart Commands” (just untick all boxes)

Soooo, I only get two break points, better than no breakpoints at all I guess ¯_(ツ)_/¯

(David Connelly) #5

It is recommended to use the latest version of JLink Software, available here:

From within Freedom Studio:

  1. Select Run -> Debug Configurations
  2. Select the JLink debug connection
  3. Click the Debugger tab
  4. Change the Executable path for JLinkGDBServerCL.exe to point to the Segger Software which is required to be v6.46a or later. On Windows the default path to this executable is: C:\Program Files (x86)\SEGGER\JLink

Some updates were made in this version and beyond to make the initial debug connection more reliable.

(Bruce Hoult) #6

Strange that four breakpoints does not work because the SoC manual says the CPU actually has 8 hardware breakpoints.

(David Connelly) #7

Also under the Debugger tab there is a field “Device name” and this needs to be “FE310”. Another option is “E31ARTY” which would apply to the Digilent Arty A7 100T board.