STM32M4 FPU isn't initialized while start in crt0.c
Posted: Tue Nov 05, 2013 12:30 pm
Hello,
I tried to use FPU on STM32F4 (OS v 2.6.1) and I've got exception while context switching (while try to vpush {s16-s31}).
I've found CORTEX_USE_FPU is set to TRUE in os/ports/GCC/ARMCMx/chcore_v7m.h:
CORTEX_HAS_FPU is TRUE in os/ports/GCC/ARMCMx/STM32F4xx/cmparams.h:
But os/ports/GCC/ARMCMx/crt0.c doesn't include any headers (except for stdint.h), so CORTEX_HAS_FPU is undefined and FPU initialization is skipped:
When I defined CORTEX_HAS_FPU globally in Eclipse then it works fine.
Is it mistake?
I tried to use FPU on STM32F4 (OS v 2.6.1) and I've got exception while context switching (while try to vpush {s16-s31}).
I've found CORTEX_USE_FPU is set to TRUE in os/ports/GCC/ARMCMx/chcore_v7m.h:
Code: Select all
#define CORTEX_USE_FPU CORTEX_HAS_FPUCORTEX_HAS_FPU is TRUE in os/ports/GCC/ARMCMx/STM32F4xx/cmparams.h:
Code: Select all
#define CORTEX_HAS_FPU TRUEBut os/ports/GCC/ARMCMx/crt0.c doesn't include any headers (except for stdint.h), so CORTEX_HAS_FPU is undefined and FPU initialization is skipped:
Code: Select all
#if CORTEX_USE_FPU
/* Initializing the FPU context save in lazy mode.*/
SCB_FPCCR = FPCCR_ASPEN | FPCCR_LSPEN;
/* CP10 and CP11 set to full access.*/
SCB_CPACR |= 0x00F00000;
/* FPSCR and FPDSCR initially zero.*/
reg = 0;
asm volatile ("vmsr FPSCR, %0" : : "r" (reg) : "memory");
SCB_FPDSCR = reg;
/* CPU mode initialization, enforced FPCA bit.*/
reg = CRT0_CONTROL_INIT | 4;
#else
/* CPU mode initialization.*/
reg = CRT0_CONTROL_INIT;
#endif
When I defined CORTEX_HAS_FPU globally in Eclipse then it works fine.
Is it mistake?