Allow the size of the stack used by many of the standard demo/test tasks to be overridden by FreeRTOSConfig.h settings.

Update the Freedom Studio RISC-V project so the 'full' build configuration is now functional.
This commit is contained in:
Richard Barry 2018-12-28 00:44:18 +00:00
parent 178fe4f143
commit d369110167
15 changed files with 138 additions and 61 deletions

View file

@ -88,6 +88,14 @@ event bits in a group are unblocked as appropriate as different bits get set. */
#define ebSELECTIVE_BITS_1 0x03
#define ebSELECTIVE_BITS_2 0x05
#ifndef ebRENDESVOUS_TEST_TASK_STACK_SIZE
#define ebRENDESVOUS_TEST_TASK_STACK_SIZE configMINIMAL_STACK_SIZE
#endif
#ifndef ebEVENT_GROUP_SET_BITS_TEST_TASK_STACK_SIZE
#define ebEVENT_GROUP_SET_BITS_TEST_TASK_STACK_SIZE configMINIMAL_STACK_SIZE
#endif
/*-----------------------------------------------------------*/
/*
@ -179,10 +187,10 @@ TaskHandle_t xTestSlaveTaskHandle;
*
* Create the test tasks as described at the top of this file.
*/
xTaskCreate( prvTestSlaveTask, "WaitO", configMINIMAL_STACK_SIZE, NULL, ebWAIT_BIT_TASK_PRIORITY, &xTestSlaveTaskHandle );
xTaskCreate( prvTestMasterTask, "SetB", configMINIMAL_STACK_SIZE, ( void * ) xTestSlaveTaskHandle, ebSET_BIT_TASK_PRIORITY, NULL );
xTaskCreate( prvSyncTask, "Rndv", configMINIMAL_STACK_SIZE, ( void * ) ebRENDESVOUS_TASK_1_SYNC_BIT, ebWAIT_BIT_TASK_PRIORITY, &xSyncTask1 );
xTaskCreate( prvSyncTask, "Rndv", configMINIMAL_STACK_SIZE, ( void * ) ebRENDESVOUS_TASK_2_SYNC_BIT, ebWAIT_BIT_TASK_PRIORITY, &xSyncTask2 );
xTaskCreate( prvTestSlaveTask, "WaitO", ebRENDESVOUS_TEST_TASK_STACK_SIZE, NULL, ebWAIT_BIT_TASK_PRIORITY, &xTestSlaveTaskHandle );
xTaskCreate( prvTestMasterTask, "SetB", ebEVENT_GROUP_SET_BITS_TEST_TASK_STACK_SIZE, ( void * ) xTestSlaveTaskHandle, ebSET_BIT_TASK_PRIORITY, NULL );
xTaskCreate( prvSyncTask, "Rndv", ebRENDESVOUS_TEST_TASK_STACK_SIZE, ( void * ) ebRENDESVOUS_TASK_1_SYNC_BIT, ebWAIT_BIT_TASK_PRIORITY, &xSyncTask1 );
xTaskCreate( prvSyncTask, "Rndv", ebRENDESVOUS_TEST_TASK_STACK_SIZE, ( void * ) ebRENDESVOUS_TASK_2_SYNC_BIT, ebWAIT_BIT_TASK_PRIORITY, &xSyncTask2 );
/* If the last task was created then the others will have been too. */
configASSERT( xSyncTask2 );

View file

