FreeRTOS+TCP: types conflict when including FreeRTOS_IP_Private.h and message_buffer.h together

marlb1234 wrote on Monday, September 30, 2019:

Hello,

in order to include FreeRTOS+TCP in my project, I followed the guide “Porting FreeRTOS+TCP to a Different Microcontroller” as no complete examples were available for my platform.
I’m using FreeRTOS 10.2.1.
The guide suggest to use eConsiderFrameForProcessing(…) before processing the frame. Actually, I verified that both the function eConsiderFrameForProcessing and the enum eProcessBuffer are defined in FreeRTOS_IP_Private.h header file.
In order to get access to those symbols I directly included FreeRTOS_IP_Private.h in my module.
Everything was fine until I decided to use Message Buffers in the same module. When including also message_buffer.h, in fact, I get the following error:

…\FreeRTOS_TCP_Source\include\FreeRTOS_Stream_Buffer.h:178:30: error: conflicting types for ‘xStreamBufferIsFull’
static portINLINE BaseType_t xStreamBufferIsFull( const StreamBuffer_t *pxBuffer );
^```
In file included from …\FreeRTOS_Source\include/message_buffer.h:66:0,
from …\TCPTask\TCPTask.c:12:
…\FreeRTOS_Source\include/stream_buffer.h:629:12: note: previous declaration of ‘xStreamBufferIsFull’ was here
BaseType_t xStreamBufferIsFull( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION;

In fact, it looks that some symbols defined in message_buffer.h are also re-defined in FreeRTOS_Stream_Buffer.h, included by FreeRTOS_IP_Private.h.

Not sure whether the mistake is in including FreeRTOS_IP_Private.h (maybe there is a more correct approach to have access to eConsiderFrameForProcessing and eProcessBuffer symbols) or in something else.

Thanks in advance for your support.

heinbali01 wrote on Monday, September 30, 2019:

Thanks a lot for reporting this conflict.
FreeRTOS+TCP is using its own implementation of stream buffers (FreeRTOS_Stream_Buffer.h), one that is slightly different from the stream buffers in the FreeRTOS kernel (stream_buffer.h).
In fact there are two implementations of the function xStreamBufferIsFull()
and xStreamBufferIsEmpty().
I will see if we can change FreeRTOS+TCP to give them a slightly different name.