FreeRTOS+TCP and STM32Fx - redefined definition

Hello,

I am facing a compiler warning that I would like to ensure is not an error (directories have been scubbed):

/FreeRTOS-Plus-TCP/portable/NetworkInterface/STM32Fxx/NetworkInterface.c:82: warning: "ipFRAGMENT_OFFSET_BIT_MASK" redefined
   82 | #define ipFRAGMENT_OFFSET_BIT_MASK          ( ( uint16_t ) 0x0fff ) /* The bits in the two byte IP header field that make up the fragment offset value. */
      | 
In file included from /FreeRTOS-Plus-TCP/portable/NetworkInterface/STM32Fxx/NetworkInterface.c:45:
/FreeRTOS-Plus-TCP/include/FreeRTOS_IP_Private.h:346: note: this is the location of the previous definition
  346 |         #define ipFRAGMENT_OFFSET_BIT_MASK         ( ( uint16_t ) 0xff1fU )
      |

My lack of knowledge about this port makes me concerned about whether or not the definition in NetworkInterface.c is actually legit, if not perhaps it should be removed, otherwise guard the definition in FreeRTOS_IP_Private.h?

Thank you.

I’d propose to get rid of the legacy redefinition in the source file and use FreeRTOS_IP_Private.h.
That was a corresponding CR time ago and the latest main version FreeRTOS-Plus-TCP/FreeRTOS_IP_Private.h at main · FreeRTOS/FreeRTOS-Plus-TCP · GitHub ( FreeRTOS+TCP V2.3.4) unconditionally defines it.

@htibosch While we’re at it, I was a bit confused about the
#if ( ipconfigETHERNET_DRIVER_FILTERS_PACKETS == 0 )
condition still in FreeRTOS+TCP V2.3.3 bundled with FreeRTOS 202107.00 at the time I migrated to it and had to patch FreeRTOS_IP_Private.h again to make use exactly of those definitions in my MAC driver packet filter with ipconfigETHERNET_DRIVER_FILTERS_PACKETS enabled.
However, seems that it’s finally cleanup up in the latest/coming version. Thanks :slight_smile:

Should I just patch it local to remove the definition in NetworkInterface.c?

@rpcme , thanks for reporting this.

I am facing a compiler warning that I would like to ensure is not an error (directories have been scubbed):

NetworkInterface.c:82: warning: "ipFRAGMENT_OFFSET_BIT_MASK" redefined
82 | #define ipFRAGMENT_OFFSET_BIT_MASK ( ( uint16_t ) 0x0fff )

include/FreeRTOS_IP_Private.h:346: note: this is the location of the previous definition
346 | #define ipFRAGMENT_OFFSET_BIT_MASK ( ( uint16_t ) 0xff1fU )

My lack of knowledge about this port makes me concerned about whether or not the definition in NetworkInterface.c is actually legit, if not perhaps it should be removed, otherwise guard the definition in FreeRTOS_IP_Private.h?

The macro ipFRAGMENT_OFFSET_BIT_MASK used to be defined in FreeRTOS_IP.c and in mentioned network interface. In January the define was moved to FreeRTOS_IP_Private.h, thanks to PR #179.

@hs2 wrote:

I’d propose to get rid of the legacy redefinition in the source file and use FreeRTOS_IP_Private.h.

Fully agreed.

Should I just patch it local to remove the definition in NetworkInterface.c?

That is the quickest way.

I just removed the macro definition in PR #370, so the one from FreeRTOS_IP_Private.h will be used.

Excellent - thank you for the detailed and action oriented response.