ST10R272L - SYSTEM PROGRAMMING
308/320
18.3.3 Linear stack
The ST10R272L offers a linear stack option (STKSZ = ‘111b’), where the system stack may
use the complete internal RAM area. This provides a large system stack, without requiring
extra procedures to handle data transfers for a circular stack. However, this method also
leaves less RAM space for variables or code. The RAM area that is available for the system
stack is defined by the STKUN and STKOV pointers. The underflow and overflow traps, in
this case, serve as fatal error detection only.
For the linear stack option all modifiable bits of register SP are used to access the physical
stack. Although the stack pointer may cover addresses from 00’F000h up to 00’FFFEh the
(physical) system stack must be located within the internal RAM, and therefore, may only
use the address range 00’F600h to 00’FDFEh. It is the user’s responsibility to restrict the
system stack to the internal RAM range.
Note
Avoid stack accesses within address range 00’F000h to 00’F5FEh (ESFR space
and reserved area) and within address range 00’FE00h and 00’FFFEh (SFR
space). Otherwise unpredictable results will occur.
18.3.4 User stacks
User stacks can be used to create task specific data stacks and to off-load data from the
system stack. The user may push both bytes and words onto a user stack, but is responsible
for using the appropriate instructions when popping data from the specific user stack. No
hardware detection of overflow or underflow of a user stack is provided. The following
addressing modes allow implementation of user stacks:
•
[– Rw], Rb or [– Rw], Rw: Pre-decrement Indirect Addressing.
Used to push one byte or word onto a user stack. This mode is only available for MOV
instructions and can specify any GPR as the user stack pointer.
•
Rb, [Rw+] or Rw, [Rw+]: Post-increment Index Register Indirect Addressing.
Used to pop one byte or word from a user stack. This mode is available to most
instructions, but only GPRs R0-R3 can be specified as the user stack pointer.
•
Rb, [Rw+] or Rw, [Rw+]: Post-increment Indirect Addressing.
Used to pop one byte or word from a user stack. This mode is only available for MOV
instructions and can specify any GPR as the user stack pointer.
18.4
Register banking
Register banking provides an extremely fast method to switch user context. A single
machine-cycle instruction, saves the old register bank and enters a new register bank. Each
register bank may assign up to 16 registers. Each register bank should be allocated during
coding based on the needs of each task. Once the internal memory has been partitioned
into a register bank space, internal stack space and a global internal memory area, each