fix(freertos/idf): Add work around vTaskResumeAll() compiler optimization

This commit adds a workaround for a compiler optimization issue in FreeRTOS
v10.5.1 in xTaskResumeAll() where pxTCB is only read once, even if in a loop.

A follow up ticket has been added to properly resolve this issue.
This commit is contained in:
Darian Leung 2023-10-11 14:48:05 +08:00
parent 0c15815c2b
commit 4d14717e77

View File

@ -2554,7 +2554,8 @@ BaseType_t xTaskResumeAll( void )
* appropriate ready list. */
while( listLIST_IS_EMPTY( &xPendingReadyList[ xCurCoreID ] ) == pdFALSE )
{
pxTCB = listGET_OWNER_OF_HEAD_ENTRY( ( &xPendingReadyList[ xCurCoreID ] ) ); /*lint !e9079 void * is used as this macro is used with timers and co-routines too. Alignment is known to be fine as the type of the pointer stored and retrieved is the same. */
/* Note: Add volatile cast (IDF-8361) */
pxTCB = listGET_OWNER_OF_HEAD_ENTRY( ( volatile List_t * ) ( &xPendingReadyList[ xCurCoreID ] ) ); /*lint !e9079 void * is used as this macro is used with timers and co-routines too. Alignment is known to be fine as the type of the pointer stored and retrieved is the same. */
listREMOVE_ITEM( &( pxTCB->xEventListItem ) );
portMEMORY_BARRIER();
listREMOVE_ITEM( &( pxTCB->xStateListItem ) );