mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-19 21:11:57 -04:00
Add configUSE_MINI_LIST_ITEM configuration option to enable the MiniListItem_t type. (#433)
* Add configUSE_MINI_LIST_ITEM configuration option to enable the MiniListItem_t type. When configUSE_MINI_LIST_ITEM == 0: MiniListItem_t and ListItem_t are both typedefs of struct xLIST_ITEM. When configUSE_MINI_LIST_ITEM == 1 (the default in projdefs.h): MiniListItem_t is a typedef of struct xMINI_LIST_ITEM, which contains 3 fewer fields than a struct xLIST_ITEM. This configuration saves approximately sizeof(TickType_t) + 2 * sizeof( void * ) bytes of ram, however it also violates strict aliasing rules which some compilers depend on for optimization. configUSE_MINI_LIST_ITEM defaults to 1 when not defined. * Add pp_indent_brace option to uncrustify config Improves compliance with the FreeRTOS code style guide: https://www.freertos.org/FreeRTOS-Coding-Standard-and-Style-Guide.html
This commit is contained in:
parent
043c2c7ef6
commit
dca4f80a6b
1
.github/uncrustify.cfg
vendored
1
.github/uncrustify.cfg
vendored
|
@ -157,4 +157,5 @@ pp_indent_at_level = true # false/true
|
||||||
pp_indent_count = 4 # unsigned number
|
pp_indent_count = 4 # unsigned number
|
||||||
pp_space = remove # ignore/add/remove/force
|
pp_space = remove # ignore/add/remove/force
|
||||||
pp_if_indent_code = true # false/true
|
pp_if_indent_code = true # false/true
|
||||||
|
pp_indent_brace = false # true/false
|
||||||
# option(s) with 'not default' value: 158
|
# option(s) with 'not default' value: 158
|
||||||
|
|
|
@ -7,6 +7,12 @@ Documentation and download available at https://www.FreeRTOS.org/
|
||||||
The new function xTimerGetAutoReload() provides the auto-reload state as
|
The new function xTimerGetAutoReload() provides the auto-reload state as
|
||||||
a BaseType_t. The legacy function uxTimerGetAutoReload is retained with the
|
a BaseType_t. The legacy function uxTimerGetAutoReload is retained with the
|
||||||
original UBaseType_t return value.
|
original UBaseType_t return value.
|
||||||
|
+ Introduce the configUSE_MINI_LIST_ITEM configuration option. When this
|
||||||
|
option is set to 1, ListItem_t and MiniLitItem_t remain separate types.
|
||||||
|
However, when configUSE_MINI_LIST_ITEM == 0, MiniLitItem_t and ListItem_t
|
||||||
|
are both typedefs of the same struct xLIST_ITEM. This addresses some issues
|
||||||
|
observed when strict-aliasing and link time optimization are enabled.
|
||||||
|
To maintain backwards compatibility, configUSE_MINI_LIST_ITEM defaults to 1.
|
||||||
|
|
||||||
|
|
||||||
Changes between FreeRTOS V10.4.4 and FreeRTOS V10.4.5 released September 10 2021
|
Changes between FreeRTOS V10.4.4 and FreeRTOS V10.4.5 released September 10 2021
|
||||||
|
|
|
@ -334,6 +334,10 @@
|
||||||
#define pcQueueGetName( xQueue )
|
#define pcQueueGetName( xQueue )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef configUSE_MINI_LIST_ITEM
|
||||||
|
#define configUSE_MINI_LIST_ITEM 1
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef portPOINTER_SIZE_TYPE
|
#ifndef portPOINTER_SIZE_TYPE
|
||||||
#define portPOINTER_SIZE_TYPE uint32_t
|
#define portPOINTER_SIZE_TYPE uint32_t
|
||||||
#endif
|
#endif
|
||||||
|
@ -1134,16 +1138,20 @@ struct xSTATIC_LIST_ITEM
|
||||||
};
|
};
|
||||||
typedef struct xSTATIC_LIST_ITEM StaticListItem_t;
|
typedef struct xSTATIC_LIST_ITEM StaticListItem_t;
|
||||||
|
|
||||||
/* See the comments above the struct xSTATIC_LIST_ITEM definition. */
|
#if ( configUSE_MINI_LIST_ITEM == 1 )
|
||||||
struct xSTATIC_MINI_LIST_ITEM
|
/* See the comments above the struct xSTATIC_LIST_ITEM definition. */
|
||||||
{
|
struct xSTATIC_MINI_LIST_ITEM
|
||||||
|
{
|
||||||
#if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
|
#if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
|
||||||
TickType_t xDummy1;
|
TickType_t xDummy1;
|
||||||
#endif
|
#endif
|
||||||
TickType_t xDummy2;
|
TickType_t xDummy2;
|
||||||
void * pvDummy3[ 2 ];
|
void * pvDummy3[ 2 ];
|
||||||
};
|
};
|
||||||
typedef struct xSTATIC_MINI_LIST_ITEM StaticMiniListItem_t;
|
typedef struct xSTATIC_MINI_LIST_ITEM StaticMiniListItem_t;
|
||||||
|
#else /* if ( configUSE_MINI_LIST_ITEM == 1 ) */
|
||||||
|
typedef struct xSTATIC_LIST_ITEM StaticMiniListItem_t;
|
||||||
|
#endif /* if ( configUSE_MINI_LIST_ITEM == 1 ) */
|
||||||
|
|
||||||
/* See the comments above the struct xSTATIC_LIST_ITEM definition. */
|
/* See the comments above the struct xSTATIC_LIST_ITEM definition. */
|
||||||
typedef struct xSTATIC_LIST
|
typedef struct xSTATIC_LIST
|
||||||
|
|
|
@ -153,14 +153,18 @@ struct xLIST_ITEM
|
||||||
};
|
};
|
||||||
typedef struct xLIST_ITEM ListItem_t; /* For some reason lint wants this as two separate definitions. */
|
typedef struct xLIST_ITEM ListItem_t; /* For some reason lint wants this as two separate definitions. */
|
||||||
|
|
||||||
struct xMINI_LIST_ITEM
|
#if ( configUSE_MINI_LIST_ITEM == 1 )
|
||||||
{
|
struct xMINI_LIST_ITEM
|
||||||
|
{
|
||||||
listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
||||||
configLIST_VOLATILE TickType_t xItemValue;
|
configLIST_VOLATILE TickType_t xItemValue;
|
||||||
struct xLIST_ITEM * configLIST_VOLATILE pxNext;
|
struct xLIST_ITEM * configLIST_VOLATILE pxNext;
|
||||||
struct xLIST_ITEM * configLIST_VOLATILE pxPrevious;
|
struct xLIST_ITEM * configLIST_VOLATILE pxPrevious;
|
||||||
};
|
};
|
||||||
typedef struct xMINI_LIST_ITEM MiniListItem_t;
|
typedef struct xMINI_LIST_ITEM MiniListItem_t;
|
||||||
|
#else
|
||||||
|
typedef struct xLIST_ITEM MiniListItem_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Definition of the type of queue used by the scheduler.
|
* Definition of the type of queue used by the scheduler.
|
||||||
|
|
11
list.c
11
list.c
|
@ -54,6 +54,8 @@ void vListInitialise( List_t * const pxList )
|
||||||
* as the only list entry. */
|
* as the only list entry. */
|
||||||
pxList->pxIndex = ( ListItem_t * ) &( pxList->xListEnd ); /*lint !e826 !e740 !e9087 The mini list structure is used as the list end to save RAM. This is checked and valid. */
|
pxList->pxIndex = ( ListItem_t * ) &( pxList->xListEnd ); /*lint !e826 !e740 !e9087 The mini list structure is used as the list end to save RAM. This is checked and valid. */
|
||||||
|
|
||||||
|
listSET_FIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE( &( pxList->xListEnd ) );
|
||||||
|
|
||||||
/* The list end value is the highest possible value in the list to
|
/* The list end value is the highest possible value in the list to
|
||||||
* ensure it remains at the end of the list. */
|
* ensure it remains at the end of the list. */
|
||||||
pxList->xListEnd.xItemValue = portMAX_DELAY;
|
pxList->xListEnd.xItemValue = portMAX_DELAY;
|
||||||
|
@ -63,6 +65,15 @@ void vListInitialise( List_t * const pxList )
|
||||||
pxList->xListEnd.pxNext = ( ListItem_t * ) &( pxList->xListEnd ); /*lint !e826 !e740 !e9087 The mini list structure is used as the list end to save RAM. This is checked and valid. */
|
pxList->xListEnd.pxNext = ( ListItem_t * ) &( pxList->xListEnd ); /*lint !e826 !e740 !e9087 The mini list structure is used as the list end to save RAM. This is checked and valid. */
|
||||||
pxList->xListEnd.pxPrevious = ( ListItem_t * ) &( pxList->xListEnd ); /*lint !e826 !e740 !e9087 The mini list structure is used as the list end to save RAM. This is checked and valid. */
|
pxList->xListEnd.pxPrevious = ( ListItem_t * ) &( pxList->xListEnd ); /*lint !e826 !e740 !e9087 The mini list structure is used as the list end to save RAM. This is checked and valid. */
|
||||||
|
|
||||||
|
/* Initialize the remaining fields of xListEnd when it is a proper ListItem_t */
|
||||||
|
#if ( configUSE_MINI_LIST_ITEM == 0 )
|
||||||
|
{
|
||||||
|
pxList->xListEnd.pvOwner = NULL;
|
||||||
|
pxList->xListEnd.pxContainer = NULL;
|
||||||
|
listSET_SECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE( &( pxList->xListEnd ) );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
pxList->uxNumberOfItems = ( UBaseType_t ) 0U;
|
pxList->uxNumberOfItems = ( UBaseType_t ) 0U;
|
||||||
|
|
||||||
/* Write known values into the list if
|
/* Write known values into the list if
|
||||||
|
|
Loading…
Reference in a new issue