trampoline icon indicating copy to clipboard operation
trampoline copied to clipboard

Trampoline FPU armv7

Open grundmanns opened this issue 3 years ago • 1 comments

Hello Jean-Luc, I have a question. Is it possible in Trampoline to use hardware FPU ? We have one but there was hardly a reference to FPU in the code. Will it work in case of task switch ? I have some problems with my softfpu library from gcc and would like to solve it, using the hardware fpu, but I am not sure if this is supported by the OS. BR Sven Grundmann

grundmanns avatar Sep 07 '22 21:09 grundmanns

Hello Sven,

Currently, it is not possible. It won't work in case of a context switch because the FPU registers are not saved on the stack.

To support a FPU, you need to:

  1. add an attribute in OS object in the OIL file to indicate the FPU is used (let's say a FPU boolean attribute);
  2. add code conditional to WITH_FPU macro definition in kernel to perform initializations;
  3. add flag in the task object OIL description to indicate the task uses the FPU;
  4. add a flag in the static task descriptor, conditional to WITH_FPU, indicating if the task uses FPU;
  5. add code in tpl_sc_handler/systick handler/ISR2 handlers that read the flag of the switched tasks to save FP regs and load FP regs when necessary.

Best regards

Jean-Luc Béchennec

jlbirccyn avatar Sep 08 '22 15:09 jlbirccyn