cancel
Showing results for 
Search instead for 
Did you mean: 

How to enable the FPU in Atollic for the STM32F4-Discovery

pedroh44
Associate
Posted on March 14, 2014 at 16:03

If someone could give me an idea, that'd be great. I need it to speed up math operations.

2 REPLIES 2
Posted on March 14, 2014 at 16:21

Don't some of the template projects do so? Probably buried in a compiler/target option pane some place.

Remember the FPU supports only 32-bit float operations, ie sqrtf(), cosf(), etc The FPU is typically physically enabled in SystemInit() within system_stm32f4xx.c, note the defines the compiler generates when the FPU is enabled, this likely also impacts the libraries pulled in by the linker.

void SystemInit(void)
{
/* FPU settings ------------------------------------------------------------*/
#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
SCB->CPACR |= ((3UL << 10*2)|(3UL << 11*2)); /* set CP10 and CP11 Full Access */
#endif
//..

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
chen
Associate II
Posted on March 14, 2014 at 16:40

Hi

Right click on the project and select properties.

Open the ''C/C++ Build'' on the left hand panel.

Select ''Settings'' in the left hand panel.

In the main panel - select the ''Tool Setting'' panel (2nd one along)

This should list the settings for Assembler, C Compiler, C linker, Other

Open the C Compiler list and select ''Target''

In the panel : there should be ''Floating point'' and ''FPU'' drop downs.

In the FPU drop down select ''FPV4-SP-D16''

BE WARNED - if you change the processor - it will wipe ALL the other settings!

This is a known problem with Atollic/Eclipse