ARM Technical Support Knowledge Articles


Applies to: C251 C Compiler



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 uVision1, if you specify hdata(0xE00000-0xEFFFFF) for one of the class lines, the HDATA memory will reside between E00000h and EFFFFFh (inclusive).

Article last edited on: 2000-12-05 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