<?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>Initializing Memory</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/22760/initializing-memory</link><description> 
How do we initialize the XDATA memory with dummy data (e.g.
0xDEADBEEF)? 

 
By default all the memory is initialized to 0x00 during debugging
(in the IDE). When you burn your firmware on the controller, the
memory holds random values. To be able to</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: Initializing Memory</title><link>https://community.arm.com/thread/113523?ContentTypeID=1</link><pubDate>Mon, 07 Jan 2008 00:46:21 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:7b86675a-5e7c-4076-8a54-0ecfba6ad4ab</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
Please read the instructions on how to post source code:&lt;br /&gt;
&lt;a href="http://www.danlhenry.com/caps/keil_code.png"&gt;www.danlhenry.com/.../keil_code.png&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;
Note that TABs don&amp;#39;t work (well) - use spaces instead,&lt;/p&gt;

&lt;p&gt;
and don&amp;#39;t forget to check it in the &amp;#39;&lt;b&gt;Preview&lt;/b&gt;&amp;#39;...&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Initializing Memory</title><link>https://community.arm.com/thread/100113?ContentTypeID=1</link><pubDate>Sun, 06 Jan 2008 23:37:40 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:a43bdf75-44b9-40ec-81e3-5e8cc648d36f</guid><dc:creator>Louis Dow</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hi guys&lt;/p&gt;

&lt;p&gt;
Thanks for the tip. Indeed, the snippet of code below seems to be
doing what you indicated:&lt;/p&gt;

&lt;p&gt;
IF XDATALEN &amp;lt;&amp;gt; 0 MOV DPTR,#XDATASTART MOV R7,#LOW (XDATALEN)
IF (LOW (XDATALEN)) &amp;lt;&amp;gt; 0 MOV R6,#(HIGH (XDATALEN)) +1 ELSE MOV
R6,#HIGH (XDATALEN) ENDIF CLR A&lt;br /&gt;
XDATALOOP: MOVX @DPTR,A INC DPTR DJNZ R7,XDATALOOP DJNZ
R6,XDATALOOP&lt;/p&gt;

&lt;p&gt;
In my case, XDATALEN was set to zero.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Initializing Memory</title><link>https://community.arm.com/thread/88777?ContentTypeID=1</link><pubDate>Fri, 04 Jan 2008 09:23:31 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:f926640f-6b8c-42eb-94f6-134cffbcd085</guid><dc:creator>Drew Davis</dc:creator><description>&lt;p&gt;&lt;p&gt;
As Andy says, STARTUP.A51 initializes memory. It&amp;#39;s attempting to
fulfill the requirements of the C language spec that uninitialized
variables have value 0. If you change the fill pattern, then
programmers for your system need to be aware that they cannot rely on
the C runtime init&amp;#39;ing their variables to zero for them.&lt;/p&gt;

&lt;p&gt;
You also might consider avoiding initialized constant globals.
INIT.A51 has to copy the values from non-volatile code space to
xdata/data space. So, you have two copies of your values, which can
be a waste of memory space. You can declare the variable as
&lt;b&gt;code&lt;/b&gt; and just read the value straight from code space.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Initializing Memory</title><link>https://community.arm.com/thread/49205?ContentTypeID=1</link><pubDate>Fri, 04 Jan 2008 03:24:06 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:d800123c-b04c-4b27-8f92-7cad26b30ac7</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
Have you looked at the comments in &lt;b&gt;startup.a51&lt;/b&gt; ?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>