Skip to content

Commit

Permalink
Merge branch 'FreeRTOS:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
n9wxu authored Sep 26, 2023
2 parents e3add71 + 84bdb05 commit b283a6a
Show file tree
Hide file tree
Showing 120 changed files with 6,647 additions and 592 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Format Pull Request Files

on:
issue_comment:
types: [created]

env:
bashPass: \033[32;1mPASSED -
bashInfo: \033[33;1mINFO -
bashFail: \033[31;1mFAILED -
bashEnd: \033[0m

jobs:
Formatting:
name: Run Formatting Check
if: ${{ github.event.issue.pull_request }} &&
( ( github.event.comment.body == '/bot run uncrustify' ) ||
( github.event.comment.body == '/bot run formatting' ) )
runs-on: ubuntu-20.04
steps:
- name: Apply Formatting Fix
uses: FreeRTOS/CI-CD-Github-Actions/formatting-bot@main
id: check-formatting
14 changes: 0 additions & 14 deletions .github/workflows/kernel-demos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,20 +166,6 @@ jobs:
working-directory: FreeRTOS/Demo/CORTEX_LM3S102_GCC
run: make -j

- name: Build CORTEX_M3_MPS2_QEMU_GCC Demo
shell: bash
working-directory: FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC
run: |
make clean
make -j
- name: Build CORTEX_M3_MPS2_QEMU_GCC Demo
shell: bash
working-directory: FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC
run: |
make clean
make FULL_DEMO=1 -j
- name: Build CORTEX_LM3S811_GCC Demo
shell: bash
working-directory: FreeRTOS/Demo/CORTEX_LM3S811_GCC
Expand Down
16 changes: 16 additions & 0 deletions croutine.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@
BaseType_t xReturn;
CRCB_t * pxCoRoutine;

traceENTER_xCoRoutineCreate( pxCoRoutineCode, uxPriority, uxIndex );

/* Allocate the memory that will store the co-routine control block. */
pxCoRoutine = ( CRCB_t * ) pvPortMalloc( sizeof( CRCB_t ) );

Expand Down Expand Up @@ -156,6 +158,8 @@
xReturn = errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY;
}

traceRETURN_xCoRoutineCreate( xReturn );

return xReturn;
}
/*-----------------------------------------------------------*/
Expand All @@ -165,6 +169,8 @@
{
TickType_t xTimeToWake;

traceENTER_vCoRoutineAddToDelayedList( xTicksToDelay, pxEventList );

/* Calculate the time to wake - this may overflow but this is
* not a problem. */
xTimeToWake = xCoRoutineTickCount + xTicksToDelay;
Expand Down Expand Up @@ -196,6 +202,8 @@
* function must be called with interrupts disabled. */
vListInsert( pxEventList, &( pxCurrentCoRoutine->xEventListItem ) );
}

traceRETURN_vCoRoutineAddToDelayedList();
}
/*-----------------------------------------------------------*/

Expand Down Expand Up @@ -283,6 +291,8 @@

void vCoRoutineSchedule( void )
{
traceENTER_vCoRoutineSchedule();

/* Only run a co-routine after prvInitialiseCoRoutineLists() has been
* called. prvInitialiseCoRoutineLists() is called automatically when a
* co-routine is created. */
Expand Down Expand Up @@ -313,6 +323,8 @@
/* Call the co-routine. */
( pxCurrentCoRoutine->pxCoRoutineFunction )( pxCurrentCoRoutine, pxCurrentCoRoutine->uxIndex );
}

traceRETURN_vCoRoutineSchedule();
}
/*-----------------------------------------------------------*/

Expand Down Expand Up @@ -341,6 +353,8 @@
CRCB_t * pxUnblockedCRCB;
BaseType_t xReturn;

traceENTER_xCoRoutineRemoveFromEventList( pxEventList );

