FreeRTOS source:

+ Previously, if a task was deleted, the memory allocated to the task by the RTOS was freed in the Idle task.  Now if a task deletes another task the memory is freed immediately.  The idle task is however still responsible for freeing the memory when a task deletes itself.
+ Added pcQueueGetQueueName() function to return the name of a queue from its handle, assuming the queue is registers.

Demo application:
+ Update GenQTest to exercise the new pcQueueGetQueueName() function.
+ Delete workspaces from old Eclipse examples, leaving just the projects.
+ Rework comments in the MSVC simply blinky demo.
This commit is contained in:
Richard Barry 2015-12-08 20:22:58 +00:00
parent 94dd3f871b
commit 7d6609f8db
347 changed files with 256 additions and 25411 deletions

View file

@ -79,19 +79,17 @@
* hardware setup and FreeRTOS hook functions.
*
*******************************************************************************
* -NOTE- The Win32 port is a simulation (or is that emulation?) only! Do not
* expect to get real time behaviour from the Win32 port or this demo
* application. It is provided as a convenient development and demonstration
* test bed only. This was tested using Windows XP on a dual core laptop.
*
* Windows will not be running the FreeRTOS simulator threads continuously, so
* the timing information in the FreeRTOS+Trace logs have no meaningful units.
* See the documentation page for the Windows simulator for an explanation of
* the slow timing:
* NOTE: Windows will not be running the FreeRTOS demo threads continuously, so
* do not expect to get real time behaviour from the FreeRTOS Windows port, or
* this demo application. Also, the timing information in the FreeRTOS+Trace
* logs have no meaningful units. See the documentation page for the Windows
* port for further information:
* http://www.freertos.org/FreeRTOS-Windows-Simulator-Emulator-for-Visual-Studio-and-Eclipse-MingW.html
* - READ THE WEB DOCUMENTATION FOR THIS PORT FOR MORE INFORMATION ON USING IT -
*******************************************************************************
*
* This demo was created using Windows XP on a dual core laptop, and has since
* been maintained using Windows 7 on a quad core laptop.
*
*******************************************************************************
*/
/* Standard includes. */
@ -103,23 +101,29 @@
#include "FreeRTOS.h"
#include "task.h"
/* This project provides two demo applications. A simple blinky style project,
and a more comprehensive test and demo application. The
/* This project provides two demo applications. A simple blinky style demo
application, and a more comprehensive test and demo application. The
mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is used to select between the two.
The simply blinky demo is implemented and described in main_blinky.c. The more
comprehensive test and demo application is implemented and described in
main_full.c. */
#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0
If mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is 1 then the blinky demo will be built.
The blinky demo is implemented and described in main_blinky.c.
If mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is not 1 then the comprehensive test and
demo application will be built. The comprehensive test and demo application is
implemented and described in main_full.c. */
#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1
/* This demo uses heap_5.c, and these constants define the sizes of the regions
that make up the total heap. This is only done to provide an example of heap_5
being used as this demo could easily create one large heap region instead of
multiple smaller heap regions - in which case heap_4.c would be the more
appropriate choice. */
that make up the total heap. heap_5 is only used for test and example purposes
as this demo could easily create one large heap region instead of multiple
smaller heap regions - in which case heap_4.c would be the more appropriate
choice. See http://www.freertos.org/a00111.html for an explanation. */
#define mainREGION_1_SIZE 4001
#define mainREGION_2_SIZE 18105
#define mainREGION_3_SIZE 1807
/*-----------------------------------------------------------*/
/*
* main_blinky() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1.
* main_full() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 0.
@ -128,26 +132,23 @@ extern void main_blinky( void );
extern void main_full( void );
/*
* Some of the RTOS hook (callback) functions only need special processing when
* the full demo is being used. The simply blinky demo has no special
* requirements, so these functions are called from the hook functions defined
* in this file, but are defined in main_full.c.
* Only the comprehensive demo uses application hook (callback) functions. See
* http://www.freertos.org/a00016.html for more information.
*/
void vFullDemoTickHookFunction( void );
void vFullDemoIdleFunction( void );
/*
* This demo uses heap_5.c, so start by defining some heap regions. This is
* only done to provide an example as this demo could easily create one large
* heap region instead of multiple smaller heap regions - in which case heap_4.c
* would be the more appropriate choice. No initialisation is required when
* heap_4.c is used.
* This demo uses heap_5.c, so start by defining some heap regions. It is not
* necessary for this demo to use heap_5, as it could define one large heap
* region. Heap_5 is only used for test and example purposes. See
* http://www.freertos.org/a00111.html for an explanation.
*/
static void prvInitialiseHeap( void );
/*
* Prototypes for the standard FreeRTOS callback/hook functions implemented
* within this file.
* Prototypes for the standard FreeRTOS application hook (callback) functions
* implemented within this file. See http://www.freertos.org/a00016.html .
*/
void vApplicationMallocFailedHook( void );
void vApplicationIdleHook( void );
@ -161,9 +162,9 @@ void vApplicationTickHook( void );
static void prvSaveTraceFile( void );
/* The user trace event posted to the trace recording on each tick interrupt.
Note tick events will not appear in the trace recording with regular period
because this project runs in a Windows simulator, and does not therefore
exhibit deterministic behaviour. */
Note: This project runs under Windows, and Windows will not be executing the
RTOS threads continuously. Therefore tick events will not appear with a regular
interval within the the trace recording. */
traceLabel xTickTraceUserEvent;
static portBASE_TYPE xTraceRunning = pdTRUE;
@ -171,24 +172,18 @@ static portBASE_TYPE xTraceRunning = pdTRUE;
int main( void )
{
/* This demo uses heap_5.c, so start by defining some heap regions. This
is only done to provide an example as this demo could easily create one
large heap region instead of multiple smaller heap regions - in which case
heap_4.c would be the more appropriate choice. No initialisation is
required when heap_4.c is used. */
/* This demo uses heap_5.c, so start by defining some heap regions. heap_5
is only used for test and example reasons. Heap_4 is more appropriate. See
http://www.freertos.org/a00111.html for an explanation. */
prvInitialiseHeap();
/* Initialise the trace recorder and create the label used to post user
events to the trace recording on each tick interrupt. */
events to the trace recording on each tick interrupt. Use of the trace
recorder is optional. See http://www.FreeRTOS.org/trace for more
information. */
vTraceInitTraceData();
xTickTraceUserEvent = xTraceOpenLabel( "tick" );
/* Start the trace recording - the recording is written to a file if
configASSERT() is called. */
printf( "\r\nTrace started.\r\nThe trace will be dumped to disk if a call to configASSERT() fails.\r\n" );
printf( "Uncomment the call to kbhit() in this file to also dump trace with a key press.\r\n" );
uiTraceStart();
/* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top
of this file. */
#if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 )
@ -197,6 +192,12 @@ int main( void )
}
#else
{
/* Start the trace recording - the recording is written to a file if
configASSERT() is called. */
printf( "\r\nTrace started.\r\nThe trace will be dumped to disk if a call to configASSERT() fails.\r\n" );
printf( "Uncomment the call to kbhit() in this file to also dump trace with a key press.\r\n" );
uiTraceStart();
main_full();
}
#endif
@ -212,11 +213,13 @@ void vApplicationMallocFailedHook( void )
function that will get called if a call to pvPortMalloc() fails.
pvPortMalloc() is called internally by the kernel whenever a task, queue,
timer or semaphore is created. It is also called by various parts of the
demo application. If heap_1.c or heap_2.c are used, then the size of the
heap available to pvPortMalloc() is defined by configTOTAL_HEAP_SIZE in
FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used
to query the size of free heap space that remains (although it does not
provide information on how the remaining heap might be fragmented). */
demo application. If heap_1.c, heap_2.c or heap_4.c is being used, then the
size of the heap available to pvPortMalloc() is defined by
configTOTAL_HEAP_SIZE in FreeRTOSConfig.h, and the xPortGetFreeHeapSize()
API function can be used to query the size of free heap space that remains
(although it does not provide information on how the remaining heap might be
fragmented). See http://www.freertos.org/a00111.html for more
information. */
vAssertCalled( __LINE__, __FILE__ );
}
/*-----------------------------------------------------------*/
@ -227,11 +230,11 @@ void vApplicationIdleHook( void )
to 1 in FreeRTOSConfig.h. It will be called on each iteration of the idle
task. It is essential that code added to this hook function never attempts
to block in any way (for example, call xQueueReceive() with a block time
specified, or call vTaskDelay()). If the application makes use of the
vTaskDelete() API function (as this demo application does) then it is also
important that vApplicationIdleHook() is permitted to return to its calling
function, because it is the responsibility of the idle task to clean up
memory allocated by the kernel to any task that has since been deleted. */
specified, or call vTaskDelay()). If application tasks make use of the
vTaskDelete() API function to delete themselves then it is also important
that vApplicationIdleHook() is permitted to return to its calling function,
because it is the responsibility of the idle task to clean up memory
allocated by the kernel to any task that has since deleted itself. */
/* Uncomment the following code to allow the trace to be stopped with any
key press. The code is commented out by default as the kbhit() function
@ -265,7 +268,9 @@ void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName )
/* Run time stack overflow checking is performed if
configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook
function is called if a stack overflow is detected. */
function is called if a stack overflow is detected. This function is
provided as an example only as stack overflow checking does not function
when running the FreeRTOS Windows port. */
vAssertCalled( __LINE__, __FILE__ );
}
/*-----------------------------------------------------------*/
@ -284,11 +289,10 @@ void vApplicationTickHook( void )
}
#endif /* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY */
/* Write a user event to the trace log.
Note tick events will not appear in the trace recording with regular period
because this project runs in a Windows simulator, and does not therefore
exhibit deterministic behaviour. Windows will run the simulator in
bursts. */
/* Write a user event to the trace log. Note: This project runs under
Windows, and Windows will not be executing the RTOS threads continuously.
Therefore tick events will not appear with a regular interval within the the
trace recording. */
vTraceUserEvent( xTickTraceUserEvent );
}
/*-----------------------------------------------------------*/
@ -298,6 +302,9 @@ void vAssertCalled( unsigned long ulLine, const char * const pcFileName )
static portBASE_TYPE xPrinted = pdFALSE;
volatile uint32_t ulSetToNonZeroInDebuggerToContinue = 0;
/* Called if an assertion passed to configASSERT() fails. See
http://www.freertos.org/a00110.html#configASSERT for more information. */
/* Parameters are not used. */
( void ) ulLine;
( void ) pcFileName;
@ -351,13 +358,15 @@ FILE* pxOutputFile;
static void prvInitialiseHeap( void )
{
/* This demo uses heap_5.c, so start by defining some heap regions. This is
only done to provide an example as this demo could easily create one large heap
region instead of multiple smaller heap regions - in which case heap_4.c would
be the more appropriate choice. No initialisation is required when heap_4.c is
used. The xHeapRegions structure requires the regions to be defined in order,
so this just creates one big array, then populates the structure with offsets
into the array - with gaps in between and messy alignment just for test
/* The Windows demo could create one large heap region, in which case it would
be appropriate to use heap_4. However, purely for demonstration purposes,
heap_5 is used instead, so start by defining some heap regions. No
initialisation is required when any other heap implementation is used. See
http://www.freertos.org/a00111.html for more information.
The xHeapRegions structure requires the regions to be defined in start address
order, so this just creates one big array, then populates the structure with
offsets into the array - with gaps in between and messy alignment just for test
purposes. */
static uint8_t ucHeap[ configTOTAL_HEAP_SIZE ];
volatile uint32_t ulAdditionalOffset = 19; /* Just to prevent 'condition is always true' warnings in configASSERT(). */

View file

@ -68,20 +68,19 @@
*/
/******************************************************************************
* NOTE 1: Do not expect to get real time behaviour from the Win32 port or this
* demo application. It is provided as a convenient development and
* demonstration test bed only. Windows will not be running the FreeRTOS
* threads continuously, so the timing information in the FreeRTOS+Trace logs
* have no meaningful units. See the documentation page for the Windows
* simulator for further explanation:
* NOTE: Windows will not be running the FreeRTOS demo threads continuously, so
* do not expect to get real time behaviour from the FreeRTOS Windows port, or
* this demo application. Also, the timing information in the FreeRTOS+Trace
* logs have no meaningful units. See the documentation page for the Windows
* port for further information:
* http://www.freertos.org/FreeRTOS-Windows-Simulator-Emulator-for-Visual-Studio-and-Eclipse-MingW.html
* - READ THE WEB DOCUMENTATION FOR THIS PORT FOR MORE INFORMATION ON USING IT -
*
* NOTE 2: This project provides two demo applications. A simple blinky style
* project, and a more comprehensive test and demo application. The
* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting in main.c is used to select
* between the two. See the notes on using mainCREATE_SIMPLE_BLINKY_DEMO_ONLY
* in main.c. This file implements the simply blinky style version.
* in main.c. This file implements the simply blinky version. Console output
* is used in place of the normal LED toggling.
*
* NOTE 3: This file only contains the source code that is specific to the
* basic demo. Generic functions, such FreeRTOS hook functions, are defined
@ -93,9 +92,9 @@
*
* The Queue Send Task:
* The queue send task is implemented by the prvQueueSendTask() function in
* this file. It uses vTaskDelayUntil() to create a period task that sends the
* value 100 to the queue every 200 milliseconds (please read the notes above
* regarding the accuracy of timing under Windows).
* this file. It uses vTaskDelayUntil() to create a periodic task that sends
* the value 100 to the queue every 200 milliseconds (please read the notes
* above regarding the accuracy of timing under Windows).
*
* The Queue Send Software Timer:
* The timer is a one-shot timer that is reset by a key press. The timer's
@ -108,11 +107,21 @@
* in this file. prvQueueReceiveTask() waits for data to arrive on the queue.
* When data is received, the task checks the value of the data, then outputs a
* message to indicate if the data came from the queue send task or the queue
* send software timer. As the queue send task writes to the queue every 200ms,
* the queue receive task will print a message indicating that it received data
* from the queue send task every 200ms. The queue receive task will print a
* message indicating that it received data from the queue send software timer
* 2 seconds after a key was last pressed.
* send software timer.
*
* Expected Behaviour:
* - The queue send task writes to the queue every 200ms, so every 200ms the
* queue receive task will output a message indicating that data was received
* on the queue from the queue send task.
* - The queue send software timer has a period of two seconds, and is reset
* each time a key is pressed. So if two seconds expire without a key being
* pressed then the queue receive task will output a message indicating that
* data was received on the queue from the queue send software timer.
*
* NOTE: Console input and output relies on Windows system calls, which can
* interfere with the execution of the FreeRTOS Windows port. This demo only
* uses Windows system call occasionally. Heavier use of Windows system calls
* can crash the port.
*/
/* Standard includes. */
@ -130,18 +139,13 @@
#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
/* The rate at which data is sent to the queue. The times are converted from
milliseconds to ticks by the pdMS_TO_TICKS() macro where they are used. */
#define mainTASK_SEND_FREQUENCY_MS 200
#define mainTIMER_SEND_FREQUENCY_MS 2000
milliseconds to ticks using the pdMS_TO_TICKS() macro. */
#define mainTASK_SEND_FREQUENCY_MS pdMS_TO_TICKS( 200UL )
#define mainTIMER_SEND_FREQUENCY_MS pdMS_TO_TICKS( 2000UL )
/* The number of items the queue can hold. */
/* The number of items the queue can hold at once. */
#define mainQUEUE_LENGTH ( 2 )
/* Values passed to the two tasks just to check the task parameter
functionality. */
#define mainQUEUE_SEND_PARAMETER ( 0x1111UL )
#define mainQUEUE_RECEIVE_PARAMETER ( 0x22UL )
/* The values sent to the queue receive task from the queue send task and the
queue send software timer respectively. */
#define mainVALUE_SENT_FROM_TASK ( 100UL )
@ -170,25 +174,26 @@ static TimerHandle_t xTimer = NULL;
/*-----------------------------------------------------------*/
/*** SEE THE COMMENTS AT THE TOP OF THIS FILE ***/
void main_blinky( void )
{
const TickType_t xTimerPeriod = pdMS_TO_TICKS( mainTIMER_SEND_FREQUENCY_MS );
const TickType_t xTimerPeriod = mainTIMER_SEND_FREQUENCY_MS;
/* Create the queue. */
xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) );
xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( uint32_t ) );
if( xQueue != NULL )
{
/* Start the two tasks as described in the comments at the top of this
file. */
xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */
"Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */
configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */
( void * ) mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */
mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */
NULL ); /* The task handle is not required, so NULL is passed. */
xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */
"Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */
configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */
NULL, /* The parameter passed to the task - not used in this simple case. */
mainQUEUE_RECEIVE_TASK_PRIORITY,/* The priority assigned to the task. */
NULL ); /* The task handle is not required, so NULL is passed. */
xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL );
xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL );
/* Create the software timer, but don't start it yet. */
xTimer = xTimerCreate( "Timer", /* The text name assigned to the software timer - for debug only as it is not used by the kernel. */
@ -213,29 +218,25 @@ const TickType_t xTimerPeriod = pdMS_TO_TICKS( mainTIMER_SEND_FREQUENCY_MS );
static void prvQueueSendTask( void *pvParameters )
{
TickType_t xNextWakeTime;
const TickType_t xBlockTime = pdMS_TO_TICKS( mainTASK_SEND_FREQUENCY_MS );
const TickType_t xBlockTime = mainTASK_SEND_FREQUENCY_MS;
const uint32_t ulValueToSend = mainVALUE_SENT_FROM_TASK;
/* Remove compiler warning in the case that configASSERT() is not
defined. */
/* Prevent the compiler warning about the unused parameter. */
( void ) pvParameters;
/* Check the task parameter is as expected. */
configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_SEND_PARAMETER );
/* Initialise xNextWakeTime - this only needs to be done once. */
xNextWakeTime = xTaskGetTickCount();
for( ;; )
{
/* Place this task in the blocked state until it is time to run again.
The block time is specified in ticks, the constant used converts ticks
to ms. While in the Blocked state this task will not consume any CPU
time. */
The block time is specified in ticks, pdMS_TO_TICKS() was used to
convert a time specified in milliseconds into a time specified in ticks.
While in the Blocked state this task will not consume any CPU time. */
vTaskDelayUntil( &xNextWakeTime, xBlockTime );
/* Send to the queue - causing the queue receive task to unblock and
toggle the LED. 0 is used as the block time so the sending operation
write to the console. 0 is used as the block time so the send operation
will not block - it shouldn't need to block as the queue should always
have at least one space at this point in the code. */
xQueueSend( xQueue, &ulValueToSend, 0U );
@ -247,6 +248,11 @@ static void prvQueueSendTimerCallback( TimerHandle_t xTimerHandle )
{
const uint32_t ulValueToSend = mainVALUE_SENT_FROM_TIMER;
/* This is the software timer callback function. The software timer has a
period of two seconds and is reset each time a key is pressed. This
callback function will execute if the timer expires, which will only happen
if a key is not pressed for two seconds. */
/* Avoid compiler warnings resulting from the unused parameter. */
( void ) xTimerHandle;
@ -259,26 +265,25 @@ const uint32_t ulValueToSend = mainVALUE_SENT_FROM_TIMER;
static void prvQueueReceiveTask( void *pvParameters )
{
unsigned long ulReceivedValue;
uint32_t ulReceivedValue;
/* Remove compiler warning in the case that configASSERT() is not
defined. */
/* Prevent the compiler warning about the unused parameter. */
( void ) pvParameters;
/* Check the task parameter is as expected. */
configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_RECEIVE_PARAMETER );
for( ;; )
{
/* Wait until something arrives in the queue - this task will block
indefinitely provided INCLUDE_vTaskSuspend is set to 1 in
FreeRTOSConfig.h. */
FreeRTOSConfig.h. It will not use any CPU time while it is in the
Blocked state. */
xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY );
/* To get here something must have been received from the queue, but
is it the expected value? Normally calling printf() from a task is not
is it an expected value? Normally calling printf() from a task is not
a good idea. Here there is lots of stack space and only one task is
using console IO so it is ok. */
using console IO so it is ok. However, note the comments at the top of
this file about the risks of making Windows system calls (such as
console output) from a FreeRTOS task. */
if( ulReceivedValue == mainVALUE_SENT_FROM_TASK )
{
printf( "Message received from task\r\n" );

View file

@ -69,14 +69,12 @@
/*
*******************************************************************************
* NOTE 1: Do not expect to get real time behaviour from the Win32 port or this
* demo application. It is provided as a convenient development and
* demonstration test bed only. Windows will not be running the FreeRTOS
* threads continuously, so the timing information in the FreeRTOS+Trace logs
* have no meaningful units. See the documentation page for the Windows
* simulator for further explanation:
* NOTE: Windows will not be running the FreeRTOS demo threads continuously, so
* do not expect to get real time behaviour from the FreeRTOS Windows port, or
* this demo application. Also, the timing information in the FreeRTOS+Trace
* logs have no meaningful units. See the documentation page for the Windows
* port for further information:
* http://www.freertos.org/FreeRTOS-Windows-Simulator-Emulator-for-Visual-Studio-and-Eclipse-MingW.html
* - READ THE WEB DOCUMENTATION FOR THIS PORT FOR MORE INFORMATION ON USING IT -
*
* NOTE 2: This project provides two demo applications. A simple blinky style
* project, and a more comprehensive test and demo application. The
@ -100,9 +98,9 @@
* "Check" task - This only executes every five seconds but has a high priority
* to ensure it gets processor time. Its main function is to check that all the
* standard demo tasks are still operational. While no errors have been
* discovered the check task will print out "OK" and the current simulated tick
* time. If an error is discovered in the execution of a task then the check
* task will print out an appropriate error message.
* discovered the check task will print out "No Errors" along with some system
* status information. If an error is discovered in the execution of a task
* then the check task will print out an appropriate error message.
*
*/
@ -185,7 +183,7 @@ static void prvDemoQueueSpaceFunctions( void *pvParameters );
/*-----------------------------------------------------------*/
/* The variable into which error messages are latched. */
static char *pcStatusMessage = "OK";
static char *pcStatusMessage = "No errors";
/* This semaphore is created purely to test using the vSemaphoreDelete() and
semaphore tracing API functions. It has no other purpose. */
@ -246,7 +244,7 @@ int main_full( void )
static void prvCheckTask( void *pvParameters )
{
TickType_t xNextWakeTime;
const TickType_t xCycleFrequency = 2500 / portTICK_PERIOD_MS;
const TickType_t xCycleFrequency = pdMS_TO_TICKS( 2500UL );
/* Just to remove compiler warning. */
( void ) pvParameters;
@ -342,7 +340,10 @@ const TickType_t xCycleFrequency = 2500 / portTICK_PERIOD_MS;
/* This is the only task that uses stdout so its ok to call printf()
directly. */
printf( "%s - %d\r\n", pcStatusMessage, xTaskGetTickCount() );
printf( "%s - tick count %d - free heap %d - min free heap %d\r\n", pcStatusMessage,
xTaskGetTickCount(),
xPortGetFreeHeapSize(),
xPortGetMinimumEverFreeHeapSize() );
}
}
/*-----------------------------------------------------------*/
@ -395,7 +396,7 @@ void *pvAllocated;
/* Exercise heap_5 a bit. The malloc failed hook will trap failed
allocations so there is no need to test here. */
pvAllocated = pvPortMalloc( ( rand() % 100 ) + 1 );
pvAllocated = pvPortMalloc( ( rand() % 500 ) + 1 );
vPortFree( pvAllocated );
}
/*-----------------------------------------------------------*/