NOTE: These instructions apply to the Cerf board only!

Wannadebugsome ? here you go.

As mentioned previously, if you "boot c0000000 1 x" it will try and drop in the debugger.
To avoid this, do a "boot c0000000 0 x"
If you get any exception, it will drop in the debugger [will finesse later]

The ARM tools builds should be unaffected, this only applies to GCC builds.

Example use (release build):

1- boot the board with tftp && boot as usual. last command should be
	boot c0000000 1 2

2- start GDB in a window:
	gdb -baud 38400 <path-to-your-image-with-slashes-backward>
	(gdb) target remote com1	-- or com2, depends on your serial line setup
	0xc0000080 in _start ()
	(gdb)
  Optionally, if things dont work you might do a "set remotedebug 1" before the target command.
  This will print some garbage that I can decipher for you...;-))

3- typing ^C while a thread is waiting for console input drops in the debugger.

4- Loading symbols for an image:
	Image init.exe is x2f9c bytes at xc00135a8 [c00135a8], entry = c0015860
	....
	(gdb) add-symbol-file f:/mmlitesdk/build/arm/bin/release/init.rel 0xc00135a8
	add symbol.... (y or n) ? y
	Reading symbols from f:/mmlitesdk/build/arm/bin/release/init.rel...(no debugging symbols found)...done.
	(gdb) i s
	#0  0xc0007ae0 in getc ()
	#1  0xc0001890 in DCGetchar ()
	#2  0xc00019b4 in DCReadAt ()
	#3  0xc0014ca8 in read ()
	#4  0xc0014550 in fread ()
	#5  0xc00136ec in ReadCommandLine ()
	#6  0xc0013734 in CommandShell ()
	#7  0xc001365c in __my_iob ()
	(gdb)

BUGBUGs:

1- Synchronization between debugger and debuggee is a bit shakey.
So if you start the debugger first it expects an ack ('+') character..
which the debuggee wont send.

2- It only drops in the debugger when someone calls getc().
This should be fixed once we use the serial line driver, which will
work interrupt-based.

3- For now we keep both the foo.rel and foo.exe images.  Only the first one
has proper symbols. PMDLL should be fixed to keep symbols [itsabug]
You load the .exe and feed the .rel to GDB's add-symbol-file commands.
Yes this is confusing.