2014-11-10 10:50 AM
I am using:
STM32F401 & STM32F407 processorsKeil uVision 4.73I have several general questions about using the floating point unit on this processor.1. What should I expect to happen if I try to use floats without explicitly enabling the FPU?float var1 = 1.2;float var2 = 3.4;float result = 0;result = var1 * var2;If anyone is familiar with Keil, do we expect it to automatically use the FPU in this case?2. How do you find the theoretical computation time for multiply/accumulate operations? I am implementing an FIR filter and need to estimate its executing time. #fpu #stm32f42014-11-10 11:44 AM
I would expect the compiler to generate code using the floating point library.
If you use FPU instructions in your code without enabling the FPU, I would expect the processor to Fault. You'd want to select ''Use FPU'' in the Target dialog, and you would need code in your start up to enable the FPU in the processor. This would normally be code placed in startup_ARCH.s or system_ARCH.c I would generally suggest the use of float constants in the form 34f The FPU is not particularly advanced, some functions will be a hybrid of FPU and software library code using/augmenting the FPU. To benchmark throughput of code, I'd suggest the use of DWT_CYCCNT, and also generating code sequences to evaluate performance and cycle times. Latency is probably not a big issue here.void SystemInit(void)
{
/* FPU settings ------------------------------------------------------------*/
#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
SCB->CPACR |= ((3UL << 10*2)|(3UL << 11*2)); /* set CP10 and CP11 Full Access */
#endif
...