ARM Technical Support Knowledge Articles

CHANGING THE SYSTEM STACK SIZE AND LOCATION

Applies to: C166 C Compiler

Answer


Information in this article applies to:


QUESTION

How do I change the size and location of the system stack?

ANSWER

Configure the startup code START167.A66 (not required for XC16x devices) for no wrapping stack and define the location of the stack section using the L166 SECTIONS directive.

  1. Startup code START167.A66 configuration (Note: this is not required for XC16x devices since START_V2.A66 always configures a non-wrapping stack):
    ; STKSZ: Maximum System Stack Size selection  (SYSCON.13 .. SYSCON.15)
    ;  Defines the system stack space which is used by CALL/RET and PUSH/POP
    ;  instructions.  The system stack space must be adjusted according the
    ;  actual requirements of the application.
    $SET (STK_SIZE = 7)
    ;     System stack sizes:
    ;       0 = 256 words (Reset Value)
    ;       1 = 128 words
    ;       2 =  64 words
    ;       3 =  32 words
    ;       4 = 512 words
    ;       5 = not implemented
    ;       6 = not implemented
    ;       7 = no wrapping (entire internal RAM use as STACK, set size with SYSSZ)
    ; If you have selected 7 for STK_SIZE, you can set the actual system stack size
    ; with the following SSTSZ statement.
    SSTSZ  EQU  200H  ; set System Stack Size to 200H Bytes
    
  2. Enter the stack section setting in uVision under Project - Options - L166 Locate - User Sections:
    ?C_SYSSTACK%IDATA (0xFA00)
    
    As alternative you may use the Linker SECTIONS directive at the command line. Note that the stack must be within IDATA RAM.

SEE ALSO

Article last edited on: 2005-06-02 06:59:49

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