Add the option to specify a stack size in the standard demo MessageBuffer tests.

Add stream and message buffer tests into the Zynq demo project.
This commit is contained in:
Richard Barry 2018-06-13 16:50:16 +00:00
parent 4fbcdbf13b
commit d6fcd5dbba
14 changed files with 134 additions and 54 deletions

View File

@ -219,7 +219,7 @@
</matcher>
</filter>
<filter>
<id>1461598461900</id>
<id>1528755597221</id>
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
<type>5</type>
<matcher>
@ -228,7 +228,7 @@
</matcher>
</filter>
<filter>
<id>1461598461910</id>
<id>1528755597236</id>
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
<type>5</type>
<matcher>
@ -237,7 +237,7 @@
</matcher>
</filter>
<filter>
<id>1461598461930</id>
<id>1528755597244</id>
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
<type>5</type>
<matcher>
@ -246,7 +246,7 @@
</matcher>
</filter>
<filter>
<id>1461598461940</id>
<id>1528755597250</id>
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
<type>5</type>
<matcher>
@ -255,7 +255,7 @@
</matcher>
</filter>
<filter>
<id>1461598461940</id>
<id>1528755597254</id>
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
<type>5</type>
<matcher>
@ -264,7 +264,7 @@
</matcher>
</filter>
<filter>
<id>1461598461950</id>
<id>1528755597258</id>
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
<type>5</type>
<matcher>
@ -273,7 +273,7 @@
</matcher>
</filter>
<filter>
<id>1461598461960</id>
<id>1528755597263</id>
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
<type>5</type>
<matcher>
@ -282,7 +282,7 @@
</matcher>
</filter>
<filter>
<id>1461598461960</id>
<id>1528755597267</id>
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
<type>5</type>
<matcher>
@ -291,7 +291,7 @@
</matcher>
</filter>
<filter>
<id>1461598461980</id>
<id>1528755597271</id>
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
<type>5</type>
<matcher>
@ -300,7 +300,7 @@
</matcher>
</filter>
<filter>
<id>1461598461990</id>
<id>1528755597278</id>
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
<type>5</type>
<matcher>
@ -309,7 +309,7 @@
</matcher>
</filter>
<filter>
<id>1461598461990</id>
<id>1528755597282</id>
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
<type>5</type>
<matcher>
@ -318,7 +318,7 @@
</matcher>
</filter>
<filter>
<id>1461598462000</id>
<id>1528755597288</id>
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
<type>5</type>
<matcher>
@ -327,7 +327,7 @@
</matcher>
</filter>
<filter>
<id>1461598462000</id>
<id>1528755597292</id>
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
<type>5</type>
<matcher>
@ -336,7 +336,7 @@
</matcher>
</filter>
<filter>
<id>1461598462020</id>
<id>1528755597302</id>
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
<type>5</type>
<matcher>
@ -345,7 +345,7 @@
</matcher>
</filter>
<filter>
<id>1461598462020</id>
<id>1528755597306</id>
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
<type>5</type>
<matcher>
@ -354,7 +354,7 @@
</matcher>
</filter>
<filter>
<id>1461598462030</id>
<id>1528755597310</id>
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
<type>5</type>
<matcher>
@ -363,7 +363,7 @@
</matcher>
</filter>
<filter>
<id>1461598462040</id>
<id>1528755597314</id>
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
<type>5</type>
<matcher>
@ -372,7 +372,7 @@
</matcher>
</filter>
<filter>
<id>1461598462040</id>
<id>1528755597318</id>
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
<type>5</type>
<matcher>
@ -381,7 +381,7 @@
</matcher>
</filter>
<filter>
<id>1461598462050</id>
<id>1528755597321</id>
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
<type>5</type>
<matcher>
@ -389,6 +389,42 @@
<arguments>1.0-name-matches-false-false-AbortDelay.c</arguments>
</matcher>
</filter>
<filter>
<id>1528755597325</id>
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
<type>5</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-MessageBufferAMP.c</arguments>
</matcher>
</filter>
<filter>
<id>1528755597330</id>
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
<type>5</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-MessageBufferDemo.c</arguments>
</matcher>
</filter>
<filter>
<id>1528755597334</id>
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
<type>5</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-StreamBufferDemo.c</arguments>
</matcher>
</filter>
<filter>
<id>1528755597338</id>
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
<type>5</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-StreamBufferInterrupt.c</arguments>
</matcher>
</filter>
<filter>
<id>1461598705091</id>
<name>src/lwIP_Demo/lwip-1.4.0/src/core</name>

