Skip to main content
terter etuet
Associate II
July 24, 2017
Question

stm32F4 FPU Question

  • July 24, 2017
  • 1 reply
  • 1882 views
Posted on July 24, 2017 at 17:01

Hello,

i am trying to work with the fpu of the stm32f469-Disco and got some questions...

i am on ac6 systemworkbench/win7/

so far i can compile and run my app that uses float math...

0690X00000607fUQAQ.png

when i look at the disassmbly it looks good: (as far as i can understand this, it uses the fpu-commands vadd.f32, vmul.f32 etc)

0800c842:   beq.n   0x800c8cc <main()+588>

 545              test = 1.0f / (float)(ix%4) + test;

0800c844:   ldrh    r3, [r7, #50]   ; 0x32

0800c846:   uxth    r3, r3

0800c848:   and.w   r3, r3, #3

0800c84c:   vmov    s15, r3

0800c850:   vcvt.f32.s32    s15, s15

0800c854:   vmov.f32        s13, #112       ; 0x70

0800c858:   vdiv.f32        s14, s13, s15

0800c85c:   vldr    s15, [r7, #44]  ; 0x2c

0800c860:   vadd.f32        s15, s14, s15

etc

but:

__FPU_USED is 0 because __VFP_FP__ is not defined (core_cm4.h line 149)

and SCB->CPACR |= ((3UL << 10*2)|(3UL << 11*2));  /* set CP10 and CP11 Full Access */

doesent get set

SystemInit(void){

  #if (__FPU_PRESENT == 1) && (__FPU_USED == 1)

    SCB->CPACR |= ((3UL << 10*2)|(3UL << 11*2));  /* set CP10 and CP11 Full Access */

  #endif

....

}

shouldent this generate a FPU-FAULT?

and where can i define __VFP_FP__ ?  putting in

0690X00000607evQAA.png

dident help...

many thanks for some enlightment!

    This topic has been closed for replies.

    1 reply

    Tesla DeLorean
    Guru
    July 24, 2017
    Posted on July 24, 2017 at 17:16

    Check for

    SCB->CPACR 

    code in the Reset_Handler, that's typically where I'd put it.
    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    waclawek.jan
    Super User
    July 24, 2017
    Posted on July 24, 2017 at 19:01

     ,

     ,

    +1

    Instead of hunting down an infinite chain of ♯ defines stemming from obscure system headers and some even directly from cc1, I too chose to enable the FPU myself 'manually'.

    Sometimes overautomation hurts.

    JW