<?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>How to run the function from RAM in keil.</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/41444/how-to-run-the-function-from-ram-in-keil</link><description> 
Hi, 

 
i am using keil ide and controller LPC1837. i want to execute the
function which is using IAP commands from RAM. 

 
I found options are available to make that executable code in RAM
in following link. 

 
 http://www.keil.com/support/docs/3228</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: How to run the function from RAM in keil.</title><link>https://community.arm.com/thread/118705?ContentTypeID=1</link><pubDate>Wed, 28 Dec 2016 04:19:45 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:d1e53df4-7fa2-41e6-9b48-eb0df2a34a42</guid><dc:creator>Westonsupermare Pier</dc:creator><description>&lt;p&gt;&lt;p&gt;
Then don&amp;#39;t use the same names. Use the memory method, or have the
linker place the function in RAM in the first place.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to run the function from RAM in keil.</title><link>https://community.arm.com/thread/93864?ContentTypeID=1</link><pubDate>Tue, 27 Dec 2016 21:49:14 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:3125c6b2-9e6e-43b2-b2f2-57e7375227dd</guid><dc:creator>alagappan muthiah</dc:creator><description>&lt;p&gt;&lt;p&gt;
Thanks Pier,&lt;/p&gt;

&lt;p&gt;
As you suggested i tried. But i have doubt, how the function
definition of Func() can be assigned to RAM address.&lt;/p&gt;

&lt;p&gt;
typedef void (*pFunction)(void);&lt;/p&gt;

&lt;p&gt;
pFunction pF1 = Func;&lt;/p&gt;

&lt;p&gt;
/* definition of Func() */&lt;/p&gt;

&lt;p&gt;
void Func(void)&lt;br /&gt;
{&lt;/p&gt;

&lt;p&gt;
}&lt;br /&gt;
here the address of Func can be assigned to function pointer
pFunction. But adding this line &amp;quot;Func = (pFunction)&amp;amp;Buffer[1];&amp;quot;
is giving error saying redefinition of function Func.&lt;/p&gt;

&lt;p&gt;
How can i assign the RAM address (referred by Buffer) to the
function defined Func()&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to run the function from RAM in keil.</title><link>https://community.arm.com/thread/65218?ContentTypeID=1</link><pubDate>Mon, 26 Dec 2016 05:38:58 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:a8707eaa-95c0-4558-bfe5-92e50cbdd786</guid><dc:creator>Westonsupermare Pier</dc:creator><description>&lt;p&gt;&lt;p&gt;
Use a function pointer&lt;/p&gt;

&lt;pre&gt;
unsigned char *Buffer = (unsigned char *)0x20002000; // RAM address (you pick/allocate) EVEN alignment

typedef void (*pFunction)(void);

Func = (pFunction)&amp;amp;Buffer[1]; // ODD (+1) for Thumb code

Func();
&lt;/pre&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>