@ -56,6 +56,13 @@
#define genqMUTEX_MEDIUM_PRIORITY ( tskIDLE_PRIORITY + 2 )
#define genqMUTEX_HIGH_PRIORITY ( tskIDLE_PRIORITY + 3 )
#ifndef genqMUTEX_TEST_TASK_STACK_SIZE
#define configMINIMAL_STACK_SIZE
#endif
#ifndef genqGENERIC_QUEUE_TEST_TASK_STACK_SIZE
#define genqGENERIC_QUEUE_TEST_TASK_STACK_SIZE configMINIMAL_STACK_SIZE
#endif
/*-----------------------------------------------------------*/
/*
@ -158,7 +165,7 @@ SemaphoreHandle_t xMutex;
/* Create the demo task and pass it the queue just created. We are
passing the queue handle by value so it does not matter that it is
declared on the stack here. */
xTaskCreate( prvSendFrontAndBackTest, "GenQ", configMINIMAL_STACK_SIZE, ( void * ) xQueue, uxPriority, NULL );
xTaskCreate( prvSendFrontAndBackTest, "GenQ", genqGENERIC_QUEUE_TEST_TASK_STACK_SIZE, ( void * ) xQueue, uxPriority, NULL );
}
/* Create the mutex used by the prvMutexTest task. */
@ -177,9 +184,9 @@ SemaphoreHandle_t xMutex;
/* Create the mutex demo tasks and pass it the mutex just created. We
are passing the mutex handle by value so it does not matter that it is
declared on the stack here. */
xTaskCreate( prvLowPriorityMutexTask, "MuLow", configMINIMAL_STACK_SIZE, ( void * ) xMutex, genqMUTEX_LOW_PRIORITY, NULL );
xTaskCreate( prvLowPriorityMutexTask, "MuLow", genqMUTEX_TEST_TASK_STACK_SIZE, ( void * ) xMutex, genqMUTEX_LOW_PRIORITY, NULL );
xTaskCreate( prvMediumPriorityMutexTask, "MuMed", configMINIMAL_STACK_SIZE, NULL, genqMUTEX_MEDIUM_PRIORITY, &xMediumPriorityMutexTask );
xTaskCreate( prvHighPriorityMutexTask, "MuHigh", configMINIMAL_STACK_SIZE, ( void * ) xMutex, genqMUTEX_HIGH_PRIORITY, &xHighPriorityMutexTask );
xTaskCreate( prvHighPriorityMutexTask, "MuHigh", genqMUTEX_TEST_TASK_STACK_SIZE, ( void * ) xMutex, genqMUTEX_HIGH_PRIORITY, &xHighPriorityMutexTask );
/* If INCLUDE_xTaskAbortDelay is set then additional tests are performed,
requiring two instances of prvHighPriorityMutexTask(). */

View file

