aimal wrote on Thursday, February 22, 2018:
Hi,
I am trying to integrate FreeRTOS with some other libraries which is already using ARM Systick timer for its internal operation. The tick rate is different from FreeRTOS configTICK_RATE_HZ. Which means i have to configure another timer for Free RTOS to use as tick timer.
From https://www.freertos.org/low-power-ARM-cortex-rtos.html , steps are given how to use another timer for FreeRTOS schaduler.
My question is in the second step, i.e. xPortSysTickHandler() function.
- Should xPortSysTickHandler() only contian Timer interrupt handler like clearing timer flag? if this is the case then how the FreeRTOS schadular will know about tick? i.e.
/*
#define xPortSysTickHandler SysTick_Handler
*/
#define xPortSysTickHandler TIMx_IRQHandler
.
TIMx_IRQHandler () {
//clear timer flag for another interrupt.
}
- OR the xPortSysTickHandler() should contian both SYStick_Handler(default tick handler for ARM) and timer interrupt flags clearing etc.
/*
#define xPortSysTickHandler SysTick_Handler
*/
#define xPortSysTickHandler TIMx_IRQHandler
.
TIMx_IRQHandler () {
//clear timer flag for another interrupt.
//copied contents from SysTick_Handler port.c:
uint32_t ulDummy;
ulDummy = portSET_INTERRUPT_MASK_FROM_ISR();
{
if( xTaskIncrementTick() != pdFALSE )
{
/* Pend a context switch. */
*(portNVIC_INT_CTRL) = portNVIC_PENDSVSET;
}
}
portCLEAR_INTERRUPT_MASK_FROM_ISR( ulDummy );
}