robert b, on 12 December 2011 - 10:13 PM, said:
in the end of every project we run out of cpu cycles.
everyone is stealing them - because there are enough to do so.
That is true for sure. Having a fast MCU shouldn't mean that this power should be wasted blindly, I really agree with that.
naiiawah, on 13 December 2011 - 04:11 AM, said:
When an ISR or Thread context switch happens, the handler just has to look at the current TCB to see if FP is used on that thread and only store FPU regs off if the flag is set.
It's really much easier - just set the "lazy-save" flag and the MCU will act (somewhat) like that. I still claim (until someone proves we wrong ;-) that the scheduler has nothing to do with storing the FPU registers. From the
Cortex M4 Users Guide :
2.3.7. Exception entry and return
....
....
When the processor takes an exception, unless the exception is a tail-chained or a late-arriving
exception, the processor pushes information onto the current stack. This operation is referred to
as[i]stacking[/i] and the structure of eight data words is referred as the [i]stack frame[/i].
When using floating-point routines the Cortex-M4 processor automatically stacks the architected
floating-point state on exception entry.
I see it this way: as long as we cannot quantify the impact and clearly see that we have a problem here, there's no need looking for a solution. High frequency ISR's like USART handlers could for example be an area where it's worth looking at, much more than context switches. But again, using the "lazy-save" feature and not using any FPU instructions in the handler should be enough to do the trick.