Keil Logo

CX51: CODE ADDRESS SPACE OVERFLOW WITH ROM(HUGE)


Information in this article applies to:

  • C51 Version 7

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

Last Reviewed: Saturday, April 8, 2006


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