<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/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/"><channel><title>Using External Memory for Heap</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/31037/using-external-memory-for-heap</link><description> 
How do I configure the HEAP to be placed within the external
memory? 

 
I&amp;#39;m using an LPC1778 with 2MB external memory. I want the
controller to calculate an a*-algorithm on a bitmap (loaded from
sd-card). Thus, i need lots of dynamically allocated</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: Using External Memory for Heap</title><link>https://community.arm.com/thread/131076?ContentTypeID=1</link><pubDate>Tue, 11 Sep 2012 03:30:46 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:0092a619-44d9-4a1c-a125-3d71a05a0085</guid><dc:creator>Wouter Schol</dc:creator><description>&lt;p&gt;&lt;p&gt;
The heap and stack are initialized in the startup file.&lt;br /&gt;
since the external memory is initialized in a C function, this will
never work on that way. because the C function tries to use the stack
and heap (on the external memory) which isn&amp;#39;t initialized yet.&lt;/p&gt;

&lt;p&gt;
I&amp;#39;ve had the same problem with my EA lpc1788 dev board.&lt;br /&gt;
I&amp;#39;ve added the C function initialization of the external memory to
the startup file (in assembly)&lt;br /&gt;
The startup code will initialize the external memory and after that,
still in startup file, the Heap and Stack are placed in the external
memory.&lt;br /&gt;
when the program jumps to the C code functions, it will use the heap
and stack on the initialized external memory.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using External Memory for Heap</title><link>https://community.arm.com/thread/127702?ContentTypeID=1</link><pubDate>Fri, 31 Aug 2012 00:17:10 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:b5ca7a32-6b36-4dee-a719-a865bbcd8d66</guid><dc:creator>Tamiryan Michael</dc:creator><description>&lt;p&gt;&lt;p&gt;
If external RAM is initialized via a function call - unlike the
Keil LPC2400 implementation that are confined to the startup file -
and if the linker places the processor stack in external RAM rather
than internal RAM, you are dead once the code that initializes the
external RAM attempts to return, or even before that.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using External Memory for Heap</title><link>https://community.arm.com/thread/116970?ContentTypeID=1</link><pubDate>Fri, 31 Aug 2012 00:08:02 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:268bf2e2-864b-44e0-996f-24ffb8b3e72a</guid><dc:creator>Sascha Albrecht</dc:creator><description>&lt;p&gt;&lt;p&gt;
It works! Thank u so much!&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using External Memory for Heap</title><link>https://community.arm.com/thread/106310?ContentTypeID=1</link><pubDate>Thu, 30 Aug 2012 06:07:59 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:8747fdac-d079-4558-b361-bd20e98eb239</guid><dc:creator>Tamiryan Michael</dc:creator><description>&lt;p&gt;&lt;p&gt;
try adding this to RW_IRAM1 zone:&lt;/p&gt;

&lt;pre&gt;
x.o (STACK)
&lt;/pre&gt;

&lt;p&gt;
x = the name of your startup (.s) file.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using External Memory for Heap</title><link>https://community.arm.com/thread/80501?ContentTypeID=1</link><pubDate>Thu, 30 Aug 2012 04:20:49 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:6b5f3294-5a09-494b-93f0-bd5a7ed9812f</guid><dc:creator>Sascha Albrecht</dc:creator><description>&lt;p&gt;&lt;p&gt;
This is how my scatter file looks out now:&lt;/p&gt;

&lt;pre&gt;
LR_IROM1 0x00000000 0x00080000  {    ; load region size_region
  ER_IROM1 0x00000000 0x00080000  {  ; load address = execution address
   *.o (RESET, +First)
   *(InRoot$$Sections)
   .ANY (+RO)
  }
  RW_RAM1 0x80000000 0x00200000  {  ; RW data
   sram.o (+ZI +RW)
   .ANY (+RW +ZI)
  }
  RW_IRAM1 0x10000000 0x00010000  {
   .ANY (+RW +ZI)
  }
}
&lt;/pre&gt;

&lt;p&gt;
Unfortunately, if i try to Debug my program, i run into the
HardFaultHandler even before main() is called. Within the linker
options inside uVision4 i have deselected &amp;quot;Use Memory Layout from
Target Dialog&amp;quot; and set the R/W Base to 0x80000000. Has anyone an
idea?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using External Memory for Heap</title><link>https://community.arm.com/thread/61066?ContentTypeID=1</link><pubDate>Tue, 28 Aug 2012 05:46:34 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:9c741a85-573e-460d-b702-60b5915638d2</guid><dc:creator>Tamiryan Michael</dc:creator><description>&lt;p&gt;&lt;p&gt;
The linker should place your heap in external memory automatically
once its maximum size grows (.s file) and you use scatter loading and
place an .ANY (+RW +ZI) in it for the external memory execution
region.&lt;br /&gt;
I think the linker also emits symbols for this - something containing
&amp;quot;HEAP&amp;quot; maybe? Check your linker manual.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>