Hello
I am developing for tm4c123g MCU using GCC toolchain with hard FPU. I've encountered a hard fault while making some calculations. After some investigation I've came up with a sample function that is causing such a fault:
int32_t crash(float f, uint32_t u) { int64_t tmp; tmp = f * u; //<---- This line is generating the fault return (int32_t)tmp; }
Here is a part of disassembly, that is generating the fault:
__fixunssfdi: 00004158: vldr d5, [pc, #52] ; 0x4190 <__fixunssfdi+56> 0000415c: vmov s9, r0 00004160: vldr d6, [pc, #52] ; 0x4198 <__fixunssfdi+64> 00004164: vcvt.f64.f32 d7, s9 ; <-------- This line is generating the fault 00004168: vmul.f64 d5, d7, d5 0000416c: vcvt.u32.f64 s9, d5 00004170: movs r0, #0
So as I understand, the instruction vcvt.f64.f32 is unsupported on this FPU. Is that right? Is there a way of tellin GCC not to generate it ? Any other solution (well, I have a workaround by playing with different types and conversions, but I would like to avoid such a problems in the future, since it is rather innocently looking code...).
Thank you