Use avarice to talk to the JTAG ICE debugger device, and open up a local socket:
Next, use avr-gdb to debug. In the debugger, use the following command to connect to the socket opened by avarice:
Once the connection is established, use continue to start runnig the program. Do not use run! Also, set up break points before using continue to stop the program at a specific place.
Use LEDs to indicate the program reaches a certain point. Move the code that turns on an LED around to find out where is unreachable (but should be).
When the RTK sleeps (to save power), it uses the RTK’s own stack. The size of this stack is determined by the macro RTK_STACK_SIZE. If you have interrupt service routines (ISRs) that require a deep stack, be sure to specify RTK_STACK_SIZE in the compiler’s command line. The default value is 64, which is not sufficient for more complex ISRs that call many levels of subroutines.