AnsweredAssumed Answered

_task_restart() frees and corrupts stack

Question asked by Kevin Kramb on Feb 24, 2012
Latest reply on Mar 1, 2012 by Martin Kojtal

I'm using MQX 3.8 with Code Warrior 10.2 for a ColdFire MCF52258 project.

 

The MQX documentation says that _task_restart() is suppossed to restart the specified task with the same stack.  In my application, _task_restart() causes the specified task's stack to be freed.  The task does restart using a stack area near, but no exactly in the original location.  And since the memory is free it eventually gets allocated to other purposes, which causes the task's stack to become corrupted.

 

I have started to dig into the MQX code.  The _task_restart_func() routine seems to intentionally free the task's stack.  Then it attempts to rebuild the stack.  But it seems to calculate a size and location that is slightly different from the original.  And I don't see yet where it actually attempts to reallocate the memory.

 

Is this a problem with MQX or may I have done something wrong at a higher level?  If it's a problem with MQX has anyone already developed a fix?

 

Thanks,

 -- Kevin

 

Outcomes