Keil Logo

C166: PROBLEMS WITH THE USER STACK

QUESTION

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.

ANSWER

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).

Last Reviewed: Sunday, May 16, 2004


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.