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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/27/03 19:31
Read: times


 
#53542 - RE: HELP ME! Stack space overflow !
Responding to: ???'s previous message
"i have over 80 function nested."

Do the maths: over 80 functions, each called from the other, each call will at least put 2 more bytes on the stack... (presuming you are using assembler) at least 160 bytes needed for the stack alone!
If you are using C, I am really surprised that this didn't happen earlier already.
Then there is this limitation that you can only have the stack in data memory, which is 256 bytes max, which you must have learned from reading the datasheet before you started your big project. You will probably not want to sacrifice all data memory to the stack, because other than external RAM, data memory allows you some speedy access (and bit manipulation in areas, and registers r0...)
Bottom line: calling (nesting) and pushing is something you only want to do, at least on an 8051, if it is absolutely necessary. As a rule of thumb, get worried if you must reserve more than 16...32 bytes for the stack, including interrupt levels.

Is it the finish of the 8051 (you mean stop using the 8051 and switch to another chip)? it depends. If you can't think of a way to do it without nesting so awfully deep: yes, if you can: no.

List of 16 messages in thread
TopicAuthorDate
HELP ME! Stack space overflow !            01/01/70 00:00      
   RE: HELP ME! Stack space overflow !            01/01/70 00:00      
      RE: HELP ME! Stack space overflow !            01/01/70 00:00      
   RE: HELP ME! Stack space overflow !            01/01/70 00:00      
   RE: HELP ME! Stack space overflow !            01/01/70 00:00      
      RE: HELP ME! Stack space overflow !            01/01/70 00:00      
         RE: HELP ME! Stack space overflow !            01/01/70 00:00      
            RE: HELP ME! Stack space overflow !            01/01/70 00:00      
            RE: HELP ME! Stack space overflow !            01/01/70 00:00      
               RE: HELP ME! Stack space overflow !            01/01/70 00:00      
         RE: HELP ME! Stack space overflow !            01/01/70 00:00      
   RE: HELP ME! Stack space overflow !            01/01/70 00:00      
      RE: HELP ME! Stack space overflow !            01/01/70 00:00      
   How about a State Machine instead?            01/01/70 00:00      
      RE: How about a State Machine instead?            01/01/70 00:00      
         RE: How about a State Machine instead?            01/01/70 00:00      

Back to Subject List