This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

  • Resolved

Interrupt Context Saving Problem

Prodigy 150 points

Replies: 2

Views: 2599

I'm having an issue with my code not running as expected, and have narrowed it down to the fact that some registers are not being saved during context switching to an ISR.  The register in question is related to the floating point unit, namely the FPSCR register.  Because the ISR interrupting my code also uses the floating point unit, it is altering this register, and once the ISR exits, I'm failing a compare operation in my original code that is looking at the flags contained in this register.

Looking at the assembly for the ISR in question, the following context saving instructions are occuring:

STMFD           R13!, {R0, R1, R2, R3, R12, R14}
FSTMDBD         R13!, {D0-D7}

I believe that the D0-D7 registers indicate that is saving some of the VFP registers, however, shouldn't it also be saving the FPSCR register (which contains the flags that I'm concerned with)?  I manually saved/restored this register and it fixed my issue.  I'm not sure if I have some control over enabling the compiler to save this register?  Also, I'm having a hard time finding in the document where it shows how the compiler determines what context registers to save.  FYI, the interrupt is declared as such:

#pragma INTERRUPT(MyISR);

interrupt void MyISR(void){ ...

Thanks in advance...

 

  • Lucas,

     

    Thanks for your post.

    After checking with our CodeGen group, they agree on the fact that the FPSCR has to be saved to the stack. This is not done by hardware automatically like it is for the CPSR.

    The plan is to fix the compiler to take care of the FPCSR. In the mean time, you will have to do it in your code has a workaround.

    We will update this post as soon as we have a fix in the compiler. For now, I don't know if this will be a patch on the current compiler version or if it will be part of the next codegen release.

     

    Best Regards,

     

    Jean-Marc Mifsud

    Best regards,
    Jean-Marc
    Application Engineer


    If my reply answers your question please click on the green button "Verify Answer".

  • In reply to Jean-Marc Mifsud:

    I wonder if this is still an issue?

This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.