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!


Maarten Brock wrote:

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


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...


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.
Sdcc-user mailing list