C251 User's Guide

Tips for the Stack

Another reason for your program hanging up could be that your application is running out of stack space. Since embedded applications usually use interrupt functions, it is not possible to calculate the stack requirements at compile time. If you think that your application has problems with the available stack space you have the following options:

  • Execute your program with a debugger or emulator. Stop after the memory initialization at the beginning of the main function. Fill the memory space of the system stack and the user stack with a constant value (like 0xA5) and execute all functions of the application. Use the debugger to determine if there is enough stack space to execute your most complex interrupt procedure. The location of the stack area is listed in the MEMORY MAP of the linker/locator listing file (*.MAP) under the segment ?STACK.
  • If you cannot work with a debugger in your target system, increase the stack space and check to see if the problems go away.