View File

@ -78,7 +78,7 @@
#define configUSE_TICK_HOOK 1
#define configMAX_PRIORITIES ( 7 )
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 250 ) /* Large in case configUSE_TASK_FPU_SUPPORT is 2 in which case all tasks have an FPU context. */
#define configTOTAL_HEAP_SIZE ( 90 * 1024 )
#define configTOTAL_HEAP_SIZE ( 125 * 1024 )
#define configMAX_TASK_NAME_LEN ( 10 )
#define configUSE_TRACE_FACILITY 1
#define configUSE_16_BIT_TICKS 0

View File

@ -110,6 +110,10 @@
#include "IntSemTest.h"
#include "StaticAllocation.h"
#include "AbortDelay.h"
#include "MessageBufferDemo.h"
#include "StreamBufferDemo.h"
#include "StreamBufferInterrupt.h"
#include "MessageBufferAMP.h"
/* Priorities for the demo application tasks. */
@ -149,6 +153,9 @@ purpose of ensuring parameters are passed into tasks correctly. */
/* The base period used by the timer test tasks. */
#define mainTIMER_TEST_PERIOD ( 50 )
/* Base stack size of tasks created in the message buffer demos. */
#define mainMESSAGE_BUFFER_STACK_SIZE ( configMINIMAL_STACK_SIZE * 2 )
/*-----------------------------------------------------------*/
@ -221,6 +228,10 @@ void main_full( void )
vStartInterruptSemaphoreTasks();
vStartStaticallyAllocatedTasks();
vCreateAbortDelayTasks();
vStartMessageBufferTasks( mainMESSAGE_BUFFER_STACK_SIZE );
vStartStreamBufferTasks();
vStartStreamBufferInterruptDemo();
vStartMessageBufferAMPTasks( mainMESSAGE_BUFFER_STACK_SIZE );
/* Start the tasks that implements the command console on the UART, as
described above. */
@ -372,17 +383,37 @@ unsigned long ulErrorFound = pdFALSE;
ulErrorFound |= 1UL << 16UL;
}
if( xAreStreamBufferTasksStillRunning() != pdTRUE )
{
ulErrorFound |= 1UL << 17UL;
}
if( xAreMessageBufferTasksStillRunning() != pdTRUE )
{
ulErrorFound |= 1UL << 18UL;
}
if( xIsInterruptStreamBufferDemoStillRunning() != pdPASS )
{
ulErrorFound |= 1UL << 19UL;
}
if( xAreMessageBufferAMPTasksStillRunning() != pdPASS )
{
ulErrorFound |= 1UL << 20UL;
}
/* Check that the register test 1 task is still running. */
if( ulLastRegTest1Value == ulRegTest1LoopCounter )
{
ulErrorFound |= 1UL << 17UL;
ulErrorFound |= 1UL << 21UL;
}
ulLastRegTest1Value = ulRegTest1LoopCounter;
/* Check that the register test 2 task is still running. */
if( ulLastRegTest2Value == ulRegTest2LoopCounter )
{
ulErrorFound |= 1UL << 18UL;
ulErrorFound |= 1UL << 22UL;
}
ulLastRegTest2Value = ulRegTest2LoopCounter;

View File

