Hi everyone,
I’m currently using FreeRTOS V9.0.0 on STM32H7A3. I have encountered an issue with the Timer thread getting stuck in an infinite for-loop in vListInsert.
The problem is that pxNext is pointing to the last element in the list, and its value is less than xValueOfInsertion, causing it to be trapped in the for loop. There are comments in the code explaining four potential causes of this issue.
/* *** NOTE ***********************************************************
If you find your application is crashing here then likely causes are
listed below. In addition see http://www.freertos.org/FAQHelp.html for
more tips, and ensure configASSERT() is defined!
http://www.freertos.org/a00110.html#configASSERT
1) Stack overflow -
see http://www.freertos.org/Stacks-and-stack-overflow-checking.html
2) Incorrect interrupt priority assignment, especially on Cortex-M
parts where numerically high priority values denote low actual
interrupt priorities, which can seem counter intuitive. See
http://www.freertos.org/RTOS-Cortex-M3-M4.html and the definition
of configMAX_SYSCALL_INTERRUPT_PRIORITY on
http://www.freertos.org/a00110.html
3) Calling an API function from within a critical section or when
the scheduler is suspended, or calling an API function that does
not end in "FromISR" from an interrupt.
4) Using a queue or semaphore before it has been initialised or
before the scheduler has been started (are interrupts firing
before vTaskStartScheduler() has been called?).
**********************************************************************/
I have gone through all four cases but haven’t been able to prevent this problem from occurring.
configASSERT is defined, and my application doesn’t run into an assert trap when this issue happens.
/* Normal assert() semantics without relying on the provision of an assert.h
header file. */
#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); }
I also tried
#define configASSERT( x ) assert(x)
I also set configCHECK_FOR_STACK_OVERFLOW to 2 and add vApplicationStackOverflowHook, and still my application doesn’t run into an assert trap when this issue happens.
void vApplicationStackOverflowHook( TaskHandle_t xTask, char *pcTaskName )
{
assert(0);
}
This issue happens when my application wakes up from sleep (stop2 mode), and the timer thread gets stuck in vListInsert <5% after waking up.
I’m not sure how to proceed to resolve this issue. Could someone please help me troubleshoot this problem and suggest what I can do to gather more information to resolve this issue? Thanks!