cancel
Showing results for 
Search instead for 
Did you mean: 

"#warning "FPU is not initialized"??? (Version: 1.9.0)

ULehm.1
Associate III

A warning called be ST generate source code remebers me,

I have do solve the "FPU is not initialized"-problem.

I haven't decided , wether I use or use not the FPU,

but I haven't found any information, what I have to do

when I use the FPU or use it not?

Can someone provide a link to the necessary information?

Thx

3 REPLIES 3
KnarfB
Principal III

If you let Cube generate your code, you find a line

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

in SystemInit.

If you create an empty project, no such code is generated. The warning is then a reminder to switch the FPU on if it is used. The gcc compiler sets the defines __FPU_PRESENT and __FPU_USED depending on the compiler options you set on the command line.

hth

KnarfB

ULehm.1
Associate III

I've created an empty STM32 project - the warning was generated by code placed in main.c.

main.c

[code]

/**

 ******************************************************************************

 * @file          : main.c

 * @author        : Auto-generated by STM32CubeIDE

 * @brief         : Main program body

 ******************************************************************************

 * @attention

 *

 * Copyright (c) 2022 STMicroelectronics.

 * All rights reserved.

 *

 * This software is licensed under terms that can be found in the LICENSE file

 * in the root directory of this software component.

 * If no LICENSE file comes with this software, it is provided AS-IS.

 *

 ******************************************************************************

 */

#include <stdint.h>

#if !defined(__SOFT_FP__) && defined(__ARM_FP)

 #warning "FPU is not initialized, but the project is compiling for an FPU. Please initialize the FPU before use."

#endif

int main(void)

{

   /* Loop forever */

   for(;;);

}

[/code]

When I change "MCU Settings" => "Floating-point ABI" to "Software implementation", the warning will not be thrown,

but what have I to do, when I want use MCUs FPU and let "MCU Settings" => "Floating-point ABI" at "Hardware implementation"?

Including some header file? Calling an initialisation function? Setting a compiler option?

What are the guidelines for selecting "Software implementation", "Hardware implementation" or "Mix HW/'SW implementation"?

I don't find any adequate information in the net anserwing my questions (may be because of using the wrong search keys)?

I let the cube create the project, but taking the CMSIS DSP library is giving me this error when it tries to compile the DSP code. very frustrating. Have started from scratch AGAIN and still I get this.