In a recent thread Jon Kirwan and I were discussing FPUs and power consumption. I decided to try some real world tests on an STM32F4 Discovery board. After a few tests in the ChiBios RTOS, where I discovered that you can save a lot of power by doing floating point math with the FPU and shutting off the CPU clock in the idle process, I decided to try to measure the power using software and hardware floating point without the RTOS. I initialized the CPU clock to 168MHz and ran this code:
// ChiBios calls commented out to run without OS static msg_t ThreadMath(void *arg) { float sinetable[360], fval; int i,j; systime_t start, end;
msg_t mathmsg; long mathloop = 0; (void)arg; // chRegSetThreadName("Math"); while (TRUE) { // mathmsg = chBSemWait(&MathSemaphore); // start = chTimeNow(); for(j= 0; j