ARM Technical Support Knowledge Articles


Applies to: C166 C Compiler



In my 166 tools, when I look at Register 0 (R0), I am unable to determine where my user stack is placed. I think the user stack is being located incorrectly.


The Keil C166 compiler uses R0 to maintain a user stack for local variables and function arguments. The startup code in START166.A166 and START167.A66 includes a section which sets up the user stack.

The user stack grows from the top down. So, as arguments are pushed on the stack, R0 decreases. Many people find this activity in R0 confusing.

The easiest way to find where your user stack is being placed is to evaluate the symbol ?C_USRSTKBOT, which is the bottom of the user stack. To do this in dScope, open the symbol window and look for ?C_USRSTKBOT. Next to the symbol will be its location. The user stack will extend from that location up into memory as far as the size of the stack (USTSZ in the startup code).

Article last edited on: 2004-05-16 17:21:01

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