I have a hard fault on my Cortex-M0+. All my tasks have priority 1 (so far).
Using FreeRTOS commit c19b13cdf.
Examing the backtrace, the chip is stuck at tasks.c:4820
:
/* Place the unblocked task into the appropriate ready
* list. */
prvAddTaskToReadyList( pxTCB );
Looking at the definition of the macro above:
#define prvAddTaskToReadyList( pxTCB ) \
do { \
traceMOVED_TASK_TO_READY_STATE( pxTCB ); \
taskRECORD_READY_PRIORITY( ( pxTCB )->uxPriority ); \
listINSERT_END( &( pxReadyTasksLists[ ( pxTCB )->uxPriority ] ), &( ( pxTCB )->xStateListItem ) ); \
tracePOST_MOVED_TASK_TO_READY_STATE( pxTCB ); \
} while( 0 )
The priority value:
(gdb) p pxTCB
$4 = (TCB_t *) 0x20003f70
(gdb) p/x pxTCB->uxPriority
$5 = 0x30000001
This index is naturally out of bound for pxReadyTasksLists[]
. Unfortunately, I could not make the debugger descend into that macro, so I am not sure where the debugger is stopped.
My questions are:
- what could possibly be causing the 0x30 in the MSByte of the priority?
- is it normal?
- is the fault caused by the array index out of bound, or is that high value supposed to be cleaned inside the macro, before being used as an array index, e.g. by
taskRECORD_READY_PRIORITY
? - if not that, what could be causing the hard fault?