ARM Technical Support Knowledge Articles

STRUCTURE MEMORY SPACE DETAILS IN LISTING FILES

Applies to: C51 C Compiler

Answer


Information in this article applies to:


SYMPTOMS

I have declared a structure called foo and defined a variable of type struct foo called baz, as follows:

struct foo
{
  unsigned char x;
  unsigned char y;
  unsigned int bar;
  unsigned char bit0 : 1;
  unsigned char bit1 : 1;
}baz;

When I look at the listing file generated by the compiler, I see the following information:

NAME                                    CLASS   MSPACE  TYPE    OFFSET  SIZE
====                                    =====   ======  ====    ======  ====
baz. . . . . . . . . . . . . . . . . .  PUBLIC   DATA   STRUCT   0000H  5
foo. . . . . . . . . . . . . . . . . .  * TAG *  -----  STRUCT   -----  5
  x. . . . . . . . . . . . . . . . . .  MEMBER   -----  U_CHAR   0000H  1
  y. . . . . . . . . . . . . . . . . .  MEMBER   -----  U_CHAR   0001H  1
  bar. . . . . . . . . . . . . . . . .  MEMBER   -----  U_INT    0002H  2
  bit0 . . . . . . . . . . . . . . . .  MEMBER   -----  FIELD    0004H  1.0
  bit1 . . . . . . . . . . . . . . . .  MEMBER   DATA   FIELD    0004H  1.1

According to the table, baz is located in data space, which is correct. However, for the actual structure, only bit1 is listed as being in data space.

CAUSE

This is a bug in the compiler and should be fixed in the next version. The structure definition is not located in any memory space, only variables whose type are the structure, in this case baz.

RESOLUTION

Ignore the MSPACE column for structures in the listing file.

Article last edited on: 2004-06-08 13:38:36

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