ARM Technical Support Knowledge Articles

WHAT IS R0 USED FOR?

Applies to: C166 C Compiler

Answer


Information in this article applies to:


QUESTION

What is register 0 (R0) used for in the code generated by the C166 compiler? There seems to be a lot of weird stuff going on with it.

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. This is probably the "weird stuff" that you see happening.

Article last edited on: 2006-01-25 20:06:53

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