ARM Technical Support Knowledge Articles

LOCATING DATA STRUCTURES IN XDATA IN THE ORDER DEFINED

Applies to: C51 C Compiler

Answer


Information in this article applies to:


QUESTION

I am trying to locate 3 data structures physically adjacent to one another in xdata memory in the order that they were defined and starting at location 0x0000. Is there a way of implementing this without using subsequent _at_ commands?

ANSWER

Yes. The best way to implement this is as follows:

The following example source code memmap.c shows this.

#pragma ORDER

typedef struct
  {
  unsigned char x[1000];
  } D_CaLInfo;


typedef struct
  {
  unsigned char x[1000];
  } D_SysVars;


typedef struct
  {
  unsigned char x[1000];
  } D_AlarmBits;


D_CaLInfo   xdata CaLInfo;
D_SysVars   xdata SysVars;
D_AlarmBits xdata AlarmBits;


void main(void)
{
while (1);
}

The xdata field of the BL51 Locate Tab contains ?XD?MEMMAP(0x0000) for this file.

The resulting map file is shown below.

LINK MAP OF MODULE:  memmap (MEMMAP)


            TYPE    BASE      LENGTH    RELOCATION   SEGMENT NAME
            -----------------------------------------------------

            * * * * * * *   D A T A   M E M O R Y   * * * * * * *
            REG     0000H     0008H     ABSOLUTE     "REG BANK 0"
            IDATA   0008H     0001H     UNIT         ?STACK

            * * * * * * *  X D A T A   M E M O R Y  * * * * * * *
            XDATA   0000H     0BB8H     UNIT         ?XD?MEMMAP

            * * * * * * *   C O D E   M E M O R Y   * * * * * * *
            CODE    0000H     0003H     ABSOLUTE
            CODE    0003H     000CH     UNIT         ?C_C51STARTUP
            CODE    000FH     0002H     UNIT         ?PR?MAIN?MEMMAP



SYMBOL TABLE OF MODULE:  memmap (MEMMAP)

  VALUE           TYPE          NAME
  ----------------------------------------------------
  -------                       MODULE         MEMMAP
  C:0000H        SYMBOL      _ICE_DUMMY_
  X:0000H        PUBLIC        CaLInfo
  X:03E8H        PUBLIC        SysVars
  X:07D0H        PUBLIC        AlarmBits
  C:000FH         PUBLIC       main
  -------                       PROC           MAIN
  C:000FH         LINE#         29
  C:000FH         LINE#         30
  C:000FH         LINE#         32

Article last edited on: 2002-02-07 00:00:00

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