@ -41,6 +41,11 @@
/* Demo program include files. */
#include "TaskNotify.h"
/* Allow parameters to be overridden on a demo by demo basis. */
#ifndef notifyNOTIFIED_TASK_STACK_SIZE
#define notifyNOTIFIED_TASK_STACK_SIZE configMINIMAL_STACK_SIZE
#endif
#define notifyTASK_PRIORITY ( tskIDLE_PRIORITY )
#define notifyUINT32_MAX ( ( uint32_t ) 0xffffffff )
#define notifySUSPENDED_TEST_TIMER_PERIOD pdMS_TO_TICKS( 50 )
@ -104,7 +109,12 @@ void vStartTaskNotifyTask( void )
{
/* Create the task that performs some tests by itself, then loops around
being notified by both a software timer and an interrupt. */
xTaskCreate( prvNotifiedTask, "Notified", configMINIMAL_STACK_SIZE, NULL, notifyTASK_PRIORITY, &xTaskToNotify );
xTaskCreate( prvNotifiedTask, /* Function that implements the task. */
"Notified", /* Text name for the task - for debugging only - not used by the kernel. */
notifyNOTIFIED_TASK_STACK_SIZE, /* Task's stack size in words, not bytes!. */
NULL, /* Task parameter, not used in this case. */
notifyTASK_PRIORITY, /* Task priority, 0 is the lowest. */
&xTaskToNotify ); /* Used to pass a handle to the task out is needed, otherwise set to NULL. */
/* Pseudo seed the random number generator. */
uxNextRand = ( size_t ) prvRand;

View file

@ -48,7 +48,11 @@
#define tmrdemoDONT_BLOCK ( ( TickType_t ) 0 )
#define tmrdemoONE_SHOT_TIMER_PERIOD ( xBasePeriod * ( TickType_t ) 3 )
#define trmdemoNUM_TIMER_RESETS ( ( uint8_t ) 10 )
#define tmrdemoNUM_TIMER_RESETS ( ( uint8_t ) 10 )
#ifndef tmrTIMER_TEST_TASK_STACK_SIZE
#define tmrTIMER_TEST_TASK_STACK_SIZE configMINIMAL_STACK_SIZE
#endif
/*-----------------------------------------------------------*/
@ -137,7 +141,7 @@ void vStartTimerDemoTask( TickType_t xBasePeriodIn )
task, which will then preempt this task). */
if( xTestStatus != pdFAIL )
{
xTaskCreate( prvTimerTestTask, "Tmr Tst", configMINIMAL_STACK_SIZE, NULL, configTIMER_TASK_PRIORITY - 1, NULL );
xTaskCreate( prvTimerTestTask, "Tmr Tst", tmrTIMER_TEST_TASK_STACK_SIZE, NULL, configTIMER_TASK_PRIORITY - 1, NULL );
}
}
/*-----------------------------------------------------------*/
@ -546,7 +550,7 @@ uint8_t ucTimer;
configASSERT( xTestStatus );
}
for( ucTimer = 0; ucTimer < trmdemoNUM_TIMER_RESETS; ucTimer++ )
for( ucTimer = 0; ucTimer < tmrdemoNUM_TIMER_RESETS; ucTimer++ )
{
/* Delay for half as long as the one shot timer period, then reset it.
It should never expire while this is done, so its callback count should

View file

@ -39,7 +39,7 @@
/* Demo includes. */
#include "blocktim.h"
/* Task priorities. Allow these to be overridden. */
/* Task priorities and stack sizes. Allow these to be overridden. */
#ifndef bktPRIMARY_PRIORITY
#define bktPRIMARY_PRIORITY ( configMAX_PRIORITIES - 3 )
#endif
@ -48,6 +48,10 @@
#define bktSECONDARY_PRIORITY ( configMAX_PRIORITIES - 4 )
#endif
#ifndef bktBLOCK_TIME_TASK_STACK_SIZE
#define bktBLOCK_TIME_TASK_STACK_SIZE configMINIMAL_STACK_SIZE
#endif
/* Task behaviour. */
#define bktQUEUE_LENGTH ( 5 )
#define bktSHORT_WAIT pdMS_TO_TICKS( ( TickType_t ) 20 )
@ -111,8 +115,8 @@ void vCreateBlockTimeTasks( void )
vQueueAddToRegistry( xTestQueue, "Block_Time_Queue" );
/* Create the two test tasks. */
xTaskCreate( vPrimaryBlockTimeTestTask, "BTest1", configMINIMAL_STACK_SIZE, NULL, bktPRIMARY_PRIORITY, NULL );
xTaskCreate( vSecondaryBlockTimeTestTask, "BTest2", configMINIMAL_STACK_SIZE, NULL, bktSECONDARY_PRIORITY, &xSecondary );
xTaskCreate( vPrimaryBlockTimeTestTask, "BTest1", bktBLOCK_TIME_TASK_STACK_SIZE, NULL, bktPRIMARY_PRIORITY, NULL );
xTaskCreate( vSecondaryBlockTimeTestTask, "BTest2", bktBLOCK_TIME_TASK_STACK_SIZE, NULL, bktSECONDARY_PRIORITY, &xSecondary );
}
}
/*-----------------------------------------------------------*/

View file

