Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/13/07 05:00
Read: times


 
#143140 - rock bottom
Responding to: ???'s previous message
It would just perhaps be an indicator that something went wrong, but you'd only know that the cookie got eaten and not who ate it; and also it might be too late to check...

I learned from a colleague of mine to put a stack checking routine into the interrupt of the highest priority (which happened to hold some 20-30% of the whole programs functionality - I know you'd say phooey but you also certainly know I am not afraid to do unusual things if I have a good reason); and make a stack dump if overflow occurs (provided that there is good place to store the dump into or to transmit it or to display it), but I would not say it's perfect either (it caught a case or two but never out in the wild only on my desk, so I would catch them most probably without this, too - but this is perhaps given by the nature of the tasks I am usually solving and the method might be more useful generally).

Certainly the best thing is to have a rock bottom (which in '51 happens to be at the top... :-) ) of the stack - so if some routine chews it all up, it chokes on the next bite... Yes, I mean real hardware. It does not require any sophisticated and complicated memory management unit, as the stack is guaranteed to be accessed linearly (until some idiot starts to play with SP, of course), so a single-address access breakpoint throwing an interrupt (or, if you want an another fancy term, exception) will suffice. Such hardware is I suspect present in those '51s which have hardware support for debugging (SiLabs, Ramtron/exGoal Versa, ADuC???), but I am afraid that the manufacturers jealously
withhold these information from the public...

JW


List of 32 messages in thread
TopicAuthorDate
for(;;) anomally            01/01/70 00:00      
   How to post code:            01/01/70 00:00      
   re: for(;;) anomaly            01/01/70 00:00      
      malloc() on 8051?!?            01/01/70 00:00      
         Yes.            01/01/70 00:00      
            Off topic: Mixed 51 and PC mind :)            01/01/70 00:00      
         You are right            01/01/70 00:00      
   Probably this miight be happening            01/01/70 00:00      
      This sounds as a reason but...            01/01/70 00:00      
         asm            01/01/70 00:00      
            I think the same            01/01/70 00:00      
               the asm will maybe help            01/01/70 00:00      
                  Assembler codes            01/01/70 00:00      
                     Michal, you are cheating! :-)            01/01/70 00:00      
                        This was the reason :)            01/01/70 00:00      
                     ... but it's easy to do it in C :-)            01/01/70 00:00      
                        I dont trust to any any any compiler :)            01/01/70 00:00      
            Stack overflow?            01/01/70 00:00      
               I think this will be complicated            01/01/70 00:00      
                  1 of 2 ways            01/01/70 00:00      
                     Thx            01/01/70 00:00      
         The Compiler does not protect you            01/01/70 00:00      
            Like SDCC...            01/01/70 00:00      
               Better?            01/01/70 00:00      
                  option --main-return            01/01/70 00:00      
                     SDCC function startup code            01/01/70 00:00      
                        use a cookie near the end of the stack?            01/01/70 00:00      
                           rock bottom            01/01/70 00:00      
                           Why only 0xF8?            01/01/70 00:00      
                              paranoia!)            01/01/70 00:00      
               also Keil?            01/01/70 00:00      
            I have while(1) loop in main()            01/01/70 00:00      

Back to Subject List