AnsweredAssumed Answered

MQX not restoring the stack on K70 Tower?

Question asked by Larry5335 on Aug 26, 2015
Latest reply on Dec 14, 2017 by Dawei You

Customer created a very small test program to recreate the issue on the tower using MK70FN1M0VMJ12 mask 4N96B. Running this test program recreates the issue very quickly and very often.

 

What seems to be happening is that when a task is performing work using the floating point registers and it is interrupted by another task of higher priority that also uses the same floating point registers, then the lower priority task ends up with corrupted data in those floating point registers. For example, this code returns true very often:

 

test = 0.5f;

        if(test < 0.4f || test > 0.6f)

        {

retVal++;

        }

        else

        {

retVal++;

        }

 

If you look at the screen shots, you can see that the floating point register S0 is being used by the lower priority task. Then after a context switch, the higher priority task uses the same register. Then when the lower priority task resumes, the register S0 has the wrong value. If I make the tasks the same priority or I do this:

 

_int_disable();

        test = 0.5f;

        if(test < 0.4f || test > 0.6f)

        {

retVal++;

        }

        else

        {

retVal++;

        }

        _int_enable();

 

Then everything works fine. It’s like the RTOS is not restoring the stack properly. Can you please help us with this issue?

Original Attachment has been moved to: BugTest-(2).zip

Outcomes