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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/28/03 08:57
Read: times


 
#53563 - RE: HELP ME! Stack space overflow !
Responding to: ???'s previous message
Hi,
first of all - do not panic! (=
suggestion:
- use registers and on-chip XRAM for passing parameters between functions.
- do not call-call-call functions in deeeeep nesting. Instead it, create task dispatcher in main loop and a variable-descriptor which will indicate where your logical sequence is.
- if you still need with many nested levels - do not use CALLs. Use JUMP and a variable where place return address in. In this case use JUMP (varibale) instead RET for return from subroutines.
Now, do you use C or ASM?
In C: it depends on compilers, for example, Keil has options to use reentrant stack pointer (for LARGE model it may be even 64kB). Read manual.
In ASM: yes, it is possible to flush stack into XRAM, reinitialize SP with new value, execute some functions and move stack back from XRAM. But be careful - it requires alot of attention - disable interrupts due moving, do not return to functions of previous levels before restore old stack etc.
Good days!

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