/* This function is called from within an interrupt. It can only access
* event lists and the pending ready list. This function assumes that a
* check has already been made to ensure pxEventList is not empty. */
Expand All @@ -357,6 +371,8 @@
xReturn = pdFALSE;
}

traceRETURN_xCoRoutineRemoveFromEventList( xReturn );

return xReturn;
}

Expand Down
60 changes: 60 additions & 0 deletions event_groups.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ static BaseType_t prvTestWaitCondition( const EventBits_t uxCurrentEventBits,
{
EventGroup_t * pxEventBits;

traceENTER_xEventGroupCreateStatic( pxEventGroupBuffer );

/* A StaticEventGroup_t object must be provided. */
configASSERT( pxEventGroupBuffer );

Expand Down Expand Up @@ -122,6 +124,8 @@ static BaseType_t prvTestWaitCondition( const EventBits_t uxCurrentEventBits,
traceEVENT_GROUP_CREATE_FAILED();
}

traceRETURN_xEventGroupCreateStatic( pxEventBits );

return pxEventBits;
}

Expand All @@ -134,6 +138,8 @@ static BaseType_t prvTestWaitCondition( const EventBits_t uxCurrentEventBits,
{
EventGroup_t * pxEventBits;

traceENTER_xEventGroupCreate();

/* Allocate the event group. Justification for MISRA deviation as
* follows: pvPortMalloc() always ensures returned memory blocks are
* aligned per the requirements of the MCU stack. In this case
Expand Down Expand Up @@ -170,6 +176,8 @@ static BaseType_t prvTestWaitCondition( const EventBits_t uxCurrentEventBits,
traceEVENT_GROUP_CREATE_FAILED(); /*lint !e9063 Else branch only exists to allow tracing and does not generate code if trace macros are not defined. */
}

traceRETURN_xEventGroupCreate( pxEventBits );

return pxEventBits;
}

Expand All @@ -186,6 +194,8 @@ EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup,
BaseType_t xAlreadyYielded;
BaseType_t xTimeoutOccurred = pdFALSE;

traceENTER_xEventGroupSync( xEventGroup, uxBitsToSet, uxBitsToWaitFor, xTicksToWait );

configASSERT( ( uxBitsToWaitFor & eventEVENT_BITS_CONTROL_BYTES ) == 0 );
configASSERT( uxBitsToWaitFor != 0 );
#if ( ( INCLUDE_xTaskGetSchedulerState == 1 ) || ( configUSE_TIMERS == 1 ) )
Expand Down Expand Up @@ -303,6 +313,8 @@ EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup,
/* Prevent compiler warnings when trace macros are not used. */
( void ) xTimeoutOccurred;

traceRETURN_xEventGroupSync( uxReturn );

return uxReturn;
}
/*-----------------------------------------------------------*/
Expand All @@ -318,6 +330,8 @@ EventBits_t xEventGroupWaitBits( EventGroupHandle_t xEventGroup,
BaseType_t xWaitConditionMet, xAlreadyYielded;
BaseType_t xTimeoutOccurred = pdFALSE;

traceENTER_xEventGroupWaitBits( xEventGroup, uxBitsToWaitFor, xClearOnExit, xWaitForAllBits, xTicksToWait );

/* Check the user is not attempting to wait on the bits used by the kernel
* itself, and that at least one bit is being requested. */
configASSERT( xEventGroup );
Expand Down Expand Up @@ -467,6 +481,8 @@ EventBits_t xEventGroupWaitBits( EventGroupHandle_t xEventGroup,
/* Prevent compiler warnings when trace macros are not used. */
( void ) xTimeoutOccurred;

traceRETURN_xEventGroupWaitBits( uxReturn );

return uxReturn;
}
/*-----------------------------------------------------------*/
Expand All @@ -477,6 +493,8 @@ EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup,
EventGroup_t * pxEventBits = xEventGroup;
EventBits_t uxReturn;

traceENTER_xEventGroupClearBits( xEventGroup, uxBitsToClear );

/* Check the user is not attempting to clear the bits used by the kernel
* itself. */
configASSERT( xEventGroup );
Expand All @@ -495,6 +513,8 @@ EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup,
}
taskEXIT_CRITICAL();

