<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>xdata and code segments overlap?</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/22143/xdata-and-code-segments-overlap</link><description> 
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</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: xdata and code segments overlap?</title><link>https://community.arm.com/thread/99506?ContentTypeID=1</link><pubDate>Wed, 08 Aug 2007 03:37:06 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:15fc1dad-b7a6-4701-97c0-461b5d20c7d9</guid><dc:creator>Christoph Franck</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;In my application, both xdata and the code are placed in the
same memory.&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
Your hardware maps both xdata and code space to the same physical
memory - is that what you mean ?&lt;/p&gt;

&lt;p&gt;
This is a very unusual memory configuration, since for the &amp;#39;51
chip itself, code and xdata are completely separate memory areas.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: xdata and code segments overlap?</title><link>https://community.arm.com/thread/123993?ContentTypeID=1</link><pubDate>Wed, 08 Aug 2007 03:18:40 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:516b6cf7-6e8b-492f-8def-77ce1c617460</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;&amp;quot;it is fine if they are relative addresses&amp;quot;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
I said you should &lt;i&gt;think of them&lt;/i&gt; as &amp;quot;relative&amp;quot; (in quotes)
addresses - be careful not to read too much into that!&lt;/p&gt;

&lt;p&gt;
Again, you really need to study those documents to really
understand what&amp;#39;s going on...&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: xdata and code segments overlap?</title><link>https://community.arm.com/thread/123987?ContentTypeID=1</link><pubDate>Wed, 08 Aug 2007 03:14:12 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:1b9f0594-f845-4572-a355-70008a1c684b</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;&amp;quot;Let me know if you have anything more to tell me that will
help me resolve the problem&amp;quot;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
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 &amp;amp; solid before you start trying to build your
grand edifice...&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: xdata and code segments overlap?</title><link>https://community.arm.com/thread/113098?ContentTypeID=1</link><pubDate>Wed, 08 Aug 2007 03:08:12 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:9b9f9cf5-0a33-45f6-af1e-aa70698e7e3a</guid><dc:creator>Gaurav Borkar</dc:creator><description>&lt;p&gt;&lt;p&gt;
OK...&lt;br /&gt;
it is fine if they are relative addresses.&lt;br /&gt;
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.&lt;br /&gt;
So I thot maybe the data is corrupting the code when I increase it
beyond 256 bytes.&lt;br /&gt;
Thanks a lot for the prompt replies.&lt;br /&gt;
Let me know if you have anything more to tell me that will help me
resolve the problem&lt;br /&gt;
Regards,&lt;br /&gt;
Gaurav&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: xdata and code segments overlap?</title><link>https://community.arm.com/thread/99505?ContentTypeID=1</link><pubDate>Wed, 08 Aug 2007 02:53:15 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:0602d188-f280-4d5e-9cb0-98446a26de01</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;&amp;quot;As I mentioned earlier, in my case it is showing&lt;br /&gt;
xdata starting from 0000H and the code also starting from
0000H.&amp;quot;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
You should think of those as &amp;quot;relative&amp;quot; addresses;&lt;br /&gt;
The &amp;quot;fully-qualified&amp;quot; addresses would be, in Keil notation,
&lt;b&gt;X:&lt;/b&gt;0000H and &lt;b&gt;C:&lt;/b&gt;0000H&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: xdata and code segments overlap?</title><link>https://community.arm.com/thread/88453?ContentTypeID=1</link><pubDate>Wed, 08 Aug 2007 02:49:47 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:a0171d2e-f8fd-4105-aac7-4e125e0b96f3</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
As Christoph says, XDATA and CODE are completely independent
address spaces!&lt;/p&gt;

&lt;p&gt;
There are also PDATA, DATA, and IDATA...&lt;/p&gt;

&lt;p&gt;
You need to do some basic study on the 8051 architecture; eg, by
reading the so-called &amp;quot;bible&amp;quot; for the 8051:&lt;/p&gt;

&lt;p&gt;
Chapter 1 - 80C51 Family Architecture:&lt;br /&gt;
&lt;a href="http://www.nxp.com/acrobat_download/various/80C51_FAM_ARCH_1.pdf"&gt;www.nxp.com/.../80C51_FAM_ARCH_1.pdf&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;
Chapter 2 - 80C51 Family Programmer&amp;#39;s Guide and Instruction
Set:&lt;br /&gt;

&lt;a href="http://www.nxp.com/acrobat_download/various/80C51_FAM_PROG_GUIDE_1.pdf"&gt;www.nxp.com/.../80C51_FAM_PROG_GUIDE_1.pdf&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;
Chapter 3 - 80C51 Family Hardware Description:&lt;br /&gt;

&lt;a href="http://www.nxp.com/acrobat_download/various/80C51_FAM_HARDWARE_1.pdf"&gt;www.nxp.com/.../80C51_FAM_HARDWARE_1.pdf&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;
And, for details of how Keil C51 supports all this, see:&lt;br /&gt;
&lt;a href="http://www.keil.com/support/man/docs/c51/c51_le_memareas.htm"&gt;http://www.keil.com/support/man/docs/c51/c51_le_memareas.htm&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;
&lt;a href="http://www.keil.com/support/man/docs/c51/c51_le_memtypes.htm"&gt;http://www.keil.com/support/man/docs/c51/c51_le_memtypes.htm&lt;/a&gt;&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: xdata and code segments overlap?</title><link>https://community.arm.com/thread/75352?ContentTypeID=1</link><pubDate>Wed, 08 Aug 2007 02:44:13 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:3cbe7ffa-045c-4acf-a238-cb5683573f78</guid><dc:creator>Gaurav Borkar</dc:creator><description>&lt;p&gt;&lt;p&gt;
modifying my question&lt;br /&gt;
Say you declare some xdata and define some code&lt;br /&gt;
when you compile this, in the resultant image, in which address
locations will xdata and the code be placed.&lt;/p&gt;

&lt;p&gt;
As I mentioned earlier, in my case it is showing&lt;br /&gt;
xdata starting from 0000H and the code also starting from 0000H.&lt;/p&gt;

&lt;p&gt;
In my application, both xdata and the code are placed in the same
memory.&lt;/p&gt;

&lt;p&gt;
Regards,&lt;br /&gt;
Gaurav&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: xdata and code segments overlap?</title><link>https://community.arm.com/thread/51020?ContentTypeID=1</link><pubDate>Wed, 08 Aug 2007 02:24:28 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:be9e50c2-6e4f-4a94-859e-d676276b3ccd</guid><dc:creator>Christoph Franck</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;Where is the xdata stored and where is code stored?&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
xdata and code are different memory spaces. Unless your chip
provides some sort of mapping mechanism (i.e. it can map xdata space
into code space or vice versa), the two memory spaces are completely
separate.&lt;/p&gt;

&lt;p&gt;
The &amp;#39;51 processor even uses different instructions to access the
different memory spaces.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>