<?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>MQX Software Solutions中的主题 Re: Using TWR-MEM with MQX/TWRK60N512</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/Using-TWR-MEM-with-MQX-TWRK60N512/m-p/195732#M4032</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi David,&lt;/P&gt;&lt;P&gt;The code you shared works fine. My use case however is different. I have got multiple tasks running for one. What I notice is that whether I create my memory pool before the tasks are created or if I create the memory pool for a particular task, the data at that memory pool is blank when control goes to another task.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The moment a memory pool is created there is a linked-list of available memory in that pool that is created along with a tag that indicates that the pool is valid. The moment I move into the say the first task&amp;nbsp; (given that I create the memory pool outside) however the contents of that memory pool are now blank (all zeroes) and so all mallocs then fail as a result since the memory is deemed to be invalid. Any pointers ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Akshaya&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 24 Sep 2012 13:56:27 GMT</pubDate>
    <dc:creator>Akshaya_Mukund</dc:creator>
    <dc:date>2012-09-24T13:56:27Z</dc:date>
    <item>
      <title>Using TWR-MEM with MQX/TWRK60N512</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Using-TWR-MEM-with-MQX-TWRK60N512/m-p/195729#M4029</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to increase the heap memory available to me in my application, for which purpose I got a TWR-MEM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For places where I want to use a different memory pool (the one from the TWR-MEM) I used the _mem_create_pool() with the External MRAM Base and Size as arguments.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;_mem_pool_id&amp;nbsp;&amp;nbsp;&amp;nbsp; _MRAM_pool_id;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;void mram_create_pool()&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;{&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt; _MRAM_pool_id = _mem_create_pool(BSP_EXTERNAL_MRAM_RAM_BASE, BSP_EXTERNAL_MRAM_RAM_SIZE);&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt; if(_MRAM_pool_id == NULL)&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt; {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; _task_block();&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt; }&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I then use the function as shown below for mallocs on the External SRAM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;pointer mram_alloc(int mem_size)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;{ &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt; return _mem_alloc_from(_MRAM_pool_id, mem_size); &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code I am using was something I got off the forum. (and thank you to the one who posted this)&lt;/P&gt;&lt;P&gt;The problem I am facing is that everytime I called the mram_alloc I end up with the hard-fault which is triggered by the _lwmem_alloc_internal() funciton in lwm_alli.c.&lt;/P&gt;&lt;P&gt;I feel I am doing something fundamentally wrong here. If anyone has any pointers I would appreciate it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Sep 2012 12:33:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Using-TWR-MEM-with-MQX-TWRK60N512/m-p/195729#M4029</guid>
      <dc:creator>Akshaya_Mukund</dc:creator>
      <dc:date>2012-09-18T12:33:31Z</dc:date>
    </item>
    <item>
      <title>Re: Using TWR-MEM with MQX/TWRK60N512</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Using-TWR-MEM-with-MQX-TWRK60N512/m-p/195730#M4030</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Akshaya,&lt;/P&gt;&lt;P&gt;I started with the mqx/examples/hello project and have attached the modified code.&lt;/P&gt;&lt;P&gt;I use the TWR-MCF52259 and the TWR-K60N612 kits with the TWR-MEM card that has MRAM.&lt;/P&gt;&lt;P&gt;I was able to create a second memory pool in the MRAM.&amp;nbsp; I then write to a block of MRAM and then read it back.&lt;/P&gt;&lt;P&gt;I did have to update the CW10.2 *.mem file to allow the debugger to have access to the MRAM space.&lt;/P&gt;&lt;P&gt;With the MCF52259 I had to also update the MQX to disable the watchdog in the twrmcf52259.h&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #define&lt;SPAN style="font-size: 10pt;"&gt; BSP_WATCHDOG_DISABLED 2&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #3f7f5f; font-size: 10pt;"&gt;//DES was 0...set to 2 to disable core watchdog&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3f7f5f; font-size: 10pt;"&gt;Lastly I did slow down the K60 flexbus timing by adding wait states in the init_hw.c of the twrk60n512 folder.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left"&gt;FB_CSCR_WS(6) |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;lt;-- new value&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3f7f5f; font-size: 10pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left"&gt;//DES FB_CSCR_WS(2) |&amp;nbsp; &amp;lt;-- old value&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Sep 2012 20:27:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Using-TWR-MEM-with-MQX-TWRK60N512/m-p/195730#M4030</guid>
      <dc:creator>DavidS</dc:creator>
      <dc:date>2012-09-20T20:27:31Z</dc:date>
    </item>
    <item>
      <title>Re: Using TWR-MEM with MQX/TWRK60N512</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Using-TWR-MEM-with-MQX-TWRK60N512/m-p/195731#M4031</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi David,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried using the code you shared (FYI the IDE I m using is Keil MDK). There doesn't seem to be any problem right until the point wherer the malloced memory is either writted or read. A hard_fault is triggered and program crashes. Any pointers ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I wanted to know if the MQX_USE_LWMEM_ALLOCATOR macro is set to 0 or 1 in your setup.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also do any switch settings need to be modified on the TWR-MEM. The only TWR-MEM specific changes I have done till now (in MQX) is to uncomment&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#define BSP_EXTERNAL_MRAM_RAM_SIZE ((uint_32)__EXTERNAL_MRAM_RAM_SIZE)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in twrk60n512.h and rebuild my libs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also is there any need to do a _mem_extend anywhere to extend the existing memory pool.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Sep 2012 06:46:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Using-TWR-MEM-with-MQX-TWRK60N512/m-p/195731#M4031</guid>
      <dc:creator>Akshaya_Mukund</dc:creator>
      <dc:date>2012-09-24T06:46:27Z</dc:date>
    </item>
    <item>
      <title>Re: Using TWR-MEM with MQX/TWRK60N512</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Using-TWR-MEM-with-MQX-TWRK60N512/m-p/195732#M4032</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi David,&lt;/P&gt;&lt;P&gt;The code you shared works fine. My use case however is different. I have got multiple tasks running for one. What I notice is that whether I create my memory pool before the tasks are created or if I create the memory pool for a particular task, the data at that memory pool is blank when control goes to another task.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The moment a memory pool is created there is a linked-list of available memory in that pool that is created along with a tag that indicates that the pool is valid. The moment I move into the say the first task&amp;nbsp; (given that I create the memory pool outside) however the contents of that memory pool are now blank (all zeroes) and so all mallocs then fail as a result since the memory is deemed to be invalid. Any pointers ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Akshaya&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Sep 2012 13:56:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Using-TWR-MEM-with-MQX-TWRK60N512/m-p/195732#M4032</guid>
      <dc:creator>Akshaya_Mukund</dc:creator>
      <dc:date>2012-09-24T13:56:27Z</dc:date>
    </item>
    <item>
      <title>Re: Using TWR-MEM with MQX/TWRK60N512</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Using-TWR-MEM-with-MQX-TWRK60N512/m-p/195733#M4033</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Akshaya,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P align="left"&gt;Mine is #define&lt;SPAN style="font-size: 10pt;"&gt; MQX_USE_LWMEM_ALLOCATOR 1&lt;/SPAN&gt;&lt;STRONG style="color: #7f0055; font-size: 10pt;"&gt;&lt;STRONG style="color: #7f0055; font-size: 10pt;"&gt;&lt;STRONG&gt;&amp;nbsp; .&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;SPAN style="color: #7f0055; font-size: 10pt;"&gt;I'm attaching picture of my TWR-MEM Rev B.&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;SPAN style="color: #7f0055; font-size: 10pt;"&gt;The CPU and serial card jumpered per the "MQX3.8/doc/FSL_MQX_getting_started.pdf" section 7.&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;SPAN style="color: #7f0055; font-size: 10pt;"&gt;I haven't tried the _Mem_extend pool but will add that to my to-do list.&lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;SPAN style="color: #7f0055; font-size: 10pt;"&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;SPAN style="color: #7f0055; font-size: 10pt;"&gt;David &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Sep 2012 18:45:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Using-TWR-MEM-with-MQX-TWRK60N512/m-p/195733#M4033</guid>
      <dc:creator>DavidS</dc:creator>
      <dc:date>2012-09-24T18:45:44Z</dc:date>
    </item>
    <item>
      <title>Re: Using TWR-MEM with MQX/TWRK60N512</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Using-TWR-MEM-with-MQX-TWRK60N512/m-p/195734#M4034</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Akshaya,&lt;/P&gt;&lt;P&gt;Can you simplify your app and post the file?&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Sep 2012 18:46:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Using-TWR-MEM-with-MQX-TWRK60N512/m-p/195734#M4034</guid>
      <dc:creator>DavidS</dc:creator>
      <dc:date>2012-09-24T18:46:50Z</dc:date>
    </item>
  </channel>
</rss>

