Hardfault error Float
Hi,
I am using stm32 f407 for my project. I have set stack size min 0x6000. I am using STM Cube IDE. In one of the project files I have a float assignment
float val = resizedImage[i];
I have enabled FPU in the systemInit() function. I have set FPU_PRESENT and FPU_USED as 1. The following code excutes in SystemInit() function
#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
SCB->CPACR |= ((3UL << 10*2)|(3UL << 11*2)); /* set CP10 and CP11 Full Access */
__DSB();
__ISB();
#endif
I have selected floating point hardware implementation in project properties (-mfloat-abi==hard). The floating point unit is FPv4-SP-D16.
However, there occurs a hardfault in the float val assignmemt code. The fault analyzer states "attempt to execute a coprocessor instruction".
When I tried to debug using breakpoints, the systemInit() function is called, and the code to set CPACR is valuated as well. However when I examine the register value after execution, I still see that the CPACR register values 0x00. I dont know why the values are not set in the register. Any insights on this will be of great help.
Thanks and Regards,
Sinduja