traceRETURN_xEventGroupClearBits( uxReturn );

return uxReturn;
}
/*-----------------------------------------------------------*/
Expand All @@ -506,9 +526,13 @@ EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup,
{
BaseType_t xReturn;

traceENTER_xEventGroupClearBitsFromISR( xEventGroup, uxBitsToClear );

traceEVENT_GROUP_CLEAR_BITS_FROM_ISR( xEventGroup, uxBitsToClear );
xReturn = xTimerPendFunctionCallFromISR( vEventGroupClearBitsCallback, ( void * ) xEventGroup, ( uint32_t ) uxBitsToClear, NULL ); /*lint !e9087 Can't avoid cast to void* as a generic callback function not specific to this use case. Callback casts back to original type so safe. */

traceRETURN_xEventGroupClearBitsFromISR( xReturn );

return xReturn;
}

Expand All @@ -521,12 +545,16 @@ EventBits_t xEventGroupGetBitsFromISR( EventGroupHandle_t xEventGroup )
EventGroup_t const * const pxEventBits = xEventGroup;
EventBits_t uxReturn;

traceENTER_xEventGroupGetBitsFromISR( xEventGroup );

uxSavedInterruptStatus = taskENTER_CRITICAL_FROM_ISR();
{
uxReturn = pxEventBits->uxEventBits;
}
taskEXIT_CRITICAL_FROM_ISR( uxSavedInterruptStatus );

traceRETURN_xEventGroupGetBitsFromISR( uxReturn );

return uxReturn;
} /*lint !e818 EventGroupHandle_t is a typedef used in other functions to so can't be pointer to const. */
/*-----------------------------------------------------------*/
Expand All @@ -542,6 +570,8 @@ EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup,
EventGroup_t * pxEventBits = xEventGroup;
BaseType_t xMatchFound = pdFALSE;

traceENTER_xEventGroupSetBits( xEventGroup, uxBitsToSet );

/* Check the user is not attempting to set the bits used by the kernel
* itself. */
configASSERT( xEventGroup );
Expand Down Expand Up @@ -623,6 +653,8 @@ EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup,
}
( void ) xTaskResumeAll();

traceRETURN_xEventGroupSetBits( pxEventBits->uxEventBits );

return pxEventBits->uxEventBits;
}
/*-----------------------------------------------------------*/
Expand All @@ -632,6 +664,8 @@ void vEventGroupDelete( EventGroupHandle_t xEventGroup )
EventGroup_t * pxEventBits = xEventGroup;
const List_t * pxTasksWaitingForBits;

traceENTER_vEventGroupDelete( xEventGroup );

configASSERT( pxEventBits );

pxTasksWaitingForBits = &( pxEventBits->xTasksWaitingForBits );
Expand Down Expand Up @@ -670,6 +704,8 @@ void vEventGroupDelete( EventGroupHandle_t xEventGroup )
}
}
#endif /* configSUPPORT_DYNAMIC_ALLOCATION */

traceRETURN_vEventGroupDelete();
}
/*-----------------------------------------------------------*/

Expand All @@ -680,6 +716,8 @@ void vEventGroupDelete( EventGroupHandle_t xEventGroup )
BaseType_t xReturn;
EventGroup_t * pxEventBits = xEventGroup;

traceENTER_xEventGroupGetStaticBuffer( xEventGroup, ppxEventGroupBuffer );

configASSERT( pxEventBits );
configASSERT( ppxEventGroupBuffer );

Expand All @@ -704,6 +742,8 @@ void vEventGroupDelete( EventGroupHandle_t xEventGroup )
}
#endif /* configSUPPORT_DYNAMIC_ALLOCATION */

traceRETURN_xEventGroupGetStaticBuffer( xReturn );

