<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Heap and Dynamic Memory Allocation on K64F in Kinetis Design Studio</title>
    <link>https://community.nxp.com/t5/Kinetis-Design-Studio/Heap-and-Dynamic-Memory-Allocation-on-K64F/m-p/436996#M3958</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I'm using FRDM-K64F dev board and I would like to use the the Heap for large array data allocation.&lt;/P&gt;&lt;P&gt;I tried suggested settings for heap and stack in PE (like changing heap and stack in the PEx CPU Build panel) with no compiling errors but failing debugging at run time.&lt;/P&gt;&lt;P&gt;I would like to configure the heap&amp;nbsp; for using &lt;STRONG style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 15px; color: #373737;"&gt;.data &lt;/STRONG&gt;sections areas and allow malloc() to dynamically allocate arrays in this area.&lt;/P&gt;&lt;P&gt;I don't use any ROTS since I prefer bare metal configurations and programming with KDS and PEx without KSDK.&lt;/P&gt;&lt;P&gt;A user heap section specification like possible with FreeRTOS would be perfect but I don't know how to do it without.&lt;/P&gt;&lt;P&gt;Thank you for your help guys.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 08 Jun 2015 08:02:58 GMT</pubDate>
    <dc:creator>torquatocecchin</dc:creator>
    <dc:date>2015-06-08T08:02:58Z</dc:date>
    <item>
      <title>Heap and Dynamic Memory Allocation on K64F</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/Heap-and-Dynamic-Memory-Allocation-on-K64F/m-p/436996#M3958</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I'm using FRDM-K64F dev board and I would like to use the the Heap for large array data allocation.&lt;/P&gt;&lt;P&gt;I tried suggested settings for heap and stack in PE (like changing heap and stack in the PEx CPU Build panel) with no compiling errors but failing debugging at run time.&lt;/P&gt;&lt;P&gt;I would like to configure the heap&amp;nbsp; for using &lt;STRONG style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 15px; color: #373737;"&gt;.data &lt;/STRONG&gt;sections areas and allow malloc() to dynamically allocate arrays in this area.&lt;/P&gt;&lt;P&gt;I don't use any ROTS since I prefer bare metal configurations and programming with KDS and PEx without KSDK.&lt;/P&gt;&lt;P&gt;A user heap section specification like possible with FreeRTOS would be perfect but I don't know how to do it without.&lt;/P&gt;&lt;P&gt;Thank you for your help guys.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Jun 2015 08:02:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/Heap-and-Dynamic-Memory-Allocation-on-K64F/m-p/436996#M3958</guid>
      <dc:creator>torquatocecchin</dc:creator>
      <dc:date>2015-06-08T08:02:58Z</dc:date>
    </item>
    <item>
      <title>Re: Heap and Dynamic Memory Allocation on K64F</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/Heap-and-Dynamic-Memory-Allocation-on-K64F/m-p/436997#M3959</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Torquato, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you please show your configuration and code , and i will test on my side .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Alice&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Jun 2015 02:05:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/Heap-and-Dynamic-Memory-Allocation-on-K64F/m-p/436997#M3959</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2015-06-09T02:05:12Z</dc:date>
    </item>
    <item>
      <title>Re: Heap and Dynamic Memory Allocation on K64F</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/Heap-and-Dynamic-Memory-Allocation-on-K64F/m-p/436998#M3960</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alice.&lt;/P&gt;&lt;P&gt;Thanks for your the interest.&lt;/P&gt;&lt;P&gt;I kept the standard &lt;SPAN style="line-height: 19.0909080505371px;"&gt;memory &lt;/SPAN&gt;&lt;SPAN style="line-height: 1.5;"&gt;sections&amp;nbsp; config.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I tried changing the in the Build Options settings panel:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_0.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/23648i1850ABDE9FA98E3A/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_0.png" alt="pastedImage_0.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;the Heap amount from 0x0400 to upper values (0x0C00 or 0x1000) with no compiling and linking errors, but I have run time exceptions on isatty() call.&lt;/P&gt;&lt;P&gt;Following suggestions like described in &lt;A href="http://www.nongnu.org/avr-libc/user-manual/malloc.html" title="http://www.nongnu.org/avr-libc/user-manual/malloc.html"&gt;Memory Areas and Using malloc()&lt;/A&gt; , I tried to configure linker with -WI switch but I think that symbol definition is different from the one I used. I found other suggestions like reported in &lt;A href="http://stackoverflow.com/questions/15489641/use-no-heap-in-gnu-gcc" title="http://stackoverflow.com/questions/15489641/use-no-heap-in-gnu-gcc"&gt;compiler construction - use no heap in gnu gcc - Stack Overflow&lt;/A&gt;&amp;nbsp; and others without achieving more heap.&lt;/P&gt;&lt;P&gt;I'm testing the available memory amount with this simple function&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;uint32_t GetAvailableMemory(void)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; char *p;&lt;/P&gt;&lt;P&gt;&amp;nbsp; uint32_t siz = 1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; p = calloc(1,siz);&lt;/P&gt;&lt;P&gt;&amp;nbsp; while (p)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; siz++; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; p = realloc(p,siz);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; free(p);&lt;/P&gt;&lt;P&gt;&amp;nbsp; return siz;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At least I could follow tweaks like &lt;A href="http://www.cypress.com/?id=4&amp;amp;rID=39611" title="http://www.cypress.com/?id=4&amp;amp;rID=39611"&gt;Allocation of Variables at Absolute Address in RAM - Cypress &lt;/A&gt;using static or global pre-allocation &lt;/P&gt;&lt;P&gt;but I would like not to change malloc()-like calls because I'm generating C-code from a Matlab algorithm.&lt;/P&gt;&lt;P&gt;The .ld Linker file obviously reflects the PE config for I ask to generate linker code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 08:15:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/Heap-and-Dynamic-Memory-Allocation-on-K64F/m-p/436998#M3960</guid>
      <dc:creator>torquatocecchin</dc:creator>
      <dc:date>2015-06-11T08:15:59Z</dc:date>
    </item>
    <item>
      <title>Re: Heap and Dynamic Memory Allocation on K64F</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/Heap-and-Dynamic-Memory-Allocation-on-K64F/m-p/436999#M3961</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Torquato, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I test your code on my side , the realloc() function can work well,&amp;nbsp; while i don/t know why you use while(p) , does here the "P"can repeated by some other &lt;/P&gt;&lt;P&gt;cycle conditons?&lt;/P&gt;&lt;P&gt;And i'm sorry that i don't know where you think is wrong , could your&amp;nbsp; tell me ? and tell me the right situation you think ! thank !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Alice&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jun 2015 12:10:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/Heap-and-Dynamic-Memory-Allocation-on-K64F/m-p/436999#M3961</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2015-06-15T12:10:32Z</dc:date>
    </item>
  </channel>
</rss>

