2022-12-22 09:33 PM
There must be a function to save the FPU context of the 32F4 but after an hour searching all I see is 11 years of people asking for clarification on how to do this, and nice looking technical papers none of which list more than a couple of lines of ASM that are far from complete!
Is there a function in CMSIS or other library, of sample code that does this?
2022-12-22 11:26 PM
processor executes the VSTM instruction (also known as the Floating-point Store Multiple)
from: an 298
https://developer.arm.com/documentation/dai0298/a
diy in asm:
https://stackoverflow.com/questions/38614776/cortex-m4f-lazy-fpu-stacking
2022-12-23 01:47 AM
Looking at FreeRTOS port.c module may also be useful.
2022-12-23 03:40 AM
Saw that one, though helps, it requires investigation, testing, maybe some research.
So he runs the asm to read FPCAR and trigger a bus fault, guess he uses a flag so that his code in the bus fault handler knows to save the context, and hopefully voila!
That simple?
2022-12-23 03:42 AM
Saw that one too, but thanks. It also needs a bit of research to know how to add that code, use it, test it, etc.,
This is such an important and necessary functions I am amazed that Arm, STM or CMSIS don't have a near function rolled out for users to just use.
2022-12-23 04:39 AM
>This is such an important and necessary functions
shure, but most people do no more asm and write a task switcher in asm;
so in "C" (or c++ ) the compiler +optimizer should do the best code , without user inserting some asm instructions.
same when using rtos, task switching should work , even user knows nothing about VSTM . :)
2022-12-26 08:03 AM
So no code snipped to save and restore the FPU state?
After a decade no one at STM thought to post this code?
I read that by reading from the FPU registers a bus fault is generated, so we have to the process the save/restore from the error handler. Its a bit messy really, and having to wade through RTOS code to extract their handler shouldn't be necessary if STM had their act together.
Hey, yes, its a criticism.