FPU Context Saving for Microchip PIC32MZ EF

weehau wrote on Thursday, November 07, 2019:

Hi there,

The Cortex-A port has support for configUSE_TASK_FPU_SUPPORT = 2 which automatically enable FPU context saving all the newly created tasks which having to explicitly call portTASK_USES_FLOATING_POINT() in each task. Read the description below:

I want to implement the same configUSE_TASK_FPU_SUPPORT = 2 for Microchip PIC32MZ EF processor. However it only supports configUSE_TASK_FPU_SUPPORT = 1. I tried make changes to port.c and port_asm to enable support for configUSE_TASK_FPU_SUPPORT = 2, but it didn’t work well.

Can someone guide me how to make changes to the port for PIC32MZ EF? I have attached source files for PIC32MZ here.

I will really appreciate your kindness.

rtel wrote on Saturday, November 09, 2019:

Are the files you attached the updated files? Asking as I looked at the function that initialises the task stack and it doesn’t seem to give the task an FPU context if configUSE_TASK_FPU_SUPPORT is set to 2. I would suggest looking at all the places in the Cortex-A has that constant set to 2 and replicate the functionality (like giving the task an FPU context from the outset in the function that initialises the stack) in the PIC32 port. It will be hard for people here to know if you get it right or not without being able to step through the code and inspect the hardware manual themselves, but you can test the code by extending the register test tasks in the demo to also check the FPU registers (if the are not already).

weehau wrote on Tuesday, November 12, 2019:

Hi Richard,

Thanks for your reply. No those are the original files from the PIC32MZ port. Ok i will give it a shot to implement first.