C51: CONFIGURING XDATA BANKING
Information in this article applies to:
My application requires large amounts of RAM which is available on my hardware. But, I need to access it through the Compiler and Linker.
I have an ASIC containing an 8051 core that supports XDATA banking with 32 kbyte pages at X:0x8000-X:0xFFFF. An SFR named XPAGE at address D:0x95 is used to select the XDATA page. So, the memory map appears as follows:
X:0x0000 - X:0x7FFF Common Xdata Memory X:0x8000 - X:0xFFFF Page 0 Xdata X:0x8000 - X:0xFFFF Page 1 Xdata (Selection via SFR at D:0x95)
How can I configure the C51 Compiler and the extended LX51 Linker/Locater to use this paging mechanism?
How can I allocate variables in the various xdata memory pages?
Can I allocate large arrays (of 64K size) in the C code?
Large memory and XDATA banking are supported starting with Version 6.20 of the PK51 Professional Developer's Kit (C51 Version 6.20). In this and later releases, the memory types far and far const allow you to place variables in banked RAM (far = HDATA) and ROM (far const = HCONST). Since your memory is fragmented into 32 KByte blocks, it is not possible to create arrays larger than 32 KBytes.
The XDATA banking is configured using the XBANKING.A51 file found in the \KEIL\C51\LIB\ folder. To configure the tools for your application:
This configuration for the Compiler and Linker will allow you to use the extended memory regions of your hardware.
To allocate variables in these spaces, simply declare them as far memory types. For example:
int far array ;
The following Discussion Forum threads may provide information related to this topic.
Last Reviewed: Tuesday, May 5, 2015
of your data.