ARM Technical Support Knowledge Articles

INCORRECT VALUES DISPLAYED FOR LOCALS

Applies to: uVision Debugger

Answer


Information in this article applies to:


QUESTION

I have the following simple function in my C program that I call with different values:

unsigned char xa, xb;

void sendword (unsigned int w)  {
  xa = w >> 8;
  xb = w & 0x00ff;
}

It appears that the uVision Debugger does not display correct values for the local variable w. When I call the function with the value 0x1234, the value 0x1200 is shown. What is the reason for this?

ANSWER

The Keil C Compiler performs very high code optimizations and removes even partly variables. This happens on very simple functions like that shown above. However, the code executes correctly.

You may reduce code optimization to get the proper debug results. However, in most cases, this is not possible.

SEE ALSO

Article last edited on: 2004-06-30 19:36:26

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