diff --git a/source/FreeRTOS_IP_Utils.c b/source/FreeRTOS_IP_Utils.c index c1fa3a7ba5..c39449211c 100644 --- a/source/FreeRTOS_IP_Utils.c +++ b/source/FreeRTOS_IP_Utils.c @@ -1004,26 +1004,29 @@ void vPreCheckConfigs( void ) { size_t uxSize; - /* Check if ipBUFFER_PADDING has a minimum size, depending on the platform. - * See FreeRTOS_IP.h for more details. */ - #if ( UINTPTR_MAX > 0xFFFFFFFFU ) + #if ( ipconfigSUPPRESS_BUFFER_PADDING_CHECK == 0 ) + + /* Check if ipBUFFER_PADDING has a minimum size, depending on the platform. + * See FreeRTOS_IP.h for more details. */ + #if ( UINTPTR_MAX > 0xFFFFFFFFU ) + + /* + * This is a 64-bit platform, make sure there is enough space in + * pucEthernetBuffer to store a pointer. + */ + configASSERT( ipBUFFER_PADDING >= 14U ); + #else + /* This is a 32-bit platform. */ + configASSERT( ipBUFFER_PADDING >= 10U ); + #endif /* UINTPTR_MAX > 0xFFFFFFFFU */ /* - * This is a 64-bit platform, make sure there is enough space in - * pucEthernetBuffer to store a pointer. + * The size of the Ethernet header (14) plus ipBUFFER_PADDING should be a + * multiple of 32 bits, in order to get aligned access to all uint32_t + * fields in the protocol headers. */ - configASSERT( ipBUFFER_PADDING >= 14U ); - #else - /* This is a 32-bit platform. */ - configASSERT( ipBUFFER_PADDING >= 10U ); - #endif /* UINTPTR_MAX > 0xFFFFFFFFU */ - - /* - * The size of the Ethernet header (14) plus ipBUFFER_PADDING should be a - * multiple of 32 bits, in order to get aligned access to all uint32_t - * fields in the protocol headers. - */ - configASSERT( ( ( ( ipSIZE_OF_ETH_HEADER ) + ( ipBUFFER_PADDING ) ) % 4U ) == 0U ); + configASSERT( ( ( ( ipSIZE_OF_ETH_HEADER ) + ( ipBUFFER_PADDING ) ) % 4U ) == 0U ); + #endif /* if ( ipconfigSUPPRESS_BUFFER_PADDING_CHECK == 0 ) */ /* LCOV_EXCL_BR_START */ uxSize = ipconfigNETWORK_MTU; diff --git a/source/include/FreeRTOSIPConfigDefaults.h b/source/include/FreeRTOSIPConfigDefaults.h index efdeb89840..dcd7564447 100644 --- a/source/include/FreeRTOSIPConfigDefaults.h +++ b/source/include/FreeRTOSIPConfigDefaults.h @@ -3403,6 +3403,24 @@ STATIC_ASSERT( ipconfigDNS_SEND_BLOCK_TIME_TICKS <= portMAX_DELAY ); /*---------------------------------------------------------------------------*/ +/* + * ipconfigSUPPRESS_BUFFER_PADDING_CHECK + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * Suppress configuration check when user configuration + * for ipconfigPACKET_FILLER_SIZE or ipconfigBUFFER_PADDING is + * sub optimal. Useful when porting to a MAC that does not include + * the option to pad received packets ipconfigPACKET_FILLER_SIZE + * within a word boundary. + */ + +#ifndef ipconfigSUPPRESS_BUFFER_PADDING_CHECK + #define ipconfigSUPPRESS_BUFFER_PADDING_CHECK ipconfigDISABLE +#endif + +/*---------------------------------------------------------------------------*/ + /* * ipconfigINCLUDE_EXAMPLE_FREERTOS_PLUS_TRACE_CALLS *