<?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: _task_restart() frees and corrupts stack</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/task-restart-frees-and-corrupts-stack/m-p/209745#M5111</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've figured out my problem with _task_restart().&amp;nbsp; I was using MXQ v3.8 beta 2 and this was a bug in the beta.&amp;nbsp; But it has been fixed in the official release of MXQ v3.8.&amp;nbsp; Since upgrading MXQ to the official release, _task_restart() now calculates the correct size and location of the stack and it does not free the stack*.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;*&amp;nbsp;MQX_ALLOW_TYPED_MEMORY&amp;nbsp;and MQX_CHECK_MEMORY_ALLOCATION_ERRORS must be defined as 1 in order for _task_restart() to handle the stack correctly.&amp;nbsp; This is the default behavior in mqx_cnfg.h but if you define either as 0 in your user_config.h then _task_restart() will free the stack, which will lead to eventual stack corruption.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 01 Mar 2012 05:55:55 GMT</pubDate>
    <dc:creator>kkramb</dc:creator>
    <dc:date>2012-03-01T05:55:55Z</dc:date>
    <item>
      <title>_task_restart() frees and corrupts stack</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/task-restart-frees-and-corrupts-stack/m-p/209744#M5110</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm using MQX 3.8 with Code Warrior 10.2 for a ColdFire MCF52258&amp;nbsp;project.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The MQX documentation says that _task_restart() is suppossed to restart the specified task with the same stack.&amp;nbsp; In my application, _task_restart() causes the specified task's stack to be freed.&amp;nbsp; The task does restart using a stack area near, but no exactly in the original location.&amp;nbsp; And since the memory is free it eventually gets allocated to other purposes, which&amp;nbsp;causes the task's stack to become corrupted.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have started to dig into the MQX code.&amp;nbsp; The _task_restart_func() routine seems to intentionally free the task's stack.&amp;nbsp; Then it attempts to rebuild the stack.&amp;nbsp; But it seems to calculate a size and location that is slightly different from the original.&amp;nbsp; And I don't see yet where it actually attempts to reallocate the memory.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this a problem with MQX or may&amp;nbsp;I have done something wrong at a higher level?&amp;nbsp; If it's a problem with MQX has anyone already developed a fix?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;-- Kevin&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Feb 2012 23:15:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/task-restart-frees-and-corrupts-stack/m-p/209744#M5110</guid>
      <dc:creator>kkramb</dc:creator>
      <dc:date>2012-02-24T23:15:42Z</dc:date>
    </item>
    <item>
      <title>Re: _task_restart() frees and corrupts stack</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/task-restart-frees-and-corrupts-stack/m-p/209745#M5111</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've figured out my problem with _task_restart().&amp;nbsp; I was using MXQ v3.8 beta 2 and this was a bug in the beta.&amp;nbsp; But it has been fixed in the official release of MXQ v3.8.&amp;nbsp; Since upgrading MXQ to the official release, _task_restart() now calculates the correct size and location of the stack and it does not free the stack*.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;*&amp;nbsp;MQX_ALLOW_TYPED_MEMORY&amp;nbsp;and MQX_CHECK_MEMORY_ALLOCATION_ERRORS must be defined as 1 in order for _task_restart() to handle the stack correctly.&amp;nbsp; This is the default behavior in mqx_cnfg.h but if you define either as 0 in your user_config.h then _task_restart() will free the stack, which will lead to eventual stack corruption.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Mar 2012 05:55:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/task-restart-frees-and-corrupts-stack/m-p/209745#M5111</guid>
      <dc:creator>kkramb</dc:creator>
      <dc:date>2012-03-01T05:55:55Z</dc:date>
    </item>
    <item>
      <title>Re: _task_restart() frees and corrupts stack</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/task-restart-frees-and-corrupts-stack/m-p/209746#M5112</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;ÂµManaged,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for providing an explanation how you solved the problem, it might help others !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;MartinK&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Mar 2012 17:38:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/task-restart-frees-and-corrupts-stack/m-p/209746#M5112</guid>
      <dc:creator>c0170</dc:creator>
      <dc:date>2012-03-01T17:38:32Z</dc:date>
    </item>
  </channel>
</rss>