@ -105,6 +105,9 @@ static portTASK_FUNCTION_PROTO( vQueueReceiveWhenSuspendedTask, pvParameters );
static portTASK_FUNCTION_PROTO( vQueueSendWhenSuspendedTask, pvParameters );
/* Demo task specific constants. */
#ifndef priSUSPENDED_RX_TASK_STACK_SIZE
#define priSUSPENDED_RX_TASK_STACK_SIZE ( configMINIMAL_STACK_SIZE )
#endif
#define priSTACK_SIZE ( configMINIMAL_STACK_SIZE )
#define priSLEEP_TIME pdMS_TO_TICKS( 128 )
#define priLOOPS ( 5 )
@ -159,9 +162,9 @@ void vStartDynamicPriorityTasks( void )
xTaskCreate( vContinuousIncrementTask, "CNT_INC", priSTACK_SIZE, ( void * ) &ulCounter, tskIDLE_PRIORITY, &xContinuousIncrementHandle );
xTaskCreate( vLimitedIncrementTask, "LIM_INC", priSTACK_SIZE, ( void * ) &ulCounter, tskIDLE_PRIORITY + 1, &xLimitedIncrementHandle );
xTaskCreate( vCounterControlTask, "C_CTRL", priSTACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
xTaskCreate( vCounterControlTask, "C_CTRL", priSUSPENDED_RX_TASK_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
xTaskCreate( vQueueSendWhenSuspendedTask, "SUSP_TX", priSTACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
xTaskCreate( vQueueReceiveWhenSuspendedTask, "SUSP_RX", priSTACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
xTaskCreate( vQueueReceiveWhenSuspendedTask, "SUSP_RX", priSUSPENDED_RX_TASK_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
}
}
/*-----------------------------------------------------------*/

View file

@ -85,6 +85,10 @@ be overridden by a definition in FreeRTOSConfig.h. */
#define recmuNO_DELAY ( ( TickType_t ) 0 )
#define recmu15ms_DELAY ( pdMS_TO_TICKS( 15 ) )
#ifndef recmuRECURSIVE_MUTEX_TEST_TASK_STACK_SIZE
#define recmuRECURSIVE_MUTEX_TEST_TASK_STACK_SIZE configMINIMAL_STACK_SIZE
#endif
/* The three tasks as described at the top of this file. */
static void prvRecursiveMutexControllingTask( void *pvParameters );
static void prvRecursiveMutexBlockingTask( void *pvParameters );
@ -119,9 +123,9 @@ void vStartRecursiveMutexTasks( void )
defined to be less than 1. */
vQueueAddToRegistry( ( QueueHandle_t ) xMutex, "Recursive_Mutex" );
xTaskCreate( prvRecursiveMutexControllingTask, "Rec1", configMINIMAL_STACK_SIZE, NULL, recmuCONTROLLING_TASK_PRIORITY, &xControllingTaskHandle );
xTaskCreate( prvRecursiveMutexBlockingTask, "Rec2", configMINIMAL_STACK_SIZE, NULL, recmuBLOCKING_TASK_PRIORITY, &xBlockingTaskHandle );
xTaskCreate( prvRecursiveMutexPollingTask, "Rec3", configMINIMAL_STACK_SIZE, NULL, recmuPOLLING_TASK_PRIORITY, NULL );
xTaskCreate( prvRecursiveMutexControllingTask, "Rec1", recmuRECURSIVE_MUTEX_TEST_TASK_STACK_SIZE, NULL, recmuCONTROLLING_TASK_PRIORITY, &xControllingTaskHandle );
xTaskCreate( prvRecursiveMutexBlockingTask, "Rec2", recmuRECURSIVE_MUTEX_TEST_TASK_STACK_SIZE, NULL, recmuBLOCKING_TASK_PRIORITY, &xBlockingTaskHandle );
xTaskCreate( prvRecursiveMutexPollingTask, "Rec3", recmuRECURSIVE_MUTEX_TEST_TASK_STACK_SIZE, NULL, recmuPOLLING_TASK_PRIORITY, NULL );
}
}
/*-----------------------------------------------------------*/