ARM Technical Support Knowledge Articles

CODE ADDRESS SPACE OVERFLOW WITH ROM(HUGE)

Applies to: CX51 C Compiler

Answer


Information in this article applies to:


QUESTION

I am writing a Philips 8051MX application in the ROM model HUGE which allows program code everywhere, since the program code resides in the memory class ECODE. To optimize constant accesses, I have used the memory type code in my C source. This generates MOVC instructions which are optimal, and since I am porting existing 8051 C code I did not care too much. However, it looks like portions of code are placed in the memory class CODE rather than ECODE.

But CODE is limited to 64KB, and the linker generates:

*** ERROR 107: ADDRESS SPACE OVERFLOW.
    SPACE: CODE

How can I write program with ROM(HUGE) while at the same time using the memory type 'code' for constants? I would like all my code to be in the ECODE memory class.

ANSWER

The Philips 80C51 hardware limits the possibilities when you are using the MOVC instructions. Therefore, you should use far const instead of code in your application. Typically, it is enough to change a few places in your program until the CODE memory class fits into a 64KB segment.

Variables defined with far const are addressed with EMOV instructions, which may reach the complete address space. Therefore, both program code and constants may be everywhere in memory.

When you are using the code memory type, the compiler uses the MOVC instruction to access the constant data. However, the 8051MX requires that the MOVC and the accessed constants reside in one 64KB page.

The compiler places functions that use MOVC instructions into the CODE memory class. This ensures that the MOVC and the accessed constants reside in the same 64KB memory block.

MORE INFORMATION

SEE ALSO

Article last edited on: 2006-04-08 07:07:52

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