Part Number: AM263P4
Team,
Our customer has an inquiry for our AM263P4 MCU as follows:
"In short, we've found that our FIQ interrupt has been interrupting code in our main loop and not saving the context of the s0-s31 registers. We've set EN_SAVE_RESTORE_FPU_CONTEXT to be defined in kernel/dpl/HwiP.h which enables the following function calls in the FIQ handler:
/* Save FPU context, used in FIQ Handler */
static inline void Hwip_save_fpu_context(void)
{
__asm__ __volatile__ ( "FMRX R0, FPSCR" "\n\t": : : "memory");
__asm__ __volatile__ ( "VPUSH {D0-D15}" "\n\t": : : "memory");
__asm__ __volatile__ ( "PUSH {R0}" "\n\t": : : "memory");
}
/* Restore FPU context, used in FIQ Handler */
static inline void Hwip_restore_fpu_context(void)
{
__asm__ __volatile__ ( "POP {R0}" "\n\t": : : "memory");
__asm__ __volatile__ ( "VPOP {D0-D15}" "\n\t": : : "memory");
__asm__ __volatile__ ( "VMSR FPSCR, R0" "\n\t": : : "memory");
}
However, we've noticed that there's a point in our main loop where we have multiple FPU instructions in a row (some vldr and a vcmp.f32) and the FIQ interrupts the code between some of those instructions. The FIQ then does some float operations and returns without restoring the s0-s31 registers. This causes unexpected behavior back in the main loop.
We have looked at the VFP registers before and after the interrupt and the d0-d15 registers get restored correctly, but the s0-s31 registers do not. We assumed the s0-s31 registers mapped directly to the high/low 32 bits of d0-d15, so they would get restored as well, but they didn't. Is there a step we are missing to make this work? Do we need to "refresh" the s0-s31 registers after a context restore?
TY,
CY

