使用二值信号量过程中,刚开始程序还是正常运行,一段时间后出现了死机。通过仿真发现程序卡在了 xQueueSemaphoreTake 函数的 configASSERT( ( pxQueue ) )中。
通过查看 xQueueSemaphoreTake 函数可知, configASSERT( ( pxQueue ) )主要是用于断言QueueHandle_t xQueue是否为NULL,卡死在这里说明程序运行中传入了NULL句柄。
BaseType_t xQueueSemaphoreTake( QueueHandle_t xQueue, TickType_t xTicksToWait )
{
BaseType_t xEntryTimeSet = pdFALSE;
TimeOut_t xTimeOut;
Queue_t * const pxQueue = xQueue;
#if( configUSE_MUTEXES == 1 )
BaseType_t xInheritanceOccurred = pdFALSE;
#endif
/* Check the queue pointer is not NULL. */
configASSERT( ( pxQueue ) );
/* Check this really is a semaphore, in which case the item size will be
0. */
configASSERT( pxQueue->uxItemSize == 0 );
/* Cannot block if the scheduler is suspended. */
#if ( ( INCLUDE_xTaskGetSchedulerState == 1 ) || ( configUSE_TIMERS == 1 ) )
{
configASSERT( !( ( xTaskGetSchedulerState() == taskSCHEDULER_SUSPENDED ) && ( xTic
5985



被折叠的 条评论
为什么被折叠?



