<?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>variables at same memory places</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/37832/variables-at-same-memory-places</link><description> 
I have declared in source file src1.c following variables. 

 
xdata unsigned char keybuffer[8];
unsigned int keys;
unsigned char keyctr;
 

 
 
I have an another source file src2.c and I want to declare 
variables into same memory places. 

 
How can</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: variables at same memory places</title><link>https://community.arm.com/thread/76297?ContentTypeID=1</link><pubDate>Fri, 16 May 2008 00:11:21 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:58172243-9a88-4d8e-857d-11af4c3e381e</guid><dc:creator>arto malm</dc:creator><description>&lt;p&gt;&lt;p&gt;
Yes, you are absolutely right. I thought that also and it is
better to belive linker analysis feature. Using of union is of course
one possibility(mentioned in previous answer).&lt;br /&gt;
Thanks everybody for answers.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: variables at same memory places</title><link>https://community.arm.com/thread/49897?ContentTypeID=1</link><pubDate>Thu, 15 May 2008 15:21:45 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:ffe2d191-de8b-4822-aecc-5aa0d0b33795</guid><dc:creator>HansBernhard Broeker</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;I know that my software do not use variables declared in src1.c
in this case.&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
Then those variable don&amp;#39;t deserve having external linkage in
src1.c. Odds are they shouldn&amp;#39;t even have file scope inside
src1.c.&lt;/p&gt;

&lt;p&gt;
You&amp;#39;re basically trying to outsmart the linker&amp;#39;s overlay analysis.
Are you sure you&amp;#39;re up to it?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: variables at same memory places</title><link>https://community.arm.com/thread/89053?ContentTypeID=1</link><pubDate>Thu, 15 May 2008 03:20:30 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:9bb5c038-ef81-4853-9224-a5e221682e0c</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
Why not use the C way of declaring overlayed variables - the
union? That works with all compilers, and since it is clearly visible
in the source code, the next developer to handle the source code will
not get any bad surprises that his variables may be overwritten by
other functions.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: variables at same memory places</title><link>https://community.arm.com/thread/49902?ContentTypeID=1</link><pubDate>Thu, 15 May 2008 02:55:46 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:df9b9be9-0992-43b3-ae93-af4d78ce8aac</guid><dc:creator>arto malm</dc:creator><description>&lt;p&gt;&lt;p&gt;
Actually I want to declare unsigned long(four bytes)long variable
into same memoryarea(keybuffer[8]) in src1.c.&lt;/p&gt;

&lt;p&gt;
In src2.c I want to do following:&lt;/p&gt;

&lt;pre&gt;
unsigned long var32 _at_ keybuffer[3]; //does not compile.
&lt;/pre&gt;

&lt;p&gt;
regards&lt;br /&gt;
Arto&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>