Keil™, An ARM® Company

RTX51 Tiny User's Guide

Stack

Several options are available for stack configuration. The following EQUates define the size of the internal RAM used for stack area and the minimum free space on the stack. A macro allows you to specify code that is executed when there is there is not enough free stack on the CPU stack.

  • RAMTOP specifies the top address for the on-chip stack. You should not change this unless you have IDATA variables located above the stack. The default setting is 0xFF.
  • FREE_STACK specifies the minimum number of bytes available on the stack. When switching to a task, if RTX51 Tiny detects fewer than the value specified, the STACK_ERROR macro executes. A value of 0 disables stack checking. The default setting is 20 bytes.
  • STACK_ERROR is a macro that specifies the instructions to execute in the event of a stack error (fewer than FREE_STACK bytes available). The default macro disables interrupts and enters an endless loop. For example:
    STACK_ERROR MACRO
    CLR EA ; disable interrupts
    SJMP $ ; endless loop if stack space is exhausted
    ENDM