|
|||||||||||
|
Technical Support Support Resources
Product Information |
CX51: Code Address Space Overflow with ROM (Huge)Information in this article applies to:
QUESTIONI 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:
How can I write program with ROM(HUGE) while at the same time using the memory type 'code' for constants? I want all my code to be in the ECODE memory class. ANSWERThe 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: Thursday, February 25, 2021 | ||||||||||
|
|||||||||||
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.