<?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>The S120 APP RAM is not enough for RSA calculation</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/7851/the-s120-app-ram-is-not-enough-for-rsa-calculation</link><description>Hi, 
 I want do RSA on NRF51822. The build environment is GCC. And the develop base on S120. The RSA need 1K to do calculation. If I enable the RSA calculation, the APP may have some tricky problem. 
 I want to decrease the RAM using. But all is needed</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 29 Jun 2015 14:28:09 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/7851/the-s120-app-ram-is-not-enough-for-rsa-calculation" /><item><title>RE: The S120 APP RAM is not enough for RSA calculation</title><link>https://devzone.nordicsemi.com/thread/27981?ContentTypeID=1</link><pubDate>Mon, 29 Jun 2015 14:28:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d5991318-9bb0-4e14-a0a5-b314c5853b0c</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@bihu: Setting the stack size of 512 byte maybe not a very good idea. As described in the S110 Spec, in worst case it would need 1.5kB call stack.&lt;/p&gt;
&lt;p&gt;If you don&amp;#39;t have many characteristics, service, and with small value size, you may want to consider to reduce the size of the attribute table to have some more RAM for the application.&lt;/p&gt;
&lt;p&gt;The default attribute table size is 0x700 bytes and the minimum you can reduce to  is 216 bytes. The extra saved RAM can be retreived by modifying the IRAM layout (0x20002000).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: The S120 APP RAM is not enough for RSA calculation</title><link>https://devzone.nordicsemi.com/thread/27980?ContentTypeID=1</link><pubDate>Mon, 29 Jun 2015 01:43:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3f9db1ea-c620-45a8-b418-70f2a11901d5</guid><dc:creator>bihu</dc:creator><description>&lt;p&gt;I see. I already set heap size as 0. And I try to set stack size as 512, and the APP can works. Does this makes potential problems?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: The S120 APP RAM is not enough for RSA calculation</title><link>https://devzone.nordicsemi.com/thread/27982?ContentTypeID=1</link><pubDate>Sat, 27 Jun 2015 07:22:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8bf198b1-81c0-4cb5-8dd4-4231e2fe4a9c</guid><dc:creator>Nenik</dc:creator><description>&lt;p&gt;Are you using a static buffer for the RSA, dynamically allocated one or stack allocated one?
I can easily imaging problems stemming from taking 1kB out of stack, as in:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;my_handler() {
    char rsa_value[1024];
    perform_math(&amp;amp;rsa_value);
    ...
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For a statically allocated buffer, you should be able to verify the compiler-generated memory map...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: The S120 APP RAM is not enough for RSA calculation</title><link>https://devzone.nordicsemi.com/thread/27979?ContentTypeID=1</link><pubDate>Fri, 26 Jun 2015 12:19:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:db3f9b9f-5b43-4a1c-8161-cfd281ec7ad0</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@Bihu: which &amp;quot;reserved 2K&amp;quot; you talked about ? Did you mean 8k  ?&lt;/p&gt;
&lt;p&gt;The nRF51 has 16kB Ram but the S110 stack already used (and blocked) 8KB. That&amp;#39;s why in the application you only have 8kB left. Note in that 8kB you would need to spare 1.5kB for the call stack for the stack (documented in the Softdevice spec)&lt;/p&gt;
&lt;p&gt;If you are running out of memory and if you don&amp;#39;t use any dynamic allocated memory (malloc) you can reduce the heap_size in gcc_startup_nrf51.s. We are currently leave it at 2048 byte. You can set it to 0 if you don&amp;#39;t plan to use malloc.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>