Keil Logo

User Stack Size

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

  1. Halt program execution at the entery to the main C function and fill the memory area allocated to the user stack with a constant value (such as 0xA5). The address range of the user stack (the ?C_USERSTACK section) is listed in the linker map file (*.M66) under MEMORY MAP OF MODULE heading.
  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 user stack that were used.
  4. Calculate the number of bytes of the stack that were changed (from your constant value). This indicates the number of bytes that were used. We recommend that you have at least 100 bytes (50 words) of additional stack space.

Note

  • We recommend that you have at least 100 bytes (50 words) of user stack space beyond the maximum calculated requirements.
  • If your application behaves strangely, try increasing the size of the user stack.

Related Knowledgebase Articles

  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.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.