@ -76,6 +76,8 @@
#include "EventGroupsDemo.h"
#include "TaskNotify.h"
#include "IntSemTest.h"
#include "StreamBufferInterrupt.h"
#include "StreamBufferDemo.h"
/* Xilinx includes. */
#include "platform.h"
@ -293,6 +295,14 @@ void vApplicationTickHook( void )
/* Use mutexes from interrupts. */
vInterruptSemaphorePeriodicTest();
/* Writes to stream buffer byte by byte to test the stream buffer trigger
level functionality. */
vPeriodicStreamBufferProcessing();
/* Writes a string to a string buffer four bytes at a time to demonstrate
a stream being sent from an interrupt to a task. */
vBasicStreamBufferSendFromISR();
/* Test flop alignment in interrupts - calling printf from an interrupt
is BAD! */
#if( configASSERT_DEFINED == 1 )

View File

@ -220,7 +220,7 @@ int main( void )
vStartQueuePeekTasks();
vStartQueueSetTasks();
vStartEventGroupTasks();
vStartMessageBufferTasks();
vStartMessageBufferTasks( configMINIMAL_STACK_SIZE );
vStartStreamBufferTasks();
/* Exclude some tasks if using the kickstart version to ensure we stay within
@ -244,8 +244,8 @@ int main( void )
or not the correct/expected number of tasks are running at any given time. */
vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );
/* Uncomment the following line to configure the high frequency interrupt
used to measure the interrupt jitter time.
/* Uncomment the following line to configure the high frequency interrupt
used to measure the interrupt jitter time.
vSetupHighFrequencyTimer(); */
/* Start the scheduler. */
@ -497,7 +497,7 @@ void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, Stack
function then they must be declared static - otherwise they will be allocated on
the stack and so not exists after this function exits. */
static StaticTask_t xTimerTaskTCB;
static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ];
static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ];
/* Pass out a pointer to the StaticTask_t structure in which the Timer
task's state will be stored. */

View File

@ -191,7 +191,7 @@ void main_full( void )
vStartTaskNotifyTask();
vStartInterruptSemaphoreTasks();
vStartStreamBufferTasks();
vStartMessageBufferTasks();
vStartMessageBufferTasks( configMINIMAL_STACK_SIZE );
/* Create the register check tasks, as described at the top of this file */
xTaskCreate( prvRegTestTaskEntry1, "Reg1", configMINIMAL_STACK_SIZE, mainREG_TEST_TASK_1_PARAMETER, tskIDLE_PRIORITY, NULL );

View File