return xReturn;
}
#endif /* configSUPPORT_STATIC_ALLOCATION */
Expand All @@ -714,7 +754,11 @@ void vEventGroupDelete( EventGroupHandle_t xEventGroup )
void vEventGroupSetBitsCallback( void * pvEventGroup,
const uint32_t ulBitsToSet )
{
traceENTER_vEventGroupSetBitsCallback( pvEventGroup, ulBitsToSet );

( void ) xEventGroupSetBits( pvEventGroup, ( EventBits_t ) ulBitsToSet ); /*lint !e9079 Can't avoid cast to void* as a generic timer callback prototype. Callback casts back to original type so safe. */

traceRETURN_vEventGroupSetBitsCallback();
}
/*-----------------------------------------------------------*/

Expand All @@ -723,7 +767,11 @@ void vEventGroupSetBitsCallback( void * pvEventGroup,
void vEventGroupClearBitsCallback( void * pvEventGroup,
const uint32_t ulBitsToClear )
{
traceENTER_vEventGroupClearBitsCallback( pvEventGroup, ulBitsToClear );

( void ) xEventGroupClearBits( pvEventGroup, ( EventBits_t ) ulBitsToClear ); /*lint !e9079 Can't avoid cast to void* as a generic timer callback prototype. Callback casts back to original type so safe. */

traceRETURN_vEventGroupClearBitsCallback();
}
/*-----------------------------------------------------------*/

Expand Down Expand Up @@ -772,9 +820,13 @@ static BaseType_t prvTestWaitCondition( const EventBits_t uxCurrentEventBits,
{
BaseType_t xReturn;

traceENTER_xEventGroupSetBitsFromISR( xEventGroup, uxBitsToSet, pxHigherPriorityTaskWoken );

traceEVENT_GROUP_SET_BITS_FROM_ISR( xEventGroup, uxBitsToSet );
xReturn = xTimerPendFunctionCallFromISR( vEventGroupSetBitsCallback, ( void * ) xEventGroup, ( uint32_t ) uxBitsToSet, pxHigherPriorityTaskWoken ); /*lint !e9087 Can't avoid cast to void* as a generic callback function not specific to this use case. Callback casts back to original type so safe. */

traceRETURN_xEventGroupSetBitsFromISR( xReturn );

return xReturn;
}

Expand All @@ -788,6 +840,8 @@ static BaseType_t prvTestWaitCondition( const EventBits_t uxCurrentEventBits,
UBaseType_t xReturn;
EventGroup_t const * pxEventBits = ( EventGroup_t * ) xEventGroup; /*lint !e9087 !e9079 EventGroupHandle_t is a pointer to an EventGroup_t, but EventGroupHandle_t is kept opaque outside of this file for data hiding purposes. */

traceENTER_uxEventGroupGetNumber( xEventGroup );

if( xEventGroup == NULL )
{
xReturn = 0;
Expand All @@ -797,6 +851,8 @@ static BaseType_t prvTestWaitCondition( const EventBits_t uxCurrentEventBits,
xReturn = pxEventBits->uxEventGroupNumber;
}

traceRETURN_uxEventGroupGetNumber( xReturn );

return xReturn;
}

Expand All @@ -808,7 +864,11 @@ static BaseType_t prvTestWaitCondition( const EventBits_t uxCurrentEventBits,
void vEventGroupSetNumber( void * xEventGroup,
UBaseType_t uxEventGroupNumber )
{
traceENTER_vEventGroupSetNumber( xEventGroup, uxEventGroupNumber );

( ( EventGroup_t * ) xEventGroup )->uxEventGroupNumber = uxEventGroupNumber; /*lint !e9087 !e9079 EventGroupHandle_t is a pointer to an EventGroup_t, but EventGroupHandle_t is kept opaque outside of this file for data hiding purposes. */

traceRETURN_vEventGroupSetNumber();
}

#endif /* configUSE_TRACE_FACILITY */
Expand Down
Loading

0 comments on commit b283a6a

Please sign in to comment.