ARM Technical Support Knowledge Articles


Applies to: C251 C Compiler


Information in this article applies to:


I'm using the C251 compiler and there appears to be a problem. The compiler appears to be placing variables in the SFR memory space. Is this a known problem? From the linker MAP file, I get the following information:

0000DDH   0000EAH   00000EH   BYTE   UNIT     EDATA          ?ED?KERNEL
0000EBH   0000ECH   000002H   BYTE   UNIT     EDATA          ?ED?MAIN
0000EDH   0000F0H   000004H   BYTE   UNIT     EDATA          ?ED?ISR
0000F1H   0000F4H   000004H   BYTE   UNIT     EDATA          ?ED?HBEAT

Why are these variables located in the SFR space?


The 251 offers numerous memory spaces that have their own, unique offset addresses that do not necessarily coincide.

The variables referenced in your MAP file are located in the EDATA memory class. SFR's, however, are located in the DATA class between 0x80 and 0xFF inclusive.

To test this, you may create following program:

sfr P1 = 0x90;
unsigned char near edata_var;

void main (void)
P1 = 0x55;
edata_var = 0xAA;
while (1);

Compile and link specifying that the EDATA class reside from 0x0090-0x00FF. The following excerpt is from the MAP file:

      VALUE       REP       CLASS    TYPE      SYMBOL NAME
      ---         MODULE    ---      ---       main
      00FF0019H   PUBLIC    CODE     ---       main
      00000090H   PUBLIC    EDATA    BYTE      edata_var
      00000090H   SFRSYM    DATA     BYTE      P1

This shows that P1 is in the DATA class and edata_var is in the EDATA class. Furthermore, when you run this simple program, you will find that P1 is not overwritten with 0xAA (by the write the edata_var).

You may want to take a look at the databook because the NUMEROUS different memory areas of the 251 are very comfusing many of them overlap and do strange things.

Article last edited on: 2002-01-29 00:00:00

Rate this article

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