mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-08-01 08:54:14 -04:00
+ New feature added: Task notifications.
+ Optimise Cortex-M4F ports by inlining some critical section macros. + Original ports used a #define to set the path to portmacro.h - that method has been obsolete for years and now all the old definitions have been moved into a separate header files called deprecated_definitions.h. + Cortex-M port now check the active vector bits against 0xff when determining if a function is called from an interrupt - previously only a subset of the bits (0x1f) were checked. + Add in new standard demo/test files TaskNotify.c/h and include the files in the simulator demos. + Update trace recorder code, and some demos to use the new version (more to do). + Introduce uxTaskPriorityGetFromISR(). + Minor typo corrections. + Update MingW simulator demo to match the MSVC simulator demo.
This commit is contained in:
parent
ca22607d14
commit
85fb1cc024
65 changed files with 5524 additions and 4527 deletions
|
@ -132,7 +132,7 @@ BaseType_t xStatus;
|
|||
XUartPs_Config *pxConfig;
|
||||
|
||||
/* Create the queue used to hold received characters. NOTE THE COMMENTS AT
|
||||
THE TOP OF THIS FILE REGARDING THE QUEUE OF QUEUES FOR THIS PURPSOE. */
|
||||
THE TOP OF THIS FILE REGARDING THE USE OF QUEUES FOR THIS PURPSOE. */
|
||||
xRxQueue = xQueueCreate( uxQueueLength, sizeof( char ) );
|
||||
configASSERT( xRxQueue );
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
FreeRTOS V7.0.2 - Copyright (C) 2011 Real Time Engineers Ltd.
|
||||
|
||||
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
|
@ -100,7 +100,7 @@ extern void vRegisterSampleCLICommands( void );
|
|||
sLocalAddr.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
sLocalAddr.sin_port = ntohs( ( ( unsigned short ) 23 ) );
|
||||
|
||||
if( lwip_bind( lSocket, ( struct sockaddr *) &sLocalAddr, sizeof( sLocalAddr ) ) < 0 )
|
||||
if( lwip_bind( lSocket, ( struct sockaddr *) &sLocalAddr, sizeof( sLocalAddr ) ) < 0 )
|
||||
{
|
||||
lwip_close( lSocket );
|
||||
vTaskDelete( NULL );
|
||||
|
@ -125,14 +125,14 @@ extern void vRegisterSampleCLICommands( void );
|
|||
memset( cInputString, 0x00, cmdMAX_INPUT_SIZE );
|
||||
|
||||
do
|
||||
{
|
||||
{
|
||||
lBytes = lwip_recv( lClientFd, &cInChar, sizeof( cInChar ), 0 );
|
||||
|
||||
if( lBytes > 0L )
|
||||
if( lBytes > 0L )
|
||||
{
|
||||
if( cInChar == '\n' )
|
||||
{
|
||||
/* The input string has been terminated. Was the
|
||||
/* The input string has been terminated. Was the
|
||||
input a quit command? */
|
||||
if( strcmp( "quit", ( const char * ) cInputString ) == 0 )
|
||||
{
|
||||
|
@ -141,18 +141,18 @@ extern void vRegisterSampleCLICommands( void );
|
|||
}
|
||||
else
|
||||
{
|
||||
/* The input string was not a quit command.
|
||||
/* The input string was not a quit command.
|
||||
Pass the string to the command interpreter. */
|
||||
do
|
||||
{
|
||||
/* Get the next output string from the command interpreter. */
|
||||
xReturned = FreeRTOS_CLIProcessCommand( cInputString, cOutputString, configCOMMAND_INT_MAX_OUTPUT_SIZE );
|
||||
xReturned = FreeRTOS_CLIProcessCommand( cInputString, cOutputString, cmdMAX_INPUT_SIZE );
|
||||
lwip_send( lClientFd, cOutputString, strlen( ( const char * ) cOutputString ), 0 );
|
||||
|
||||
} while( xReturned != pdFALSE );
|
||||
|
||||
|
||||
/* All the strings generated by the input
|
||||
/* All the strings generated by the input
|
||||
command have been sent. Clear the input
|
||||
string ready to receive the next command. */
|
||||
lInputIndex = 0;
|
||||
|
@ -168,7 +168,7 @@ extern void vRegisterSampleCLICommands( void );
|
|||
}
|
||||
else if( cInChar == '\b' )
|
||||
{
|
||||
/* Backspace was pressed. Erase the last
|
||||
/* Backspace was pressed. Erase the last
|
||||
character in the string - if any. */
|
||||
if( lInputIndex > 0 )
|
||||
{
|
||||
|
@ -194,7 +194,7 @@ extern void vRegisterSampleCLICommands( void );
|
|||
|
||||
lwip_close( lClientFd );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Will only get here if a listening socket could not be created. */
|
||||
|
|
|
@ -80,7 +80,7 @@
|
|||
* point registers. To avoid this causing corruption it is necessary to avoid
|
||||
* their use. For this reason main.c contains very basic C implementations of
|
||||
* the standard C library functions memset(), memcpy() and memcmp(), which are
|
||||
* are used by FreeRTOS itself. Defining these functions in the project
|
||||
* are used by FreeRTOS itself. Defining these functions in the project
|
||||
* prevents the linker pulling them in from the library. Any other standard C
|
||||
* library functions that are used by the application must likewise be defined
|
||||
* in C.
|
||||
|
@ -145,7 +145,7 @@ static void prvSetupHardware( void );
|
|||
extern void main_lwIP( void );
|
||||
#else
|
||||
#error Invalid mainSELECTED_APPLICATION setting. See the comments at the top of this file and above the mainSELECTED_APPLICATION definition.
|
||||
#endif /* #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The Xilinx projects use a BSP that do not allow the start up code to be
|
||||
|
|
505
FreeRTOS/Demo/Common/Minimal/TaskNotify.c
Normal file
505
FreeRTOS/Demo/Common/Minimal/TaskNotify.c
Normal file
|
@ -0,0 +1,505 @@
|
|||
/*
|
||||
FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that has become a de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly and support the FreeRTOS *
|
||||
* project by purchasing a FreeRTOS tutorial book, reference *
|
||||
* manual, or both from: http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
* Thank you! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
|
||||
|
||||
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||
>>! obliged to provide the source code for proprietary components !<<
|
||||
>>! outside of the FreeRTOS kernel. !<<
|
||||
|
||||
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available from the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* Having a problem? Start by reading the FAQ "My application does *
|
||||
* not run, what could be wrong?" *
|
||||
* *
|
||||
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||
license and Real Time Engineers Ltd. contact details.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||
Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
mission critical applications that require provable dependability.
|
||||
|
||||
1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Tests the behaviour of direct task notifications.
|
||||
*/
|
||||
|
||||
/* Standard includes. */
|
||||
#include <limits.h>
|
||||
|
||||
/* Scheduler include files. */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "timers.h"
|
||||
|
||||
/* Demo program include files. */
|
||||
#include "TaskNotify.h"
|
||||
|
||||
#define notifyTASK_PRIORITY ( tskIDLE_PRIORITY )
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Implementation of the task that gets notified.
|
||||
*/
|
||||
static void prvNotifiedTask( void *pvParameters );
|
||||
|
||||
/*
|
||||
* Performs a few initial tests that can be done prior to creating the second
|
||||
* task.
|
||||
*/
|
||||
static void prvSingleTaskTests( void );
|
||||
|
||||
/*
|
||||
* Software timer callback function from which xTaskNotify() is called.
|
||||
*/
|
||||
static void prvNotifyingTimer( TimerHandle_t xTimer );
|
||||
|
||||
/*
|
||||
* Utility function to create pseudo random numbers.
|
||||
*/
|
||||
static UBaseType_t prvRand( void );
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Used to latch errors during the test's execution. */
|
||||
static BaseType_t xErrorStatus = pdPASS;
|
||||
|
||||
/* Used to ensure the task has not stalled. */
|
||||
static volatile uint32_t ulNotifyCycleCount = 0;
|
||||
|
||||
/* The handle of the task that receives the notifications. */
|
||||
static TaskHandle_t xTaskToNotify = NULL;
|
||||
|
||||
/* Used to count the notifications sent to the task from a software timer and
|
||||
the number of notifications received by the task from the software timer. The
|
||||
two should stay synchronised. */
|
||||
static uint32_t ulTimerNotificationsReceived = 0UL, ulTimerNotificationsSent = 0UL;
|
||||
|
||||
/* The timer used to notify the task. */
|
||||
static TimerHandle_t xTimer = NULL;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
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 );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvSingleTaskTests( void )
|
||||
{
|
||||
const TickType_t xTicksToWait = pdMS_TO_TICKS( 100UL );
|
||||
BaseType_t xReturned;
|
||||
uint32_t ulNotifiedValue, ulLoop, ulNotifyingValue;
|
||||
TickType_t xTimeOnEntering;
|
||||
const uint32_t ulFirstNotifiedConst = 100001UL, ulSecondNotifiedValueConst = 5555UL, ulMaxLoops = 5UL;
|
||||
const uint32_t ulBit0 = 0x01UL, ulBit1 = 0x02UL;
|
||||
|
||||
/* -------------------------------------------------------------------------
|
||||
Check blocking when there are no notifications. */
|
||||
xTimeOnEntering = xTaskGetTickCount();
|
||||
xReturned = xTaskNotifyWait( ULONG_MAX, 0, &ulNotifiedValue, xTicksToWait );
|
||||
|
||||
/* Should have blocked for the entire block time. */
|
||||
if( ( xTaskGetTickCount() - xTimeOnEntering ) < xTicksToWait )
|
||||
{
|
||||
xErrorStatus = pdFAIL;
|
||||
}
|
||||
configASSERT( xReturned == pdFAIL );
|
||||
configASSERT( ulNotifiedValue == 0UL );
|
||||
|
||||
|
||||
|
||||
|
||||
/* -------------------------------------------------------------------------
|
||||
Check no blocking when notifications are pending. First notify itself -
|
||||
this would not be a normal thing to do and is done here for test purposes
|
||||
only. */
|
||||
xReturned = xTaskNotify( xTaskToNotify, ulFirstNotifiedConst, eSetValueWithoutOverwrite );
|
||||
|
||||
/* Even through the 'without overwrite' action was used the update should
|
||||
have been successful. */
|
||||
configASSERT( xReturned == pdPASS );
|
||||
|
||||
/* The task should now have a notification pending, and so not time out. */
|
||||
xTimeOnEntering = xTaskGetTickCount();
|
||||
xReturned = xTaskNotifyWait( ULONG_MAX, 0, &ulNotifiedValue, xTicksToWait );
|
||||
|
||||
if( ( xTaskGetTickCount() - xTimeOnEntering ) >= xTicksToWait )
|
||||
{
|
||||
xErrorStatus = pdFAIL;
|
||||
}
|
||||
|
||||
/* The task should have been notified, and the notified value should
|
||||
be equal to ulFirstNotifiedConst. */
|
||||
configASSERT( xReturned == pdPASS );
|
||||
configASSERT( ulNotifiedValue == ulFirstNotifiedConst );
|
||||
|
||||
/* Incremented to show the task is still running. */
|
||||
ulNotifyCycleCount++;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
Check the non-overwriting functionality. The notification is done twice
|
||||
using two different notification values. The action says don't overwrite so
|
||||
only the first notification should pass and the value read back should also
|
||||
be that used with the first notification. */
|
||||
xReturned = xTaskNotify( xTaskToNotify, ulFirstNotifiedConst, eSetValueWithoutOverwrite );
|
||||
configASSERT( xReturned == pdPASS );
|
||||
|
||||
xReturned = xTaskNotify( xTaskToNotify, ulSecondNotifiedValueConst, eSetValueWithoutOverwrite );
|
||||
configASSERT( xReturned == pdFAIL );
|
||||
|
||||
/* Waiting for the notification should now return immediately so a block
|
||||
time of zero is used. */
|
||||
xReturned = xTaskNotifyWait( ULONG_MAX, 0, &ulNotifiedValue, 0 );
|
||||
|
||||
configASSERT( xReturned == pdPASS );
|
||||
configASSERT( ulNotifiedValue == ulFirstNotifiedConst );
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
Do the same again, only this time use the overwriting version. This time
|
||||
both notifications should pass, and the value written the second time should
|
||||
overwrite the value written the first time, and so be the value that is read
|
||||
back. */
|
||||
xReturned = xTaskNotify( xTaskToNotify, ulFirstNotifiedConst, eSetValueWithOverwrite );
|
||||
configASSERT( xReturned == pdPASS );
|
||||
xReturned = xTaskNotify( xTaskToNotify, ulSecondNotifiedValueConst, eSetValueWithOverwrite );
|
||||
configASSERT( xReturned == pdPASS );
|
||||
xReturned = xTaskNotifyWait( ULONG_MAX, 0, &ulNotifiedValue, 0 );
|
||||
configASSERT( xReturned == pdPASS );
|
||||
configASSERT( ulNotifiedValue == ulSecondNotifiedValueConst );
|
||||
|
||||
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
Check notifications with no action pass without updating the value. Even
|
||||
though ulFirstNotifiedConst is used as the value the value read back should
|
||||
remain at ulSecondNotifiedConst. */
|
||||
xReturned = xTaskNotify( xTaskToNotify, ulFirstNotifiedConst, eNoAction );
|
||||
configASSERT( xReturned == pdPASS );
|
||||
xReturned = xTaskNotifyWait( ULONG_MAX, 0, &ulNotifiedValue, 0 );
|
||||
configASSERT( ulNotifiedValue == ulSecondNotifiedValueConst );
|
||||
|
||||
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
Check incrementing values. Send ulMaxLoop increment notifications, then
|
||||
ensure the received value is as expected - which should be
|
||||
ulSecondNotificationValueConst plus how ever many times to loop iterated. */
|
||||
for( ulLoop = 0; ulLoop < ulMaxLoops; ulLoop++ )
|
||||
{
|
||||
xReturned = xTaskNotify( xTaskToNotify, 0, eIncrement );
|
||||
configASSERT( xReturned == pdPASS );
|
||||
}
|
||||
|
||||
xReturned = xTaskNotifyWait( ULONG_MAX, 0, &ulNotifiedValue, 0 );
|
||||
configASSERT( xReturned == pdPASS );
|
||||
configASSERT( ulNotifiedValue == ( ulSecondNotifiedValueConst + ulMaxLoops ) );
|
||||
|
||||
/* Should not be any notifications pending now. */
|
||||
xReturned = xTaskNotifyWait( 0, 0, &ulNotifiedValue, 0 );
|
||||
configASSERT( xReturned == pdFAIL );
|
||||
|
||||
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
Check all bits can be set by notifying the task with one additional bit set
|
||||
on each notification, and exiting the loop when all the bits are found to be
|
||||
set. As there are 32-bits the loop should execute 32 times before all the
|
||||
bits are found to be set. */
|
||||
ulNotifyingValue = 0x01;
|
||||
ulLoop = 0;
|
||||
|
||||
/* Start with all bits clear. */
|
||||
xTaskNotifyWait( ULONG_MAX, 0, &ulNotifiedValue, 0 );
|
||||
|
||||
do
|
||||
{
|
||||
/* Set the next bit in the task's notified value. */
|
||||
xTaskNotify( xTaskToNotify, ulNotifyingValue, eSetBits );
|
||||
|
||||
/* Wait for the notified value - which of course will already be
|
||||
available. Don't clear the bits on entry or exit as this loop is exited
|
||||
when all the bits are set. */
|
||||
xReturned = xTaskNotifyWait( 0, 0, &ulNotifiedValue, 0 );
|
||||
configASSERT( xReturned == pdPASS );
|
||||
|
||||
ulLoop++;
|
||||
|
||||
/* Use the next bit on the next iteration around this loop. */
|
||||
ulNotifyingValue <<= 1UL;
|
||||
|
||||
} while ( ulNotifiedValue != ULONG_MAX );
|
||||
|
||||
/* As a 32-bit value was used the loop should have executed 32 times before
|
||||
all the bits were set. */
|
||||
configASSERT( ulLoop == 32 );
|
||||
|
||||
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
Check bits are cleared on entry but not on exit when a notification fails
|
||||
to arrive before timing out - both with and without a timeout value. Wait
|
||||
for the notification again - but this time it is not given by anything and
|
||||
should return pdFAIL. The parameters are set to clear bit zero on entry and
|
||||
bit one on exit. As no notification was received only the bit cleared on
|
||||
entry should actually get cleared. */
|
||||
xReturned = xTaskNotifyWait( ulBit0, ulBit1, &ulNotifiedValue, xTicksToWait );
|
||||
configASSERT( xReturned == pdFAIL );
|
||||
|
||||
/* Notify the task with no action so as not to update the bits even though
|
||||
ULONG_MAX is used as the notification value. */
|
||||
xTaskNotify( xTaskToNotify, ULONG_MAX, eNoAction );
|
||||
|
||||
/* Reading back the value should should find bit 0 is clear, as this was
|
||||
cleared on entry, but bit 1 is not clear as it will not have been cleared on
|
||||
exit as no notification was received. */
|
||||
xReturned = xTaskNotifyWait( 0x00UL, 0x00UL, &ulNotifiedValue, 0 );
|
||||
configASSERT( xReturned == pdPASS );
|
||||
configASSERT( ulNotifiedValue == ( ULONG_MAX & ~ulBit0 ) );
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
Now try clearing the bit on exit. For that to happen a notification must be
|
||||
received, so the task is notified first. */
|
||||
xTaskNotify( xTaskToNotify, 0, eNoAction );
|
||||
xTaskNotifyWait( 0x00, ulBit1, &ulNotifiedValue, 0 );
|
||||
|
||||
/* However as the bit is cleared on exit, after the returned notification
|
||||
value is set, the returned notification value should not have the bit
|
||||
cleared... */
|
||||
configASSERT( ulNotifiedValue == ( ULONG_MAX & ~ulBit0 ) );
|
||||
|
||||
/* ...but reading the value back again should find that the bit was indeed
|
||||
cleared internally. The returned value should be pdFAIL however as nothing
|
||||
has notified the task in the mean time. */
|
||||
xReturned = xTaskNotifyWait( 0x00, 0x00, &ulNotifiedValue, 0 );
|
||||
configASSERT( xReturned == pdFAIL );
|
||||
configASSERT( ulNotifiedValue == ( ULONG_MAX & ~( ulBit0 | ulBit1 ) ) );
|
||||
|
||||
|
||||
|
||||
/* Incremented to show the task is still running. */
|
||||
ulNotifyCycleCount++;
|
||||
|
||||
/* Leave all bits cleared. */
|
||||
xTaskNotifyWait( ULONG_MAX, 0, NULL, 0 );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvNotifyingTimer( TimerHandle_t xTimer )
|
||||
{
|
||||
( void ) xTimer;
|
||||
|
||||
xTaskNotifyGive( xTaskToNotify );
|
||||
|
||||
/* This value is also incremented from an interrupt. */
|
||||
taskENTER_CRITICAL();
|
||||
{
|
||||
ulTimerNotificationsSent++;
|
||||
}
|
||||
taskEXIT_CRITICAL();
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvNotifiedTask( void *pvParameters )
|
||||
{
|
||||
const TickType_t xMaxPeriod = pdMS_TO_TICKS( 90 ), xMinPeriod = pdMS_TO_TICKS( 10 ), xDontBlock = 0;
|
||||
TickType_t xPeriod;
|
||||
|
||||
/* Remove compiler warnings about unused parameters. */
|
||||
( void ) pvParameters;
|
||||
|
||||
/* Run a few tests that can be done from a single task before entering the
|
||||
main loop. */
|
||||
prvSingleTaskTests();
|
||||
|
||||
/* Create the software timer that is used to send notifications to this
|
||||
task. Notifications are also received from an interrupt. */
|
||||
xTimer = xTimerCreate( "Notifier", xMaxPeriod, pdFALSE, NULL, prvNotifyingTimer );
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
/* Start the timer again with a different period. Sometimes the period
|
||||
will be higher than the tasks block time, sometimes it will be lower
|
||||
than the tasks block time. */
|
||||
xPeriod = prvRand() % xMaxPeriod;
|
||||
if( xPeriod < xMinPeriod )
|
||||
{
|
||||
xPeriod = xMinPeriod;
|
||||
}
|
||||
|
||||
xTimerChangePeriod( xTimer, xPeriod, portMAX_DELAY );
|
||||
xTimerStart( xTimer, portMAX_DELAY );
|
||||
|
||||
/* Block waiting for the notification again with a different period.
|
||||
Sometimes the period will be higher than the tasks block time, sometimes
|
||||
it will be lower than the tasks block time. */
|
||||
xPeriod = prvRand() % xMaxPeriod;
|
||||
if( xPeriod < xMinPeriod )
|
||||
{
|
||||
xPeriod = xMinPeriod;
|
||||
}
|
||||
|
||||
/* Block to wait for a notification but without clearing the
|
||||
notification count, so only add one to the count of received
|
||||
notifications as any other notifications will remain pending. */
|
||||
if( ulTaskNotifyTake( pdFALSE, xPeriod ) != 0 )
|
||||
{
|
||||
ulTimerNotificationsReceived++;
|
||||
}
|
||||
|
||||
|
||||
/* Take a notification without clearing again, but this time without a
|
||||
block time specified. */
|
||||
if( ulTaskNotifyTake( pdFALSE, xDontBlock ) != 0 )
|
||||
{
|
||||
ulTimerNotificationsReceived++;
|
||||
}
|
||||
|
||||
/* Wait for the next notification from the timer, clearing all
|
||||
notifications if one is received, so this time adding the total number
|
||||
of notifications that were pending as none will be left pending after
|
||||
the function call. */
|
||||
ulTimerNotificationsReceived += ulTaskNotifyTake( pdTRUE, xPeriod );
|
||||
|
||||
/* Wait for the next notification again, clearing all notifications if
|
||||
one is received, but this time blocking indefinitely. */
|
||||
ulTimerNotificationsReceived += ulTaskNotifyTake( pdTRUE, portMAX_DELAY );
|
||||
|
||||
/* Incremented to show the task is still running. */
|
||||
ulNotifyCycleCount++;
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void xNotifyTaskFromISR( void )
|
||||
{
|
||||
static BaseType_t xCallCount = 0;
|
||||
const BaseType_t xCallInterval = pdMS_TO_TICKS( 50 );
|
||||
|
||||
/* The task performs some tests before starting the timer that gives the
|
||||
notification from this interrupt. If the timer has not been created yet
|
||||
then the initial tests have not yet completed and the notification should
|
||||
not be sent. */
|
||||
if( xTimer != NULL )
|
||||
{
|
||||
xCallCount++;
|
||||
|
||||
if( xCallCount >= xCallInterval )
|
||||
{
|
||||
/* It is time to 'give' the notification again. */
|
||||
xCallCount = 0;
|
||||
|
||||
xTaskNotifyGiveFromISR( xTaskToNotify, NULL );
|
||||
ulTimerNotificationsSent++;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* This is called to check the created tasks are still running and have not
|
||||
detected any errors. */
|
||||
BaseType_t xAreTaskNotificationTasksStillRunning( void )
|
||||
{
|
||||
static uint32_t ulLastNotifyCycleCount = 0;
|
||||
const uint32_t ulMaxSendReceiveDeviation = 5UL;
|
||||
|
||||
/* Check the cycle count is still incrementing to ensure the task is still
|
||||
actually running. */
|
||||
if( ulLastNotifyCycleCount == ulNotifyCycleCount )
|
||||
{
|
||||
xErrorStatus = pdFAIL;
|
||||
}
|
||||
else
|
||||
{
|
||||
ulLastNotifyCycleCount = ulNotifyCycleCount;
|
||||
}
|
||||
|
||||
/* Check the count of 'takes' from the software timer is keeping track with
|
||||
the amount of 'gives'. */
|
||||
if( ulTimerNotificationsSent > ulTimerNotificationsSent )
|
||||
{
|
||||
if( ( ulTimerNotificationsSent - ulTimerNotificationsReceived ) > ulMaxSendReceiveDeviation )
|
||||
{
|
||||
xErrorStatus = pdFAIL;
|
||||
}
|
||||
}
|
||||
|
||||
return xErrorStatus;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static UBaseType_t prvRand( void )
|
||||
{
|
||||
static uint32_t ulNextRand = ( uint32_t ) prvRand;
|
||||
|
||||
const uint32_t ulMultiplier = 0x015a4e35UL, ulIncrement = 1UL;
|
||||
|
||||
/* Utility function to generate a pseudo random number. */
|
||||
ulNextRand = ( ulMultiplier * ulNextRand ) + ulIncrement;
|
||||
return( ( int ) ( ulNextRand >> 16UL ) & 0x7fffUL );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
|
@ -739,11 +739,16 @@ static TickType_t uxTick = ( TickType_t ) -1;
|
|||
will expire when the kernel's tick count is (100 + xBasePeriod). For this
|
||||
reason xMargin is used as an allowable margin for premature timer expiries
|
||||
as well as late timer expiries. */
|
||||
const TickType_t xMargin = 6;
|
||||
#ifdef _WINDOWS_
|
||||
/* Windows is not real real time. */
|
||||
const TickType_t xMargin = 20;
|
||||
#else
|
||||
const TickType_t xMargin = 6;
|
||||
#endif /* _WINDOWS_ */
|
||||
#else
|
||||
#ifdef _WINDOWS_
|
||||
/* Windows is not real real time. */
|
||||
const TickType_t xMargin = 10;
|
||||
const TickType_t xMargin = 20;
|
||||
#else
|
||||
const TickType_t xMargin = 4;
|
||||
#endif /* _WINDOWS_ */
|
||||
|
|
76
FreeRTOS/Demo/Common/include/TaskNotify.h
Normal file
76
FreeRTOS/Demo/Common/include/TaskNotify.h
Normal file
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that has become a de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly and support the FreeRTOS *
|
||||
* project by purchasing a FreeRTOS tutorial book, reference *
|
||||
* manual, or both from: http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
* Thank you! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
|
||||
|
||||
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||
>>! obliged to provide the source code for proprietary components !<<
|
||||
>>! outside of the FreeRTOS kernel. !<<
|
||||
|
||||
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available from the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* Having a problem? Start by reading the FAQ "My application does *
|
||||
* not run, what could be wrong?" *
|
||||
* *
|
||||
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||
license and Real Time Engineers Ltd. contact details.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||
Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
mission critical applications that require provable dependability.
|
||||
|
||||
1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
#ifndef TASK_NOTIFY_H
|
||||
#define TASK_NOTIFY_H
|
||||
|
||||
void vStartTaskNotifyTask( void );
|
||||
BaseType_t xAreTaskNotificationTasksStillRunning( void );
|
||||
void xNotifyTaskFromISR( void );
|
||||
|
||||
#endif /* TASK_NOTIFY_H */
|
||||
|
||||
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef CGC_SET_VALUES_H_
|
||||
#define CGC_SET_VALUES_H_
|
||||
|
||||
/* Do not modify these macros. These values are used to initialise
|
||||
/* Do not modify these macros. These values are used to initialise
|
||||
the SCKCR and SCKCR2 registers based upon the above values. */
|
||||
#if (FCLK_DIV == 64)
|
||||
#define FCLK_SCKCR 0x60000000L
|
||||
|
@ -40,12 +40,12 @@
|
|||
#define ICLK_SCKCR 0x01000000L
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if (BCLK_PIN == 1)
|
||||
#define PSTOP1_SCKCR 0x00800000L
|
||||
#elif
|
||||
#else
|
||||
#define PSTOP1_SCKCR 0x00000000L
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if (BCLK_DIV == 64)
|
||||
|
@ -120,7 +120,7 @@
|
|||
#elif (PCLK47_DIV == 1)
|
||||
#define PCLK47_SCKCR 0x00000000L
|
||||
#else
|
||||
#define PCLK47_SCKCR 0x00000010L
|
||||
#define PCLK47_SCKCR 0x00000010L
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -139,7 +139,7 @@
|
|||
#elif (PCLK03_DIV == 1)
|
||||
#define PCLK03_SCKCR 0x00000000L
|
||||
#else
|
||||
#define PCLK03_SCKCR 0x00000001L
|
||||
#define PCLK03_SCKCR 0x00000001L
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -173,7 +173,7 @@
|
|||
|
||||
#if (CLK_SOURCE == CLK_SOURCE_LOCO)
|
||||
/* Internal LOCO circuit - 125kHz*/
|
||||
#define CLK_FREQUENCY (125000L)
|
||||
#define CLK_FREQUENCY (125000L)
|
||||
#define FCLK_FREQUENCY (CLK_FREQUENCY / FCLK_DIV)
|
||||
#define ICLK_FREQUENCY (CLK_FREQUENCY / ICLK_DIV)
|
||||
#define BCLK_FREQUENCY (CLK_FREQUENCY / BCLK_DIV)
|
||||
|
@ -185,7 +185,7 @@
|
|||
|
||||
#elif (CLK_SOURCE == CLK_SOURCE_HOCO)
|
||||
/* Internal high speed on-chip oscillator (HOCO) */
|
||||
#define CLK_FREQUENCY (50000000L)
|
||||
#define CLK_FREQUENCY (50000000L)
|
||||
#define FCLK_FREQUENCY (CLK_FREQUENCY / FCLK_DIV)
|
||||
#define ICLK_FREQUENCY (CLK_FREQUENCY / ICLK_DIV)
|
||||
#define BCLK_FREQUENCY (CLK_FREQUENCY / BCLK_DIV)
|
||||
|
@ -196,7 +196,7 @@
|
|||
|
||||
|
||||
#elif (CLK_SOURCE == CLK_SOURCE_MAIN)
|
||||
/* External XTAL, but not via the PLL circuit */
|
||||
/* External XTAL, but not via the PLL circuit */
|
||||
#define FCLK_FREQUENCY (XTAL_FREQUENCY / FCLK_DIV)
|
||||
#define ICLK_FREQUENCY (XTAL_FREQUENCY / ICLK_DIV)
|
||||
#define BCLK_FREQUENCY (XTAL_FREQUENCY / BCLK_DIV)
|
||||
|
@ -207,7 +207,7 @@
|
|||
|
||||
|
||||
#elif (CLK_SOURCE == CLK_SOURCE_SUB)
|
||||
/* External 32khZ XTAL */
|
||||
/* External 32khZ XTAL */
|
||||
#define FCLK_FREQUENCY (SUB_FREQUENCY / FCLK_DIV)
|
||||
#define ICLK_FREQUENCY (SUB_FREQUENCY / ICLK_DIV)
|
||||
#define BCLK_FREQUENCY (SUB_FREQUENCY / BCLK_DIV)
|
||||
|
@ -219,7 +219,7 @@
|
|||
|
||||
#elif (CLK_SOURCE == CLK_SOURCE_PLL)
|
||||
/* External XTAL, but using the PLL circuit */
|
||||
#define PLL_FREQUENCY (XTAL_FREQUENCY * (PLL_MUL / PLL_INPUT_FREQ_DIV))
|
||||
#define PLL_FREQUENCY (XTAL_FREQUENCY * (PLL_MUL / PLL_INPUT_FREQ_DIV))
|
||||
#define FCLK_FREQUENCY (PLL_FREQUENCY / FCLK_DIV)
|
||||
#define ICLK_FREQUENCY (PLL_FREQUENCY / ICLK_DIV)
|
||||
#define BCLK_FREQUENCY (PLL_FREQUENCY / BCLK_DIV)
|
||||
|
|
|
@ -96,8 +96,8 @@
|
|||
#include "rskrx64mdef.h"
|
||||
|
||||
/* Set option bytes */
|
||||
#pragma address OFS0_location = 0xFFFFFF8CUL
|
||||
#pragma address OFS1_location = 0xFFFFFF88UL
|
||||
#pragma address OFS0_location 0xFFFFFF8CUL
|
||||
#pragma address OFS1_location 0xFFFFFF88UL
|
||||
volatile const uint32_t OFS0_location = 0xFFFFFFFFUL;
|
||||
volatile const uint32_t OFS1_location = 0xFFFFFFFFUL;
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@
|
|||
#define configUSE_TICK_HOOK 1
|
||||
#define configTICK_RATE_HZ ( 1000 ) /* In this non-real time simulated environment the tick frequency has to be at least a multiple of the Win32 tick frequency, and therefore very slow. */
|
||||
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 50 ) /* In this simulated case, the stack only has to hold one small structure as the real stack is part of the win32 thread. */
|
||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 22 * 1024 ) )
|
||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 23 * 1024 ) )
|
||||
#define configMAX_TASK_NAME_LEN ( 12 )
|
||||
#define configUSE_TRACE_FACILITY 1
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
|
@ -97,6 +97,7 @@
|
|||
#define configUSE_COUNTING_SEMAPHORES 1
|
||||
#define configUSE_ALTERNATIVE_API 1
|
||||
#define configUSE_QUEUE_SETS 1
|
||||
#define configUSE_TASK_NOTIFICATIONS 1
|
||||
|
||||
/* Software timer related configuration options. */
|
||||
#define configUSE_TIMERS 1
|
||||
|
@ -104,18 +105,18 @@
|
|||
#define configTIMER_QUEUE_LENGTH 20
|
||||
#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE * 2 )
|
||||
|
||||
#define configMAX_PRIORITIES ( 7 )
|
||||
#define configMAX_PRIORITIES ( 7 )
|
||||
|
||||
/* Run time stats gathering configuration options. */
|
||||
unsigned long ulGetRunTimeCounterValue( void ); /* Prototype of function that returns run time counter. */
|
||||
void vConfigureTimerForRunTimeStats( void ); /* Prototype of function that initialises the run time counter. */
|
||||
#define configGENERATE_RUN_TIME_STATS 1
|
||||
#define configGENERATE_RUN_TIME_STATS 1
|
||||
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() vConfigureTimerForRunTimeStats()
|
||||
#define portGET_RUN_TIME_COUNTER_VALUE() ulGetRunTimeCounterValue()
|
||||
|
||||
/* Co-routine related configuration options. */
|
||||
#define configUSE_CO_ROUTINES 1
|
||||
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
|
||||
#define configUSE_CO_ROUTINES 1
|
||||
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
|
||||
|
||||
/* This demo makes use of one or more example stats formatting functions. These
|
||||
format the raw data provided by the uxTaskGetSystemState() function in to human
|
||||
|
@ -148,6 +149,8 @@ extern void vAssertCalled( unsigned long ulLine, const char * const pcFileName )
|
|||
#define configASSERT( x ) if( ( x ) == 0 ) vAssertCalled( __LINE__, __FILE__ )
|
||||
|
||||
/* Include the FreeRTOS+Trace FreeRTOS trace macro definitions. */
|
||||
#define TRACE_ENTER_CRITICAL_SECTION() portENTER_CRITICAL()
|
||||
#define TRACE_EXIT_CRITICAL_SECTION() portEXIT_CRITICAL()
|
||||
#include "trcKernelPort.h"
|
||||
|
||||
#endif /* FREERTOS_CONFIG_H */
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/*******************************************************************************
|
||||
* Tracealyzer v2.6.0 Recorder Library
|
||||
* Tracealyzer v2.7.0 Recorder Library
|
||||
* Percepio AB, www.percepio.com
|
||||
*
|
||||
* trcConfig.h
|
||||
*
|
||||
* Configuration parameters for the trace recorder library. Before using the
|
||||
* trace recorder library, please check that the default settings are
|
||||
* appropriate for your system, and if necessary adjust these. Most likely, you
|
||||
* will need to adjust the NTask, NISR, NQueue, NMutex and NSemaphore values to
|
||||
* reflect the number of such objects in your system. These may be
|
||||
* Configuration parameters for the trace recorder library. Before using the
|
||||
* trace recorder library, please check that the default settings are
|
||||
* appropriate for your system, and if necessary adjust these. Most likely, you
|
||||
* will need to adjust the NTask, NISR, NQueue, NMutex and NSemaphore values to
|
||||
* reflect the number of such objects in your system. These may be
|
||||
* over-approximated, although larger values values implies more RAM usage.
|
||||
*
|
||||
* Terms of Use
|
||||
|
@ -16,36 +16,121 @@
|
|||
* use together with Percepio products. You may distribute the recorder library
|
||||
* in its original form, including modifications in trcHardwarePort.c/.h
|
||||
* given that these modification are clearly marked as your own modifications
|
||||
* and documented in the initial comment section of these source files.
|
||||
* This software is the intellectual property of Percepio AB and may not be
|
||||
* sold or in other ways commercially redistributed without explicit written
|
||||
* and documented in the initial comment section of these source files.
|
||||
* This software is the intellectual property of Percepio AB and may not be
|
||||
* sold or in other ways commercially redistributed without explicit written
|
||||
* permission by Percepio AB.
|
||||
*
|
||||
* Disclaimer
|
||||
* The trace tool and recorder library is being delivered to you AS IS and
|
||||
* Percepio AB makes no warranty as to its use or performance. Percepio AB does
|
||||
* not and cannot warrant the performance or results you may obtain by using the
|
||||
* software or documentation. Percepio AB make no warranties, express or
|
||||
* implied, as to noninfringement of third party rights, merchantability, or
|
||||
* fitness for any particular purpose. In no event will Percepio AB, its
|
||||
* technology partners, or distributors be liable to you for any consequential,
|
||||
* incidental or special damages, including any lost profits or lost savings,
|
||||
* even if a representative of Percepio AB has been advised of the possibility
|
||||
* of such damages, or for any claim by any third party. Some jurisdictions do
|
||||
* not allow the exclusion or limitation of incidental, consequential or special
|
||||
* damages, or the exclusion of implied warranties or limitations on how long an
|
||||
* Disclaimer
|
||||
* The trace tool and recorder library is being delivered to you AS IS and
|
||||
* Percepio AB makes no warranty as to its use or performance. Percepio AB does
|
||||
* not and cannot warrant the performance or results you may obtain by using the
|
||||
* software or documentation. Percepio AB make no warranties, express or
|
||||
* implied, as to noninfringement of third party rights, merchantability, or
|
||||
* fitness for any particular purpose. In no event will Percepio AB, its
|
||||
* technology partners, or distributors be liable to you for any consequential,
|
||||
* incidental or special damages, including any lost profits or lost savings,
|
||||
* even if a representative of Percepio AB has been advised of the possibility
|
||||
* of such damages, or for any claim by any third party. Some jurisdictions do
|
||||
* not allow the exclusion or limitation of incidental, consequential or special
|
||||
* damages, or the exclusion of implied warranties or limitations on how long an
|
||||
* implied warranty may last, so the above limitations may not apply to you.
|
||||
*
|
||||
* Copyright Percepio AB, 2013.
|
||||
* Tabs are used for indent in this file (1 tab = 4 spaces)
|
||||
*
|
||||
* Copyright Percepio AB, 2014.
|
||||
* www.percepio.com
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef TRCCONFIG_H
|
||||
#define TRCCONFIG_H
|
||||
|
||||
/******************************************************************************
|
||||
* SELECTED_PORT
|
||||
*
|
||||
* Macro that specifies what hardware port that should be used.
|
||||
* Available ports are:
|
||||
*
|
||||
* Port Name Code Official OS supported
|
||||
* PORT_APPLICATION_DEFINED -2 - -
|
||||
* PORT_NOT_SET -1 - -
|
||||
* PORT_HWIndependent 0 Yes Any
|
||||
* PORT_Win32 1 Yes FreeRTOS on Win32
|
||||
* PORT_Atmel_AT91SAM7 2 No Any
|
||||
* PORT_Atmel_UC3A0 3 No Any
|
||||
* PORT_ARM_CortexM 4 Yes Any
|
||||
* PORT_Renesas_RX600 5 Yes Any
|
||||
* PORT_Microchip_dsPIC_AND_PIC24 6 Yes Any
|
||||
* PORT_TEXAS_INSTRUMENTS_TMS570 7 No Any
|
||||
* PORT_TEXAS_INSTRUMENTS_MSP430 8 No Any
|
||||
* PORT_MICROCHIP_PIC32MX 9 Yes Any
|
||||
* PORT_XILINX_PPC405 10 No FreeRTOS
|
||||
* PORT_XILINX_PPC440 11 No FreeRTOS
|
||||
* PORT_XILINX_MICROBLAZE 12 No Any
|
||||
* PORT_NXP_LPC210X 13 No Any
|
||||
* PORT_MICROCHIP_PIC32MZ 14 Yes Any
|
||||
* PORT_ARM_CORTEX_A9 15 No Any
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef WIN32
|
||||
// Set the port setting here!
|
||||
#define SELECTED_PORT PORT_NOT_SET
|
||||
|
||||
#if (SELECTED_PORT == PORT_NOT_SET)
|
||||
#error "You need to define SELECTED_PORT here!"
|
||||
#endif
|
||||
#else
|
||||
// For Win32 demo projects this is set automatically
|
||||
#define SELECTED_PORT PORT_Win32
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
* FREERTOS_VERSION
|
||||
*
|
||||
* Specify what version of FreeRTOS that is used. This is necessary compensate
|
||||
* for renamed symbols in the FreeRTOS kernel (does not build if incorrect).
|
||||
*
|
||||
* FREERTOS_VERSION_7_3_OR_7_4 (= 1) If using FreeRTOS v7.3.0 - v7.4.2
|
||||
* FREERTOS_VERSION_7_5_OR_7_6 (= 2) If using FreeRTOS v7.5.0 - v7.6.0
|
||||
* FREERTOS_VERSION_8_0_OR_LATER (= 3) If using FreeRTOS v8.0.0 or later
|
||||
*****************************************************************************/
|
||||
#define FREERTOS_VERSION FREERTOS_VERSION_8_0_OR_LATER
|
||||
|
||||
/******************************************************************************
|
||||
* TRACE_RECORDER_STORE_MODE
|
||||
*
|
||||
* Macro which should be defined as one of:
|
||||
* - TRACE_STORE_MODE_RING_BUFFER
|
||||
* - TRACE_STORE_MODE_STOP_WHEN_FULL
|
||||
* Default is TRACE_STORE_MODE_RING_BUFFER.
|
||||
*
|
||||
* With TRACE_RECORDER_STORE_MODE set to TRACE_STORE_MODE_RING_BUFFER, the
|
||||
* events are stored in a ring buffer, i.e., where the oldest events are
|
||||
* overwritten when the buffer becomes full. This allows you to get the last
|
||||
* events leading up to an interesting state, e.g., an error, without having
|
||||
* to store the whole run since startup.
|
||||
*
|
||||
* When TRACE_RECORDER_STORE_MODE is TRACE_STORE_MODE_STOP_WHEN_FULL, the
|
||||
* recording is stopped when the buffer becomes full. This is useful for
|
||||
* recording events following a specific state, e.g., the startup sequence.
|
||||
*****************************************************************************/
|
||||
#define TRACE_RECORDER_STORE_MODE TRACE_STORE_MODE_RING_BUFFER
|
||||
|
||||
/*******************************************************************************
|
||||
* CONFIGURATION RELATED TO CAPACITY AND ALLOCATION
|
||||
* TRACE_SCHEDULING_ONLY
|
||||
*
|
||||
* Macro which should be defined as an integer value.
|
||||
*
|
||||
* If this setting is enabled (= 1), only scheduling events are recorded.
|
||||
* If disabled (= 0), all events are recorded.
|
||||
*
|
||||
* Users of FreeRTOS+Trace Free Edition only displays scheduling events, so this
|
||||
* option can be used to avoid storing unsupported events.
|
||||
*
|
||||
* Default value is 0 (store all enabled events).
|
||||
*
|
||||
******************************************************************************/
|
||||
#define TRACE_SCHEDULING_ONLY 0
|
||||
|
||||
/*******************************************************************************
|
||||
* EVENT_BUFFER_SIZE
|
||||
|
@ -53,47 +138,158 @@
|
|||
* Macro which should be defined as an integer value.
|
||||
*
|
||||
* This defines the capacity of the event buffer, i.e., the number of records
|
||||
* it may store. Each registered event typically use one record (4 byte), but
|
||||
* vTracePrintF may use multiple records depending on the number of data args.
|
||||
* it may store. Most events use one record (4 byte), although some events
|
||||
* require multiple 4-byte records. You should adjust this to the amount of RAM
|
||||
* available in the target system.
|
||||
*
|
||||
* Default value is 1000, which means that 4000 bytes is allocated for the
|
||||
* event buffer.
|
||||
******************************************************************************/
|
||||
|
||||
#define EVENT_BUFFER_SIZE 10000 /* Adjust wrt. to available RAM */
|
||||
|
||||
#define EVENT_BUFFER_SIZE 15000
|
||||
|
||||
/*******************************************************************************
|
||||
* USE_LINKER_PRAGMA
|
||||
* NTask, NISR, NQueue, NSemaphore, NMutex
|
||||
*
|
||||
* Macro which should be defined as an integer value, default is 0.
|
||||
* A group of macros which should be defined as integer values, zero or larger.
|
||||
*
|
||||
* If this is 1, the header file "recorderdata_linker_pragma.h" is included just
|
||||
* before the declaration of RecorderData (in trcBase.c), i.e., the trace data
|
||||
* structure. This allows the user to specify a pragma with linker options.
|
||||
* These define the capacity of the Object Property Table, i.e., the maximum
|
||||
* number of objects active at any given point, within each object class (e.g.,
|
||||
* task, queue, semaphore, ...).
|
||||
*
|
||||
* Example (for IAR Embedded Workbench and NXP LPC17xx):
|
||||
* #pragma location="AHB_RAM_MEMORY"
|
||||
*
|
||||
* This example instructs the IAR linker to place RecorderData in another RAM
|
||||
* bank, the AHB RAM. This can also be used for other compilers with a similar
|
||||
* pragmas for linker options.
|
||||
*
|
||||
* Note that this only applies if using static allocation, see below.
|
||||
* If tasks or other other objects are deleted in your system, this
|
||||
* setting does not limit the total amount of objects created, only the number
|
||||
* of objects that have been successfully created but not yet deleted.
|
||||
*
|
||||
* Using too small values will cause vTraceError to be called, which stores an
|
||||
* error message in the trace that is shown when opening the trace file.
|
||||
*
|
||||
* It can be wise to start with large values for these constants,
|
||||
* unless you are very confident on these numbers. Then do a recording and
|
||||
* check the actual usage by selecting View menu -> Trace Details ->
|
||||
* Resource Usage -> Object Table.
|
||||
******************************************************************************/
|
||||
#define NTask 100
|
||||
#define NISR 60
|
||||
#define NQueue 60
|
||||
#define NSemaphore 60
|
||||
#define NMutex 60
|
||||
#define NTimer 200
|
||||
#define NEventGroup 60
|
||||
|
||||
#define USE_LINKER_PRAGMA 0
|
||||
/******************************************************************************
|
||||
* INCLUDE_MEMMANG_EVENTS
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* This controls if malloc and free calls should be traced. Set this to zero to
|
||||
* exclude malloc/free calls, or one (1) to include such events in the trace.
|
||||
*
|
||||
* Default value is 1.
|
||||
*****************************************************************************/
|
||||
#define INCLUDE_MEMMANG_EVENTS 1
|
||||
|
||||
/******************************************************************************
|
||||
* INCLUDE_USER_EVENTS
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If this is zero (0) the code for creating User Events is excluded to
|
||||
* reduce code size. User Events are application-generated events, like
|
||||
* "printf" but for the trace log instead of console output. User Events are
|
||||
* much faster than a printf and can therefore be used in timing critical code.
|
||||
* See vTraceUserEvent() and vTracePrintF() in trcUser.h
|
||||
*
|
||||
* Default value is 1.
|
||||
*
|
||||
* Note that User Events are only displayed in Professional Edition.
|
||||
*****************************************************************************/
|
||||
#define INCLUDE_USER_EVENTS 1
|
||||
|
||||
/*****************************************************************************
|
||||
* INCLUDE_ISR_TRACING
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If this is zero (0), the code for recording Interrupt Service Routines is
|
||||
* excluded to reduce code size.
|
||||
*
|
||||
* Default value is 1.
|
||||
*
|
||||
* Note, if the kernel has no central interrupt dispatcher, recording ISRs
|
||||
* require that you insert calls to vTraceStoreISRBegin and vTraceStoreISREnd
|
||||
* in your interrupt handlers.
|
||||
*****************************************************************************/
|
||||
#define INCLUDE_ISR_TRACING 1
|
||||
|
||||
/*****************************************************************************
|
||||
* INCLUDE_READY_EVENTS
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If one (1), events are recorded when tasks enter scheduling state "ready".
|
||||
* This uses a lot of space in the event buffer, so excluding "ready events"
|
||||
* will allow for longer traces. Including ready events however allows for
|
||||
* showing the initial pending time before tasks enter the execution state, and
|
||||
* for presenting accurate response times.
|
||||
*
|
||||
* Default value is 1.
|
||||
*****************************************************************************/
|
||||
#define INCLUDE_READY_EVENTS 1
|
||||
|
||||
/*****************************************************************************
|
||||
* INCLUDE_NEW_TIME_EVENTS
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If this is zero (1), events will be generated whenever the OS clock is
|
||||
* increased.
|
||||
*
|
||||
* Default value is 0.
|
||||
*****************************************************************************/
|
||||
#define INCLUDE_NEW_TIME_EVENTS 1
|
||||
|
||||
/******************************************************************************
|
||||
* INCLUDE_FLOAT_SUPPORT
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If this is zero (0), all references to floating point values are removed,
|
||||
* in case floating point values are not supported by the platform used.
|
||||
* Floating point values are only used in vTracePrintF and its subroutines, to
|
||||
* store float (%f) or double (%lf) arguments.
|
||||
*
|
||||
* vTracePrintF can be used with integer and string arguments in either case.
|
||||
*
|
||||
* Default value is 1.
|
||||
*****************************************************************************/
|
||||
#define INCLUDE_FLOAT_SUPPORT 0
|
||||
|
||||
/******************************************************************************
|
||||
* INCLUDE_OBJECT_DELETE
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* This must be enabled (1) if tasks, queues or other
|
||||
* traced kernel objects are deleted at runtime. If no deletes are made, this
|
||||
* can be set to 0 in order to exclude the delete-handling code.
|
||||
*
|
||||
* Default value is 1.
|
||||
*****************************************************************************/
|
||||
#define INCLUDE_OBJECT_DELETE 1
|
||||
|
||||
/*******************************************************************************
|
||||
* SYMBOL_TABLE_SIZE
|
||||
*
|
||||
* Macro which should be defined as an integer value.
|
||||
*
|
||||
* This defines the capacity of the symbol table, in bytes. This symbol table
|
||||
* This defines the capacity of the symbol table, in bytes. This symbol table
|
||||
* stores User Events labels and names of deleted tasks, queues, or other kernel
|
||||
* objects. Note that the names of active objects not stored here but in the
|
||||
* Object Table. Thus, if you don't use User Events or delete any kernel
|
||||
* objects you set this to a very low value, e.g. 4, but not zero (0) since
|
||||
* this causes a declaration of a zero-sized array, for which the C compiler
|
||||
* behavior is not standardized and may cause misaligned data.
|
||||
* objects. If you don't use User Events or delete any kernel
|
||||
* objects you set this to a very low value. The minimum recommended value is 4.
|
||||
* A size of zero (0) is not allowed since a zero-sized array may result in a
|
||||
* 32-bit pointer, i.e., using 4 bytes rather than 0.
|
||||
*
|
||||
* Default value is 800.
|
||||
******************************************************************************/
|
||||
#define SYMBOL_TABLE_SIZE 5000
|
||||
|
||||
|
@ -101,16 +297,153 @@
|
|||
#error "SYMBOL_TABLE_SIZE may not be zero!"
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
* NameLenTask, NameLenQueue, ...
|
||||
*
|
||||
* Macros that specify the maximum lengths (number of characters) for names of
|
||||
* kernel objects, such as tasks and queues. If longer names are used, they will
|
||||
* be truncated when stored in the recorder.
|
||||
*****************************************************************************/
|
||||
#define NameLenTask 15
|
||||
#define NameLenISR 15
|
||||
#define NameLenQueue 15
|
||||
#define NameLenSemaphore 15
|
||||
#define NameLenMutex 15
|
||||
#define NameLenTimer 15
|
||||
#define NameLenEventGroup 15
|
||||
|
||||
/******************************************************************************
|
||||
* TRACE_DATA_ALLOCATION
|
||||
*
|
||||
* This defines how to allocate the recorder data structure, i.e., using a
|
||||
* static declaration or using a dynamic allocation in runtime (malloc).
|
||||
*
|
||||
* Should be one of these two options:
|
||||
* - TRACE_DATA_ALLOCATION_STATIC (default)
|
||||
* - TRACE_DATA_ALLOCATION_DYNAMIC
|
||||
*
|
||||
* Using static allocation has the benefits of compile-time errors if the buffer
|
||||
* is too large (too large constants in trcConfig.h) and no need to call the
|
||||
* initialization routine (xTraceInitTraceData).
|
||||
*
|
||||
* Using dynamic allocation may give more flexibility in some cases.
|
||||
*****************************************************************************/
|
||||
#define TRACE_DATA_ALLOCATION TRACE_DATA_ALLOCATION_STATIC
|
||||
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*** ADVANCED SETTINGS ********************************************************
|
||||
******************************************************************************
|
||||
* The remaining settings are not necessary to modify but allows for optimizing
|
||||
* the recorder setup for your specific needs, e.g., to exclude events that you
|
||||
* are not interested in, in order to get longer traces.
|
||||
*****************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* HEAP_SIZE_BELOW_16M
|
||||
*
|
||||
* An integer constant that can be used to reduce the buffer usage of memory
|
||||
* allocation events (malloc/free). This value should be 1 if the heap size is
|
||||
* below 16 MB (2^24 byte), and you can live with reported addresses showing the
|
||||
* lower 24 bits only. If 0, you get the full 32-bit addresses.
|
||||
*
|
||||
* Default value is 0.
|
||||
******************************************************************************/
|
||||
#define HEAP_SIZE_BELOW_16M 0
|
||||
|
||||
/******************************************************************************
|
||||
* USE_LINKER_PRAGMA
|
||||
*
|
||||
* Macro which should be defined as an integer value, default is 0.
|
||||
*
|
||||
* If this is 1, the header file "recorderdata_linker_pragma.h" is included just
|
||||
* before the declaration of RecorderData (in trcBase.c), i.e., the trace data
|
||||
* structure. This allows the user to specify a pragma with linker options.
|
||||
*
|
||||
* Example (for IAR Embedded Workbench and NXP LPC17xx):
|
||||
* #pragma location="AHB_RAM_MEMORY"
|
||||
*
|
||||
* This example instructs the IAR linker to place RecorderData in another RAM
|
||||
* bank, the AHB RAM. This can also be used for other compilers with a similar
|
||||
* pragmas for linker options.
|
||||
*
|
||||
* Note that this only applies if using static allocation, see below.
|
||||
******************************************************************************/
|
||||
#define USE_LINKER_PRAGMA 0
|
||||
|
||||
/******************************************************************************
|
||||
* USE_IMPLICIT_IFE_RULES
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
* Default is 1.
|
||||
*
|
||||
* Tracealyzer groups the events into actor instances, based on context-switches
|
||||
* and a definition of "Instance Finish Events", or IFEs. These are kernel calls
|
||||
* considered to be the last event in a task instance. Some kernel calls are
|
||||
* considered IFEs by default (e.g., delay functions), but it is also possible
|
||||
* to specify this individually for each task (see vTraceTaskInstanceFinish).
|
||||
*
|
||||
* If USE_IMPLICIT_IFE_RULES is one (1), the default IFEs will be enabled, which
|
||||
* gives a "typical" grouping of events into instances. You can combine this
|
||||
* with calls to vTraceTaskInstanceFinish for specific tasks.
|
||||
*
|
||||
* If USE_IMPLICIT_IFE_RULES is zero (0), the implicit IFEs are disabled and all
|
||||
* events withing each task is then shown as a single instance, unless you call
|
||||
* vTraceTaskInstanceFinish() at suitable locations to mark the IFEs.
|
||||
*****************************************************************************/
|
||||
#define USE_IMPLICIT_IFE_RULES 1
|
||||
|
||||
/******************************************************************************
|
||||
* USE_16BIT_OBJECT_HANDLES
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If set to 0 (zero), the recorder uses 8-bit handles to identify kernel
|
||||
* objects such as tasks and queues. This limits the supported number of
|
||||
* concurrently active objects to 255 of each type (object class).
|
||||
*
|
||||
* If set to 1 (one), the recorder uses 16-bit handles to identify kernel
|
||||
* objects such as tasks and queues. This limits the supported number of
|
||||
* concurrent objects to 65535 of each type (object class). However, since the
|
||||
* object property table is limited to 64 KB, the practical limit is about
|
||||
* 3000 objects in total.
|
||||
*
|
||||
* Default is 0.
|
||||
*
|
||||
* NOTE: An object with handle above 255 will use an extra 4-byte record in
|
||||
* the event buffer whenever referenced. Moreover, some internal tables in the
|
||||
* recorder gets larger when using 16-bit handles. The additional RAM usage is
|
||||
* 5-10 byte plus 1 byte per kernel object i.e., task, queue, mutex, etc.
|
||||
*****************************************************************************/
|
||||
#define USE_16BIT_OBJECT_HANDLES 0
|
||||
|
||||
/******************************************************************************
|
||||
* USE_TRACE_ASSERT
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
* Default is 1.
|
||||
*
|
||||
* If this is one (1), the TRACE_ASSERT macro will verify that a condition is
|
||||
* true. If the condition is false, vTraceError() will be called.
|
||||
* This is used on several places in the recorder code for sanity checks on
|
||||
* parameters. Can be switched off to reduce CPU usage of the tracing.
|
||||
*****************************************************************************/
|
||||
#define USE_TRACE_ASSERT 1
|
||||
|
||||
/*******************************************************************************
|
||||
* USE_SEPARATE_USER_EVENT_BUFFER
|
||||
*
|
||||
* Macro which should be defined as an integer value.
|
||||
* Default is zero (0).
|
||||
*
|
||||
* This enables and disables the use of the separate user event buffer.
|
||||
* This enables and disables the use of the separate user event buffer. Using
|
||||
* this separate buffer has the benefit of not overwriting the user events with
|
||||
* kernel events (usually generated at a much higher rate), i.e., when using
|
||||
* ring-buffer mode.
|
||||
*
|
||||
* Note: When using the separate user event buffer, you may get an artificial
|
||||
* task instance named "Unknown actor". This is added as a placeholder when the
|
||||
* task instance named "Unknown actor". This is added as a placeholder when the
|
||||
* user event history is longer than the task scheduling history.
|
||||
******************************************************************************/
|
||||
#define USE_SEPARATE_USER_EVENT_BUFFER 0
|
||||
|
@ -125,7 +458,7 @@
|
|||
*
|
||||
* Only in use if USE_SEPARATE_USER_EVENT_BUFFER is set to 1.
|
||||
******************************************************************************/
|
||||
#define USER_EVENT_BUFFER_SIZE 500
|
||||
#define USER_EVENT_BUFFER_SIZE 10
|
||||
|
||||
/*******************************************************************************
|
||||
* USER_EVENT_CHANNELS
|
||||
|
@ -138,393 +471,5 @@
|
|||
******************************************************************************/
|
||||
#define CHANNEL_FORMAT_PAIRS 32
|
||||
|
||||
/*******************************************************************************
|
||||
* NTask, NISR, NQueue, NSemaphore, NMutex
|
||||
*
|
||||
* A group of Macros which should be defined as an integer value of zero (0)
|
||||
* or larger.
|
||||
*
|
||||
* This defines the capacity of the Object Property Table - the maximum number
|
||||
* of objects active at any given point within each object class.
|
||||
*
|
||||
* NOTE: In case objects are deleted and created during runtime, this setting
|
||||
* does not limit the total amount of objects, only the number of concurrently
|
||||
* active objects.
|
||||
*
|
||||
* Using too small values will give an error message through the vTraceError
|
||||
* routine, which makes the error message appear when opening the trace data
|
||||
* in Tracealyzer. If you are using the recorder status monitor task,
|
||||
* any error messages are displayed in console prints, assuming that the
|
||||
* print macro has been defined properly (vConsolePrintMessage).
|
||||
*
|
||||
* It can be wise to start with very large values for these constants,
|
||||
* unless you are very confident on these numbers. Then do a recording and
|
||||
* check the actual usage in Tracealyzer. This is shown by selecting
|
||||
* View -> Trace Details -> Resource Usage -> Object Table
|
||||
*
|
||||
* NOTE 2: Remember to account for all tasks and other objects created by
|
||||
* the kernel, such as the IDLE task, any timer tasks, and any tasks created
|
||||
* by other 3rd party software components, such as communication stacks.
|
||||
* Moreover, one task slot is used to indicate "(startup)", i.e., a fictive
|
||||
* task that represent the time before the scheduler starts.
|
||||
* NTask should thus be at least 2-3 slots larger than your application task count.
|
||||
*
|
||||
******************************************************************************/
|
||||
#define NTask 100
|
||||
#define NISR 20
|
||||
#define NQueue 60
|
||||
#define NSemaphore 60
|
||||
#define NMutex 60
|
||||
#define NTimer 200
|
||||
#define NEventGroup 60
|
||||
|
||||
/* Maximum object name length for each class (includes zero termination) */
|
||||
#define NameLenTask 15
|
||||
#define NameLenISR 15
|
||||
#define NameLenQueue 15
|
||||
#define NameLenSemaphore 15
|
||||
#define NameLenMutex 15
|
||||
#define NameLenTimer 15
|
||||
#define NameLenEventGroup 15
|
||||
|
||||
/******************************************************************************
|
||||
* TRACE_DESCRIPTION
|
||||
*
|
||||
* Macro which should be defined as a string.
|
||||
*
|
||||
* This string is stored in the trace and displayed in Tracealyzer. Can be
|
||||
* used to store, e.g., system version or build date. This is also used to store
|
||||
* internal error messages from the recorder, which if occurs overwrites the
|
||||
* value defined here. This may be maximum 256 chars.
|
||||
*****************************************************************************/
|
||||
#define TRACE_DESCRIPTION "Tracealyzer Recorder Test Program"
|
||||
|
||||
/******************************************************************************
|
||||
* TRACE_DESCRIPTION_MAX_LENGTH
|
||||
*
|
||||
* The maximum length (including zero termination) for the TRACE_DESCRIPTION
|
||||
* string. Since this string also is used for internal error messages from the
|
||||
* recorder do not make it too short, as this may truncate the error messages.
|
||||
* Default is 80.
|
||||
* Maximum allowed length is 256 - the trace will fail to load if longer.
|
||||
*****************************************************************************/
|
||||
#define TRACE_DESCRIPTION_MAX_LENGTH 80
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* TRACE_DATA_ALLOCATION
|
||||
*
|
||||
* This defines how to allocate the recorder data structure, i.e., using a
|
||||
* static declaration or using a dynamic allocation in runtime (malloc).
|
||||
*
|
||||
* Should be one of these two options:
|
||||
* - TRACE_DATA_ALLOCATION_STATIC (default)
|
||||
* - TRACE_DATA_ALLOCATION_DYNAMIC
|
||||
*
|
||||
* Using static allocation has the benefits of compile-time errors if the buffer
|
||||
* is too large (too large constants in trcConfig.h) and no need to call the
|
||||
* initialization routine (xTraceInitTraceData).
|
||||
*
|
||||
* Using dynamic allocation may give more flexibility in some cases.
|
||||
*****************************************************************************/
|
||||
|
||||
#define TRACE_DATA_ALLOCATION TRACE_DATA_ALLOCATION_STATIC
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* CONFIGURATION REGARDING WHAT CODE/FEATURES TO INCLUDE
|
||||
*****************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* USE_TRACE_ASSERT
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
* Default is 0.
|
||||
*
|
||||
* If this is one (1), the TRACE_ASSERT macro will verify that a condition is
|
||||
* true. If the condition is false, vTraceError() will be called.
|
||||
*****************************************************************************/
|
||||
#define USE_TRACE_ASSERT 1
|
||||
|
||||
/******************************************************************************
|
||||
* INCLUDE_FLOAT_SUPPORT
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
* Default is 1.
|
||||
*
|
||||
* If this is zero (0), all references to floating point values are removed,
|
||||
* in case floating point values are not supported by the platform used.
|
||||
* Floating point values are only used in vTracePrintF and its subroutines, to
|
||||
* store float (%f) or double (%lf) argments.
|
||||
*
|
||||
* Note: vTracePrintF can still be used with integer and string arguments in
|
||||
* either case.
|
||||
*****************************************************************************/
|
||||
#define INCLUDE_FLOAT_SUPPORT 0
|
||||
|
||||
/******************************************************************************
|
||||
* INCLUDE_USER_EVENTS
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
* Default is 1.
|
||||
*
|
||||
* If this is zero (0) the code for creating User Events is excluded to
|
||||
* reduce code size. User Events are application-generated events, like
|
||||
* "printf" but for the trace log instead of console output. User Events are
|
||||
* much faster than a printf and can therefore be used in timing critical code.
|
||||
* See vTraceUserEvent() and vTracePrintF() in trcUser.h
|
||||
*
|
||||
* Note that User Events are not displayed in FreeRTOS+Trace Free Edition.
|
||||
*****************************************************************************/
|
||||
#define INCLUDE_USER_EVENTS 1
|
||||
|
||||
/*****************************************************************************
|
||||
* INCLUDE_READY_EVENTS
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
* Default is 1.
|
||||
*
|
||||
* If this is zero (0), the code for recording Ready events is
|
||||
* excluded. Note, this will make it impossible to calculate the correct
|
||||
* response times.
|
||||
*****************************************************************************/
|
||||
#define INCLUDE_READY_EVENTS 1
|
||||
|
||||
/*****************************************************************************
|
||||
* INCLUDE_NEW_TIME_EVENTS
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
* Default is 0.
|
||||
*
|
||||
* If this is zero (1), events will be generated whenever the os clock is
|
||||
* increased.
|
||||
*****************************************************************************/
|
||||
#define INCLUDE_NEW_TIME_EVENTS 0
|
||||
|
||||
/*****************************************************************************
|
||||
* INCLUDE_ISR_TRACING
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
* Default is 1.
|
||||
*
|
||||
* If this is zero (0), the code for recording Interrupt Service Routines is
|
||||
* excluded to reduce code size.
|
||||
*
|
||||
* Note, if the kernel has no central interrupt dispatcher, recording ISRs
|
||||
* require that you insert calls to vTraceStoreISRBegin and vTraceStoreISREnd
|
||||
* in your interrupt handlers.
|
||||
*****************************************************************************/
|
||||
#define INCLUDE_ISR_TRACING 1
|
||||
|
||||
/******************************************************************************
|
||||
* INCLUDE_OBJECT_DELETE
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
* Default is 1.
|
||||
*
|
||||
* This must be enabled (1) if tasks, queues or other
|
||||
* traced kernel objects are deleted at runtime. If no deletes are made, this
|
||||
* can be set to 0 in order to exclude the delete-handling code.
|
||||
*****************************************************************************/
|
||||
#define INCLUDE_OBJECT_DELETE 1
|
||||
|
||||
/******************************************************************************
|
||||
* INCLUDE_MEMMANG_EVENTS
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
* Default is 1.
|
||||
*
|
||||
* This controls if malloc and free calls should be traced. Set this to zero to
|
||||
* exclude malloc/free calls from the tracing.
|
||||
*****************************************************************************/
|
||||
#define INCLUDE_MEMMANG_EVENTS 1
|
||||
|
||||
/******************************************************************************
|
||||
* CONFIGURATION RELATED TO BEHAVIOR
|
||||
*****************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* TRACE_RECORDER_STORE_MODE
|
||||
*
|
||||
* Macro which should be defined as one of:
|
||||
* - TRACE_STORE_MODE_RING_BUFFER
|
||||
* - TRACE_STORE_MODE_STOP_WHEN_FULL
|
||||
* Default is TRACE_STORE_MODE_RING_BUFFER.
|
||||
*
|
||||
* With TRACE_RECORDER_STORE_MODE set to TRACE_STORE_MODE_RING_BUFFER, the events are
|
||||
* stored in a ring buffer, i.e., where the oldest events are overwritten when
|
||||
* the buffer becomes full. This allows you to get the last events leading up
|
||||
* to an interesting state, e.g., an error, without having a large trace buffer
|
||||
* for string the whole run since startup. In this mode, the recorder can run
|
||||
* "forever" as the buffer never gets full, i.e., in the sense that it always
|
||||
* has room for more events.
|
||||
*
|
||||
* To fetch the trace in mode TRACE_STORE_MODE_RING_BUFFER, you need to first halt the
|
||||
* system using your debugger and then do a RAM dump, or to explicitly stop the
|
||||
* recorder using vTraceStop() and then store/upload the trace data using a
|
||||
* task that you need to provide yourself. The trace data is found in the struct
|
||||
* RecorderData, initialized in trcBase.c.
|
||||
*
|
||||
* Note that, if you upload the trace using a RAM dump, i.e., when the system is
|
||||
* halted on a breakpoint or by a debugger command, there is no need to stop the
|
||||
* recorder first.
|
||||
*
|
||||
* When TRACE_RECORDER_STORE_MODE is TRACE_STORE_MODE_STOP_WHEN_FULL, the recording is
|
||||
* stopped when the buffer becomes full. When the recorder stops itself this way
|
||||
* vTracePortEnd() is called which allows for custom actions, such as triggering
|
||||
* a task that stores the trace buffer, i.e., in case taking a RAM dump
|
||||
* using an on-chip debugger is not possible. In the Windows port, vTracePortEnd
|
||||
* saves the trace to file directly, but this is not recommended in a real-time
|
||||
* system since the scheduler is blocked during the processing of vTracePortEnd.
|
||||
*****************************************************************************/
|
||||
|
||||
#define TRACE_RECORDER_STORE_MODE TRACE_STORE_MODE_RING_BUFFER
|
||||
|
||||
/******************************************************************************
|
||||
* STOP_AFTER_N_EVENTS
|
||||
*
|
||||
* Macro which should be defined as an integer value, or not defined.
|
||||
* Default is -1
|
||||
*
|
||||
* STOP_AFTER_N_EVENTS is intended for tests of the ring buffer mode (when
|
||||
* RECORDER_STORE_MODE is STORE_MODE_RING_BUFFER). It stops the recording when
|
||||
* the specified number of events has been observed. This value can be larger
|
||||
* than the buffer size, to allow for test of the "wrapping around" that occurs
|
||||
* in ring buffer mode . A negative value (or no definition of this macro)
|
||||
* disables this feature.
|
||||
*****************************************************************************/
|
||||
#define STOP_AFTER_N_EVENTS -1
|
||||
|
||||
/******************************************************************************
|
||||
* USE_IMPLICIT_IFE_RULES
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
* Default is 1.
|
||||
*
|
||||
* ### Instance Finish Events (IFE) ###
|
||||
*
|
||||
* For tasks with "infinite" main loops (non-terminating tasks), the concept
|
||||
* of a task instance has no clear definition, it is an application-specific
|
||||
* thing. Tracealyzer allows you to define Instance Finish Events (IFEs),
|
||||
* which marks the point in a cyclic task when the "task instance" ends.
|
||||
* The IFE is a blocking kernel call, typically in the main loop of a task
|
||||
* which typically reads a message queue, waits for a semaphore or performs
|
||||
* an explicit delay.
|
||||
*
|
||||
* If USE_IMPLICIT_IFE_RULES is one (1), the kernel macros (trcKernelPort.h)
|
||||
* will define what kernel calls are considered by default to be IFEs.
|
||||
*
|
||||
* However, Implicit IFEs only applies to blocking kernel calls. If a
|
||||
* service reads a message without blocking, it does not create a new
|
||||
* instance since no blocking occurred.
|
||||
*
|
||||
* Moreover, the actual IFE might sometimes be another blocking call. We
|
||||
* therefore allow for user-defined Explicit IFEs by calling
|
||||
*
|
||||
* vTraceTaskInstanceIsFinished()
|
||||
*
|
||||
* right before the kernel call considered as IFE. This does not create an
|
||||
* additional event but instead stores the service code and object handle
|
||||
* of the IFE call as properties of the task.
|
||||
*
|
||||
* If using Explicit IFEs and the task also calls an Implicit IFE, this may
|
||||
* result in additional incorrect task instances.
|
||||
* This is solved by disabling the Implicit IFEs for the task, by adding
|
||||
* a call to
|
||||
*
|
||||
* vTraceTaskSkipDefaultInstanceFinishedEvents()
|
||||
*
|
||||
* in the very beginning of that task. This allows you to combine Explicit IFEs
|
||||
* for some tasks with Implicit IFEs for the rest of the tasks, if
|
||||
* USE_IMPLICIT_IFE_RULES is 1.
|
||||
*
|
||||
* By setting USE_IMPLICIT_IFE_RULES to zero (0), the implicit IFEs are disabled
|
||||
* for all tasks. Tasks will then be considered to have a single instance only,
|
||||
* covering all execution fragments, unless you define an explicit IFE in each
|
||||
* task by calling vTraceTaskInstanceIsFinished before the blocking call.
|
||||
*****************************************************************************/
|
||||
#define USE_IMPLICIT_IFE_RULES 1
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* USE_16BIT_OBJECT_HANDLES
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
* Default is 0.
|
||||
*
|
||||
* If set to 0 (zero), the recorder uses 8-bit handles to identify kernel
|
||||
* objects such as tasks and queues. This limits the supported number of
|
||||
* concurrently active objects to 255 of each type (object class).
|
||||
*
|
||||
* If set to 1 (one), the recorder uses 16-bit handles to identify kernel
|
||||
* objects such as tasks and queues. This limits the supported number of
|
||||
* concurrent objects to 65535 of each type (object class). However, since the
|
||||
* object property table is limited to 64 KB, the practical limit is about
|
||||
* 3000 objects in total.
|
||||
*
|
||||
* NOTE: An object with a high ID (> 255) will generate an extra event
|
||||
* (= 4 byte) in the event buffer.
|
||||
*
|
||||
* NOTE: Some internal tables in the recorder gets larger when using 16-bit
|
||||
* handles. The additional RAM usage is 5-10 byte plus 1 byte per kernel object
|
||||
*, i.e., task, queue, semaphore, mutex, etc.
|
||||
*****************************************************************************/
|
||||
#define USE_16BIT_OBJECT_HANDLES 0
|
||||
|
||||
/****** Port Name ******************** Code ** Official ** OS Platform ******
|
||||
* PORT_APPLICATION_DEFINED -2 - -
|
||||
* PORT_NOT_SET -1 - -
|
||||
* PORT_HWIndependent 0 Yes Any
|
||||
* PORT_Win32 1 Yes FreeRTOS Win32
|
||||
* PORT_Atmel_AT91SAM7 2 No Any
|
||||
* PORT_Atmel_UC3A0 3 No Any
|
||||
* PORT_ARM_CortexM 4 Yes Any
|
||||
* PORT_Renesas_RX600 5 Yes Any
|
||||
* PORT_Microchip_dsPIC_AND_PIC24 6 Yes Any
|
||||
* PORT_TEXAS_INSTRUMENTS_TMS570 7 No Any
|
||||
* PORT_TEXAS_INSTRUMENTS_MSP430 8 No Any
|
||||
* PORT_MICROCHIP_PIC32 9 No Any
|
||||
* PORT_XILINX_PPC405 10 No FreeRTOS
|
||||
* PORT_XILINX_PPC440 11 No FreeRTOS
|
||||
* PORT_XILINX_MICROBLAZE 12 No Any
|
||||
* PORT_NXP_LPC210X 13 No Any
|
||||
*****************************************************************************/
|
||||
#define SELECTED_PORT PORT_Win32
|
||||
|
||||
#if (SELECTED_PORT == PORT_NOT_SET)
|
||||
#error "You need to define SELECTED_PORT here!"
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
* USE_PRIMASK_CS (for Cortex M devices only)
|
||||
*
|
||||
* An integer constant that selects between two options for the critical
|
||||
* sections of the recorder library.
|
||||
*
|
||||
* 0: The default FreeRTOS critical section (BASEPRI) - default setting
|
||||
* 1: Always disable ALL interrupts (using PRIMASK)
|
||||
*
|
||||
* Option 0 uses the standard FreeRTOS macros for critical sections.
|
||||
* However, on Cortex-M devices they only disable interrupts with priorities
|
||||
* below a certain configurable level, while higher priority ISRs remain active.
|
||||
* Such high-priority ISRs may not use the recorder functions in this mode.
|
||||
*
|
||||
* Option 1 allows you to safely call the recorder from any ISR, independent of
|
||||
* the interrupt priority. This mode may however cause higher IRQ latencies
|
||||
* (some microseconds) since ALL configurable interrupts are disabled during
|
||||
* the recorder's critical sections in this mode, using the PRIMASK register.
|
||||
******************************************************************************/
|
||||
#define USE_PRIMASK_CS 0
|
||||
|
||||
/******************************************************************************
|
||||
* HEAP_SIZE_BELOW_16M
|
||||
*
|
||||
* An integer constant that can be used to reduce the buffer usage of memory
|
||||
* allocation events (malloc/free). This value should be 1 if the heap size is
|
||||
* below 16 MB (2^24 byte), and you can live with addresses truncated to the
|
||||
* lower 24 bit. Otherwise set it to 0 to get the full 32-bit addresses.
|
||||
******************************************************************************/
|
||||
#define HEAP_SIZE_BELOW_16M 0
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -149,6 +149,7 @@
|
|||
<ClCompile Include="..\Common\Minimal\QueueOverwrite.c" />
|
||||
<ClCompile Include="..\Common\Minimal\QueueSet.c" />
|
||||
<ClCompile Include="..\Common\Minimal\semtest.c" />
|
||||
<ClCompile Include="..\Common\Minimal\TaskNotify.c" />
|
||||
<ClCompile Include="..\Common\Minimal\timerdemo.c" />
|
||||
<ClCompile Include="DemosModifiedForLowTickRate\recmutex.c" />
|
||||
<ClCompile Include="main.c">
|
||||
|
|
|
@ -139,6 +139,9 @@
|
|||
<ClCompile Include="..\Common\Minimal\IntSemTest.c">
|
||||
<Filter>Demo App Source\Common Demo Tasks</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Common\Minimal\TaskNotify.c">
|
||||
<Filter>Demo App Source\Common Demo Tasks</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="FreeRTOSConfig.h">
|
||||
|
|
|
@ -113,8 +113,8 @@ 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. */
|
||||
#define mainREGION_1_SIZE 3001
|
||||
#define mainREGION_2_SIZE 18005
|
||||
#define mainREGION_3_SIZE 1007
|
||||
#define mainREGION_2_SIZE 18105
|
||||
#define mainREGION_3_SIZE 1407
|
||||
|
||||
/*
|
||||
* main_blinky() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1.
|
||||
|
@ -228,10 +228,10 @@ void vApplicationIdleHook( void )
|
|||
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. */
|
||||
|
||||
/* Uncomment the following code to allow the trace to be stopped with any
|
||||
/* 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
|
||||
interferes with the run time behaviour. */
|
||||
/*
|
||||
/*
|
||||
if( _kbhit() != pdFALSE )
|
||||
{
|
||||
if( xTraceRunning == pdTRUE )
|
||||
|
@ -369,4 +369,5 @@ const HeapRegion_t xHeapRegions[] =
|
|||
|
||||
vPortDefineHeapRegions( xHeapRegions );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@
|
|||
|
||||
/* The rate at which data is sent to the queue. The 200ms value is converted
|
||||
to ticks using the portTICK_PERIOD_MS constant. */
|
||||
#define mainQUEUE_SEND_FREQUENCY_MS ( 200 )
|
||||
#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_PERIOD_MS )
|
||||
|
||||
/* The number of items the queue can hold. This is 1 as the receive task
|
||||
will remove items as they are added, meaning the send task should always find
|
||||
|
|
|
@ -112,10 +112,10 @@
|
|||
|
||||
/* Kernel includes. */
|
||||
#include <FreeRTOS.h>
|
||||
#include "task.h"
|
||||
#include "queue.h"
|
||||
#include "timers.h"
|
||||
#include "semphr.h"
|
||||
#include <task.h>
|
||||
#include <queue.h>
|
||||
#include <timers.h>
|
||||
#include <semphr.h>
|
||||
|
||||
/* Standard demo includes. */
|
||||
#include "BlockQ.h"
|
||||
|
@ -134,6 +134,7 @@
|
|||
#include "QueueOverwrite.h"
|
||||
#include "EventGroupsDemo.h"
|
||||
#include "IntSemTest.h"
|
||||
#include "TaskNotify.h"
|
||||
|
||||
/* Priorities at which the tasks are created. */
|
||||
#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 2 )
|
||||
|
@ -196,6 +197,7 @@ int main_full( void )
|
|||
xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
||||
|
||||
/* Create the standard demo tasks. */
|
||||
vStartTaskNotifyTask();
|
||||
vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
|
||||
vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
|
||||
vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
|
||||
|
@ -265,6 +267,11 @@ const TickType_t xCycleFrequency = 2500 / portTICK_PERIOD_MS;
|
|||
}
|
||||
#endif
|
||||
|
||||
if( xAreTaskNotificationTasksStillRunning() != pdTRUE )
|
||||
{
|
||||
pcStatusMessage = "Error: Notification";
|
||||
}
|
||||
|
||||
if( xAreInterruptSemaphoreTasksStillRunning() != pdTRUE )
|
||||
{
|
||||
pcStatusMessage = "Error: IntSem";
|
||||
|
@ -379,7 +386,7 @@ void *pvAllocated;
|
|||
xMutexToDelete = NULL;
|
||||
}
|
||||
|
||||
/* Exercise heap_4 a bit. The malloc failed hook will trap failed
|
||||
/* 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 );
|
||||
vPortFree( pvAllocated );
|
||||
|
@ -410,6 +417,9 @@ void vFullDemoTickHookFunction( void )
|
|||
|
||||
/* Exercise giving mutexes from an interrupt. */
|
||||
vInterruptSemaphorePeriodicTest();
|
||||
|
||||
/* Exercise using task notifications from an interrupt. */
|
||||
xNotifyTaskFromISR();
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
</matcher>
|
||||
</filter>
|
||||
<filter>
|
||||
<id>0</id>
|
||||
<id>1418321193247</id>
|
||||
<name>Standard_Demo_Tasks</name>
|
||||
<type>5</type>
|
||||
<matcher>
|
||||
|
@ -65,7 +65,7 @@
|
|||
</matcher>
|
||||
</filter>
|
||||
<filter>
|
||||
<id>0</id>
|
||||
<id>1418321193247</id>
|
||||
<name>Standard_Demo_Tasks</name>
|
||||
<type>5</type>
|
||||
<matcher>
|
||||
|
@ -74,7 +74,7 @@
|
|||
</matcher>
|
||||
</filter>
|
||||
<filter>
|
||||
<id>0</id>
|
||||
<id>1418321193257</id>
|
||||
<name>Standard_Demo_Tasks</name>
|
||||
<type>5</type>
|
||||
<matcher>
|
||||
|
@ -83,7 +83,7 @@
|
|||
</matcher>
|
||||
</filter>
|
||||
<filter>
|
||||
<id>0</id>
|
||||
<id>1418321193257</id>
|
||||
<name>Standard_Demo_Tasks</name>
|
||||
<type>5</type>
|
||||
<matcher>
|
||||
|
@ -92,7 +92,7 @@
|
|||
</matcher>
|
||||
</filter>
|
||||
<filter>
|
||||
<id>0</id>
|
||||
<id>1418321193267</id>
|
||||
<name>Standard_Demo_Tasks</name>
|
||||
<type>5</type>
|
||||
<matcher>
|
||||
|
@ -101,7 +101,7 @@
|
|||
</matcher>
|
||||
</filter>
|
||||
<filter>
|
||||
<id>0</id>
|
||||
<id>1418321193277</id>
|
||||
<name>Standard_Demo_Tasks</name>
|
||||
<type>5</type>
|
||||
<matcher>
|
||||
|
@ -110,7 +110,7 @@
|
|||
</matcher>
|
||||
</filter>
|
||||
<filter>
|
||||
<id>0</id>
|
||||
<id>1418321193277</id>
|
||||
<name>Standard_Demo_Tasks</name>
|
||||
<type>5</type>
|
||||
<matcher>
|
||||
|
@ -119,7 +119,7 @@
|
|||
</matcher>
|
||||
</filter>
|
||||
<filter>
|
||||
<id>0</id>
|
||||
<id>1418321193287</id>
|
||||
<name>Standard_Demo_Tasks</name>
|
||||
<type>5</type>
|
||||
<matcher>
|
||||
|
@ -128,7 +128,7 @@
|
|||
</matcher>
|
||||
</filter>
|
||||
<filter>
|
||||
<id>0</id>
|
||||
<id>1418321193297</id>
|
||||
<name>Standard_Demo_Tasks</name>
|
||||
<type>5</type>
|
||||
<matcher>
|
||||
|
@ -137,7 +137,7 @@
|
|||
</matcher>
|
||||
</filter>
|
||||
<filter>
|
||||
<id>0</id>
|
||||
<id>1418321193297</id>
|
||||
<name>Standard_Demo_Tasks</name>
|
||||
<type>5</type>
|
||||
<matcher>
|
||||
|
@ -146,7 +146,7 @@
|
|||
</matcher>
|
||||
</filter>
|
||||
<filter>
|
||||
<id>0</id>
|
||||
<id>1418321193308</id>
|
||||
<name>Standard_Demo_Tasks</name>
|
||||
<type>5</type>
|
||||
<matcher>
|
||||
|
@ -155,7 +155,7 @@
|
|||
</matcher>
|
||||
</filter>
|
||||
<filter>
|
||||
<id>0</id>
|
||||
<id>1418321193313</id>
|
||||
<name>Standard_Demo_Tasks</name>
|
||||
<type>5</type>
|
||||
<matcher>
|
||||
|
@ -164,7 +164,7 @@
|
|||
</matcher>
|
||||
</filter>
|
||||
<filter>
|
||||
<id>0</id>
|
||||
<id>1418321193319</id>
|
||||
<name>Standard_Demo_Tasks</name>
|
||||
<type>5</type>
|
||||
<matcher>
|
||||
|
@ -173,7 +173,7 @@
|
|||
</matcher>
|
||||
</filter>
|
||||
<filter>
|
||||
<id>0</id>
|
||||
<id>1418321193325</id>
|
||||
<name>Standard_Demo_Tasks</name>
|
||||
<type>5</type>
|
||||
<matcher>
|
||||
|
@ -182,7 +182,7 @@
|
|||
</matcher>
|
||||
</filter>
|
||||
<filter>
|
||||
<id>0</id>
|
||||
<id>1418321193349</id>
|
||||
<name>Standard_Demo_Tasks</name>
|
||||
<type>5</type>
|
||||
<matcher>
|
||||
|
@ -190,6 +190,24 @@
|
|||
<arguments>1.0-name-matches-false-false-timerdemo.c</arguments>
|
||||
</matcher>
|
||||
</filter>
|
||||
<filter>
|
||||
<id>1418321193369</id>
|
||||
<name>Standard_Demo_Tasks</name>
|
||||
<type>5</type>
|
||||
<matcher>
|
||||
<id>org.eclipse.ui.ide.multiFilter</id>
|
||||
<arguments>1.0-name-matches-false-false-IntSemTest.c</arguments>
|
||||
</matcher>
|
||||
</filter>
|
||||
<filter>
|
||||
<id>1418321193379</id>
|
||||
<name>Standard_Demo_Tasks</name>
|
||||
<type>5</type>
|
||||
<matcher>
|
||||
<id>org.eclipse.ui.ide.multiFilter</id>
|
||||
<arguments>1.0-name-matches-false-false-TaskNotify.c</arguments>
|
||||
</matcher>
|
||||
</filter>
|
||||
<filter>
|
||||
<id>0</id>
|
||||
<name>FreeRTOS_Source/portable</name>
|
||||
|
@ -209,12 +227,12 @@
|
|||
</matcher>
|
||||
</filter>
|
||||
<filter>
|
||||
<id>0</id>
|
||||
<id>1418321226214</id>
|
||||
<name>FreeRTOS_Source/portable/MemMang</name>
|
||||
<type>5</type>
|
||||
<matcher>
|
||||
<id>org.eclipse.ui.ide.multiFilter</id>
|
||||
<arguments>1.0-name-matches-false-false-heap_4.c</arguments>
|
||||
<arguments>1.0-name-matches-false-false-heap_5.c</arguments>
|
||||
</matcher>
|
||||
</filter>
|
||||
</filteredResources>
|
||||
|
|
|
@ -83,7 +83,7 @@
|
|||
#define configUSE_TICK_HOOK 1
|
||||
#define configTICK_RATE_HZ ( 1000 ) /* In this non-real time simulated environment the tick frequency has to be at least a multiple of the Win32 tick frequency, and therefore very slow. */
|
||||
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 50 ) /* In this simulated case, the stack only has to hold one small structure as the real stack is part of the win32 thread. */
|
||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 20 * 1024 ) )
|
||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 23 * 1024 ) )
|
||||
#define configMAX_TASK_NAME_LEN ( 12 )
|
||||
#define configUSE_TRACE_FACILITY 1
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
|
@ -97,6 +97,7 @@
|
|||
#define configUSE_COUNTING_SEMAPHORES 1
|
||||
#define configUSE_ALTERNATIVE_API 1
|
||||
#define configUSE_QUEUE_SETS 1
|
||||
#define configUSE_TASK_NOTIFICATIONS 1
|
||||
|
||||
/* Software timer related configuration options. */
|
||||
#define configUSE_TIMERS 1
|
||||
|
@ -104,18 +105,18 @@
|
|||
#define configTIMER_QUEUE_LENGTH 20
|
||||
#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE * 2 )
|
||||
|
||||
#define configMAX_PRIORITIES ( 8 )
|
||||
#define configMAX_PRIORITIES ( 7 )
|
||||
|
||||
/* Run time stats gathering configuration options. */
|
||||
unsigned long ulGetRunTimeCounterValue( void ); /* Prototype of function that returns run time counter. */
|
||||
void vConfigureTimerForRunTimeStats( void ); /* Prototype of function that initialises the run time counter. */
|
||||
#define configGENERATE_RUN_TIME_STATS 1
|
||||
#define configGENERATE_RUN_TIME_STATS 1
|
||||
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() vConfigureTimerForRunTimeStats()
|
||||
#define portGET_RUN_TIME_COUNTER_VALUE() ulGetRunTimeCounterValue()
|
||||
|
||||
/* Co-routine related configuration options. */
|
||||
#define configUSE_CO_ROUTINES 1
|
||||
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
|
||||
#define configUSE_CO_ROUTINES 1
|
||||
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
|
||||
|
||||
/* This demo makes use of one or more example stats formatting functions. These
|
||||
format the raw data provided by the uxTaskGetSystemState() function in to human
|
||||
|
@ -147,7 +148,9 @@ uses the same semantics as the standard C assert() macro. */
|
|||
extern void vAssertCalled( unsigned long ulLine, const char * const pcFileName );
|
||||
#define configASSERT( x ) if( ( x ) == 0 ) vAssertCalled( __LINE__, __FILE__ )
|
||||
|
||||
|
||||
/* Include the FreeRTOS+Trace FreeRTOS trace macro definitions. */
|
||||
#define TRACE_ENTER_CRITICAL_SECTION() portENTER_CRITICAL()
|
||||
#define TRACE_EXIT_CRITICAL_SECTION() portEXIT_CRITICAL()
|
||||
#include "trcKernelPort.h"
|
||||
|
||||
#endif /* FREERTOS_CONFIG_H */
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/*******************************************************************************
|
||||
* Tracealyzer v2.6.0 Recorder Library
|
||||
* Tracealyzer v2.7.0 Recorder Library
|
||||
* Percepio AB, www.percepio.com
|
||||
*
|
||||
* trcConfig.h
|
||||
*
|
||||
* Configuration parameters for the trace recorder library. Before using the
|
||||
* trace recorder library, please check that the default settings are
|
||||
* appropriate for your system, and if necessary adjust these. Most likely, you
|
||||
* will need to adjust the NTask, NISR, NQueue, NMutex and NSemaphore values to
|
||||
* reflect the number of such objects in your system. These may be
|
||||
* Configuration parameters for the trace recorder library. Before using the
|
||||
* trace recorder library, please check that the default settings are
|
||||
* appropriate for your system, and if necessary adjust these. Most likely, you
|
||||
* will need to adjust the NTask, NISR, NQueue, NMutex and NSemaphore values to
|
||||
* reflect the number of such objects in your system. These may be
|
||||
* over-approximated, although larger values values implies more RAM usage.
|
||||
*
|
||||
* Terms of Use
|
||||
|
@ -16,36 +16,121 @@
|
|||
* use together with Percepio products. You may distribute the recorder library
|
||||
* in its original form, including modifications in trcHardwarePort.c/.h
|
||||
* given that these modification are clearly marked as your own modifications
|
||||
* and documented in the initial comment section of these source files.
|
||||
* This software is the intellectual property of Percepio AB and may not be
|
||||
* sold or in other ways commercially redistributed without explicit written
|
||||
* and documented in the initial comment section of these source files.
|
||||
* This software is the intellectual property of Percepio AB and may not be
|
||||
* sold or in other ways commercially redistributed without explicit written
|
||||
* permission by Percepio AB.
|
||||
*
|
||||
* Disclaimer
|
||||
* The trace tool and recorder library is being delivered to you AS IS and
|
||||
* Percepio AB makes no warranty as to its use or performance. Percepio AB does
|
||||
* not and cannot warrant the performance or results you may obtain by using the
|
||||
* software or documentation. Percepio AB make no warranties, express or
|
||||
* implied, as to noninfringement of third party rights, merchantability, or
|
||||
* fitness for any particular purpose. In no event will Percepio AB, its
|
||||
* technology partners, or distributors be liable to you for any consequential,
|
||||
* incidental or special damages, including any lost profits or lost savings,
|
||||
* even if a representative of Percepio AB has been advised of the possibility
|
||||
* of such damages, or for any claim by any third party. Some jurisdictions do
|
||||
* not allow the exclusion or limitation of incidental, consequential or special
|
||||
* damages, or the exclusion of implied warranties or limitations on how long an
|
||||
* Disclaimer
|
||||
* The trace tool and recorder library is being delivered to you AS IS and
|
||||
* Percepio AB makes no warranty as to its use or performance. Percepio AB does
|
||||
* not and cannot warrant the performance or results you may obtain by using the
|
||||
* software or documentation. Percepio AB make no warranties, express or
|
||||
* implied, as to noninfringement of third party rights, merchantability, or
|
||||
* fitness for any particular purpose. In no event will Percepio AB, its
|
||||
* technology partners, or distributors be liable to you for any consequential,
|
||||
* incidental or special damages, including any lost profits or lost savings,
|
||||
* even if a representative of Percepio AB has been advised of the possibility
|
||||
* of such damages, or for any claim by any third party. Some jurisdictions do
|
||||
* not allow the exclusion or limitation of incidental, consequential or special
|
||||
* damages, or the exclusion of implied warranties or limitations on how long an
|
||||
* implied warranty may last, so the above limitations may not apply to you.
|
||||
*
|
||||
* Copyright Percepio AB, 2013.
|
||||
* Tabs are used for indent in this file (1 tab = 4 spaces)
|
||||
*
|
||||
* Copyright Percepio AB, 2014.
|
||||
* www.percepio.com
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef TRCCONFIG_H
|
||||
#define TRCCONFIG_H
|
||||
|
||||
/******************************************************************************
|
||||
* SELECTED_PORT
|
||||
*
|
||||
* Macro that specifies what hardware port that should be used.
|
||||
* Available ports are:
|
||||
*
|
||||
* Port Name Code Official OS supported
|
||||
* PORT_APPLICATION_DEFINED -2 - -
|
||||
* PORT_NOT_SET -1 - -
|
||||
* PORT_HWIndependent 0 Yes Any
|
||||
* PORT_Win32 1 Yes FreeRTOS on Win32
|
||||
* PORT_Atmel_AT91SAM7 2 No Any
|
||||
* PORT_Atmel_UC3A0 3 No Any
|
||||
* PORT_ARM_CortexM 4 Yes Any
|
||||
* PORT_Renesas_RX600 5 Yes Any
|
||||
* PORT_Microchip_dsPIC_AND_PIC24 6 Yes Any
|
||||
* PORT_TEXAS_INSTRUMENTS_TMS570 7 No Any
|
||||
* PORT_TEXAS_INSTRUMENTS_MSP430 8 No Any
|
||||
* PORT_MICROCHIP_PIC32MX 9 Yes Any
|
||||
* PORT_XILINX_PPC405 10 No FreeRTOS
|
||||
* PORT_XILINX_PPC440 11 No FreeRTOS
|
||||
* PORT_XILINX_MICROBLAZE 12 No Any
|
||||
* PORT_NXP_LPC210X 13 No Any
|
||||
* PORT_MICROCHIP_PIC32MZ 14 Yes Any
|
||||
* PORT_ARM_CORTEX_A9 15 No Any
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef WIN32
|
||||
// Set the port setting here!
|
||||
#define SELECTED_PORT PORT_NOT_SET
|
||||
|
||||
#if (SELECTED_PORT == PORT_NOT_SET)
|
||||
#error "You need to define SELECTED_PORT here!"
|
||||
#endif
|
||||
#else
|
||||
// For Win32 demo projects this is set automatically
|
||||
#define SELECTED_PORT PORT_Win32
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
* FREERTOS_VERSION
|
||||
*
|
||||
* Specify what version of FreeRTOS that is used. This is necessary compensate
|
||||
* for renamed symbols in the FreeRTOS kernel (does not build if incorrect).
|
||||
*
|
||||
* FREERTOS_VERSION_7_3_OR_7_4 (= 1) If using FreeRTOS v7.3.0 - v7.4.2
|
||||
* FREERTOS_VERSION_7_5_OR_7_6 (= 2) If using FreeRTOS v7.5.0 - v7.6.0
|
||||
* FREERTOS_VERSION_8_0_OR_LATER (= 3) If using FreeRTOS v8.0.0 or later
|
||||
*****************************************************************************/
|
||||
#define FREERTOS_VERSION FREERTOS_VERSION_8_0_OR_LATER
|
||||
|
||||
/******************************************************************************
|
||||
* TRACE_RECORDER_STORE_MODE
|
||||
*
|
||||
* Macro which should be defined as one of:
|
||||
* - TRACE_STORE_MODE_RING_BUFFER
|
||||
* - TRACE_STORE_MODE_STOP_WHEN_FULL
|
||||
* Default is TRACE_STORE_MODE_RING_BUFFER.
|
||||
*
|
||||
* With TRACE_RECORDER_STORE_MODE set to TRACE_STORE_MODE_RING_BUFFER, the
|
||||
* events are stored in a ring buffer, i.e., where the oldest events are
|
||||
* overwritten when the buffer becomes full. This allows you to get the last
|
||||
* events leading up to an interesting state, e.g., an error, without having
|
||||
* to store the whole run since startup.
|
||||
*
|
||||
* When TRACE_RECORDER_STORE_MODE is TRACE_STORE_MODE_STOP_WHEN_FULL, the
|
||||
* recording is stopped when the buffer becomes full. This is useful for
|
||||
* recording events following a specific state, e.g., the startup sequence.
|
||||
*****************************************************************************/
|
||||
#define TRACE_RECORDER_STORE_MODE TRACE_STORE_MODE_RING_BUFFER
|
||||
|
||||
/*******************************************************************************
|
||||
* CONFIGURATION RELATED TO CAPACITY AND ALLOCATION
|
||||
* TRACE_SCHEDULING_ONLY
|
||||
*
|
||||
* Macro which should be defined as an integer value.
|
||||
*
|
||||
* If this setting is enabled (= 1), only scheduling events are recorded.
|
||||
* If disabled (= 0), all events are recorded.
|
||||
*
|
||||
* Users of FreeRTOS+Trace Free Edition only displays scheduling events, so this
|
||||
* option can be used to avoid storing unsupported events.
|
||||
*
|
||||
* Default value is 0 (store all enabled events).
|
||||
*
|
||||
******************************************************************************/
|
||||
#define TRACE_SCHEDULING_ONLY 0
|
||||
|
||||
/*******************************************************************************
|
||||
* EVENT_BUFFER_SIZE
|
||||
|
@ -53,47 +138,158 @@
|
|||
* Macro which should be defined as an integer value.
|
||||
*
|
||||
* This defines the capacity of the event buffer, i.e., the number of records
|
||||
* it may store. Each registered event typically use one record (4 byte), but
|
||||
* vTracePrintF may use multiple records depending on the number of data args.
|
||||
* it may store. Most events use one record (4 byte), although some events
|
||||
* require multiple 4-byte records. You should adjust this to the amount of RAM
|
||||
* available in the target system.
|
||||
*
|
||||
* Default value is 1000, which means that 4000 bytes is allocated for the
|
||||
* event buffer.
|
||||
******************************************************************************/
|
||||
|
||||
#define EVENT_BUFFER_SIZE 10000 /* Adjust wrt. to available RAM */
|
||||
|
||||
#define EVENT_BUFFER_SIZE 15000
|
||||
|
||||
/*******************************************************************************
|
||||
* USE_LINKER_PRAGMA
|
||||
* NTask, NISR, NQueue, NSemaphore, NMutex
|
||||
*
|
||||
* Macro which should be defined as an integer value, default is 0.
|
||||
* A group of macros which should be defined as integer values, zero or larger.
|
||||
*
|
||||
* If this is 1, the header file "recorderdata_linker_pragma.h" is included just
|
||||
* before the declaration of RecorderData (in trcBase.c), i.e., the trace data
|
||||
* structure. This allows the user to specify a pragma with linker options.
|
||||
* These define the capacity of the Object Property Table, i.e., the maximum
|
||||
* number of objects active at any given point, within each object class (e.g.,
|
||||
* task, queue, semaphore, ...).
|
||||
*
|
||||
* Example (for IAR Embedded Workbench and NXP LPC17xx):
|
||||
* #pragma location="AHB_RAM_MEMORY"
|
||||
*
|
||||
* This example instructs the IAR linker to place RecorderData in another RAM
|
||||
* bank, the AHB RAM. This can also be used for other compilers with a similar
|
||||
* pragmas for linker options.
|
||||
*
|
||||
* Note that this only applies if using static allocation, see below.
|
||||
* If tasks or other other objects are deleted in your system, this
|
||||
* setting does not limit the total amount of objects created, only the number
|
||||
* of objects that have been successfully created but not yet deleted.
|
||||
*
|
||||
* Using too small values will cause vTraceError to be called, which stores an
|
||||
* error message in the trace that is shown when opening the trace file.
|
||||
*
|
||||
* It can be wise to start with large values for these constants,
|
||||
* unless you are very confident on these numbers. Then do a recording and
|
||||
* check the actual usage by selecting View menu -> Trace Details ->
|
||||
* Resource Usage -> Object Table.
|
||||
******************************************************************************/
|
||||
#define NTask 100
|
||||
#define NISR 60
|
||||
#define NQueue 60
|
||||
#define NSemaphore 60
|
||||
#define NMutex 60
|
||||
#define NTimer 200
|
||||
#define NEventGroup 60
|
||||
|
||||
#define USE_LINKER_PRAGMA 0
|
||||
/******************************************************************************
|
||||
* INCLUDE_MEMMANG_EVENTS
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* This controls if malloc and free calls should be traced. Set this to zero to
|
||||
* exclude malloc/free calls, or one (1) to include such events in the trace.
|
||||
*
|
||||
* Default value is 1.
|
||||
*****************************************************************************/
|
||||
#define INCLUDE_MEMMANG_EVENTS 1
|
||||
|
||||
/******************************************************************************
|
||||
* INCLUDE_USER_EVENTS
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If this is zero (0) the code for creating User Events is excluded to
|
||||
* reduce code size. User Events are application-generated events, like
|
||||
* "printf" but for the trace log instead of console output. User Events are
|
||||
* much faster than a printf and can therefore be used in timing critical code.
|
||||
* See vTraceUserEvent() and vTracePrintF() in trcUser.h
|
||||
*
|
||||
* Default value is 1.
|
||||
*
|
||||
* Note that User Events are only displayed in Professional Edition.
|
||||
*****************************************************************************/
|
||||
#define INCLUDE_USER_EVENTS 1
|
||||
|
||||
/*****************************************************************************
|
||||
* INCLUDE_ISR_TRACING
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If this is zero (0), the code for recording Interrupt Service Routines is
|
||||
* excluded to reduce code size.
|
||||
*
|
||||
* Default value is 1.
|
||||
*
|
||||
* Note, if the kernel has no central interrupt dispatcher, recording ISRs
|
||||
* require that you insert calls to vTraceStoreISRBegin and vTraceStoreISREnd
|
||||
* in your interrupt handlers.
|
||||
*****************************************************************************/
|
||||
#define INCLUDE_ISR_TRACING 1
|
||||
|
||||
/*****************************************************************************
|
||||
* INCLUDE_READY_EVENTS
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If one (1), events are recorded when tasks enter scheduling state "ready".
|
||||
* This uses a lot of space in the event buffer, so excluding "ready events"
|
||||
* will allow for longer traces. Including ready events however allows for
|
||||
* showing the initial pending time before tasks enter the execution state, and
|
||||
* for presenting accurate response times.
|
||||
*
|
||||
* Default value is 1.
|
||||
*****************************************************************************/
|
||||
#define INCLUDE_READY_EVENTS 1
|
||||
|
||||
/*****************************************************************************
|
||||
* INCLUDE_NEW_TIME_EVENTS
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If this is zero (1), events will be generated whenever the OS clock is
|
||||
* increased.
|
||||
*
|
||||
* Default value is 0.
|
||||
*****************************************************************************/
|
||||
#define INCLUDE_NEW_TIME_EVENTS 1
|
||||
|
||||
/******************************************************************************
|
||||
* INCLUDE_FLOAT_SUPPORT
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If this is zero (0), all references to floating point values are removed,
|
||||
* in case floating point values are not supported by the platform used.
|
||||
* Floating point values are only used in vTracePrintF and its subroutines, to
|
||||
* store float (%f) or double (%lf) arguments.
|
||||
*
|
||||
* vTracePrintF can be used with integer and string arguments in either case.
|
||||
*
|
||||
* Default value is 1.
|
||||
*****************************************************************************/
|
||||
#define INCLUDE_FLOAT_SUPPORT 0
|
||||
|
||||
/******************************************************************************
|
||||
* INCLUDE_OBJECT_DELETE
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* This must be enabled (1) if tasks, queues or other
|
||||
* traced kernel objects are deleted at runtime. If no deletes are made, this
|
||||
* can be set to 0 in order to exclude the delete-handling code.
|
||||
*
|
||||
* Default value is 1.
|
||||
*****************************************************************************/
|
||||
#define INCLUDE_OBJECT_DELETE 1
|
||||
|
||||
/*******************************************************************************
|
||||
* SYMBOL_TABLE_SIZE
|
||||
*
|
||||
* Macro which should be defined as an integer value.
|
||||
*
|
||||
* This defines the capacity of the symbol table, in bytes. This symbol table
|
||||
* This defines the capacity of the symbol table, in bytes. This symbol table
|
||||
* stores User Events labels and names of deleted tasks, queues, or other kernel
|
||||
* objects. Note that the names of active objects not stored here but in the
|
||||
* Object Table. Thus, if you don't use User Events or delete any kernel
|
||||
* objects you set this to a very low value, e.g. 4, but not zero (0) since
|
||||
* this causes a declaration of a zero-sized array, for which the C compiler
|
||||
* behavior is not standardized and may cause misaligned data.
|
||||
* objects. If you don't use User Events or delete any kernel
|
||||
* objects you set this to a very low value. The minimum recommended value is 4.
|
||||
* A size of zero (0) is not allowed since a zero-sized array may result in a
|
||||
* 32-bit pointer, i.e., using 4 bytes rather than 0.
|
||||
*
|
||||
* Default value is 800.
|
||||
******************************************************************************/
|
||||
#define SYMBOL_TABLE_SIZE 5000
|
||||
|
||||
|
@ -101,16 +297,153 @@
|
|||
#error "SYMBOL_TABLE_SIZE may not be zero!"
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
* NameLenTask, NameLenQueue, ...
|
||||
*
|
||||
* Macros that specify the maximum lengths (number of characters) for names of
|
||||
* kernel objects, such as tasks and queues. If longer names are used, they will
|
||||
* be truncated when stored in the recorder.
|
||||
*****************************************************************************/
|
||||
#define NameLenTask 15
|
||||
#define NameLenISR 15
|
||||
#define NameLenQueue 15
|
||||
#define NameLenSemaphore 15
|
||||
#define NameLenMutex 15
|
||||
#define NameLenTimer 15
|
||||
#define NameLenEventGroup 15
|
||||
|
||||
/******************************************************************************
|
||||
* TRACE_DATA_ALLOCATION
|
||||
*
|
||||
* This defines how to allocate the recorder data structure, i.e., using a
|
||||
* static declaration or using a dynamic allocation in runtime (malloc).
|
||||
*
|
||||
* Should be one of these two options:
|
||||
* - TRACE_DATA_ALLOCATION_STATIC (default)
|
||||
* - TRACE_DATA_ALLOCATION_DYNAMIC
|
||||
*
|
||||
* Using static allocation has the benefits of compile-time errors if the buffer
|
||||
* is too large (too large constants in trcConfig.h) and no need to call the
|
||||
* initialization routine (xTraceInitTraceData).
|
||||
*
|
||||
* Using dynamic allocation may give more flexibility in some cases.
|
||||
*****************************************************************************/
|
||||
#define TRACE_DATA_ALLOCATION TRACE_DATA_ALLOCATION_STATIC
|
||||
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*** ADVANCED SETTINGS ********************************************************
|
||||
******************************************************************************
|
||||
* The remaining settings are not necessary to modify but allows for optimizing
|
||||
* the recorder setup for your specific needs, e.g., to exclude events that you
|
||||
* are not interested in, in order to get longer traces.
|
||||
*****************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* HEAP_SIZE_BELOW_16M
|
||||
*
|
||||
* An integer constant that can be used to reduce the buffer usage of memory
|
||||
* allocation events (malloc/free). This value should be 1 if the heap size is
|
||||
* below 16 MB (2^24 byte), and you can live with reported addresses showing the
|
||||
* lower 24 bits only. If 0, you get the full 32-bit addresses.
|
||||
*
|
||||
* Default value is 0.
|
||||
******************************************************************************/
|
||||
#define HEAP_SIZE_BELOW_16M 0
|
||||
|
||||
/******************************************************************************
|
||||
* USE_LINKER_PRAGMA
|
||||
*
|
||||
* Macro which should be defined as an integer value, default is 0.
|
||||
*
|
||||
* If this is 1, the header file "recorderdata_linker_pragma.h" is included just
|
||||
* before the declaration of RecorderData (in trcBase.c), i.e., the trace data
|
||||
* structure. This allows the user to specify a pragma with linker options.
|
||||
*
|
||||
* Example (for IAR Embedded Workbench and NXP LPC17xx):
|
||||
* #pragma location="AHB_RAM_MEMORY"
|
||||
*
|
||||
* This example instructs the IAR linker to place RecorderData in another RAM
|
||||
* bank, the AHB RAM. This can also be used for other compilers with a similar
|
||||
* pragmas for linker options.
|
||||
*
|
||||
* Note that this only applies if using static allocation, see below.
|
||||
******************************************************************************/
|
||||
#define USE_LINKER_PRAGMA 0
|
||||
|
||||
/******************************************************************************
|
||||
* USE_IMPLICIT_IFE_RULES
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
* Default is 1.
|
||||
*
|
||||
* Tracealyzer groups the events into actor instances, based on context-switches
|
||||
* and a definition of "Instance Finish Events", or IFEs. These are kernel calls
|
||||
* considered to be the last event in a task instance. Some kernel calls are
|
||||
* considered IFEs by default (e.g., delay functions), but it is also possible
|
||||
* to specify this individually for each task (see vTraceTaskInstanceFinish).
|
||||
*
|
||||
* If USE_IMPLICIT_IFE_RULES is one (1), the default IFEs will be enabled, which
|
||||
* gives a "typical" grouping of events into instances. You can combine this
|
||||
* with calls to vTraceTaskInstanceFinish for specific tasks.
|
||||
*
|
||||
* If USE_IMPLICIT_IFE_RULES is zero (0), the implicit IFEs are disabled and all
|
||||
* events withing each task is then shown as a single instance, unless you call
|
||||
* vTraceTaskInstanceFinish() at suitable locations to mark the IFEs.
|
||||
*****************************************************************************/
|
||||
#define USE_IMPLICIT_IFE_RULES 1
|
||||
|
||||
/******************************************************************************
|
||||
* USE_16BIT_OBJECT_HANDLES
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If set to 0 (zero), the recorder uses 8-bit handles to identify kernel
|
||||
* objects such as tasks and queues. This limits the supported number of
|
||||
* concurrently active objects to 255 of each type (object class).
|
||||
*
|
||||
* If set to 1 (one), the recorder uses 16-bit handles to identify kernel
|
||||
* objects such as tasks and queues. This limits the supported number of
|
||||
* concurrent objects to 65535 of each type (object class). However, since the
|
||||
* object property table is limited to 64 KB, the practical limit is about
|
||||
* 3000 objects in total.
|
||||
*
|
||||
* Default is 0.
|
||||
*
|
||||
* NOTE: An object with handle above 255 will use an extra 4-byte record in
|
||||
* the event buffer whenever referenced. Moreover, some internal tables in the
|
||||
* recorder gets larger when using 16-bit handles. The additional RAM usage is
|
||||
* 5-10 byte plus 1 byte per kernel object i.e., task, queue, mutex, etc.
|
||||
*****************************************************************************/
|
||||
#define USE_16BIT_OBJECT_HANDLES 0
|
||||
|
||||
/******************************************************************************
|
||||
* USE_TRACE_ASSERT
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
* Default is 1.
|
||||
*
|
||||
* If this is one (1), the TRACE_ASSERT macro will verify that a condition is
|
||||
* true. If the condition is false, vTraceError() will be called.
|
||||
* This is used on several places in the recorder code for sanity checks on
|
||||
* parameters. Can be switched off to reduce CPU usage of the tracing.
|
||||
*****************************************************************************/
|
||||
#define USE_TRACE_ASSERT 1
|
||||
|
||||
/*******************************************************************************
|
||||
* USE_SEPARATE_USER_EVENT_BUFFER
|
||||
*
|
||||
* Macro which should be defined as an integer value.
|
||||
* Default is zero (0).
|
||||
*
|
||||
* This enables and disables the use of the separate user event buffer.
|
||||
* This enables and disables the use of the separate user event buffer. Using
|
||||
* this separate buffer has the benefit of not overwriting the user events with
|
||||
* kernel events (usually generated at a much higher rate), i.e., when using
|
||||
* ring-buffer mode.
|
||||
*
|
||||
* Note: When using the separate user event buffer, you may get an artificial
|
||||
* task instance named "Unknown actor". This is added as a placeholder when the
|
||||
* task instance named "Unknown actor". This is added as a placeholder when the
|
||||
* user event history is longer than the task scheduling history.
|
||||
******************************************************************************/
|
||||
#define USE_SEPARATE_USER_EVENT_BUFFER 0
|
||||
|
@ -125,7 +458,7 @@
|
|||
*
|
||||
* Only in use if USE_SEPARATE_USER_EVENT_BUFFER is set to 1.
|
||||
******************************************************************************/
|
||||
#define USER_EVENT_BUFFER_SIZE 500
|
||||
#define USER_EVENT_BUFFER_SIZE 10
|
||||
|
||||
/*******************************************************************************
|
||||
* USER_EVENT_CHANNELS
|
||||
|
@ -138,393 +471,5 @@
|
|||
******************************************************************************/
|
||||
#define CHANNEL_FORMAT_PAIRS 32
|
||||
|
||||
/*******************************************************************************
|
||||
* NTask, NISR, NQueue, NSemaphore, NMutex
|
||||
*
|
||||
* A group of Macros which should be defined as an integer value of zero (0)
|
||||
* or larger.
|
||||
*
|
||||
* This defines the capacity of the Object Property Table - the maximum number
|
||||
* of objects active at any given point within each object class.
|
||||
*
|
||||
* NOTE: In case objects are deleted and created during runtime, this setting
|
||||
* does not limit the total amount of objects, only the number of concurrently
|
||||
* active objects.
|
||||
*
|
||||
* Using too small values will give an error message through the vTraceError
|
||||
* routine, which makes the error message appear when opening the trace data
|
||||
* in Tracealyzer. If you are using the recorder status monitor task,
|
||||
* any error messages are displayed in console prints, assuming that the
|
||||
* print macro has been defined properly (vConsolePrintMessage).
|
||||
*
|
||||
* It can be wise to start with very large values for these constants,
|
||||
* unless you are very confident on these numbers. Then do a recording and
|
||||
* check the actual usage in Tracealyzer. This is shown by selecting
|
||||
* View -> Trace Details -> Resource Usage -> Object Table
|
||||
*
|
||||
* NOTE 2: Remember to account for all tasks and other objects created by
|
||||
* the kernel, such as the IDLE task, any timer tasks, and any tasks created
|
||||
* by other 3rd party software components, such as communication stacks.
|
||||
* Moreover, one task slot is used to indicate "(startup)", i.e., a fictive
|
||||
* task that represent the time before the scheduler starts.
|
||||
* NTask should thus be at least 2-3 slots larger than your application task count.
|
||||
*
|
||||
******************************************************************************/
|
||||
#define NTask 100
|
||||
#define NISR 20
|
||||
#define NQueue 60
|
||||
#define NSemaphore 60
|
||||
#define NMutex 60
|
||||
#define NTimer 200
|
||||
#define NEventGroup 60
|
||||
|
||||
/* Maximum object name length for each class (includes zero termination) */
|
||||
#define NameLenTask 15
|
||||
#define NameLenISR 15
|
||||
#define NameLenQueue 15
|
||||
#define NameLenSemaphore 15
|
||||
#define NameLenMutex 15
|
||||
#define NameLenTimer 15
|
||||
#define NameLenEventGroup 15
|
||||
|
||||
/******************************************************************************
|
||||
* TRACE_DESCRIPTION
|
||||
*
|
||||
* Macro which should be defined as a string.
|
||||
*
|
||||
* This string is stored in the trace and displayed in Tracealyzer. Can be
|
||||
* used to store, e.g., system version or build date. This is also used to store
|
||||
* internal error messages from the recorder, which if occurs overwrites the
|
||||
* value defined here. This may be maximum 256 chars.
|
||||
*****************************************************************************/
|
||||
#define TRACE_DESCRIPTION "Tracealyzer Recorder Test Program"
|
||||
|
||||
/******************************************************************************
|
||||
* TRACE_DESCRIPTION_MAX_LENGTH
|
||||
*
|
||||
* The maximum length (including zero termination) for the TRACE_DESCRIPTION
|
||||
* string. Since this string also is used for internal error messages from the
|
||||
* recorder do not make it too short, as this may truncate the error messages.
|
||||
* Default is 80.
|
||||
* Maximum allowed length is 256 - the trace will fail to load if longer.
|
||||
*****************************************************************************/
|
||||
#define TRACE_DESCRIPTION_MAX_LENGTH 80
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* TRACE_DATA_ALLOCATION
|
||||
*
|
||||
* This defines how to allocate the recorder data structure, i.e., using a
|
||||
* static declaration or using a dynamic allocation in runtime (malloc).
|
||||
*
|
||||
* Should be one of these two options:
|
||||
* - TRACE_DATA_ALLOCATION_STATIC (default)
|
||||
* - TRACE_DATA_ALLOCATION_DYNAMIC
|
||||
*
|
||||
* Using static allocation has the benefits of compile-time errors if the buffer
|
||||
* is too large (too large constants in trcConfig.h) and no need to call the
|
||||
* initialization routine (xTraceInitTraceData).
|
||||
*
|
||||
* Using dynamic allocation may give more flexibility in some cases.
|
||||
*****************************************************************************/
|
||||
|
||||
#define TRACE_DATA_ALLOCATION TRACE_DATA_ALLOCATION_STATIC
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* CONFIGURATION REGARDING WHAT CODE/FEATURES TO INCLUDE
|
||||
*****************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* USE_TRACE_ASSERT
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
* Default is 0.
|
||||
*
|
||||
* If this is one (1), the TRACE_ASSERT macro will verify that a condition is
|
||||
* true. If the condition is false, vTraceError() will be called.
|
||||
*****************************************************************************/
|
||||
#define USE_TRACE_ASSERT 1
|
||||
|
||||
/******************************************************************************
|
||||
* INCLUDE_FLOAT_SUPPORT
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
* Default is 1.
|
||||
*
|
||||
* If this is zero (0), all references to floating point values are removed,
|
||||
* in case floating point values are not supported by the platform used.
|
||||
* Floating point values are only used in vTracePrintF and its subroutines, to
|
||||
* store float (%f) or double (%lf) argments.
|
||||
*
|
||||
* Note: vTracePrintF can still be used with integer and string arguments in
|
||||
* either case.
|
||||
*****************************************************************************/
|
||||
#define INCLUDE_FLOAT_SUPPORT 0
|
||||
|
||||
/******************************************************************************
|
||||
* INCLUDE_USER_EVENTS
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
* Default is 1.
|
||||
*
|
||||
* If this is zero (0) the code for creating User Events is excluded to
|
||||
* reduce code size. User Events are application-generated events, like
|
||||
* "printf" but for the trace log instead of console output. User Events are
|
||||
* much faster than a printf and can therefore be used in timing critical code.
|
||||
* See vTraceUserEvent() and vTracePrintF() in trcUser.h
|
||||
*
|
||||
* Note that User Events are not displayed in FreeRTOS+Trace Free Edition.
|
||||
*****************************************************************************/
|
||||
#define INCLUDE_USER_EVENTS 1
|
||||
|
||||
/*****************************************************************************
|
||||
* INCLUDE_READY_EVENTS
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
* Default is 1.
|
||||
*
|
||||
* If this is zero (0), the code for recording Ready events is
|
||||
* excluded. Note, this will make it impossible to calculate the correct
|
||||
* response times.
|
||||
*****************************************************************************/
|
||||
#define INCLUDE_READY_EVENTS 1
|
||||
|
||||
/*****************************************************************************
|
||||
* INCLUDE_NEW_TIME_EVENTS
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
* Default is 0.
|
||||
*
|
||||
* If this is zero (1), events will be generated whenever the os clock is
|
||||
* increased.
|
||||
*****************************************************************************/
|
||||
#define INCLUDE_NEW_TIME_EVENTS 0
|
||||
|
||||
/*****************************************************************************
|
||||
* INCLUDE_ISR_TRACING
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
* Default is 1.
|
||||
*
|
||||
* If this is zero (0), the code for recording Interrupt Service Routines is
|
||||
* excluded to reduce code size.
|
||||
*
|
||||
* Note, if the kernel has no central interrupt dispatcher, recording ISRs
|
||||
* require that you insert calls to vTraceStoreISRBegin and vTraceStoreISREnd
|
||||
* in your interrupt handlers.
|
||||
*****************************************************************************/
|
||||
#define INCLUDE_ISR_TRACING 1
|
||||
|
||||
/******************************************************************************
|
||||
* INCLUDE_OBJECT_DELETE
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
* Default is 1.
|
||||
*
|
||||
* This must be enabled (1) if tasks, queues or other
|
||||
* traced kernel objects are deleted at runtime. If no deletes are made, this
|
||||
* can be set to 0 in order to exclude the delete-handling code.
|
||||
*****************************************************************************/
|
||||
#define INCLUDE_OBJECT_DELETE 1
|
||||
|
||||
/******************************************************************************
|
||||
* INCLUDE_MEMMANG_EVENTS
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
* Default is 1.
|
||||
*
|
||||
* This controls if malloc and free calls should be traced. Set this to zero to
|
||||
* exclude malloc/free calls from the tracing.
|
||||
*****************************************************************************/
|
||||
#define INCLUDE_MEMMANG_EVENTS 1
|
||||
|
||||
/******************************************************************************
|
||||
* CONFIGURATION RELATED TO BEHAVIOR
|
||||
*****************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* TRACE_RECORDER_STORE_MODE
|
||||
*
|
||||
* Macro which should be defined as one of:
|
||||
* - TRACE_STORE_MODE_RING_BUFFER
|
||||
* - TRACE_STORE_MODE_STOP_WHEN_FULL
|
||||
* Default is TRACE_STORE_MODE_RING_BUFFER.
|
||||
*
|
||||
* With TRACE_RECORDER_STORE_MODE set to TRACE_STORE_MODE_RING_BUFFER, the events are
|
||||
* stored in a ring buffer, i.e., where the oldest events are overwritten when
|
||||
* the buffer becomes full. This allows you to get the last events leading up
|
||||
* to an interesting state, e.g., an error, without having a large trace buffer
|
||||
* for string the whole run since startup. In this mode, the recorder can run
|
||||
* "forever" as the buffer never gets full, i.e., in the sense that it always
|
||||
* has room for more events.
|
||||
*
|
||||
* To fetch the trace in mode TRACE_STORE_MODE_RING_BUFFER, you need to first halt the
|
||||
* system using your debugger and then do a RAM dump, or to explicitly stop the
|
||||
* recorder using vTraceStop() and then store/upload the trace data using a
|
||||
* task that you need to provide yourself. The trace data is found in the struct
|
||||
* RecorderData, initialized in trcBase.c.
|
||||
*
|
||||
* Note that, if you upload the trace using a RAM dump, i.e., when the system is
|
||||
* halted on a breakpoint or by a debugger command, there is no need to stop the
|
||||
* recorder first.
|
||||
*
|
||||
* When TRACE_RECORDER_STORE_MODE is TRACE_STORE_MODE_STOP_WHEN_FULL, the recording is
|
||||
* stopped when the buffer becomes full. When the recorder stops itself this way
|
||||
* vTracePortEnd() is called which allows for custom actions, such as triggering
|
||||
* a task that stores the trace buffer, i.e., in case taking a RAM dump
|
||||
* using an on-chip debugger is not possible. In the Windows port, vTracePortEnd
|
||||
* saves the trace to file directly, but this is not recommended in a real-time
|
||||
* system since the scheduler is blocked during the processing of vTracePortEnd.
|
||||
*****************************************************************************/
|
||||
|
||||
#define TRACE_RECORDER_STORE_MODE TRACE_STORE_MODE_RING_BUFFER
|
||||
|
||||
/******************************************************************************
|
||||
* STOP_AFTER_N_EVENTS
|
||||
*
|
||||
* Macro which should be defined as an integer value, or not defined.
|
||||
* Default is -1
|
||||
*
|
||||
* STOP_AFTER_N_EVENTS is intended for tests of the ring buffer mode (when
|
||||
* RECORDER_STORE_MODE is STORE_MODE_RING_BUFFER). It stops the recording when
|
||||
* the specified number of events has been observed. This value can be larger
|
||||
* than the buffer size, to allow for test of the "wrapping around" that occurs
|
||||
* in ring buffer mode . A negative value (or no definition of this macro)
|
||||
* disables this feature.
|
||||
*****************************************************************************/
|
||||
#define STOP_AFTER_N_EVENTS -1
|
||||
|
||||
/******************************************************************************
|
||||
* USE_IMPLICIT_IFE_RULES
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
* Default is 1.
|
||||
*
|
||||
* ### Instance Finish Events (IFE) ###
|
||||
*
|
||||
* For tasks with "infinite" main loops (non-terminating tasks), the concept
|
||||
* of a task instance has no clear definition, it is an application-specific
|
||||
* thing. Tracealyzer allows you to define Instance Finish Events (IFEs),
|
||||
* which marks the point in a cyclic task when the "task instance" ends.
|
||||
* The IFE is a blocking kernel call, typically in the main loop of a task
|
||||
* which typically reads a message queue, waits for a semaphore or performs
|
||||
* an explicit delay.
|
||||
*
|
||||
* If USE_IMPLICIT_IFE_RULES is one (1), the kernel macros (trcKernelPort.h)
|
||||
* will define what kernel calls are considered by default to be IFEs.
|
||||
*
|
||||
* However, Implicit IFEs only applies to blocking kernel calls. If a
|
||||
* service reads a message without blocking, it does not create a new
|
||||
* instance since no blocking occurred.
|
||||
*
|
||||
* Moreover, the actual IFE might sometimes be another blocking call. We
|
||||
* therefore allow for user-defined Explicit IFEs by calling
|
||||
*
|
||||
* vTraceTaskInstanceIsFinished()
|
||||
*
|
||||
* right before the kernel call considered as IFE. This does not create an
|
||||
* additional event but instead stores the service code and object handle
|
||||
* of the IFE call as properties of the task.
|
||||
*
|
||||
* If using Explicit IFEs and the task also calls an Implicit IFE, this may
|
||||
* result in additional incorrect task instances.
|
||||
* This is solved by disabling the Implicit IFEs for the task, by adding
|
||||
* a call to
|
||||
*
|
||||
* vTraceTaskSkipDefaultInstanceFinishedEvents()
|
||||
*
|
||||
* in the very beginning of that task. This allows you to combine Explicit IFEs
|
||||
* for some tasks with Implicit IFEs for the rest of the tasks, if
|
||||
* USE_IMPLICIT_IFE_RULES is 1.
|
||||
*
|
||||
* By setting USE_IMPLICIT_IFE_RULES to zero (0), the implicit IFEs are disabled
|
||||
* for all tasks. Tasks will then be considered to have a single instance only,
|
||||
* covering all execution fragments, unless you define an explicit IFE in each
|
||||
* task by calling vTraceTaskInstanceIsFinished before the blocking call.
|
||||
*****************************************************************************/
|
||||
#define USE_IMPLICIT_IFE_RULES 1
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* USE_16BIT_OBJECT_HANDLES
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
* Default is 0.
|
||||
*
|
||||
* If set to 0 (zero), the recorder uses 8-bit handles to identify kernel
|
||||
* objects such as tasks and queues. This limits the supported number of
|
||||
* concurrently active objects to 255 of each type (object class).
|
||||
*
|
||||
* If set to 1 (one), the recorder uses 16-bit handles to identify kernel
|
||||
* objects such as tasks and queues. This limits the supported number of
|
||||
* concurrent objects to 65535 of each type (object class). However, since the
|
||||
* object property table is limited to 64 KB, the practical limit is about
|
||||
* 3000 objects in total.
|
||||
*
|
||||
* NOTE: An object with a high ID (> 255) will generate an extra event
|
||||
* (= 4 byte) in the event buffer.
|
||||
*
|
||||
* NOTE: Some internal tables in the recorder gets larger when using 16-bit
|
||||
* handles. The additional RAM usage is 5-10 byte plus 1 byte per kernel object
|
||||
*, i.e., task, queue, semaphore, mutex, etc.
|
||||
*****************************************************************************/
|
||||
#define USE_16BIT_OBJECT_HANDLES 0
|
||||
|
||||
/****** Port Name ******************** Code ** Official ** OS Platform ******
|
||||
* PORT_APPLICATION_DEFINED -2 - -
|
||||
* PORT_NOT_SET -1 - -
|
||||
* PORT_HWIndependent 0 Yes Any
|
||||
* PORT_Win32 1 Yes FreeRTOS Win32
|
||||
* PORT_Atmel_AT91SAM7 2 No Any
|
||||
* PORT_Atmel_UC3A0 3 No Any
|
||||
* PORT_ARM_CortexM 4 Yes Any
|
||||
* PORT_Renesas_RX600 5 Yes Any
|
||||
* PORT_Microchip_dsPIC_AND_PIC24 6 Yes Any
|
||||
* PORT_TEXAS_INSTRUMENTS_TMS570 7 No Any
|
||||
* PORT_TEXAS_INSTRUMENTS_MSP430 8 No Any
|
||||
* PORT_MICROCHIP_PIC32 9 No Any
|
||||
* PORT_XILINX_PPC405 10 No FreeRTOS
|
||||
* PORT_XILINX_PPC440 11 No FreeRTOS
|
||||
* PORT_XILINX_MICROBLAZE 12 No Any
|
||||
* PORT_NXP_LPC210X 13 No Any
|
||||
*****************************************************************************/
|
||||
#define SELECTED_PORT PORT_Win32
|
||||
|
||||
#if (SELECTED_PORT == PORT_NOT_SET)
|
||||
#error "You need to define SELECTED_PORT here!"
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
* USE_PRIMASK_CS (for Cortex M devices only)
|
||||
*
|
||||
* An integer constant that selects between two options for the critical
|
||||
* sections of the recorder library.
|
||||
*
|
||||
* 0: The default FreeRTOS critical section (BASEPRI) - default setting
|
||||
* 1: Always disable ALL interrupts (using PRIMASK)
|
||||
*
|
||||
* Option 0 uses the standard FreeRTOS macros for critical sections.
|
||||
* However, on Cortex-M devices they only disable interrupts with priorities
|
||||
* below a certain configurable level, while higher priority ISRs remain active.
|
||||
* Such high-priority ISRs may not use the recorder functions in this mode.
|
||||
*
|
||||
* Option 1 allows you to safely call the recorder from any ISR, independent of
|
||||
* the interrupt priority. This mode may however cause higher IRQ latencies
|
||||
* (some microseconds) since ALL configurable interrupts are disabled during
|
||||
* the recorder's critical sections in this mode, using the PRIMASK register.
|
||||
******************************************************************************/
|
||||
#define USE_PRIMASK_CS 0
|
||||
|
||||
/******************************************************************************
|
||||
* HEAP_SIZE_BELOW_16M
|
||||
*
|
||||
* An integer constant that can be used to reduce the buffer usage of memory
|
||||
* allocation events (malloc/free). This value should be 1 if the heap size is
|
||||
* below 16 MB (2^24 byte), and you can live with addresses truncated to the
|
||||
* lower 24 bit. Otherwise set it to 0 to get the full 32-bit addresses.
|
||||
******************************************************************************/
|
||||
#define HEAP_SIZE_BELOW_16M 0
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -66,9 +66,9 @@
|
|||
/******************************************************************************
|
||||
* 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 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
|
||||
* 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.
|
||||
*
|
||||
* This file implements the code that is not demo specific, including the
|
||||
|
@ -80,9 +80,9 @@
|
|||
* 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
|
||||
* 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:
|
||||
* 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 -
|
||||
|
@ -101,11 +101,20 @@
|
|||
|
||||
/* 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 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
|
||||
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 1
|
||||
#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0
|
||||
|
||||
/* 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. */
|
||||
#define mainREGION_1_SIZE 3001
|
||||
#define mainREGION_2_SIZE 18105
|
||||
#define mainREGION_3_SIZE 1107
|
||||
|
||||
/*
|
||||
* main_blinky() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1.
|
||||
|
@ -114,15 +123,28 @@ main_full.c. */
|
|||
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. */
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
void vFullDemoTickHookFunction( void );
|
||||
void vFullDemoIdleFunction( void );
|
||||
|
||||
/* Prototypes for the standard FreeRTOS callback/hook functions implemented
|
||||
within this file. */
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
static void prvInitialiseHeap( void );
|
||||
|
||||
/*
|
||||
* Prototypes for the standard FreeRTOS callback/hook functions implemented
|
||||
* within this file.
|
||||
*/
|
||||
void vApplicationMallocFailedHook( void );
|
||||
void vApplicationIdleHook( void );
|
||||
void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName );
|
||||
|
@ -145,6 +167,13 @@ 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. */
|
||||
prvInitialiseHeap();
|
||||
|
||||
/* Initialise the trace recorder and create the label used to post user
|
||||
events to the trace recording on each tick interrupt. */
|
||||
vTraceInitTraceData();
|
||||
|
@ -251,10 +280,10 @@ void vApplicationTickHook( void )
|
|||
}
|
||||
#endif /* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY */
|
||||
|
||||
/* Write a user event to the trace log.
|
||||
/* 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
|
||||
exhibit deterministic behaviour. Windows will run the simulator in
|
||||
bursts. */
|
||||
vTraceUserEvent( xTickTraceUserEvent );
|
||||
}
|
||||
|
@ -263,26 +292,35 @@ void vApplicationTickHook( void )
|
|||
void vAssertCalled( unsigned long ulLine, const char * const pcFileName )
|
||||
{
|
||||
static portBASE_TYPE xPrinted = pdFALSE;
|
||||
volatile uint32_t ulSetToNonZeroInDebuggerToContinue = 0;
|
||||
|
||||
/* Parameters are not used. */
|
||||
( void ) ulLine;
|
||||
( void ) pcFileName;
|
||||
|
||||
taskDISABLE_INTERRUPTS();
|
||||
__asm volatile( "int $3" );
|
||||
|
||||
/* Stop the trace recording. */
|
||||
if( xPrinted == pdFALSE )
|
||||
taskENTER_CRITICAL();
|
||||
{
|
||||
xPrinted = pdTRUE;
|
||||
if( xTraceRunning == pdTRUE )
|
||||
/* Stop the trace recording. */
|
||||
if( xPrinted == pdFALSE )
|
||||
{
|
||||
vTraceStop();
|
||||
prvSaveTraceFile();
|
||||
xPrinted = pdTRUE;
|
||||
if( xTraceRunning == pdTRUE )
|
||||
{
|
||||
vTraceStop();
|
||||
prvSaveTraceFile();
|
||||
}
|
||||
}
|
||||
|
||||
/* You can step out of this function to debug the assertion by using
|
||||
the debugger to set ulSetToNonZeroInDebuggerToContinue to a non-zero
|
||||
value. */
|
||||
while( ulSetToNonZeroInDebuggerToContinue == 0 )
|
||||
{
|
||||
__asm volatile( "NOP" );
|
||||
__asm volatile( "NOP" );
|
||||
}
|
||||
}
|
||||
|
||||
taskENABLE_INTERRUPTS();
|
||||
taskEXIT_CRITICAL();
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -303,3 +341,34 @@ FILE* pxOutputFile;
|
|||
printf( "\r\nFailed to create trace dump file\r\n" );
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
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
|
||||
purposes. */
|
||||
static uint8_t ucHeap[ configTOTAL_HEAP_SIZE ];
|
||||
volatile uint32_t ulAdditionalOffset = 19; /* Just to prevent 'condition is always true' warnings in configASSERT(). */
|
||||
const HeapRegion_t xHeapRegions[] =
|
||||
{
|
||||
/* Start address with dummy offsets Size */
|
||||
{ ucHeap + 1, mainREGION_1_SIZE },
|
||||
{ ucHeap + 15 + mainREGION_1_SIZE, mainREGION_2_SIZE },
|
||||
{ ucHeap + 19 + mainREGION_1_SIZE + mainREGION_2_SIZE, mainREGION_3_SIZE },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
/* Sanity check that the sizes and offsets defined actually fit into the
|
||||
array. */
|
||||
configASSERT( ( ulAdditionalOffset + mainREGION_1_SIZE + mainREGION_2_SIZE + mainREGION_3_SIZE ) < configTOTAL_HEAP_SIZE );
|
||||
|
||||
vPortDefineHeapRegions( xHeapRegions );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
|
|
@ -190,6 +190,7 @@ static void prvQueueSendTask( void *pvParameters )
|
|||
{
|
||||
TickType_t xNextWakeTime;
|
||||
const unsigned long ulValueToSend = 100UL;
|
||||
const TickType_t xBlockTime = pdMS_TO_TICKS( mainQUEUE_SEND_FREQUENCY_MS );
|
||||
|
||||
/* Remove compiler warning in the case that configASSERT() is not
|
||||
defined. */
|
||||
|
@ -207,7 +208,7 @@ const unsigned long ulValueToSend = 100UL;
|
|||
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. */
|
||||
vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS );
|
||||
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
|
||||
|
|
|
@ -133,6 +133,8 @@
|
|||
#include "QueueSet.h"
|
||||
#include "QueueOverwrite.h"
|
||||
#include "EventGroupsDemo.h"
|
||||
#include "IntSemTest.h"
|
||||
#include "TaskNotify.h"
|
||||
|
||||
/* Priorities at which the tasks are created. */
|
||||
#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 2 )
|
||||
|
@ -162,7 +164,7 @@ static void prvTestTask( void *pvParameters );
|
|||
static void prvDemonstrateTaskStateAndHandleGetFunctions( void );
|
||||
|
||||
/*
|
||||
* Called from the idle task hook function to demonstrate the use of
|
||||
* Called from the idle task hook function to demonstrate the use of
|
||||
* xTimerPendFunctionCall() as xTimerPendFunctionCall() is not demonstrated by
|
||||
* any of the standard demo tasks.
|
||||
*/
|
||||
|
@ -195,6 +197,7 @@ int main_full( void )
|
|||
xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
||||
|
||||
/* Create the standard demo tasks. */
|
||||
vStartTaskNotifyTask();
|
||||
vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
|
||||
vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
|
||||
vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
|
||||
|
@ -209,6 +212,7 @@ int main_full( void )
|
|||
vStartQueueOverwriteTask( mainQUEUE_OVERWRITE_PRIORITY );
|
||||
xTaskCreate( prvDemoQueueSpaceFunctions, "QSpace", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
|
||||
vStartEventGroupTasks();
|
||||
vStartInterruptSemaphoreTasks();
|
||||
|
||||
#if( configUSE_PREEMPTION != 0 )
|
||||
{
|
||||
|
@ -263,7 +267,16 @@ const TickType_t xCycleFrequency = 2500 / portTICK_PERIOD_MS;
|
|||
}
|
||||
#endif
|
||||
|
||||
if( xAreEventGroupTasksStillRunning() != pdTRUE )
|
||||
if( xAreTaskNotificationTasksStillRunning() != pdTRUE )
|
||||
{
|
||||
pcStatusMessage = "Error: Notification";
|
||||
}
|
||||
|
||||
if( xAreInterruptSemaphoreTasksStillRunning() != pdTRUE )
|
||||
{
|
||||
pcStatusMessage = "Error: IntSem";
|
||||
}
|
||||
else if( xAreEventGroupTasksStillRunning() != pdTRUE )
|
||||
{
|
||||
pcStatusMessage = "Error: EventGroup";
|
||||
}
|
||||
|
@ -374,7 +387,7 @@ void *pvAllocated;
|
|||
xMutexToDelete = NULL;
|
||||
}
|
||||
|
||||
/* Exercise heap_4 a bit. The malloc failed hook will trap failed
|
||||
/* 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 );
|
||||
vPortFree( pvAllocated );
|
||||
|
@ -402,6 +415,12 @@ void vFullDemoTickHookFunction( void )
|
|||
|
||||
/* Exercise event groups from interrupts. */
|
||||
vPeriodicEventGroupsProcessing();
|
||||
|
||||
/* Exercise giving mutexes from an interrupt. */
|
||||
vInterruptSemaphorePeriodicTest();
|
||||
|
||||
/* Exercise using task notifications from an interrupt. */
|
||||
xNotifyTaskFromISR();
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
|
5
FreeRTOS/Demo/links_to_doc_pages_for_these_demos.url
Normal file
5
FreeRTOS/Demo/links_to_doc_pages_for_these_demos.url
Normal file
|
@ -0,0 +1,5 @@
|
|||
[{000214A0-0000-0000-C000-000000000046}]
|
||||
Prop3=19,2
|
||||
[InternetShortcut]
|
||||
URL=http://www.freertos.org/a00090.html
|
||||
IDList=
|
|
@ -1,3 +1,6 @@
|
|||
Links to a documentation page for each demo are provided on the following
|
||||
URL: http://www.freertos.org/a00090.html
|
||||
|
||||
Each RTOS port has a demo application to demonstrate it's use.
|
||||
|
||||
+ The Demo/Common directory contains the demo application files as described on
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue