2024-04-04 06:04 AM
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.
Why I have this warning?
Regards,
Carlo
Solved! Go to Solution.
2024-04-04 07:59 AM - edited 2024-04-04 08:32 AM
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.c / SystemInit():
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:
Hope it does answer your question.
2024-04-04 07:59 AM - edited 2024-04-04 08:32 AM
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.c / SystemInit():
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:
Hope it does answer your question.
2024-04-05 12:16 AM
Thank you for the quick and clear response.
Regards,
Carlo