<?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 with GCC - Stacksize and Heapsize</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/3351/nrf51822-with-gcc---stacksize-and-heapsize</link><description>Using: 
 
 nRF51822 
 GCC 4.8.4 
 Nordic Sdk 5.2.0 
 and even Ole Morten&amp;#39;s nice pure-gcc setup 
 newlib-nano and -flto 
 
 Within the startup_nrf51.s I found something like this. 
 Sdk: 
 #ifdef __STACK_SIZE
 .equ Stack_Size, __STACK_SIZE</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 25 Apr 2017 18:50:35 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/3351/nrf51822-with-gcc---stacksize-and-heapsize" /><item><title>RE: nRF51822 with GCC - Stacksize and Heapsize</title><link>https://devzone.nordicsemi.com/thread/12214?ContentTypeID=1</link><pubDate>Tue, 25 Apr 2017 18:50:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1c452c2c-f71f-4a2e-be3f-27fd932d2814</guid><dc:creator>Lisandro Dami&amp;#225;n Nicanor P&amp;#233;rez Meyer</dc:creator><description>&lt;p&gt;Isn&amp;#39;t your _sbrk implementation faulty? What happens if increment is &amp;lt; 0?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF51822 with GCC - Stacksize and Heapsize</title><link>https://devzone.nordicsemi.com/thread/12213?ContentTypeID=1</link><pubDate>Wed, 25 Jan 2017 21:43:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bcc4d7af-1bd7-4195-832b-b5450c12f7e4</guid><dc:creator>Dave Hylands</dc:creator><description>&lt;p&gt;Normally, if a file ends in a capital S then gcc will run it through the pre-processor, and files which end in a small s are not.&lt;/p&gt;
&lt;p&gt;The -x assembler-with-cpp option tells gcc to run the file through the preprocessor.&lt;/p&gt;
&lt;p&gt;You need to make sure that you use the -c flag when calling gcc to assemble, otherwise it will also try to link (which is why you got the mysterious error about _exit)&lt;/p&gt;
&lt;p&gt;Adding -D__STACK_SIZE=2048 to ASMFLAGS (at least in the sample Makefile I looked at) seems to be working for me.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF51822 with GCC - Stacksize and Heapsize</title><link>https://devzone.nordicsemi.com/thread/12210?ContentTypeID=1</link><pubDate>Mon, 27 Oct 2014 14:53:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:90111d9d-5044-4a16-9b1f-d2bffe8d20b8</guid><dc:creator>Joe Merten</dc:creator><description>&lt;p&gt;Finally, I think that this issues should be fixed within the nordic sdk.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF51822 with GCC - Stacksize and Heapsize</title><link>https://devzone.nordicsemi.com/thread/12212?ContentTypeID=1</link><pubDate>Mon, 04 Aug 2014 23:10:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:556ff7bd-3e18-4731-b40f-729d42797fe2</guid><dc:creator>Clem Taylor</dc:creator><description>&lt;p&gt;For small firmware like this I generally compile everything in one call to gcc (no explicit object files). I had problems with &amp;quot;-x assembler-with-cpp&amp;quot; when using the compiler this way, so I changed the #ifdefs to .ifdef and I use: &amp;quot;-Wa,--defsym,__STACK_SIZE=4096&amp;quot;
to pass the stack size to the assembler.&lt;/p&gt;
&lt;p&gt;I also fill the heap and stack with 0xCDCDCDCD to make it easier to detect the high-water mark on the stack.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m not sure what malloc() you are using, but one newlibish implementation would test the end of the alloced region against the stack point to determine if it should fail. It would happily let malloc() away most of your stack.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF51822 with GCC - Stacksize and Heapsize</title><link>https://devzone.nordicsemi.com/thread/12211?ContentTypeID=1</link><pubDate>Mon, 04 Aug 2014 11:00:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:976eac00-27fd-4bf0-9a25-0214f1c179d5</guid><dc:creator>cocoa</dc:creator><description>&lt;p&gt;I have found, in  Nordic SDK 6.0, a  gcc makefile,  in experimental dir,  that uses the same way you have found.&lt;/p&gt;
&lt;p&gt;I think you are right.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;TARGET_CHIP := NRF51822_QFAA_CA
BOARD := BOARD_NRF6310
ASMFLAGS += -D__HEAP_SIZE=16 -D__STACK_SIZE=1024
CFLAGS += -DBLE_STACK_SUPPORT_REQD


C_SOURCE_FILES += main.c
...
...
...
...

include $(SDK_PATH)Source/templates/gcc/Makefile.common
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>