Page 2 of 2

Re: Breakpoints in UserMain

Posted: Tue Sep 13, 2011 12:49 pm
by sblair
I'm on Day 2 here so still got a lot to learn ;)

I'm using InitializeNetworkGDB_and_Wait();

Is that what is recommended?

Re: Breakpoints in UserMain

Posted: Tue Sep 13, 2011 1:13 pm
by rnixon
Yes, most of the time. The "no wait" version will just let your code run freely until you stop it.

Re: Breakpoints in UserMain

Posted: Tue Sep 13, 2011 1:20 pm
by tod
You might also find it beneficial during development to put in long delays after the call to AutoUpdate. That way if you decide to run code you haven't unit tested (subtle hint) and it crashes the system you have a better chance of being able to do an update over Ethernet instead of having to drop back to MTTY and the serial loader.

Re: Breakpoints in UserMain

Posted: Tue Sep 13, 2011 1:26 pm
by rnixon
Great idea. I've also used a getchar() so it blocks until I hit a key, that way I can update if I need to if my code is crashing right away.

Re: Breakpoints in UserMain

Posted: Thu Sep 15, 2011 1:22 pm
by pbreed
>I've also used a getchar() so it blocks until I hit a key, that way I can update if I need to if my code is crashing right away.

I use that all the time. Whenever I'm developing something crashy this is the first thing that goes in the code.

Re: Breakpoints in UserMain

Posted: Fri Sep 16, 2011 1:39 pm
by sblair
NOW I have that case where I need it to break at the top of UserMain()! I'm implementing Auto-IP and want to set some breakpoints to debug, but obviously can't as my code is at the very top of UserMain at the GetDHCPAddress() call.

Oh well, I can get around it...just being able to break at the top when it loads would be nice tho!

Scott

Re: Breakpoints in UserMain

Posted: Fri Sep 16, 2011 3:48 pm
by pbreed
You can work around that.
The network debugger has the ability to set it to a different static IP address than the configed address.

See the definitions in

#include <networkDebug.h>

You want to define/use two macros.. above user main.

DebugIP(AsciiToIp("10.1.1.123")); //Change to the desired IP
DebugNormalArp();

This will give the debuger a fixed, but differnt IP address.
It will also have the normal ARP code process ARP requests rahter than having them shortcircuited in the debuger.