<?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>CodeWarrior for StarCoreのトピックRe: Issue with fopen()/malloc() function in CW v3.0 (CW IDE version 5.7.0) in 8144</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-StarCore/Issue-with-fopen-malloc-function-in-CW-v3-0-CW-IDE-version-5-7-0/m-p/202236#M299</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you comment out the fopen() in the loop, does the program work, as much as can be expected without the use of that function? The fact that you say the fopen() fails to work in the loop yet works outside of the loop, makes me think that something in the loop code is the culprit. Somehow it's creating a memory leak, or perhaps calling fopen() so often that you run out of memory.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;---Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 21 May 2010 19:18:14 GMT</pubDate>
    <dc:creator>J2MEJediMaster</dc:creator>
    <dc:date>2010-05-21T19:18:14Z</dc:date>
    <item>
      <title>Issue with fopen()/malloc() function in CW v3.0 (CW IDE version 5.7.0) in 8144</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-StarCore/Issue-with-fopen-malloc-function-in-CW-v3-0-CW-IDE-version-5-7-0/m-p/202233#M296</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using code warrior 3.0 for my project.&amp;nbsp;&lt;/P&gt;&lt;P&gt;In that i am using fopen functionality.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While debugging , when it enters the first &amp;nbsp;&lt;STRONG style=": ; color: #FF0000;"&gt;fopen()&lt;/STRONG&gt;&amp;nbsp;after my &lt;SPAN style="color: #FF0000;"&gt;'int main()'&lt;/SPAN&gt;, no problem for my application (it works fine).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But at the second time (in a while loop) , when it enters in &lt;STRONG&gt;&lt;SPAN style="color: #FF0000;"&gt;fopen()&lt;/SPAN&gt;,&lt;/STRONG&gt; &amp;nbsp;goes to the following function in&amp;nbsp;&lt;STRONG style=": ; color: #FF0000;"&gt;msc814x_intr_vectors.asm&lt;/STRONG&gt; file&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #FF0000;"&gt;;Entry 5 Reserved &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #FF0000;"&gt;jmp&lt;/SPAN&gt;&lt;SPAN style="color: #FF0000;"&gt;&amp;gt;___EmptyIntHandler&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style=": ; color: #FF0000;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #FF0000;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;dup 29&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #FF0000;"&gt;nop&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #FF0000;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;endm&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When i traced the path , i found as ,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;from &lt;SPAN style="color: #FF0000;"&gt;fopen()&lt;/SPAN&gt; in my application&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;to&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #FF0000;"&gt;fopen() in C:\Program Files\Freescale\CodeWarrior\StarCore_Support\compiler\src\rtlib\expanded\fopen_common.c&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;to&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #FF0000;"&gt;__do_open() in&amp;nbsp;C:\Program Files\Freescale\CodeWarrior\StarCore_Support\compiler\src\rtlib\expanded\fopen_common.c&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;to&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #FF0000;"&gt;malloc() in&amp;nbsp;C:\Program Files\Freescale\CodeWarrior\StarCore_Support\compiler\src\rtlib\expanded\maloc_common.c&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From this &lt;SPAN style="color: #FF0000;"&gt;malloc()&lt;/SPAN&gt; function it is going to the exception (finally stuck &amp;nbsp; &lt;SPAN aria-label="Sad" class="emoticon_sad emoticon-inline" style="height:16px;width:16px;"&gt;&lt;/SPAN&gt; ) goes to&amp;nbsp;&lt;STRONG style=": ; color: #FF0000;"&gt;msc814x_intr_vectors.asm&lt;SPAN style="color: #808000;"&gt;&lt;SPAN&gt;file&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here am pasting the code stuff of &lt;SPAN style="color: #FF0000;"&gt;malloc()&lt;/SPAN&gt; stuck area (Inside the while() loop )from the &lt;SPAN style="color: #FF0000;"&gt;maloc_common.c&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/* First: attempt to allocate the buffer from the existing pool with a&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; minimum of wasted space. */&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #FF0000;"&gt;while ( NULL != p )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #FF0000;"&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #FF0000;"&gt;&amp;nbsp;&amp;nbsp;if ( NO == p-&amp;gt;used &amp;amp;&amp;amp; nbytes &amp;lt;= p-&amp;gt;size &amp;amp;&amp;amp; waste &amp;gt; ( p-&amp;gt;size - nbytes ) )&lt;/SPAN&gt; &lt;STRONG style=": ; color: #339966;"&gt;=&amp;gt; throws exception from this area&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #FF0000;"&gt;&amp;nbsp;&amp;nbsp;waste = p-&amp;gt;size - nbytes, best_fit = p;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #FF0000;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #FF0000;"&gt;&amp;nbsp;&amp;nbsp;p = p-&amp;gt;lnk; &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #FF0000;"&gt;&amp;nbsp;&amp;nbsp;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't know why this happens in the second time when &lt;SPAN style="color: #FF0000;"&gt;fopen()&lt;/SPAN&gt; &amp;nbsp;calls.&lt;/P&gt;&lt;P&gt;Can any one help me out in solving this problem?&lt;/P&gt;&lt;P&gt;This is the whole issue .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/renjith_g&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 May 2010 22:02:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-StarCore/Issue-with-fopen-malloc-function-in-CW-v3-0-CW-IDE-version-5-7-0/m-p/202233#M296</guid>
      <dc:creator>kanu__</dc:creator>
      <dc:date>2010-05-19T22:02:58Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with fopen()/malloc() function in CW v3.0 (CW IDE version 5.7.0) in 8144</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-StarCore/Issue-with-fopen-malloc-function-in-CW-v3-0-CW-IDE-version-5-7-0/m-p/202234#M297</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The empty interrupt handler is a catch-all for when the program gets lost and is out in the weeds. The fact that fopen() works initially but dies in a loop makes me thing that your loop code is doing something that makes fopen() run out of memory (hence the malloc() call). What does your loop code look like?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;---Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 May 2010 19:28:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-StarCore/Issue-with-fopen-malloc-function-in-CW-v3-0-CW-IDE-version-5-7-0/m-p/202234#M297</guid>
      <dc:creator>J2MEJediMaster</dc:creator>
      <dc:date>2010-05-20T19:28:28Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with fopen()/malloc() function in CW v3.0 (CW IDE version 5.7.0) in 8144</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-StarCore/Issue-with-fopen-malloc-function-in-CW-v3-0-CW-IDE-version-5-7-0/m-p/202235#M298</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is my custom embedded application taking some memory.Also how can prevent this exception at fopen()? ( or how can i give enough / more memory fopen() ?)&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can i find/control the memory overflow ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/Kanu__&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 May 2010 22:28:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-StarCore/Issue-with-fopen-malloc-function-in-CW-v3-0-CW-IDE-version-5-7-0/m-p/202235#M298</guid>
      <dc:creator>kanu__</dc:creator>
      <dc:date>2010-05-20T22:28:39Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with fopen()/malloc() function in CW v3.0 (CW IDE version 5.7.0) in 8144</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-StarCore/Issue-with-fopen-malloc-function-in-CW-v3-0-CW-IDE-version-5-7-0/m-p/202236#M299</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you comment out the fopen() in the loop, does the program work, as much as can be expected without the use of that function? The fact that you say the fopen() fails to work in the loop yet works outside of the loop, makes me think that something in the loop code is the culprit. Somehow it's creating a memory leak, or perhaps calling fopen() so often that you run out of memory.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;---Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 May 2010 19:18:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-StarCore/Issue-with-fopen-malloc-function-in-CW-v3-0-CW-IDE-version-5-7-0/m-p/202236#M299</guid>
      <dc:creator>J2MEJediMaster</dc:creator>
      <dc:date>2010-05-21T19:18:14Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with fopen()/malloc() function in CW v3.0 (CW IDE version 5.7.0) in 8144</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-StarCore/Issue-with-fopen-malloc-function-in-CW-v3-0-CW-IDE-version-5-7-0/m-p/202237#M300</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The application is very well depend on the fopen() call. So not able to realize without it.&lt;/P&gt;&lt;P&gt;As like your suggestion , may be my loop code is having some leakage.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now am analyzing that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Which are all places , should i give more importances to find the leakage?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What are the memory constraints in board /simulator?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/Kanu__&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 May 2010 19:27:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-StarCore/Issue-with-fopen-malloc-function-in-CW-v3-0-CW-IDE-version-5-7-0/m-p/202237#M300</guid>
      <dc:creator>kanu__</dc:creator>
      <dc:date>2010-05-21T19:27:17Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with fopen()/malloc() function in CW v3.0 (CW IDE version 5.7.0) in 8144</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-StarCore/Issue-with-fopen-malloc-function-in-CW-v3-0-CW-IDE-version-5-7-0/m-p/202238#M301</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;No other replies yet?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/Kanu__&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 May 2010 18:07:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-StarCore/Issue-with-fopen-malloc-function-in-CW-v3-0-CW-IDE-version-5-7-0/m-p/202238#M301</guid>
      <dc:creator>kanu__</dc:creator>
      <dc:date>2010-05-24T18:07:47Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with fopen()/malloc() function in CW v3.0 (CW IDE version 5.7.0) in 8144</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-StarCore/Issue-with-fopen-malloc-function-in-CW-v3-0-CW-IDE-version-5-7-0/m-p/202239#M302</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Did you check the sample project in {Install}/(CodeWarrior_Examples)\StarCore_Examples\FileIO?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As far as I know they are using fopen.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CrasyCat&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 May 2010 22:14:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-StarCore/Issue-with-fopen-malloc-function-in-CW-v3-0-CW-IDE-version-5-7-0/m-p/202239#M302</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2010-05-25T22:14:26Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with fopen()/malloc() function in CW v3.0 (CW IDE version 5.7.0) in 8144</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-StarCore/Issue-with-fopen-malloc-function-in-CW-v3-0-CW-IDE-version-5-7-0/m-p/202240#M303</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;hi ,&lt;/P&gt;&lt;P&gt;yes i tried the three example projects in the above directory.&lt;/P&gt;&lt;P&gt;They are working fine and completed successfully.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/Kanu__&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 May 2010 12:06:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-StarCore/Issue-with-fopen-malloc-function-in-CW-v3-0-CW-IDE-version-5-7-0/m-p/202240#M303</guid>
      <dc:creator>kanu__</dc:creator>
      <dc:date>2010-05-26T12:06:25Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with fopen()/malloc() function in CW v3.0 (CW IDE version 5.7.0) in 8144</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-StarCore/Issue-with-fopen-malloc-function-in-CW-v3-0-CW-IDE-version-5-7-0/m-p/202241#M304</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you make sure that you increase the heap this is what affects the fopen() function?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 May 2010 22:11:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-StarCore/Issue-with-fopen-malloc-function-in-CW-v3-0-CW-IDE-version-5-7-0/m-p/202241#M304</guid>
      <dc:creator>Irene</dc:creator>
      <dc:date>2010-05-26T22:11:17Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with fopen()/malloc() function in CW v3.0 (CW IDE version 5.7.0) in 8144</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-StarCore/Issue-with-fopen-malloc-function-in-CW-v3-0-CW-IDE-version-5-7-0/m-p/202242#M305</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please &amp;nbsp;describe a little bit more on that , ie heap memory which is relating with fopen()?&lt;/P&gt;&lt;P&gt;I haven't &amp;nbsp;touched the heap size control parameter in my code /configuration file .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also from where i need to start my debugging ?&lt;/P&gt;&lt;P&gt;/Kanu__&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 May 2010 11:57:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-StarCore/Issue-with-fopen-malloc-function-in-CW-v3-0-CW-IDE-version-5-7-0/m-p/202242#M305</guid>
      <dc:creator>kanu__</dc:creator>
      <dc:date>2010-05-27T11:57:43Z</dc:date>
    </item>
  </channel>
</rss>

