We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Where is the xdata stored and where is code stored?
The Problem that I am facing is , when I do
unsigned char xdata buff[300]; void func() { ........... ..... .. }
the results of running this application suggests that xdata buff has overwritten the function func.
The Map file shows the following addresses * * * * * * * X D A T A M E M O R Y ** * * * * * XDATA 0000H 012CH UNIT ?XD?DEMO XDATA 012CH 000AH UNIT _XDATA_GROUP_
* * * * * * * C O D E M E M O R Y * * * * * * * CODE 0000H 0003H ABSOLUTE 0003H 00FDH *** GAP *** CODE 0100H 03C7H UNIT ?PR?_FUNC?DEMO CODE 04C7H 0131H UNIT ?C_INITSEG
Which shows the base addresses of XD?DEMO of 300 bytes and the function func to be the same !!!
Also in the code segment, a gap of 256 bytes has been left before the function func. Hence if the xdata buff size is kept 256 bytes, there is no problem. Only when I exceed this limit , there are problems.
Let me know where is xdata stored and where is the code segment? Are they overlapping? How can I declare an external data buffer of 300 bytes?
Regards, Gaurav
modifying my question Say you declare some xdata and define some code when you compile this, in the resultant image, in which address locations will xdata and the code be placed.
As I mentioned earlier, in my case it is showing xdata starting from 0000H and the code also starting from 0000H.
In my application, both xdata and the code are placed in the same memory.
Your hardware maps both xdata and code space to the same physical memory - is that what you mean ?
This is a very unusual memory configuration, since for the '51 chip itself, code and xdata are completely separate memory areas.