avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] help debugging resets


From: Andy Warner
Subject: Re: [avr-gcc-list] help debugging resets
Date: Tue, 26 Oct 2004 21:33:07 -0500
User-agent: Mutt/1.2.5i

Erik Christiansen wrote:
> > Is there a way that I can have the reset handler print out the
> > module/line number that the MCU was on when it resets?  I am having an
> [...]

I'll second everything Erik says about MCUSR. Don't forget
that the bits are cumulative, they only get reset by power
cycling the hardware or writing zero to MCUSR.

Another technique I have used in the past, but not used
so far on AVR projects is writing a small function to
dump *all* of SRAM out via the serial port immediately
after coming out of reset. It doesn't matter how long it
takes, just slurp it all into a text file and wait for
the errant reset to make it happen again. At this point
you can examine the stack for overflow, look at task
descriptors etc etc. To be useful this has to be done
before bss is cleared, with avr-gcc that should just
mean calling the function __init(). Note that you
will need to write your own dumper function(s) that
don't use stack or bss, since they will not have been
initialised yet, don't even think of calling printf().
-- 
address@hidden

Andy Warner             Voice: (612) 801-8549   Fax: (208) 575-5634


reply via email to

[Prev in Thread] Current Thread [Next in Thread]