Hi expert,
I am working with a Cortex-R5F (specifically the TI AM263P4 SoC) and I am trying to determine the exact instruction address (PC) that causes a floating-point divide-by-zero.
Your feedback would be extremely helpful.
Thanks & Regards,
Aswin
Aswin Sankar said:Is there any architectural configuration for the R5F to force a synchronous trap (Data Abort or Undef) specifically for FPU exceptions?
There is an optional feature defined in the Armv7-A/R architecture, but it's not supported on the Cortex-R5F:https://developer.arm.com/documentation/ddi0460/d/FPU-Programmers-Model/Compliance-with-the-IEEE-754-standard/Exceptions?lang=en
Aswin Sankar said:If the FPU is strictly non-trapping, is there a recommended hardware feature that can capture the faulting instruction address?
It's not a problem I've thought about before, others might be able to chime in with suggestions. What I've seen before is periodically checking the cumulative exceptions bits in FPSCR. That's polling rather than interrupt based, but it constrains the region the divide could have been to the time between samples.
Are you trying to locate the error to debug or are you trying to recover in some way?
Aswin Sankar said:Is there any way I can make the CPU wait till FPU is done, so that the once ISR fires, the PC will be at the instruction that caused the issue?
No - the CPU doesn't "know" where the signal is going or what the destination is going to do about it, therefore it has no way to know how long to wait. Also from a performance point of view, I suspect it would be better to sanitise the inputs to divisions or frequently poll FPSCR.