Change how volatile is used in some of the standard demos to remove compiler warnings in the latest GCC versions.

pull/4/head
Richard Barry 8 years ago
parent ca9edf3531
commit c882141175

@ -619,8 +619,9 @@ uint32_t ulReceived;
static void prvSendToQueueInSetFromISR( void ) static void prvSendToQueueInSetFromISR( void )
{ {
static BaseType_t xQueueToWriteTo = 0; static BaseType_t xQueueToWriteTo = 0;
uint32_t ulTxValueSnapshot = ulISRTxValue;
if( xQueueSendFromISR( xQueues[ xQueueToWriteTo ], ( void * ) &ulISRTxValue, NULL ) == pdPASS ) if( xQueueSendFromISR( xQueues[ xQueueToWriteTo ], ( void * ) &ulTxValueSnapshot, NULL ) == pdPASS )
{ {
ulISRTxValue++; ulISRTxValue++;

@ -115,13 +115,13 @@ static void prvCountingSemaphoreTask( void *pvParameters );
* Utility function to increment the semaphore count value up from zero to * Utility function to increment the semaphore count value up from zero to
* countMAX_COUNT_VALUE. * countMAX_COUNT_VALUE.
*/ */
static void prvIncrementSemaphoreCount( SemaphoreHandle_t xSemaphore, UBaseType_t *puxLoopCounter ); static void prvIncrementSemaphoreCount( SemaphoreHandle_t xSemaphore, volatile UBaseType_t *puxLoopCounter );
/* /*
* Utility function to decrement the semaphore count value up from * Utility function to decrement the semaphore count value up from
* countMAX_COUNT_VALUE to zero. * countMAX_COUNT_VALUE to zero.
*/ */
static void prvDecrementSemaphoreCount( SemaphoreHandle_t xSemaphore, UBaseType_t *puxLoopCounter ); static void prvDecrementSemaphoreCount( SemaphoreHandle_t xSemaphore, volatile UBaseType_t *puxLoopCounter );
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@ -138,11 +138,11 @@ typedef struct COUNT_SEM_STRUCT
/* Incremented on each cycle of the demo task. Used to detect a stalled /* Incremented on each cycle of the demo task. Used to detect a stalled
task. */ task. */
UBaseType_t uxLoopCounter; volatile UBaseType_t uxLoopCounter;
} xCountSemStruct; } xCountSemStruct;
/* Two structures are defined, one is passed to each test task. */ /* Two structures are defined, one is passed to each test task. */
static volatile xCountSemStruct xParameters[ countNUM_TEST_TASKS ]; static xCountSemStruct xParameters[ countNUM_TEST_TASKS ];
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@ -178,7 +178,7 @@ void vStartCountingSemaphoreTasks( void )
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static void prvDecrementSemaphoreCount( SemaphoreHandle_t xSemaphore, UBaseType_t *puxLoopCounter ) static void prvDecrementSemaphoreCount( SemaphoreHandle_t xSemaphore, volatile UBaseType_t *puxLoopCounter )
{ {
UBaseType_t ux; UBaseType_t ux;
@ -217,7 +217,7 @@ UBaseType_t ux;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static void prvIncrementSemaphoreCount( SemaphoreHandle_t xSemaphore, UBaseType_t *puxLoopCounter ) static void prvIncrementSemaphoreCount( SemaphoreHandle_t xSemaphore, volatile UBaseType_t *puxLoopCounter )
{ {
UBaseType_t ux; UBaseType_t ux;

@ -162,7 +162,7 @@ static TaskHandle_t xContinuousIncrementHandle, xLimitedIncrementHandle;
/* The shared counter variable. This is passed in as a parameter to the two /* The shared counter variable. This is passed in as a parameter to the two
counter variables for demonstration purposes. */ counter variables for demonstration purposes. */
static volatile uint32_t ulCounter; static uint32_t ulCounter;
/* Variables used to check that the tasks are still operating without error. /* Variables used to check that the tasks are still operating without error.
Each complete iteration of the controller task increments this variable Each complete iteration of the controller task increments this variable
@ -214,11 +214,11 @@ void vStartDynamicPriorityTasks( void )
*/ */
static portTASK_FUNCTION( vLimitedIncrementTask, pvParameters ) static portTASK_FUNCTION( vLimitedIncrementTask, pvParameters )
{ {
uint32_t *pulCounter; volatile uint32_t *pulCounter;
/* Take a pointer to the shared variable from the parameters passed into /* Take a pointer to the shared variable from the parameters passed into
the task. */ the task. */
pulCounter = ( uint32_t * ) pvParameters; pulCounter = ( volatile uint32_t * ) pvParameters;
/* This will run before the control task, so the first thing it does is /* This will run before the control task, so the first thing it does is
suspend - the control task will resume it when ready. */ suspend - the control task will resume it when ready. */
@ -248,7 +248,7 @@ UBaseType_t uxOurPriority;
/* Take a pointer to the shared variable from the parameters passed into /* Take a pointer to the shared variable from the parameters passed into
the task. */ the task. */
pulCounter = ( uint32_t * ) pvParameters; pulCounter = ( volatile uint32_t * ) pvParameters;
/* Query our priority so we can raise it when exclusive access to the /* Query our priority so we can raise it when exclusive access to the
shared variable is required. */ shared variable is required. */

@ -106,7 +106,7 @@ static portTASK_FUNCTION_PROTO( vCompetingMathTask4, pvParameters );
/* These variables are used to check that all the tasks are still running. If a /* These variables are used to check that all the tasks are still running. If a
task gets a calculation wrong it will stop setting its check variable. */ task gets a calculation wrong it will stop setting its check variable. */
static volatile uint16_t usTaskCheck[ mathNUMBER_OF_TASKS ] = { ( uint16_t ) 0 }; static uint16_t usTaskCheck[ mathNUMBER_OF_TASKS ] = { ( uint16_t ) 0 };
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@ -139,7 +139,7 @@ short sError = pdFALSE;
/* The variable this task increments to show it is still running is passed in /* The variable this task increments to show it is still running is passed in
as the parameter. */ as the parameter. */
pusTaskCheckVariable = ( uint16_t * ) pvParameters; pusTaskCheckVariable = ( volatile uint16_t * ) pvParameters;
/* Keep performing a calculation and checking the result against a constant. */ /* Keep performing a calculation and checking the result against a constant. */
for(;;) for(;;)
@ -198,7 +198,7 @@ short sError = pdFALSE;
/* The variable this task increments to show it is still running is passed in /* The variable this task increments to show it is still running is passed in
as the parameter. */ as the parameter. */
pusTaskCheckVariable = ( uint16_t * ) pvParameters; pusTaskCheckVariable = ( volatile uint16_t * ) pvParameters;
/* Keep performing a calculation and checking the result against a constant. */ /* Keep performing a calculation and checking the result against a constant. */
for( ;; ) for( ;; )
@ -250,7 +250,7 @@ short sError = pdFALSE;
/* The variable this task increments to show it is still running is passed in /* The variable this task increments to show it is still running is passed in
as the parameter. */ as the parameter. */
pusTaskCheckVariable = ( uint16_t * ) pvParameters; pusTaskCheckVariable = ( volatile uint16_t * ) pvParameters;
pdArray = ( portDOUBLE * ) pvPortMalloc( xArraySize * sizeof( portDOUBLE ) ); pdArray = ( portDOUBLE * ) pvPortMalloc( xArraySize * sizeof( portDOUBLE ) );
@ -313,7 +313,7 @@ short sError = pdFALSE;
/* The variable this task increments to show it is still running is passed in /* The variable this task increments to show it is still running is passed in
as the parameter. */ as the parameter. */
pusTaskCheckVariable = ( uint16_t * ) pvParameters; pusTaskCheckVariable = ( volatile uint16_t * ) pvParameters;
pdArray = ( portDOUBLE * ) pvPortMalloc( xArraySize * sizeof( portDOUBLE ) ); pdArray = ( portDOUBLE * ) pvPortMalloc( xArraySize * sizeof( portDOUBLE ) );

@ -104,7 +104,7 @@ static portTASK_FUNCTION_PROTO( vCompeteingIntMathTask, pvParameters );
that the task is still executing. The check task sets the variable back to that the task is still executing. The check task sets the variable back to
false, flagging an error if the variable is still false the next time it false, flagging an error if the variable is still false the next time it
is called. */ is called. */
static volatile BaseType_t xTaskCheck[ intgNUMBER_OF_TASKS ] = { ( BaseType_t ) pdFALSE }; static BaseType_t xTaskCheck[ intgNUMBER_OF_TASKS ] = { ( BaseType_t ) pdFALSE };
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/

Loading…
Cancel
Save