<?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>Problem with GNU compiler(2013q4) with SDK 6.1</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/6348/problem-with-gnu-compiler-2013q4-with-sdk-6-1</link><description>Hi , 
 I have a code like below. 
 __attribute__((used, long_call, section(&amp;quot;.data&amp;quot;))) void function_1()
{
 unsigned int a;
 unsigned int b[10];
 int c;


 c= a-((a/ 10)* 10);
 b[i] = c;
 a= a/10;
}
 
 when I tried to build I got the error</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 07 Apr 2015 09:31:58 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/6348/problem-with-gnu-compiler-2013q4-with-sdk-6-1" /><item><title>RE: Problem with GNU compiler(2013q4) with SDK 6.1</title><link>https://devzone.nordicsemi.com/thread/22126?ContentTypeID=1</link><pubDate>Tue, 07 Apr 2015 09:31:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2c8ab0e0-390d-4e52-95c5-97359069f09b</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;I didn&amp;#39;t say change long_calls to mlong_calls I said compile that .c file with the -mlong_calls (or possibly -mlong-calls) compile option which should make it use long calls for all calls OUT of that piece of c code. I believe the pragma just makes it use long calls for calls INTO that piece of c, which you had already with your attribute, which also put it in the data segment. So put that back, take the pragma out and add the compilation flag to that one .c module so that when it compiles you get something like&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;gcc -o out.o -mlong_calls out.c 
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That&amp;#39;s where you need it to be. If you check the assembler instead of BLX calls you should get an LDR to load the register and then a BL Rx.&lt;/p&gt;
&lt;p&gt;By the way you&amp;#39;re not necessarily helping yourself very much as the division library you are calling will still end up in Flash, so you&amp;#39;ll be back to Flash to execute that anyway.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with GNU compiler(2013q4) with SDK 6.1</title><link>https://devzone.nordicsemi.com/thread/22125?ContentTypeID=1</link><pubDate>Sat, 04 Apr 2015 11:22:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3ab0de26-05c4-4053-b8f6-6549bf3962b0</guid><dc:creator>Anand Ramashetty</dc:creator><description>&lt;p&gt;hi rk,&lt;/p&gt;
&lt;p&gt;I have used #pragma long_calls instead of &lt;strong&gt;attribute&lt;/strong&gt;((used, long_call, section(&amp;quot;.data&amp;quot;))) and it successfully built. But the function is not moved to RAM.&lt;/p&gt;
&lt;p&gt;Will it cause any issue?&lt;/p&gt;
&lt;p&gt;Regards,
Anand&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with GNU compiler(2013q4) with SDK 6.1</title><link>https://devzone.nordicsemi.com/thread/22124?ContentTypeID=1</link><pubDate>Sat, 04 Apr 2015 09:04:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5b3279b0-1eac-4cbb-9ea8-b13fecd89cc0</guid><dc:creator>Anand Ramashetty</dc:creator><description>&lt;p&gt;Hi RK,&lt;/p&gt;
&lt;p&gt;After changing the long_calls  to mlong_calls , the same error I am facing. Can you please tell me what could be the cause.&lt;/p&gt;
&lt;p&gt;Regards,
Anand&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with GNU compiler(2013q4) with SDK 6.1</title><link>https://devzone.nordicsemi.com/thread/22123?ContentTypeID=1</link><pubDate>Sat, 04 Apr 2015 08:53:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:88a355a6-b68a-474d-9107-7cf80cfeef37</guid><dc:creator>Anand Ramashetty</dc:creator><description>&lt;p&gt;Hi RK,&lt;/p&gt;
&lt;p&gt;Thanks a lot for your clarification. Nordic suggesting that if we execute code from RAM instead of flash will help in power consumption. So I am trying to execute code from RAM instead of Flash.&lt;/p&gt;
&lt;p&gt;Regards,
Anand&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with GNU compiler(2013q4) with SDK 6.1</title><link>https://devzone.nordicsemi.com/thread/22122?ContentTypeID=1</link><pubDate>Thu, 02 Apr 2015 23:25:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2c9942fe-73b4-40ca-a40e-60607aede2bc</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;When you post code can you please use the post-code button so it looks like code instead of a jumbled mess of text, it&amp;#39;s hard to read.&lt;/p&gt;
&lt;p&gt;You used long_call in your function_1 definition to ensure anyone calling it uses a full 32-bit call, because you&amp;#39;re putting it in the data segment. However you are then trying to call back to a normal system routine to do divide, which is in your code/text segment and is too far away for a normal&lt;/p&gt;
&lt;p&gt;&lt;code&gt;bl &amp;lt;immediate&amp;gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;instruction on ARM, so it fails at link time.&lt;/p&gt;
&lt;p&gt;If you compile the one .c file containing your RAM-based function with the &lt;code&gt;-mlong_calls&lt;/code&gt; option that will make the udiv calls full 32-bit.&lt;/p&gt;
&lt;p&gt;Why are you doing this anyway by the way? What&amp;#39;s the need to run the code out of RAM?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with GNU compiler(2013q4) with SDK 6.1</title><link>https://devzone.nordicsemi.com/thread/22121?ContentTypeID=1</link><pubDate>Thu, 02 Apr 2015 14:35:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eab99599-4bfc-4da5-afc1-4591e1be0422</guid><dc:creator>Anand Ramashetty</dc:creator><description>&lt;p&gt;I am using nRF51822 version 3.1 controller with SD110&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>