2017-07-24 08:01 AM
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...
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] ; 0x320800c846: uxth r3, r30800c848: and.w r3, r3, #30800c84c: vmov s15, r30800c850: vcvt.f32.s32 s15, s150800c854: vmov.f32 s13, #112 ; 0x700800c858: vdiv.f32 s14, s13, s150800c85c: vldr s15, [r7, #44] ; 0x2c0800c860: vadd.f32 s15, s14, s15etcbut:
__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
dident help...
many thanks for some enlightment!
2017-07-24 08:16 AM
Check for
SCB->CPACR
code in the Reset_Handler, that's typically where I'd put it.2017-07-24 12:01 PM
,
,
+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
2017-07-24 01:19 PM
; Reset handler
Reset_Handler PROC
EXPORT Reset_Handler [WEAK]
IMPORT SystemInit
IMPORT __main
;FPU settings
LDR R0, =0xE000ED88 ; Enable CP10,CP11
LDR R1,[R0]
ORR R1,R1,#(0xF << 20)
STR R1,[R0]
LDR R0, =SystemInit
BLX R0
LDR R0, =__main
BX R0
�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?