Technical Support

C51: DEFINING THE MINIMUM STACK SIZE


Information in this article applies to:

  • C51 All Versions

QUESTION

When I define more and more data and idata variables in my application, the available stack space decreases. By default, only one byte is reserved for the stack which is not enough for my application. I want to make sure that the remaining stack space is at least 20 bytes. If I define too many data and idata variables, the linker should report an error message.

ANSWER

This is possible. The stack size is defined in the STARTUP code. You may copy the STARTUP.A51 file from the \Keil\C51\LIB folder to your project folder and add this file to your µVision project. Then, the stack size can be modified in this file.

?C_C51STARTUP   SEGMENT   CODE
?STACK          SEGMENT   IDATA

                RSEG    ?STACK
                DS      1

The line DS 1 specifies the stack size. You may change this value according to your needs.

SEE ALSO

Last Reviewed: Saturday, May 01, 2004


Did this article provide the answer you needed?
 
Yes
No
Not Sure