To save the FPU context, I set configUSE_TASK_FPU_SUPPORT to 1 in the FreeRTOS configuration (I am using the latest version of FreeRTOS). The problem is that when I enable configUSE_TASK_FPU_SUPPORT, the microcontroller reboots at boot time. The problem seems to occur when I activate more than one timer (I have 2 tasks that use a timer: if I activate only one task, there is no problem). The problem occurs even if the portTASK_USES_FLOATING_POINT() function is never called. I use microchip PIC32MZ2048EFM100.
When I enable configUSE_TASK_FPU_SUPPORT, I set configISR_STACK_SIZE to 1400 (instead of 400) and I checked values of configKERNEL_INTERRUPT_PRIORITY and configMAX_SYSCALL_INTERRUPT_PRIORITY
If I disable all C code and enable ASM code, problem occure… I don’t undestand because in this configuration, there isn’t task/interrupt. Structure of my .S files is :
//Dependencies
#include <xc.h>
#include <sys/asm.h>
#include "FreeRTOSConfig.h"
#include "isr_support.h"
#define APPx_TIMER_VECTOR _TIMER_xxx_VECTOR
.extern appXTimerIrqHandler
.global appXTimerIrqWrapper
// Ensure correct instructions is used
.set nomips16
.set nomicromips
.set noreorder
.set noat
#if (APPx_TIMER_VECTOR == _CORE_TIMER_VECTOR)
.equ __vector_dispatch_0, appXTimerIrqWrapper
.global __vector_dispatch_0
.section .vector_0, code, keep
#elif (APPx_TIMER_VECTOR == _TIMER_1_VECTOR)
.equ __vector_dispatch_4, appXTimerIrqWrapper
.global __vector_dispatch_4
.section .vector_4, code, keep
#elif (APPx_TIMER_VECTOR == _TIMER_2_VECTOR)
.equ __vector_dispatch_9, appXTimerIrqWrapper
.global __vector_dispatch_9
.section .vector_9, code, keep
#elif (APPx_TIMER_VECTOR == _TIMER_3_VECTOR)
.equ __vector_dispatch_14, appXTimerIrqWrapper
.global __vector_dispatch_14
.section .vector_14, code, keep
#elif (APPx_TIMER_VECTOR == _TIMER_4_VECTOR)
.equ __vector_dispatch_19, appXTimerIrqWrapper
.global __vector_dispatch_19
.section .vector_19, code, keep
#elif (APPx_TIMER_VECTOR == _TIMER_5_VECTOR)
.equ __vector_dispatch_24, appXTimerIrqWrapper
.global __vector_dispatch_24
.section .vector_24, code, keep
#elif (APPx_TIMER_VECTOR == _TIMER_6_VECTOR)
.equ __vector_dispatch_28, appXTimerIrqWrapper
.global __vector_dispatch_28
.section .vector_28, code, keep
#elif (APPx_TIMER_VECTOR == _TIMER_7_VECTOR)
.equ __vector_dispatch_32, appXTimerIrqWrapper
.global __vector_dispatch_32
.section .vector_32, code, keep
#elif (APPx_TIMER_VECTOR == _TIMER_8_VECTOR)
.equ __vector_dispatch_36, appXTimerIrqWrapper
.global __vector_dispatch_36
.section .vector_36, code, keep
#elif (APPx_TIMER_VECTOR == _TIMER_9_VECTOR)
.equ __vector_dispatch_40, appXTimerIrqWrapper
.global __vector_dispatch_40
.section .vector_40, code, keep
#endif
.ent appXTimerIrqWrapper
//timer interrupt
appXTimerIrqWrapper:
//Save the current task context
portSAVE_CONTEXT
//Call interrupt handler
jal appXTimerIrqHandler
nop
//Restore the context of the next task to execute
portRESTORE_CONTEXT
.end appXTimerIrqWrapper
To build my project with this configuration, I create empty IRQ handler functions :
void __attribute__( (interrupt(IPLxxxAUTO), vector(_TIMER_xxx_VECTOR))) appXTimerIrqHandler( void );
void appXTimerIrqHandler(void){}
What could be the reason (why isn’t there problem when configUSE_TASK_FPU_SUPPORT = 0 ?) ?