On Mon, 29 Dec 2014 15:20:05 +0000 jon <j...@jonshouse.co.uk> wrote: > On Mon, 2014-12-29 at 08:24 -0500, Joshua Lansford wrote: > > Hello, > > I understand that it is important to not overstuff a micro processor > > design to prevent the stack from encroaching on other variables and > > causing intermittent corruption that might be hard to detect and > > difficult to diagnose. > Just as point of interest: > > On most CPU where the stack works down until it hits the top of the > variables it is pretty easy to detect. Just stick a known value at the > end of the variables and test its value in the main loop to see if it > overwritten. I have done this many times over the years, also moving the > value around lets you detect corruption caused by out of bounds array > references and similar.
PIC18 can be a bit easier. If he means the internal stack then it's got over/underflow bits (see the chip docs). For the external RAM you can put guard variables, you can also run it on a good simulator and set watchpoints, or on a crap simulator and set the stack to a magic pattern (eg 0xA5A5) and look to see how much of the pattern is left. Alan ------------------------------------------------------------------------------ Dive into the World of Parallel Programming! The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net _______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user