Compiling without task notification and stream buffers

Hi

There is one thing that i have to include in FreeRTOSconfig.h despite that I never use it.

#define	configUSE_TASK_NOTIFICATIONS    1

If i dont, then stream_buffers.c don’t compile. Now, i don’t use that either, but i have not found a way to disable them either.

Is there away to be able to not compile in task notifications and streambuffers?

Best regards
Martin

The default notification method for stream buffers to unblock a task waiting on the other end of a stream buffer is task notification.

If you define new version of sbRECEIVE_COMPLETED and configUSE_SB_COMPLETED_CALLBACK that don’t use task notifications, you could take out the #error statement.

If you are not using stream buffers, then don’t compile stream_buffers.c.

Streambuffers are now out. Thanks. Don’t know why i did not try that first.

Getting rid of task notifications on the other hand seems harder.
In FreeRTOSConfig.h, you have to have

#define	configUSE_TASK_NOTIFICATIONS    1

If you were to change that to 0, that would inpact line ~400 of task.c

    #if ( configUSE_TASK_NOTIFICATIONS == 1 )
        volatile uint32_t ulNotifiedValue[ configTASK_NOTIFICATION_ARRAY_ENTRIES ];
        volatile uint8_t ucNotifyState[ configTASK_NOTIFICATION_ARRAY_ENTRIES ];
    #endif

but not influence line ~6250

    if( pxTCB->ucNotifyState[ x ] == taskWAITING_NOTIFICATION )
    {
        pxTaskStatus->eCurrentState = eBlocked;
        break;
    }

That would attempt to access ucNotifyState which will not be included in the struct.
This will only happen if you also define configUSE_TRACE_FACILITY to 1

It looks to me like the code in task.c could be modified to something like.

#if ( configUSE_TRACE_FACILITY == 1 )
  BaseType_t x;
  
  /* The task does not appear on the event list item of
   * and of the RTOS objects, but could still be in the
   * blocked state if it is waiting on its notification
   * rather than waiting on an object.  If not, is
   * suspended. */
  for( x = ( BaseType_t ) 0; x < ( BaseType_t ) configTASK_NOTIFICATION_ARRAY_ENTRIES; x++ )
  {
      if( pxTCB->ucNotifyState[ x ] == taskWAITING_NOTIFICATION )
      {
          pxTaskStatus->eCurrentState = eBlocked;
          break;
      }
  }
#endif

I am by the way running Version 11.0.1

Best regards
Martin

Version 10 had an ifdef about a dozen lines above. Looks like it might have gotten lost in the version 11 merging for SMP.

Hey @MartinB,

Thanks for pointing out the missing ifdef in tasks.c

I’ve raised this PR to add in a #if ( configUSE_TASK_NOTIFICATIONS == 1 ) in vTaskGetInfo()

Would you mind giving that branch a try and seeing if it fixes your issue?

Hi skptak

It does indeed solve my issue.
Im not sure why there is a need for a double curly brackets, but it is perhaps a coding standard thing.

Best regards
Martin

1 Like

I think any non-trivial block that is conditional compiled is put into a block with braces to make sure scope is well defined.

3 Likes