ARM Technical Support Knowledge Articles


Applies to: C166 C Compiler


Information in this article applies to:


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


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:
    As alternative you may use the Linker SECTIONS directive at the command line. Note that the stack must be within IDATA RAM.


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

Rate this article

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