|ARM Technical Support Knowledge Articles|
Applies to: C51 C Compiler
Information in this article applies to:
My 8051 target hardware does not have continuous XDATA memory. Is there a way I can declare the XDATA that is available for variables so that the compiler and linker automatically locate my XDATA variables automatically?
Yes. In C51 V6.01 and later, you may specify XDATA ranges to the BL51 linker. You may specify a range for each valid XDATA area and let the BL51 linker locate your XDATA segments automatically.
For example, suppose you have XDATA ranges from 0x0000 to 0x1FFF and from 0x4000 to 0x4FFF. And, that you have segments (?XD?SEG1, ?XD?SEG2, and ?XD?SEG3) which should be located in the XDATA range from 0x0000-0x1FFF and the following segments (?XD?SEG4, ?XD?SEG5, and ?XD?SEG6) which should be located in the XDATA range from 0x4000 to 0x4FFF.
Compile as normal. Use the following linker command line:
BL51 ... XDATA (0x0000-0x1FFF,0x4000-0x4FFF, ?XD?SEG1 (0x0000), ?XD?SEG2, ?XD?SEG3, ?XD?SEG4 (0x4000), ?XD?SEG5, ?XD?SEG6)
Since all unspecified XDATA segments are located after the last specified XDATA segment, you may avoid listing ALL XDATA segments in the linker command line.
Article last edited on: 2005-07-09 11:02:46
Did you find this article helpful? Yes No
How can we improve this article?