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
OK... it is fine if they are relative addresses. Just that I am facing a problem when I increase my xdata size to more than 256..and i see that 256 bytes of code is as a gap in the code segment and the function starts from 257th location. So I thot maybe the data is corrupting the code when I increase it beyond 256 bytes. Thanks a lot for the prompt replies. Let me know if you have anything more to tell me that will help me resolve the problem Regards, Gaurav
"Let me know if you have anything more to tell me that will help me resolve the problem"
As already noted, you really need to do that basic study on the 8051 architecture, and the Keil tools - you need to get these foundations good & solid before you start trying to build your grand edifice...
"it is fine if they are relative addresses"
I said you should think of them as "relative" (in quotes) addresses - be careful not to read too much into that!
Again, you really need to study those documents to really understand what's going on...