<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/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/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>How to execute code from RAM on nRF51</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/5413/how-to-execute-code-from-ram-on-nrf51</link><description>According to nRF51822/nRF51422 PS v3.1 table 34, current consumption can be decreased by executing code from RAM instead of from flash. How is it possible to execute code from RAM?</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 03 Sep 2021 12:51:11 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/5413/how-to-execute-code-from-ram-on-nrf51" /><item><title>RE: How to execute code from RAM on nRF51</title><link>https://devzone.nordicsemi.com/thread/327978?ContentTypeID=1</link><pubDate>Fri, 03 Sep 2021 12:51:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:66bf6d1a-e3fb-4681-866f-d57cf88883e9</guid><dc:creator>Burnie Barren</dc:creator><description>&lt;p&gt;That would be much appreciated!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to execute code from RAM on nRF51</title><link>https://devzone.nordicsemi.com/thread/187562?ContentTypeID=1</link><pubDate>Thu, 16 May 2019 13:58:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b65727c0-9df3-471a-9cab-0728c8fda06b</guid><dc:creator>Jaehong Park</dc:creator><description>&lt;p&gt;&lt;span&gt;Good1 Is it possible to add instructions for us who don&amp;#39;t have KEIL, but use SES now? Thanks!&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to execute code from RAM on nRF51</title><link>https://devzone.nordicsemi.com/thread/18898?ContentTypeID=1</link><pubDate>Thu, 28 May 2015 14:18:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d2ddacb6-2d72-400e-9eff-9921dacd9111</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;Hi. We did not make time yet to dig into how to do this for GCC. Hopefully, someone can share info on that.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to execute code from RAM on nRF51</title><link>https://devzone.nordicsemi.com/thread/18897?ContentTypeID=1</link><pubDate>Wed, 27 May 2015 13:33:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4ab8ea7c-f05d-4667-8515-82eabc174fbd</guid><dc:creator>Emil</dc:creator><description>&lt;p&gt;Nice! Is it possible to add instructions for us who don&amp;#39;t have KEIL, but use makefiles and GCC?
Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to execute code from RAM on nRF51</title><link>https://devzone.nordicsemi.com/thread/18896?ContentTypeID=1</link><pubDate>Mon, 16 Mar 2015 10:26:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:01dafa58-32ee-4562-b12c-4b03400913dc</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;I have not tried exectute code from RAM using IAR but I can see there is some guide in the IAR C/C++ Development Guide, twelfth edition, page 64 and page 99, available when you click help-&amp;gt;C/C++ Development Guide in the IAR IDE.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to execute code from RAM on nRF51</title><link>https://devzone.nordicsemi.com/thread/18895?ContentTypeID=1</link><pubDate>Sat, 14 Mar 2015 16:44:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:128e643b-9db8-4a16-b352-79d0245917e2</guid><dc:creator>MANGO</dc:creator><description>&lt;p&gt;Nice tutorial! I really appreciate you.&lt;/p&gt;
&lt;p&gt;I have a question. I&amp;#39;m using IAR for ARM (in Windows 7) and GCC (in Fedora 13) when I work with my board.&lt;/p&gt;
&lt;p&gt;Then what settings should be needed when I want to run my codes in the RAM?&lt;/p&gt;
&lt;p&gt;I&amp;#39;m using Softdevice S110 7.1 and SDK 7.2 .&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to execute code from RAM on nRF51</title><link>https://devzone.nordicsemi.com/thread/18894?ContentTypeID=1</link><pubDate>Tue, 03 Feb 2015 10:11:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3b6f470b-df20-425c-a35c-cb2b2de0166c</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;First you must define a specfic RAM block, then you need to assign your code to that RAM block.&lt;/p&gt;
&lt;p&gt;RAM block layout is described in nRF51822/nRF51422 PS v3.1, table 6 and table 7. So the way to do this is to devide the RAM into two sections in Keil -&amp;gt; Options for Target and then assign the spi_slave.c RAM to the IRAM2 section as shown in the following images.&lt;/p&gt;
&lt;p&gt;RAM configuration for S110 softdevice, 32kB RAM (e.g. nRF51 QFAC variant) could be:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/3531.Capture-_2D00_-RAM-sections-seperation-in-KEIL-_2D00_-S110-_2D00_-32kB-RAM.JPG" alt="image description" /&gt;&lt;/p&gt;
&lt;p&gt;RAM configuration for S110 softdevice, 16kB RAM (e.g. nRF51 QFAA variant) could be:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/1423.Capture-_2D00_-RAM-sections-seperation-in-KEIL-_2D00_-S110-_2D00_-16kB-RAM.JPG" alt="image description" /&gt;&lt;/p&gt;
&lt;p&gt;Right click the source code file in Keil and select &amp;quot;Options for File &amp;#39;main.c&amp;#39; if you want to place source code for main.c into RAM:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/Capture-_2D00_-Keil-code-to-RAM.JPG" alt="image description" /&gt;&lt;/p&gt;
&lt;p&gt;Note that different softdevices reserve RAM space on the chip so there is limited amount of RAM remaining for the application, especially for 16kB RAM variants. The above configuration may be different for other softdevices as they use different amount of RAM, see Softdevice Specification (SDS) for the relevant softdevice, chapter about resource usage. Compatibility of different SDS&amp;#39;s and softdevices is listed in the &lt;a href="https://www.nordicsemi.com/eng/nordic/Products/nRF51822/ATTN-51/41917"&gt;nRF51 compatibility matrix&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Also note that 2kB is reserved from the application RAM space for the softdevice and application stacks, see &lt;a href="https://devzone.nordicsemi.com/question/1088/putting-my-app-on-a-ram-memory-diet/"&gt;this thread&lt;/a&gt; and &lt;a href="https://devzone.nordicsemi.com/question/21787/available-ram-for-the-application/"&gt;this thread&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Make sure to allocate enough RAM space for the source code that you assign to RAM. It can be seen in the .map file in the _build folder how much RAM is actually used by the source file that are assigned to RAM.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>