cancel
Showing results for 
Search instead for 
Did you mean: 

FPU initialization warning

CTabo.1
Senior

Hello, 
I am developing an application, starting from stm32 empty project.

The main file presents the following preprocessor header, that triggers the reported FPU initialization warning when I try to build the project.

 

 

#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

 

The FPU project settings are the following.

CTabo1_1-1712235752805.png

Why I have this warning?

Regards,
Carlo

 
1 ACCEPTED SOLUTION

Accepted Solutions
SofLit
ST Employee

Hello,

See this thread.

Starting from Empty project needs to initialize the FPU yourself.

Starting from STM32Cube project, lets you using the HAL driver which in turn initializes the FPU for you in system_stm32h5xx.cSystemInit():

 

 

void SystemInit(void)
{
  uint32_t reg_opsr;

  /* FPU settings ------------------------------------------------------------*/
  #if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
   SCB->CPACR |= ((3UL << 20U)|(3UL << 22U));  /* set CP10 and CP11 Full Access */
  #endif
.
.

 

 

If you select FP implementation by software, the warning message disappears as you won't use HW FPU:SofLit_0-1712242651051.png

Hope it does answer your question.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

View solution in original post

2 REPLIES 2
SofLit
ST Employee

Hello,

See this thread.

Starting from Empty project needs to initialize the FPU yourself.

Starting from STM32Cube project, lets you using the HAL driver which in turn initializes the FPU for you in system_stm32h5xx.cSystemInit():

 

 

void SystemInit(void)
{
  uint32_t reg_opsr;

  /* FPU settings ------------------------------------------------------------*/
  #if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
   SCB->CPACR |= ((3UL << 20U)|(3UL << 22U));  /* set CP10 and CP11 Full Access */
  #endif
.
.

 

 

If you select FP implementation by software, the warning message disappears as you won't use HW FPU:SofLit_0-1712242651051.png

Hope it does answer your question.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

Thank you for the quick and clear response.

Regards,
Carlo