Hard Fault on call to soft float routine

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Hard Fault on call to soft float routine

1,850件の閲覧回数
chris_f
Contributor V

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>

ラベル(1)
タグ(4)
0 件の賞賛
返信
3 返答(返信)

1,444件の閲覧回数
soledad
NXP Employee
NXP Employee

I am glad your issue is solved.

0 件の賞賛
返信

1,444件の閲覧回数
chris_f
Contributor V

Looks like I was lacking -mcpu=cortex-m4 in my linker options.

0 件の賞賛
返信

1,444件の閲覧回数
embeddedarchite
Contributor I

Hi

Can you please explain where you added the -mcpu=cortex-m4 for the linker? I'm trying to add this option to the linker flags (Xlinker [option]) but it gives error.

Thanks,

0 件の賞賛
返信