@ -126,18 +126,18 @@ BaseType_t xDemoStatus = pdPASS;
/*-----------------------------------------------------------*/
void vStartMessageBufferAMPTasks( void )
void vStartMessageBufferAMPTasks( configSTACK_DEPTH_TYPE xStackSize )
{
BaseType_t x;
xControlMessageBuffer = xMessageBufferCreate( mbaCONTROL_MESSAGE_BUFFER_SIZE );
xTaskCreate( prvCoreATask, /* The function that implements the task. */
"AMPCoreA", /* Human readable name for the task. */
configMINIMAL_STACK_SIZE, /* Stack size (in words!). */
NULL, /* Task parameter is not used. */
tskIDLE_PRIORITY, /* The priority at which the task is created. */
NULL ); /* No use for the task handle. */
xTaskCreate( prvCoreATask, /* The function that implements the task. */
"AMPCoreA", /* Human readable name for the task. */
xStackSize, /* Stack size (in words!). */
NULL, /* Task parameter is not used. */
tskIDLE_PRIORITY, /* The priority at which the task is created. */
NULL ); /* No use for the task handle. */
for( x = 0; x < mbaNUMBER_OF_CORE_B_TASKS; x++ )
{
@ -149,7 +149,7 @@ BaseType_t x;
ulCycleCounters and xCoreBMessageBuffers arrays. */
xTaskCreate( prvCoreBTasks,
"AMPCoreB1",
configMINIMAL_STACK_SIZE,
xStackSize,
( void * ) x,
tskIDLE_PRIORITY + 1,
NULL );

View File

@ -62,9 +62,6 @@ priority tasks, and from high to low priority tasks. */
/* A block time of 0 means "don't block". */
#define mbDONT_BLOCK ( 0 )
/* The size of the stack allocated to the tasks that run as part of this demo/
test. The stack size is over generous in most cases. */
#define mbSTACK_SIZE ( configMINIMAL_STACK_SIZE + ( configMINIMAL_STACK_SIZE >> 1 ) )
/*-----------------------------------------------------------*/
/*
@ -122,33 +119,38 @@ static uint32_t ulNonBlockingRxCounter = 0;
message buffer to test writing different lengths at different offsets. */
static const char *pc55ByteString = "One two three four five six seven eight nine ten eleve";
/* Remember the required stack size so tasks can be created at run time (after
initialisation time. */
static configSTACK_DEPTH_TYPE xBlockingStackSize = 0;
/*-----------------------------------------------------------*/
void vStartMessageBufferTasks( void )
void vStartMessageBufferTasks( configSTACK_DEPTH_TYPE xStackSize )
{
MessageBufferHandle_t xMessageBuffer;
xBlockingStackSize = ( xStackSize + ( xStackSize >> 1U ) );
/* The echo servers sets up the message buffers before creating the echo
client tasks. One set of tasks has the server as the higher priority, and
the other has the client as the higher priority. */
xTaskCreate( prvEchoServer, "1EchoServer", mbSTACK_SIZE, NULL, mbHIGHER_PRIORITY, NULL );
xTaskCreate( prvEchoServer, "2EchoServer", mbSTACK_SIZE, NULL, mbLOWER_PRIORITY, NULL );
xTaskCreate( prvEchoServer, "1EchoServer", xBlockingStackSize, NULL, mbHIGHER_PRIORITY, NULL );
xTaskCreate( prvEchoServer, "2EchoServer", xBlockingStackSize, NULL, mbLOWER_PRIORITY, NULL );
/* The non blocking tasks run continuously and will interleave with each
other, so must be created at the lowest priority. The message buffer they
use is created and passed in using the task's parameter. */
xMessageBuffer = xMessageBufferCreate( mbMESSAGE_BUFFER_LENGTH_BYTES );
xTaskCreate( prvNonBlockingReceiverTask, "NonBlkRx", configMINIMAL_STACK_SIZE, ( void * ) xMessageBuffer, tskIDLE_PRIORITY, NULL );
xTaskCreate( prvNonBlockingSenderTask, "NonBlkTx", configMINIMAL_STACK_SIZE, ( void * ) xMessageBuffer, tskIDLE_PRIORITY, NULL );
xTaskCreate( prvNonBlockingReceiverTask, "NonBlkRx", xStackSize, ( void * ) xMessageBuffer, tskIDLE_PRIORITY, NULL );
xTaskCreate( prvNonBlockingSenderTask, "NonBlkTx", xStackSize, ( void * ) xMessageBuffer, tskIDLE_PRIORITY, NULL );
#if( configSUPPORT_STATIC_ALLOCATION == 1 )
{
/* The sender tasks set up the message buffers before creating the
receiver tasks. Priorities must be 0 and 1 as the priority is used to
index into the xStaticMessageBuffers and ucBufferStorage arrays. */
xTaskCreate( prvSenderTask, "1Sender", mbSTACK_SIZE, NULL, mbHIGHER_PRIORITY, NULL );
xTaskCreate( prvSenderTask, "2Sender", mbSTACK_SIZE, NULL, mbLOWER_PRIORITY, NULL );
xTaskCreate( prvSenderTask, "1Sender", xBlockingStackSize, NULL, mbHIGHER_PRIORITY, NULL );
xTaskCreate( prvSenderTask, "2Sender", xBlockingStackSize, NULL, mbLOWER_PRIORITY, NULL );
}
#endif /* configSUPPORT_STATIC_ALLOCATION */
}
@ -567,11 +569,11 @@ char cRxString[ 12 ];
/* Here prvSingleTaskTests() performs various tests on a message buffer
that was created statically. */
prvSingleTaskTests( xMessageBuffer );
xTaskCreate( prvReceiverTask, "MsgReceiver", mbSTACK_SIZE, ( void * ) xMessageBuffer, mbHIGHER_PRIORITY, NULL );
xTaskCreate( prvReceiverTask, "MsgReceiver", xBlockingStackSize, ( void * ) xMessageBuffer, mbHIGHER_PRIORITY, NULL );
}
else
{
xTaskCreate( prvReceiverTask, "MsgReceiver", mbSTACK_SIZE, ( void * ) xMessageBuffer, mbLOWER_PRIORITY, NULL );
xTaskCreate( prvReceiverTask, "MsgReceiver", xBlockingStackSize, ( void * ) xMessageBuffer, mbLOWER_PRIORITY, NULL );
}
for( ;; )

View File

@ -652,7 +652,7 @@ BaseType_t xNonBlockingReceiveError = pdFALSE;
static void prvReceiverTask( void *pvParameters )
{
StreamBufferHandle_t * const pxStreamBuffer = ( StreamBufferHandle_t * ) pvParameters;
StreamBufferHandle_t const pxStreamBuffer = ( StreamBufferHandle_t ) pvParameters;
char cRxString[ 12 ]; /* Large enough to hold a 32-bit number in ASCII. */
const TickType_t xTicksToWait = pdMS_TO_TICKS( 5UL );
const size_t xStringLength = strlen( pc55ByteString );

View File

@ -28,7 +28,7 @@
#ifndef MESSAGE_BUFFER_AMP_H
#define MESSAGE_BUFFER_AMP_H
void vStartMessageBufferAMPTasks( void );
void vStartMessageBufferAMPTasks( configSTACK_DEPTH_TYPE xStackSize );
BaseType_t xAreMessageBufferAMPTasksStillRunning( void );
void vGenerateCoreBInterrupt( void * xUpdatedMessageBuffer );

View File

@ -28,7 +28,7 @@
#ifndef MESSAGE_BUFFER_TEST_H
#define MESSAGE_BUFFER_TEST_H
void vStartMessageBufferTasks( void );
void vStartMessageBufferTasks( configSTACK_DEPTH_TYPE xStackSize );
BaseType_t xAreMessageBufferTasksStillRunning( void );
#endif /* MESSAGE_BUFFER_TEST_H */

View File

@ -204,10 +204,10 @@ int main_full( void )
xTaskCreate( prvPermanentlyBlockingSemaphoreTask, "BlockSem", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
xTaskCreate( prvPermanentlyBlockingNotificationTask, "BlockNoti", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
vStartMessageBufferTasks();
vStartMessageBufferTasks( configMINIMAL_STACK_SIZE );
vStartStreamBufferTasks();
vStartStreamBufferInterruptDemo();
vStartMessageBufferAMPTasks();
vStartMessageBufferAMPTasks( configMINIMAL_STACK_SIZE );
#if( configSUPPORT_STATIC_ALLOCATION == 1 )
{

View File

@ -211,10 +211,10 @@ int main_full( void )
xTaskCreate( prvPermanentlyBlockingSemaphoreTask, "BlockSem", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
xTaskCreate( prvPermanentlyBlockingNotificationTask, "BlockNoti", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
vStartMessageBufferTasks();
vStartMessageBufferTasks( configMINIMAL_STACK_SIZE );
vStartStreamBufferTasks();
vStartStreamBufferInterruptDemo();
vStartMessageBufferAMPTasks();
vStartMessageBufferAMPTasks( configMINIMAL_STACK_SIZE );
#if( configSUPPORT_STATIC_ALLOCATION == 1 )
{

View File

@ -37,6 +37,7 @@
extern "C" {
#endif
#include "task.h"
/**
* Type by which queues are referenced. For example, a call to xQueueCreate()