Skip to main content

IAR Embedded Workbench for RL78 5.20

Stack size considerations

In this section:

The required stack size depends heavily on the application’s behavior. If the given stack size is too large, RAM will be wasted. If the given stack size is too small, one of two things can happen, depending on where in memory you located your stack:

  • Variable storage will be overwritten, leading to undefined behavior

  • The stack will fall outside of the memory area, leading to an abnormal termination of your application.

Both alternatives are likely to result in application failure. Because the second alternative is easier to detect, you should consider placing your stack so that it grows toward the end of the memory.

For more information about the stack size, see Setting up stack memory, and Saving stack space and RAM memory.