pippopappo0 wrote on Monday, February 17, 2014:
Hello,
taskYIELD() works properly!!!
I’ve discovered the problem…I haven’t any scheduling!!
The tick interrupt doesn’t work because the irqs are disabled by the vTaskEnterCritical and not correctly re-enabled by the vTaskExitCritical when the xTaskCreate is called (note that at this point the scheduler doesn’t run).
The sequence is:
xTaskCreate(…)_
vTaskStartScheduler();
Below I’ve copied the two functions:
#if ( portCRITICAL_NESTING_IN_TCB == 1 )
void vTaskEnterCritical( void )
{
portDISABLE_INTERRUPTS();
if( xSchedulerRunning != pdFALSE )
{
( pxCurrentTCB->uxCriticalNesting )++;
}
else
{
mtCOVERAGE_TEST_MARKER();
}
}
#endif /* portCRITICAL_NESTING_IN_TCB /
/-----------------------------------------------------------*/
#if ( portCRITICAL_NESTING_IN_TCB == 1 )
void vTaskExitCritical( void )
{
if( xSchedulerRunning != pdFALSE )
{
if( pxCurrentTCB->uxCriticalNesting > 0U )
{
( pxCurrentTCB->uxCriticalNesting )--;
if( pxCurrentTCB->uxCriticalNesting == 0U )
{
portENABLE_INTERRUPTS();
}
else
{
mtCOVERAGE_TEST_MARKER();
}
}
else
{
mtCOVERAGE_TEST_MARKER();
}
}
else
{
mtCOVERAGE_TEST_MARKER();
}
}
#endif /* portCRITICAL_NESTING_IN_TCB */
It’s clear that with the scheduler off, none will execute the portENABLE_INTERRUPTS() macro.
is it correct??
Of course, if I insert this macro into the xPortStartScheduler inside the port.c, it works properly. I think this is the non correct way…(I force an enable…)
Do you think I have a problem somewhere into my portable code (or some wrong define) or I’ve discovered a little bug??
Regards,
Pippo