ARM Technical Support Knowledge Articles

DEFINING THE MINIMUM STACK SIZE

Applies to: C51 C Compiler

Answer


Information in this article applies to:


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 KeilC51LIB folder to your project folder and add this file to your uVision 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

Article last edited on: 2004-05-01 15:11:32

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential