Add capability to use hard float libraries for Cortex devices with FP
Currently, the M4 support is limited to systems that use the soft FP libraries only. Is it possible to update the context switching macros/functions to support devices that use the FP register set?
I believe that this is possible within the current framework by adding a compile time option, but I want to know if there was a good reason to NOT support hard FP
Yes, it is possible to support this and it was on roadmap for quite some time. The only caveat, specific to CMRX ecosystem is floating-point handling during RPC calls.
Awesome that you have added this - and please keep posting on LinkedIn to raise CMRX visibility :-)
I like the separation of saving and restoring the standard and floating point register sets based on a consistent compile time expression.
You know that you have a good architecture when changes like this seem to magically drop into the right place like a surgical implant.
As of now, this is just a draft. And this version of code probably doesn't even work. At least it doesn't crash the system immediately :)
Right now there is a question whether to store FPU state on stack, or in dedicated area inside TCB. Saving onto stack gives the advantage of using memory only when FPU is actually used but somehow complicates RPC handling and some more stuff inside the kernel.
On the other hand, the FPU state saved in TCB will keep RPC and rest of the kernel pretty much oblivious of the FPU support but will allocate that storage permanently as you have to reserve block for FPU state in TCB even if it is not actually used.