<?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>nRF51822 flash programming problem</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/10591/nrf51822-flash-programming-problem</link><description>My setups are: 
 RBL BLE Nano 
 nRF51_SDK_9.0.0_2e23562 
 Keil uVision V4.74.0.22 or gcc-arm-none-eabi-4_8-2014q2-20140609-win32 
 My design is to advertise a manufacturer specific data containing a reading from one of the analog channels. The hex</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 04 Dec 2015 13:42:20 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/10591/nrf51822-flash-programming-problem" /><item><title>RE: nRF51822 flash programming problem</title><link>https://devzone.nordicsemi.com/thread/39426?ContentTypeID=1</link><pubDate>Fri, 04 Dec 2015 13:42:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:99caf698-8f2f-4aba-8302-778caf46eba5</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;updated my answer above&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF51822 flash programming problem</title><link>https://devzone.nordicsemi.com/thread/39427?ContentTypeID=1</link><pubDate>Fri, 04 Dec 2015 08:22:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:284d9cf2-d066-4fd9-9066-e539c9a620ca</guid><dc:creator>Max</dc:creator><description>&lt;p&gt;I don&amp;#39;t understand linker description in your answer. Please elaborate how it affects 16KB-RAM vs. 32KB-RAM BLE Nano.&lt;/p&gt;
&lt;p&gt;Also, do you mean the examples in SDK 9 are for 32KB-RAM only? If so, how do I modify make file to work for xxAA chip.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF51822 flash programming problem</title><link>https://devzone.nordicsemi.com/thread/39425?ContentTypeID=1</link><pubDate>Thu, 03 Dec 2015 03:19:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:74cc050f-368c-4472-ab08-65c34759c1b2</guid><dc:creator>Max</dc:creator><description>&lt;p&gt;I found that the same gcc hex file works in 32KB-RAM Nano but fails in 16KB-RAM one. So I figure the hex compiled by gcc somehow requires more RAM usage. How do I check RAM size requirement?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF51822 flash programming problem</title><link>https://devzone.nordicsemi.com/thread/39424?ContentTypeID=1</link><pubDate>Wed, 02 Dec 2015 14:22:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4785e99b-f129-4a4e-95bd-bc3a24fea1e3</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Just so I understand correctly, the .hex built with GCC only fails run from time to time, or is it not working at all anymore? Also, is the &amp;quot;_build/app_button.o not found&amp;quot; error not consistent?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF51822 flash programming problem</title><link>https://devzone.nordicsemi.com/thread/39423?ContentTypeID=1</link><pubDate>Wed, 02 Dec 2015 14:13:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:abc1030f-3263-4936-bd3f-2b452036ce52</guid><dc:creator>Max</dc:creator><description>&lt;p&gt;I didn&amp;#39;t modify the .ld file. Both 16K-RAM and 32K-RAM versions of BLE Nano have the same problem. What puzzles me is that Keil-compiled hex (the same c source codes) works although its hex file is smaller than gcc-compiled one (55KB vs 89KB).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF51822 flash programming problem</title><link>https://devzone.nordicsemi.com/thread/39422?ContentTypeID=1</link><pubDate>Wed, 02 Dec 2015 11:47:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a49168e3-d7f8-44bf-8e75-0ff3600d701f</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Do you have any other makefiles in the same directory where you call Make? I think it&amp;#39;s strange that the &amp;quot;_build/app_button.o not found&amp;quot; error is not consistent for every build.&lt;/p&gt;
&lt;p&gt;Unrelated to the build error, but have you adjusted the linker settings in the .ld script? The examples are by default configured for the xxAC chip variant which as 32K of RAM as opposed to 16K on the RBL BLE Nano i think (&lt;a href="http://infocenter.nordicsemi.com/pdf/nRF51_Series_Compatibility_Matrix_v2.5.pdf"&gt;chip overview&lt;/a&gt;). The gnu linker places the call stack in top of RAM rather than on top of the application region as with Keil.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;UPDATE 4/12 - 2015&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Attached the image below to better illustrate the difference between Keil projects and GCC projects in how the call stack is being linked. Also see the softdevice specification &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.130.sds.v1.0.0/sd_resource_reqs/mem_resource_map_usage.html?cp=2_7_2_0_10_1"&gt;here&lt;/a&gt; for more details.&lt;/p&gt;
&lt;p&gt;Point is that an application configured for 32K of RAM may still run on a 16K part when using Keil as the call stack may still be placed below the 16K limit (0x20004000 - depends on the size of the application RAM), and with GNU it will always be linked to the top of RAM regardless. Thus, outside of the available RAM. It&amp;#39;s  important to always have the correct linker settings  part your are targeting in order to get a linker warning in case you are running out of memory.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/call-stack.png" alt="image description" /&gt;&lt;/p&gt;
&lt;p&gt;You can edit the linker file to adjust the memory layout. For GCC you do it in the .ld script typically located in the same directory as the Makefile.&lt;/p&gt;
&lt;p&gt;Example .ld file for 256K/32K RAM variants running s110 v.8.0.0:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;MEMORY
{
  FLASH (rx) : ORIGIN = 0x18000, LENGTH = 0x28000
  RAM (rwx) :  ORIGIN = 0x20002000, LENGTH = 0x6000
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and same for 256K/16K:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;MEMORY
{
  FLASH (rx) : ORIGIN = 0x18000, LENGTH = 0x28000
  RAM (rwx) :  ORIGIN = 0x20002000, LENGTH = 0x2000
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>