This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Stack Pointer Limitation

Hello,
The stack pointer for the chip I'm using is 8bits (address 256 bytes max). Is there any way to get around this limitation so I can have larger stack space? (without changing chips)
Regards,
KC

Parents
  • Hello,

    If I use a simulated stack area by setting "XBPSTACK EQU 1" in XDATA memory.
    Should I write a function to save and load the whole "stack area" (DATA memory) each time I switch between tasks or functions?
    ( or is it possible to use both stack space at the same time? )

    I noticed that if you just use DATA memory area Keil will move the "starting SP position" up by placing variables below it (so no overlap).
    But for XBPSTACKTOP, we are setting the starting value (and it grows down), so wouldnt this cause an overlap later.

    Regards,
    KC

Reply
  • Hello,

    If I use a simulated stack area by setting "XBPSTACK EQU 1" in XDATA memory.
    Should I write a function to save and load the whole "stack area" (DATA memory) each time I switch between tasks or functions?
    ( or is it possible to use both stack space at the same time? )

    I noticed that if you just use DATA memory area Keil will move the "starting SP position" up by placing variables below it (so no overlap).
    But for XBPSTACKTOP, we are setting the starting value (and it grows down), so wouldnt this cause an overlap later.

    Regards,
    KC

Children
  • But for XBPSTACKTOP, we are setting the starting value (and it grows down), so wouldnt this cause an overlap later.

    Only if you use up all of the stack space.

    If you have 64K of XDATA, set the top of the XBPSTACK at 0xFFFF. That gives you 64K-(xdata variables) of stack space. Won't this be enough?

    Jon