AnsweredAssumed Answered

FPU context saving. How to set FPCA without automatic FPU register stacking

Question asked by Bare.Bradley on Oct 13, 2016
Latest reply on Oct 15, 2016 by avi_crak.videocrak
Hello,

I am writing my own context switcher for tasking on the STM32F767ZI. This is a Cortex-M7. In the arm Generic user guide in the FPU section, it talks about allowing the processor to set Control.FPCA bit if I set the bit ASPEN in the FPCCR register. However, I do not want to enable Automatic State Preservation(ASPEN). I would rather write my own logic to check the FPCA bit. But if I do not enable ASPEN then the FPCA bit is never set.

I can successfully save and reload the FPU context during every context switch. But I would like to only save the FPU registers if it is needed. For this I need the FPCA bit to be set or reset. If I enable the ASPEN bit I get a Hard fault. I believe this is because the state is being saved to FPCAR register address instead of the current process stack. Same happens if I set ASPEN and LSPEN. 

So my question is, is there anyway to set the FPCA bit when floating point instructions are used besides the ASPEN bit? Or do I need to somehow set the bit myself in the C program?

Thank you for looking!

Outcomes