ARM Technical Support Knowledge Articles

DO XDATA AND CODE MEMORY OVERLAP?

Applies to: C51 C Compiler

Answer


Information in this article applies to:


QUESTION

I've noticed that the Keil Compiler and Linker locate my program code starting from 0000h and also my XDATA variables from 0000h. Isn't that going to cause a problem?

ANSWER

No. XDATA and CODE are two distinct memory areas. They do not overlap (unless your hardware makes them overlap). If that's the case, then there may be problems it you locate CODE and XDATA at the same addresses. However, this situation is typically only found when using the MONITOR (since it requires memory in that configuration). In that case, you'll have to tell the linker where the REAL XDATA is and where the REAL CODE memory is.

The 8051 supports 64K of CODE and 64K of XDATA. These memory areas are accessed using different addressing modes of the 8051.

At the hardware level, the /PSEN signal from the 8051 is used to READ from CODE memory (usually ROM, EPROM, or FLASH) and the /RD and /WR signals are used to READ and WRITE XDATA memory (usually a RAM or NVRAM).

There is no hardware line that allows you to write to the CODE memory. So, in situations when you must write to CODE memory, at the hardware level, the /PSEN and /RD lines are tied together and connected to a RAM. Then, writes to memory in XDATA appears in XDATA and in CODE space. This is called von Neuman memory.

Article last edited on: 2001-06-13 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