AnsweredAssumed Answered

Hardware floating point on TWR-K60F120M

Question asked by Anton Belokrylov on Mar 5, 2012
Latest reply on Mar 5, 2012 by Tom Thompson

When I was trying to benchmark FPU on TWR-K60F120M, I got some problems when trying to run even simplest application with floating-point instruction.


I've started modifying KINETIS_120MHZ_SC example, added some simple float code. It run without problems with software floating point, but when I switched to hardware, I've got an exception. (Hard Fault with No Coprocessor Usage Fault).


It was strange since according to all documentation PK60FN1M0VLQ12 has single-precision FPU. After studying ARM documentation, I've found the problem: the coprocessors should be explicitly enabled.


I didn't find related register constant in CPU header file, so I've added them (file attached, modified register info from line 14940 to 15311). So adding the following code enables FPU (and it is about ten or more times faster than software emulation):


// Enable CP10 and CP11