Keil Logo Arm Logo

C166 User's Guide

Stack Problems

If your program hangs for no apparent reason, you may be running out of stack space. Since embedded applications often use interrupts, it can be very difficult to calculate stack requirements. Try one of the following suggestions if you think your application has problems with the available stack space.

  • 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 (such as 0xA5 or "STACK...") and execute all functions of the application. Use the debugger to see if there is enough stack space to execute your most complex interrupt procedure. The location of the user stack and system stack is listed in the MEMORY MAP of the linker/locator listing file (*.M66).
  • If you cannot work with a debugger in your target system, increase the stack space and see if this resolves the problems you are experiencing.

Keil logo

Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.