Skip to main content
CTabo.1
Senior
April 4, 2024
Solved

FPU initialization warning

  • April 4, 2024
  • 1 reply
  • 1660 views

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

 
Best answer by mƎALLEm

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.

1 reply

mƎALLEm
mƎALLEmBest answer
Technical Moderator
April 4, 2024

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 "Best answer" on the reply which solved your issue or answered your question.
CTabo.1
CTabo.1Author
Senior
April 5, 2024

Thank you for the quick and clear response.

Regards,
Carlo