<?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>Address of xdata structure elements are not linked into code structure</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/33017/address-of-xdata-structure-elements-are-not-linked-into-code-structure</link><description> 
I created a structure about data fields, which are located in a
structure in xdata area. The informal structure itself should be in
code area. 

 
typedef struct
{
 unsigned char *pucRamAddr;
 eNvmDevice eDeviceId; // enum type
 unsigned short tNvmAddr;</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: Address of xdata structure elements are not linked into code structure</title><link>https://community.arm.com/thread/107702?ContentTypeID=1</link><pubDate>Fri, 23 May 2014 04:23:05 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:94530219-895e-482e-bac5-e90102fead88</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
Yes - I was including that in, &lt;i&gt;&amp;quot;...provide code to make it
so&amp;quot;&lt;/i&gt;.&lt;/p&gt;

&lt;p&gt;
You didn&amp;#39;t show or mention any initialisation in your initial
post.&lt;/p&gt;

&lt;p&gt;
Anyhow - glad is fixed now!&lt;/p&gt;

&lt;p&gt;
:-)&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Address of xdata structure elements are not linked into code structure</title><link>https://community.arm.com/thread/120342?ContentTypeID=1</link><pubDate>Fri, 23 May 2014 03:44:52 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:0c366a47-ed5a-4300-a6ba-9eb7de6a1bfb</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
With a 16-bit addressable XDATA range, an xdata pointer is
expected to be 2 bytes large.&lt;br /&gt;
A generic pointer on the other hand, needs an extra byte just to know
what memory type it points to so a generic pointer is larger and
slower. This is one of the strange workarounds needed when
implementing C in a processor that is C-hostile.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Address of xdata structure elements are not linked into code structure</title><link>https://community.arm.com/thread/107704?ContentTypeID=1</link><pubDate>Fri, 23 May 2014 02:47:59 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:8e765d90-6015-49e8-ab0e-853ecae29011</guid><dc:creator>Udo Massl</dc:creator><description>&lt;p&gt;&lt;p&gt;
Sorry, I was mistaken: the xdata structure was accidentally
located to Address 0. So the address was always correct in code
too.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Address of xdata structure elements are not linked into code structure</title><link>https://community.arm.com/thread/81912?ContentTypeID=1</link><pubDate>Fri, 23 May 2014 02:39:17 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:21af2460-126b-4c1f-baa8-94c85e4be7fe</guid><dc:creator>Udo Massl</dc:creator><description>&lt;p&gt;&lt;p&gt;
Because pucRamAddr is located in the code section it&amp;#39;s only
possible to bring the content into it through default initialization
through the linker. Therefore in the default initialization is
something like&lt;/p&gt;

&lt;pre&gt;
const TNvmBlock CODE tNvmBlock[NVM_BLOCK_COUNT] =
{
  {&amp;amp;(tStruct.Element), ... },
  ...
}
&lt;/pre&gt;

&lt;p&gt;
&lt;br /&gt;
Usually linkers can fill in the correct address (base of &amp;quot;Struct&amp;quot; +
offset of &amp;quot;Element&amp;quot;) into the code section, in my at the Output of
BL51 there is only the Offset of &amp;quot;Element&amp;quot; within &amp;quot;Struct&amp;quot;.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Address of xdata structure elements are not linked into code structure</title><link>https://community.arm.com/thread/68695?ContentTypeID=1</link><pubDate>Fri, 23 May 2014 02:29:26 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:7e4bbea7-9115-4fc2-a295-464330d425dc</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
Not sure I quite understand your problem.&lt;/p&gt;

&lt;p&gt;
&lt;i&gt;&amp;quot;So pucRamAddr should point to the element within the xdata
structure&amp;quot;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
Only when you provide code to make it so - the Linker won&amp;#39;t do
that for you.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>