Keil™, An ARM® Company

C166 User's Guide

System Stack Size

To determine the required size of the system stack, you may:

  1. Halt program execution at the main entry point and fill the memory area allocated to the system stack with a constant value (such as 0xA5).
  2. Execute all functions and interrupts in your application. Try to be as complete as possible. You may use the code coverage analysis in the µVision Debugger to make sure you have executed all functions.
  3. Calculate the number of bytes that were changed (from your constant value). This indicates the number of bytes of the stack that were used.

Note

  • The C16x architecture provides system stack overflow and underflow traps. You may add the TRAPS.C file (located in the \KEIL\C166\LIB\ folder) to your project to detect these interrupts.
  • The system stack must be large enough to execute the most complex interrupts in your system and have at least 40 bytes (20 words) of space remaining.