Ok, I looked in the datasheet myself and found that the status byte is not an SFR. And the Stack overflow bit is not set when the actual overflow occurs, but one byte earlier. Or when you have some variable placed at 0xFF. Makes me wonder why do mcu manufacturers always take those ridiculous shortcuts.
Another thing you can do is after some time check if the top of ram is still filled with 0x00 as it is cleared at startup. Maarten > In the case of a stack overflow, the system is unrecoverable. My only > hope is to notify the developer so they can debug the correct problem. > In this case jumping the stack pointer (SP) to an earlier point, perhaps > the initial value, and calling subroutines such as puts or printf would > be acceptable. > > Is there any other status bit set on on a stack push operation that > could be checked by the compiler? Would the normal overflow bit be set > for this operation? > > Anyway this is not high priority for me, I am just being hopeful. > Thanks for responding! > > a* > > > Maarten Brock wrote: > > Anthony, > > > > I don't really see how SDCC could help here. Is this debug status register > > an SFR? If so you could read it anywhere in your code. But the question is > > of course if you still get to that code when it is set. An interrupt might > > help here. When detected you can light an LED or something or perform a > > reset. > > > > Maarten > > > > > >> Is there anyway with SDCC on cc2430/MCS51 to detect a stack overflow? > >> > >> CC2430 has a stack overflow bit in the debug status register but I don't > >> see anyway to use that. I've seen other cpus have a stack overflow > >> interrupt, it would help if there was something similar for mcs51... > >> > >> a* > >> > > > > > > ------------------------------------------------------------------------------ > > Download Intel® Parallel Studio Eval > > Try the new software tools for yourself. Speed compiling, find bugs > > proactively, and fine-tune applications for parallel performance. > > See why Intel Parallel Studio got high marks during beta. > > http://p.sf.net/sfu/intel-sw-dev > > _______________________________________________ > > Sdcc-user mailing list > > Sdcc-user@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/sdcc-user > > > > ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user