Keil Logo

C51: STRUCTURE MEMORY SPACE DETAILS IN LISTING FILES


Information in this article applies to:

  • C51 Version 5.50

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.

Last Reviewed: Tuesday, June 8, 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.