ARM Technical Support Knowledge Articles


Applies to: CX51 C Compiler


Information in this article applies to:


I'm using the Philips 80C51MX devices. How can I declare a variable in EDATA space?


The MX does not provide any new instructions to access the EDATA space. So, this memory area may be viewed as another HDATA memory area. Typically, it is used as extended stack space. However, you may create an HDATA user class that allows you to place variables there. For example:

#pragma userclass (HDATA=ERAM)

unsigned char far i;  // placed in class HDATA_ERAM

void main (void)  {
  i = 0;              // accesses variables in HDATA_EDATA

You may use the LX51 linker CLASSES directive to locate the HDATA_ERAM class to address 0x7F0000.

In uVision, enter this class under Options — LX51 Locate — User Classes as:

HDATA_ERAM (0x7F0000-0x7F03FF)

If you use the LX51 on the command line, you must add this in the CLASSES directive as follows:

LX51 ... CLASSES (HDATA_ERAM (0x7F0000-0x7F03FF))

The #pragma userclass (HDATA=ERAM) directive affects the whole source file. If you need to declare variables in HDATA using an address range different than HDATA_ERAM (0x7F0000-0x7F03FF), you need to create another source file to work with those variables. In the current source file, all the far variables are placed in the user's HDATA_ERAM class.



Article last edited on: 2006-10-23 17:04:14

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