RTX51 Tiny User's Guide

Stack Management

RTX51 Tiny maintains a stack for each task using only the internal memory (IDATA) of the 8051. When a task is running, it is given the maximum amount of stack space possible. When a task switch occurs, the previous task stack is shrunk and relocated and the stack for the current task is expanded and relocated.

The following figure illustrates the layout of internal memory for an example application with three separate tasks.

The ?STACK symbol denotes the starting address of the stack. In this example, objects located below the stack include global variables, registers, and bit-addressable memory. The remaining memory is used for the task stacks. The top of memory may be specified in the configuration.