AnsweredAssumed Answered

Hard Fault on call to soft float routine

Question asked by chris_f on Sep 23, 2013
Latest reply on Oct 25, 2013 by embeddedarchitect

Hi all,

I'm having some trouble with using floating point operations on a K10. I'm compiling with gcc with -mcpu=cortex-m4 -mabi=aapcs -mthumb -msoft-float.

I get a Hard Fault exception on executing the blx instruction highlighted below:

 

74           subfactor = LOOP_CYCLES*1e6/cpu_clockRate;

000008c2:   movw r3, #61448 ; 0xf008

000008c6:   movt r3, #8191  ; 0x1fff

000008ca:   ldrh r3, [r3, #0]

000008cc:   mov r0, r3

000008ce:   blx 0x1458 <__floatsidf>   <-- Core Hard Faults here

000008d2:   mov r2, r0

000008d4:   mov r3, r1

000008d6:   add r1, pc, #56 ; (adr r1, 0x910 <cpu_Delay+88>)

000008d8:   ldrd r0, r1, [r1]

000008dc:   blx 0x17c4 <__divdf3>

000008e0:   mov r2, r0

000008e2:   mov r3, r1

000008e4:   mov r0, r2

000008e6:   mov r1, r3

000008e8:   blx 0x19d0 <__fixdfsi>

000008ec:   mov r3, r0

000008ee:   strh r3, [r7, #14]   

 

Looking at the code for the __floatsidf, it doesn't look like thumb code? Is this right? Am I missing a compiler flag?

 

          __floatsidf:

00001458:   teq r0, #0

0000145c:   moveq r1, #0

00001460:   bxeq lr

00001464:   push {r4, r5, lr}

00001468:   mov r4, #1024   ; 0x400

0000146c:   add r4, r4, #50 ; 0x32

00001470:   ands r5, r0, #-2147483648       ; 0x80000000

00001474:   rsbmi r0, r0, #0

00001478:   mov r1, #0

0000147c:   b 0x1274 <__aeabi_dadd+336>

Outcomes