Keil Logo



I need to address 128K of RAM with the C251 compiler. I'm mapping my RAM as XDATA, but the tools only let me have access to 64K of XDATA space. How do I setup the linker to give me access to the whole 128K?


Page 4 of the 251 Compiler manual outlines the address space of the different memory types on the 251.

Note that XDATA is only allowed to be 64Kbytes long. This is because of the addressing modes of the instructions used to get to XDATA. It cannot be expanded.

The far keyword in C251 specifies that the declared variable resides in the HDATA memory class. The default range for this class is 000000h-0FFFFFFh. You'll probably have to change that in the linker options.

There are numerous memory spaces for RAM on the 251. The types of instructions used to access each space are different and may be more or less eccifient depending on your application. For optimal execution speed, you may have to access memory as several different memory classes. The XDATA memory is only there to be compatible with the 8051 and is not necessarily the most efficient memory class to use for your memory!

Using the far Keyword in C251

There is no memory model that puts all variables in far (HDATA) memory. You must do this manually using the far keyword. For example:

int far bob;

These variables are placed in the HDATA memory class. You may use the Misc Tab in the Linker Options Dialog to specify the range of memory for HDATA. In µVision1, if you specify hdata(0xE00000-0xEFFFFF) for one of the class lines, the HDATA memory will reside between E00000h and EFFFFFh (inclusive).

Last Reviewed: Tuesday, December 5, 2000

Did this article provide the answer you needed?
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.