mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-08-18 09:08:33 -04:00
Add FreeRTOS-Plus directory.
This commit is contained in:
parent
7bd5f21ad5
commit
f508a5f653
6798 changed files with 134949 additions and 19 deletions
|
@ -0,0 +1,396 @@
|
|||
/*
|
||||
FreeRTOS V7.1.1 - Copyright (C) 2012 Real Time Engineers Ltd.
|
||||
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||
* Complete, revised, and edited pdf reference manuals are also *
|
||||
* available. *
|
||||
* *
|
||||
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||
* ensuring you get running as quickly as possible and with an *
|
||||
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||
* the FreeRTOS project to continue with its mission of providing *
|
||||
* professional grade, cross platform, de facto standard solutions *
|
||||
* for microcontrollers - completely free of charge! *
|
||||
* *
|
||||
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||
* *
|
||||
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
|
||||
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. See the GNU General Public License for
|
||||
more details. You should have received a copy of the GNU General Public
|
||||
License and the FreeRTOS license exception along with FreeRTOS; if not it
|
||||
can be viewed here: http://www.freertos.org/a00114.html and also obtained
|
||||
by writing to Richard Barry, contact details for whom are available on the
|
||||
FreeRTOS WEB site.
|
||||
|
||||
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, training, latest information,
|
||||
license and contact details.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool.
|
||||
|
||||
Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell
|
||||
the code with commercial support, indemnification, and middleware, under
|
||||
the OpenRTOS brand: http://www.OpenRTOS.com. High Integrity Systems also
|
||||
provide a safety engineered and independently SIL3 certified version under
|
||||
the SafeRTOS brand: http://www.SafeRTOS.com.
|
||||
*/
|
||||
|
||||
/* FreeRTOS includes. */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
/* FreeRTOS+CLI includes. */
|
||||
#include "FreeRTOS_CLI.h"
|
||||
|
||||
/* FreeRTOS+Trace includes. */
|
||||
#include "trcUser.h"
|
||||
|
||||
/*
|
||||
* Defines a command that returns a table showing the state of each task at the
|
||||
* time the command is called.
|
||||
*/
|
||||
static portBASE_TYPE prvTaskStatsCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString );
|
||||
|
||||
/*
|
||||
* Defines a command that returns a table showing how much time each task has
|
||||
* spent in the Running state.
|
||||
*/
|
||||
static portBASE_TYPE prvRunTimeStatsCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString );
|
||||
|
||||
/*
|
||||
* Defines a command that expects exactly three parameters. Each of the three
|
||||
* parameter are echoed back one at a time.
|
||||
*/
|
||||
static portBASE_TYPE prvThreeParameterEchoCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString );
|
||||
|
||||
/*
|
||||
* Defines a command that can take a variable number of parameters. Each
|
||||
* parameter is echoes back one at a time.
|
||||
*/
|
||||
static portBASE_TYPE prvParameterEchoCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString );
|
||||
|
||||
/*
|
||||
* Defines a command that starts/stops events being recorded for offline viewing
|
||||
* in FreeRTOS+Trace.
|
||||
*/
|
||||
static portBASE_TYPE prvStartStopTraceCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString );
|
||||
|
||||
/* Structure that defines the "run-time-stats" command line command. */
|
||||
static const CLI_Command_Definition_t xRunTimeStats =
|
||||
{
|
||||
( const int8_t * const ) "run-time-stats", /* The command string to type. */
|
||||
( const int8_t * const ) "run-time-stats: Displays a table showing how much processing time each FreeRTOS task has used\r\n",
|
||||
prvRunTimeStatsCommand, /* The function to run. */
|
||||
0 /* No parameters are expected. */
|
||||
};
|
||||
|
||||
/* Structure that defines the "task-stats" command line command. */
|
||||
static const CLI_Command_Definition_t xTaskStats =
|
||||
{
|
||||
( const int8_t * const ) "task-stats", /* The command string to type. */
|
||||
( const int8_t * const ) "task-stats: Displays a table showing the state of each FreeRTOS task\r\n",
|
||||
prvTaskStatsCommand, /* The function to run. */
|
||||
0 /* No parameters are expected. */
|
||||
};
|
||||
|
||||
/* Structure that defines the "echo_3_parameters" command line command. This
|
||||
takes exactly three parameters that the command simply echos back one at a
|
||||
time. */
|
||||
static const CLI_Command_Definition_t xThreeParameterEcho =
|
||||
{
|
||||
( const int8_t * const ) "echo_3_parameters",
|
||||
( const int8_t * const ) "echo_3_parameters: <param1> <param2> <param3> Expects three parameters, echos each in turn\r\n",
|
||||
prvThreeParameterEchoCommand, /* The function to run. */
|
||||
3 /* Three parameters are expected, which can take any value. */
|
||||
};
|
||||
|
||||
/* Structure that defines the "echo_parameters" command line command. This
|
||||
takes a variable number of parameters that the command simply echos back one at
|
||||
a time. */
|
||||
static const CLI_Command_Definition_t xParameterEcho =
|
||||
{
|
||||
( const int8_t * const ) "echo_parameters",
|
||||
( const int8_t * const ) "echo_parameters: <...> Take variable number of parameters, echos each in turn\r\n",
|
||||
prvParameterEchoCommand, /* The function to run. */
|
||||
-1 /* The user can enter any number of commands. */
|
||||
};
|
||||
|
||||
/* Structure that defines the "trace" command line command. This takes a single
|
||||
parameter, which can be either "start" or "stop". */
|
||||
static const CLI_Command_Definition_t xStartTrace =
|
||||
{
|
||||
( const int8_t * const ) "trace",
|
||||
( const int8_t * const ) "trace: [start | stop] Starts or stops a trace recording for viewing in FreeRTOS+Trace\r\n",
|
||||
prvStartStopTraceCommand, /* The function to run. */
|
||||
1 /* One parameter is expected. Valid values are "start" and "stop". */
|
||||
};
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vRegisterCLICommands( void )
|
||||
{
|
||||
/* Register all the command line commands defined immediately above. */
|
||||
FreeRTOS_CLIRegisterCommand( &xTaskStats );
|
||||
FreeRTOS_CLIRegisterCommand( &xRunTimeStats );
|
||||
FreeRTOS_CLIRegisterCommand( &xThreeParameterEcho );
|
||||
FreeRTOS_CLIRegisterCommand( &xParameterEcho );
|
||||
FreeRTOS_CLIRegisterCommand( &xStartTrace );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static portBASE_TYPE prvTaskStatsCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString )
|
||||
{
|
||||
const int8_t *const pcHeader = ( int8_t * ) "Task State Priority Stack #\r\n************************************************\r\n";
|
||||
|
||||
/* Remove compile time warnings about unused parameters, and check the
|
||||
write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
write buffer length is adequate, so does not check for buffer overflows. */
|
||||
( void ) pcCommandString;
|
||||
( void ) xWriteBufferLen;
|
||||
configASSERT( pcWriteBuffer );
|
||||
|
||||
/* Generate a table of task stats. */
|
||||
strcpy( ( char * ) pcWriteBuffer, ( char * ) pcHeader );
|
||||
vTaskList( pcWriteBuffer + strlen( ( char * ) pcHeader ) );
|
||||
|
||||
/* There is no more data to return after this single string, so return
|
||||
pdFALSE. */
|
||||
return pdFALSE;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static portBASE_TYPE prvRunTimeStatsCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString )
|
||||
{
|
||||
const int8_t * const pcHeader = ( int8_t * ) "Task Abs Time % Time\r\n****************************************\r\n";
|
||||
|
||||
/* Remove compile time warnings about unused parameters, and check the
|
||||
write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
write buffer length is adequate, so does not check for buffer overflows. */
|
||||
( void ) pcCommandString;
|
||||
( void ) xWriteBufferLen;
|
||||
configASSERT( pcWriteBuffer );
|
||||
|
||||
/* Generate a table of task stats. */
|
||||
strcpy( ( char * ) pcWriteBuffer, ( char * ) pcHeader );
|
||||
vTaskGetRunTimeStats( pcWriteBuffer + strlen( ( char * ) pcHeader ) );
|
||||
|
||||
/* There is no more data to return after this single string, so return
|
||||
pdFALSE. */
|
||||
return pdFALSE;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static portBASE_TYPE prvThreeParameterEchoCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString )
|
||||
{
|
||||
int8_t *pcParameter;
|
||||
portBASE_TYPE lParameterStringLength, xReturn;
|
||||
static portBASE_TYPE lParameterNumber = 0;
|
||||
|
||||
/* Remove compile time warnings about unused parameters, and check the
|
||||
write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
write buffer length is adequate, so does not check for buffer overflows. */
|
||||
( void ) pcCommandString;
|
||||
( void ) xWriteBufferLen;
|
||||
configASSERT( pcWriteBuffer );
|
||||
|
||||
if( lParameterNumber == 0 )
|
||||
{
|
||||
/* The first time the function is called after the command has been
|
||||
entered just a header string is returned. */
|
||||
sprintf( ( char * ) pcWriteBuffer, "The three parameters were:\r\n" );
|
||||
|
||||
/* Next time the function is called the first parameter will be echoed
|
||||
back. */
|
||||
lParameterNumber = 1L;
|
||||
|
||||
/* There is more data to be returned as no parameters have been echoed
|
||||
back yet. */
|
||||
xReturn = pdPASS;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Obtain the parameter string. */
|
||||
pcParameter = ( int8_t * ) FreeRTOS_CLIGetParameter
|
||||
(
|
||||
pcCommandString, /* The command string itself. */
|
||||
lParameterNumber, /* Return the next parameter. */
|
||||
&lParameterStringLength /* Store the parameter string length. */
|
||||
);
|
||||
|
||||
/* Sanity check something was returned. */
|
||||
configASSERT( pcParameter );
|
||||
|
||||
/* Return the parameter string. */
|
||||
memset( pcWriteBuffer, 0x00, xWriteBufferLen );
|
||||
sprintf( ( char * ) pcWriteBuffer, "%d: ", lParameterNumber );
|
||||
strncat( ( char * ) pcWriteBuffer, ( const char * ) pcParameter, lParameterStringLength );
|
||||
strncat( ( char * ) pcWriteBuffer, "\r\n", strlen( "\r\n" ) );
|
||||
|
||||
/* If this is the last of the three parameters then there are no more
|
||||
strings to return after this one. */
|
||||
if( lParameterNumber == 3L )
|
||||
{
|
||||
/* If this is the last of the three parameters then there are no more
|
||||
strings to return after this one. */
|
||||
xReturn = pdFALSE;
|
||||
lParameterNumber = 0L;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* There are more parameters to return after this one. */
|
||||
xReturn = pdTRUE;
|
||||
lParameterNumber++;
|
||||
}
|
||||
}
|
||||
|
||||
return xReturn;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static portBASE_TYPE prvParameterEchoCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString )
|
||||
{
|
||||
int8_t *pcParameter;
|
||||
portBASE_TYPE lParameterStringLength, xReturn;
|
||||
static portBASE_TYPE lParameterNumber = 0;
|
||||
|
||||
/* Remove compile time warnings about unused parameters, and check the
|
||||
write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
write buffer length is adequate, so does not check for buffer overflows. */
|
||||
( void ) pcCommandString;
|
||||
( void ) xWriteBufferLen;
|
||||
configASSERT( pcWriteBuffer );
|
||||
|
||||
if( lParameterNumber == 0 )
|
||||
{
|
||||
/* The first time the function is called after the command has been
|
||||
entered just a header string is returned. */
|
||||
sprintf( ( char * ) pcWriteBuffer, "The parameters were:\r\n" );
|
||||
|
||||
/* Next time the function is called the first parameter will be echoed
|
||||
back. */
|
||||
lParameterNumber = 1L;
|
||||
|
||||
/* There is more data to be returned as no parameters have been echoed
|
||||
back yet. */
|
||||
xReturn = pdPASS;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Obtain the parameter string. */
|
||||
pcParameter = ( int8_t * ) FreeRTOS_CLIGetParameter
|
||||
(
|
||||
pcCommandString, /* The command string itself. */
|
||||
lParameterNumber, /* Return the next parameter. */
|
||||
&lParameterStringLength /* Store the parameter string length. */
|
||||
);
|
||||
|
||||
if( pcParameter != NULL )
|
||||
{
|
||||
/* Return the parameter string. */
|
||||
memset( pcWriteBuffer, 0x00, xWriteBufferLen );
|
||||
sprintf( ( char * ) pcWriteBuffer, "%d: ", lParameterNumber );
|
||||
strncat( ( char * ) pcWriteBuffer, ( const char * ) pcParameter, lParameterStringLength );
|
||||
strncat( ( char * ) pcWriteBuffer, "\r\n", strlen( "\r\n" ) );
|
||||
|
||||
/* There might be more parameters to return after this one. */
|
||||
xReturn = pdTRUE;
|
||||
lParameterNumber++;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No more parameters were found. Make sure the write buffer does
|
||||
not contain a valid string. */
|
||||
pcWriteBuffer[ 0 ] = 0x00;
|
||||
|
||||
/* No more data to return. */
|
||||
xReturn = pdFALSE;
|
||||
|
||||
/* Start over the next time this command is executed. */
|
||||
lParameterNumber = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return xReturn;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static portBASE_TYPE prvStartStopTraceCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString )
|
||||
{
|
||||
int8_t *pcParameter;
|
||||
portBASE_TYPE lParameterStringLength;
|
||||
|
||||
/* Remove compile time warnings about unused parameters, and check the
|
||||
write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
write buffer length is adequate, so does not check for buffer overflows. */
|
||||
( void ) pcCommandString;
|
||||
( void ) xWriteBufferLen;
|
||||
configASSERT( pcWriteBuffer );
|
||||
|
||||
/* Obtain the parameter string. */
|
||||
pcParameter = ( int8_t * ) FreeRTOS_CLIGetParameter
|
||||
(
|
||||
pcCommandString, /* The command string itself. */
|
||||
1, /* Return the first parameter. */
|
||||
&lParameterStringLength /* Store the parameter string length. */
|
||||
);
|
||||
|
||||
/* Sanity check something was returned. */
|
||||
configASSERT( pcParameter );
|
||||
|
||||
/* There are only two valid parameter values. */
|
||||
if( strncmp( ( const char * ) pcParameter, "start", strlen( "start" ) ) == 0 )
|
||||
{
|
||||
/* Start or restart the trace. */
|
||||
vTraceStop();
|
||||
vTraceClear();
|
||||
vTraceStart();
|
||||
|
||||
sprintf( ( char * ) pcWriteBuffer, "Trace recording (re)started.\r\n" );
|
||||
}
|
||||
else if( strncmp( ( const char * ) pcParameter, "stop", strlen( "stop" ) ) == 0 )
|
||||
{
|
||||
/* End the trace, if one is running. */
|
||||
vTraceStop();
|
||||
sprintf( ( char * ) pcWriteBuffer, "Stopping trace recording.\r\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf( ( char * ) pcWriteBuffer, "Valid parameters are 'start' and 'stop'.\r\n" );
|
||||
}
|
||||
|
||||
/* There is no more data to return after this single string, so return
|
||||
pdFALSE. */
|
||||
return pdFALSE;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
|
@ -0,0 +1,155 @@
|
|||
/*
|
||||
FreeRTOS V7.1.1 - Copyright (C) 2012 Real Time Engineers Ltd.
|
||||
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||
* Complete, revised, and edited pdf reference manuals are also *
|
||||
* available. *
|
||||
* *
|
||||
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||
* ensuring you get running as quickly as possible and with an *
|
||||
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||
* the FreeRTOS project to continue with its mission of providing *
|
||||
* professional grade, cross platform, de facto standard solutions *
|
||||
* for microcontrollers - completely free of charge! *
|
||||
* *
|
||||
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||
* *
|
||||
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
|
||||
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. See the GNU General Public License for
|
||||
more details. You should have received a copy of the GNU General Public
|
||||
License and the FreeRTOS license exception along with FreeRTOS; if not it
|
||||
can be viewed here: http://www.freertos.org/a00114.html and also obtained
|
||||
by writing to Richard Barry, contact details for whom are available on the
|
||||
FreeRTOS WEB site.
|
||||
|
||||
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, training, latest information,
|
||||
license and contact details.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool.
|
||||
|
||||
Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell
|
||||
the code with commercial support, indemnification, and middleware, under
|
||||
the OpenRTOS brand: http://www.OpenRTOS.com. High Integrity Systems also
|
||||
provide a safety engineered and independently SIL3 certified version under
|
||||
the SafeRTOS brand: http://www.SafeRTOS.com.
|
||||
*/
|
||||
|
||||
#ifndef FREERTOS_CONFIG_H
|
||||
#define FREERTOS_CONFIG_H
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Application specific definitions.
|
||||
*
|
||||
* These definitions should be adjusted for your particular hardware and
|
||||
* application requirements.
|
||||
*
|
||||
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
|
||||
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
|
||||
* http://www.freertos.org/a00110.html
|
||||
*----------------------------------------------------------*/
|
||||
|
||||
#define configUSE_PREEMPTION 1
|
||||
#define configUSE_IDLE_HOOK 1
|
||||
#define configUSE_TICK_HOOK 0
|
||||
#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 ) 60 ) /* 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 ) 0 ) /* This parameter has no effect when heap_3.c is included in the project. */
|
||||
#define configMAX_TASK_NAME_LEN ( 7 )
|
||||
#define configUSE_TRACE_FACILITY 1
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
#define configIDLE_SHOULD_YIELD 1
|
||||
#define configUSE_CO_ROUTINES 0
|
||||
#define configUSE_MUTEXES 1
|
||||
#define configCHECK_FOR_STACK_OVERFLOW 0 /* Not applicable to the Win32 port. */
|
||||
#define configUSE_RECURSIVE_MUTEXES 1
|
||||
#define configQUEUE_REGISTRY_SIZE 0
|
||||
#define configUSE_MALLOC_FAILED_HOOK 0
|
||||
#define configUSE_APPLICATION_TASK_TAG 0
|
||||
#define configUSE_COUNTING_SEMAPHORES 1
|
||||
#define configUSE_ALTERNATIVE_API 0
|
||||
|
||||
#define configUSE_TIMERS 1
|
||||
#define configTIMER_TASK_PRIORITY 2
|
||||
#define configTIMER_QUEUE_LENGTH 20
|
||||
#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE * 2 )
|
||||
|
||||
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 7 )
|
||||
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
|
||||
|
||||
|
||||
/* Co-routine definitions. */
|
||||
#define configUSE_CO_ROUTINES 0
|
||||
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
|
||||
|
||||
/* Set the following definitions to 1 to include the API function, or zero
|
||||
to exclude the API function. */
|
||||
|
||||
#define INCLUDE_vTaskPrioritySet 1
|
||||
#define INCLUDE_uxTaskPriorityGet 1
|
||||
#define INCLUDE_vTaskDelete 1
|
||||
#define INCLUDE_vTaskCleanUpResources 0
|
||||
#define INCLUDE_vTaskSuspend 1
|
||||
#define INCLUDE_vTaskDelayUntil 1
|
||||
#define INCLUDE_vTaskDelay 1
|
||||
#define INCLUDE_uxTaskGetStackHighWaterMark 1
|
||||
#define INCLUDE_xTaskGetSchedulerState 1
|
||||
|
||||
/* Run time stats gathering definitions. */
|
||||
unsigned long ulGetRunTimeCounterValue( void );
|
||||
void vConfigureTimerForRunTimeStats( void );
|
||||
#define configGENERATE_RUN_TIME_STATS 1
|
||||
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() vConfigureTimerForRunTimeStats()
|
||||
#define portGET_RUN_TIME_COUNTER_VALUE() ulGetRunTimeCounterValue()
|
||||
|
||||
extern void vAssertCalled( void );
|
||||
#define configASSERT( x ) if( ( x ) == 0 ) vAssertCalled()
|
||||
|
||||
/* The UDP port to use for incoming command inputs. The outgoing port is
|
||||
set to ( configUDP_CLI_PORT_NUMBER + 1 ). */
|
||||
#define configUDP_CLI_PORT_NUMBER 5001
|
||||
|
||||
/* The size of the global output buffer that is available for use when there
|
||||
are multiple command interpreters running at once (for example, one on a UART
|
||||
and one on TCP/IP). This is done to prevent an output buffer being defined by
|
||||
each implementation - which would waste RAM. In this case, there is only one
|
||||
command interpreter running, and it has its own local output buffer, so the
|
||||
global buffer is just set to be one byte long as it is not used and should not
|
||||
take up unnecessary RAM. */
|
||||
#define configCOMMAND_INT_MAX_OUTPUT_SIZE 1
|
||||
|
||||
|
||||
/* Include the FreeRTOS+Trace FreeRTOS trace macro definitions. */
|
||||
#include "trcHooks.h"
|
||||
|
||||
|
||||
#endif /* FREERTOS_CONFIG_H */
|
|
@ -0,0 +1,20 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual C++ Express 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WIN32", "WIN32.vcxproj", "{C686325E-3261-42F7-AEB1-DDE5280E1CEB}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{C686325E-3261-42F7-AEB1-DDE5280E1CEB}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{C686325E-3261-42F7-AEB1-DDE5280E1CEB}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{C686325E-3261-42F7-AEB1-DDE5280E1CEB}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{C686325E-3261-42F7-AEB1-DDE5280E1CEB}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
Binary file not shown.
|
@ -0,0 +1,132 @@
|
|||
/*
|
||||
FreeRTOS V7.1.1 - Copyright (C) 2012 Real Time Engineers Ltd.
|
||||
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||
* Complete, revised, and edited pdf reference manuals are also *
|
||||
* available. *
|
||||
* *
|
||||
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||
* ensuring you get running as quickly as possible and with an *
|
||||
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||
* the FreeRTOS project to continue with its mission of providing *
|
||||
* professional grade, cross platform, de facto standard solutions *
|
||||
* for microcontrollers - completely free of charge! *
|
||||
* *
|
||||
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||
* *
|
||||
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
|
||||
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. See the GNU General Public License for
|
||||
more details. You should have received a copy of the GNU General Public
|
||||
License and the FreeRTOS license exception along with FreeRTOS; if not it
|
||||
can be viewed here: http://www.freertos.org/a00114.html and also obtained
|
||||
by writing to Richard Barry, contact details for whom are available on the
|
||||
FreeRTOS WEB site.
|
||||
|
||||
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, training, latest information,
|
||||
license and contact details.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool.
|
||||
|
||||
Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell
|
||||
the code with commercial support, indemnification, and middleware, under
|
||||
the OpenRTOS brand: http://www.OpenRTOS.com. High Integrity Systems also
|
||||
provide a safety engineered and independently SIL3 certified version under
|
||||
the SafeRTOS brand: http://www.SafeRTOS.com.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Utility functions required to gather run time statistics. See:
|
||||
* http://www.freertos.org/rtos-run-time-stats.html
|
||||
*
|
||||
* Note that this is a simulated port, where simulated time is a lot slower than
|
||||
* real time, therefore the run time counter values have no real meaningful
|
||||
* units.
|
||||
*
|
||||
* Also note that it is assumed this demo is going to be used for short periods
|
||||
* of time only, and therefore timer overflows are not handled.
|
||||
*/
|
||||
|
||||
/* FreeRTOS includes. */
|
||||
#include <FreeRTOS.h>
|
||||
|
||||
/* FreeRTOS+Trace includes. */
|
||||
#include "trcUser.h"
|
||||
|
||||
/* Variables used in the creation of the run time stats time base. Run time
|
||||
stats record how much time each task spends in the Running state. */
|
||||
static long long llInitialRunTimeCounterValue = 0LL, llTicksPerHundedthMillisecond = 0LL;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vConfigureTimerForRunTimeStats( void )
|
||||
{
|
||||
LARGE_INTEGER liPerformanceCounterFrequency, liInitialRunTimeValue;
|
||||
|
||||
/* Initialise the variables used to create the run time stats time base.
|
||||
Run time stats record how much time each task spends in the Running
|
||||
state. */
|
||||
|
||||
if( QueryPerformanceFrequency( &liPerformanceCounterFrequency ) == 0 )
|
||||
{
|
||||
llTicksPerHundedthMillisecond = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* How many times does the performance counter increment in 1/100th
|
||||
millisecond. */
|
||||
llTicksPerHundedthMillisecond = liPerformanceCounterFrequency.QuadPart / 100000LL;
|
||||
|
||||
/* What is the performance counter value now, this will be subtracted
|
||||
from readings taken at run time. */
|
||||
QueryPerformanceCounter( &liInitialRunTimeValue );
|
||||
llInitialRunTimeCounterValue = liInitialRunTimeValue.QuadPart;
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
unsigned long ulGetRunTimeCounterValue( void )
|
||||
{
|
||||
LARGE_INTEGER liCurrentCount;
|
||||
unsigned long ulReturn;
|
||||
|
||||
/* What is the performance counter value now? */
|
||||
QueryPerformanceCounter( &liCurrentCount );
|
||||
|
||||
/* Subtract the performance counter value reading taken when the
|
||||
application started to get a count from that reference point, then
|
||||
scale to (simulated) 1/100ths of a millisecond. */
|
||||
ulReturn = ( unsigned long ) ( ( liCurrentCount.QuadPart - llInitialRunTimeCounterValue ) / llTicksPerHundedthMillisecond );
|
||||
|
||||
return ulReturn;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
|
@ -0,0 +1,415 @@
|
|||
/*******************************************************************************
|
||||
* FreeRTOS+Trace v2.2.2 Recorder Library
|
||||
* Percepio AB, www.percepio.se
|
||||
*
|
||||
* 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
|
||||
* overapproximated, although larger values values implies more RAM usage.
|
||||
*
|
||||
* Terms of Use
|
||||
* This software is copyright Percepio AB. The recorder library is free for
|
||||
* use together with Percepio products. You may distribute the recorder library
|
||||
* in its original form, including modifications in trcPort.c and trcPort.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
|
||||
* 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
|
||||
* implied warranty may last, so the above limitations may not apply to you.
|
||||
*
|
||||
* FreeRTOS+Trace is available as Free Edition and in two premium editions.
|
||||
* You may use the premium features during 30 days for evaluation.
|
||||
* Download FreeRTOS+Trace at http://www.percepio.se/index.php?page=downloads
|
||||
*
|
||||
* Copyright Percepio AB, 2012.
|
||||
* www.percepio.se
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef TRCCONFIG_H
|
||||
#define TRCCONFIG_H
|
||||
|
||||
/*******************************************************************************
|
||||
* CONFIGURATION RELATED TO CAPACITY AND ALLOCATION
|
||||
******************************************************************************/
|
||||
|
||||
/*******************************************************************************
|
||||
* EVENT_BUFFER_SIZE
|
||||
*
|
||||
* 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.
|
||||
******************************************************************************/
|
||||
|
||||
#if WIN32
|
||||
#define EVENT_BUFFER_SIZE 3000
|
||||
#else
|
||||
#define EVENT_BUFFER_SIZE 1000 /* Adjust wrt. to available RAM */
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
* 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
|
||||
* 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 zero (0) to minimize RAM usage.
|
||||
******************************************************************************/
|
||||
#define SYMBOL_TABLE_SIZE 1000
|
||||
|
||||
/*******************************************************************************
|
||||
* 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 FreeRTOS+Trace. 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).
|
||||
*
|
||||
* NOTE 2: If you include the monitor task (USE_TRACE_PROGRESS_MONITOR_TASK)
|
||||
* make sure to dimension NTask with this task accounted for.
|
||||
*
|
||||
* Also remember to account for all tasks created by FreeRTOS, such as the
|
||||
* IDLE task, the FreeRTOS timer task, 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 "task" that
|
||||
* represent the time before the first task starts. NTask should thus be at
|
||||
* least 2-3 slots larger than your application task count.
|
||||
*
|
||||
* NOTE 3: The FreeRTOS timer task creates a Queue, that should be accounted
|
||||
* for in NQueue.
|
||||
******************************************************************************/
|
||||
#define NTask 15
|
||||
#define NISR 4
|
||||
#define NQueue 3
|
||||
#define NSemaphore 4
|
||||
#define NMutex 2
|
||||
|
||||
/* Maximum object name length for each class (includes zero termination) */
|
||||
#define NameLenTask configMAX_TASK_NAME_LEN
|
||||
#define NameLenISR 10
|
||||
#define NameLenQueue 15
|
||||
#define NameLenSemaphore 15
|
||||
#define NameLenMutex 15
|
||||
|
||||
/******************************************************************************
|
||||
* TRACE_DESCRIPTION
|
||||
*
|
||||
* Macro which should be defined as a string.
|
||||
*
|
||||
* This string is stored in the trace and displayed in FreeRTOS+Trace. 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 "FreeRTOS+Trace Demo"
|
||||
|
||||
/******************************************************************************
|
||||
* 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
|
||||
*****************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* 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 FreeRTOS+Trace Standard Edition or Professional Edition is required
|
||||
* for User Events, they are not displayed in FreeRTOS+Trace Free Edition.
|
||||
*****************************************************************************/
|
||||
#define INCLUDE_USER_EVENTS 1
|
||||
|
||||
/*****************************************************************************
|
||||
* 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, recording ISRs require that you insert
|
||||
* calls to vTraceStoreISRBegin and vTraceStoreISREnd in your interrupt handlers.
|
||||
* There is no automatic recording of ISRs like for task scheduling, since
|
||||
* FreeRTOS does not have a central interrupt dispatcher.
|
||||
*****************************************************************************/
|
||||
#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, e.g., using vTaskDelete or
|
||||
* vQueueDelete. If no deletes are made, this can be set to 0 in order to
|
||||
* exclude the delete-handling code.
|
||||
*****************************************************************************/
|
||||
#define INCLUDE_OBJECT_DELETE 1
|
||||
|
||||
/******************************************************************************
|
||||
* CONFIGURATION RELATED TO BEHAVIOR
|
||||
*****************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* RECORDER_STORE_MODE
|
||||
*
|
||||
* Macro which should be defined as one of:
|
||||
* - STORE_MODE_RING_BUFFER
|
||||
* - STORE_MODE_STOP_WHEN_FULL
|
||||
* Default is STORE_MODE_RING_BUFFER.
|
||||
*
|
||||
* With RECORDER_STORE_MODE set to 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 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
|
||||
* FreeRTOS 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 RECORDER_STORE_MODE is 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.
|
||||
*****************************************************************************/
|
||||
#ifndef WIN32
|
||||
#define RECORDER_STORE_MODE STORE_MODE_RING_BUFFER
|
||||
#else
|
||||
/* Default in the Win32 demo */
|
||||
#define RECORDER_STORE_MODE STORE_MODE_STOP_WHEN_FULL
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
* 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. FreeRTOS+Trace 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 following FreeRTOS kernel calls
|
||||
* are considered by default to be IFEs (Implicit IFEs):
|
||||
* - vTaskDelay
|
||||
* - vTaskDelayUntil
|
||||
* - vTaskSuspend
|
||||
* - xQueueReceive (blocking cases only)
|
||||
* - xSemaphoreTake (blocking cases only)
|
||||
*
|
||||
* However, Implicit IFEs only applies to blocking kernel calls. If an
|
||||
* xQueueReceive 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 such as
|
||||
* xQueueSend or xSemaphoreGive. 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 like
|
||||
* vTaskDelay, 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
|
||||
|
||||
/******************************************************************************
|
||||
* INCLUDE_SAVE_TO_FILE
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
* Default is 0.
|
||||
*
|
||||
* If enabled (1), the recorder will include code for saving the trace
|
||||
* to a local file system.
|
||||
******************************************************************************/
|
||||
#ifdef WIN32
|
||||
#define INCLUDE_SAVE_TO_FILE 1
|
||||
#else
|
||||
#define INCLUDE_SAVE_TO_FILE 0
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
* TRACE_PROGRESS_MONITOR_TASK_PRIORITY
|
||||
*
|
||||
* Macro which sets the priority of the "recorder status monitor" task.
|
||||
*
|
||||
* This task, vTraceMonitorTask in trcUser.c, periodically writes
|
||||
* the recorder status using the vTraceConsoleMessage macro, which is to
|
||||
* be mapped to your console "printf" routine. The task is named TraceMon but
|
||||
* is intentionally excluded from the demo trace.
|
||||
*
|
||||
* Default is tskIDLE_PRIORITY + 1
|
||||
* Note that if your system constantly has a high CPU load from high-priority
|
||||
* tasks, this might not be get a chance to execute.
|
||||
*
|
||||
* See vTraceMonitorTask in trcUser.c
|
||||
*****************************************************************************/
|
||||
#define TRACE_PROGRESS_MONITOR_TASK_PRIORITY (tskIDLE_PRIORITY + 1)
|
||||
|
||||
/******************************************************************************
|
||||
* TRACE_PROGRESS_MONITOR_TASK_STACKSIZE
|
||||
*
|
||||
* Macro which sets the stack size of the "recorder status monitor" task.
|
||||
*
|
||||
* This task, vTraceMonitorTask in trcUser.c, periodically writes
|
||||
* the recorder status using the vTraceConsoleMessage macro, which is to
|
||||
* be mapped to your console "printf" routine. The task is intentionally
|
||||
* excluded from the demo trace.
|
||||
*
|
||||
* See vTraceMonitorTask in trcUser.c
|
||||
*****************************************************************************/
|
||||
#define TRACE_PROGRESS_MONITOR_TASK_STACKSIZE 500
|
||||
|
||||
/******************************************************************************
|
||||
* TRACE_PROGRESS_MONITOR_TASK_PERIOD
|
||||
*
|
||||
* Macro which sets the period of the "recorder status monitor" task.
|
||||
*
|
||||
* This task, vTraceMonitorTask in trcUser.c, periodically writes
|
||||
* the recorder status using the vTraceConsoleMessage macro, which is to
|
||||
* be mapped to your console "printf" routine. The task is named TraceMon but
|
||||
* is intentionally excluded from the demo trace.
|
||||
*
|
||||
* Default is 1000 FreeRTOS ticks (typically 1 second). On the Windows port, a
|
||||
* lower value is suggested since the Windows port runs very slowly, often 20-40
|
||||
* times slower than the simulated FreeRTOS time.
|
||||
*
|
||||
* See vTraceMonitorTask in trcUser.c
|
||||
*****************************************************************************/
|
||||
#if WIN32
|
||||
#define TRACE_PROGRESS_MONITOR_TASK_PERIOD 100
|
||||
#else
|
||||
#define TRACE_PROGRESS_MONITOR_TASK_PERIOD 1000
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
* TEAM_LICENSE_CODE
|
||||
*
|
||||
* Macro which defines a string - the team license code.
|
||||
* If no team license is available, this should be an empty string "".
|
||||
* This should be maximum 32 chars, including zero-termination.
|
||||
*****************************************************************************/
|
||||
#define TEAM_LICENSE_CODE ""
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,419 @@
|
|||
/*******************************************************************************
|
||||
* FreeRTOS+Trace v2.2.2 Recorder Library
|
||||
* Percepio AB, www.percepio.se
|
||||
*
|
||||
* trcPort.h
|
||||
*
|
||||
* Contains together with trcPort.c all portability issues of the trace recorder
|
||||
* library.
|
||||
*
|
||||
* Terms of Use
|
||||
* This software is copyright Percepio AB. The recorder library is free for
|
||||
* use together with Percepio products. You may distribute the recorder library
|
||||
* in its original form, including modifications in trcPort.c and trcPort.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
|
||||
* 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
|
||||
* implied warranty may last, so the above limitations may not apply to you.
|
||||
*
|
||||
* FreeRTOS+Trace is available as Free Edition and in two premium editions.
|
||||
* You may use the premium features during 30 days for evaluation.
|
||||
* Download FreeRTOS+Trace at http://www.percepio.se/index.php?page=downloads
|
||||
*
|
||||
* Copyright Percepio AB, 2012.
|
||||
* www.percepio.se
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef TRCPORT_H
|
||||
#define TRCPORT_H
|
||||
|
||||
#include "trcBase.h"
|
||||
|
||||
/* If FreeRTOS Win32 port */
|
||||
#ifdef WIN32
|
||||
|
||||
#undef _WIN32_WINNT
|
||||
#define _WIN32_WINNT 0x0600
|
||||
|
||||
/* Standard includes. */
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#include <direct.h>
|
||||
|
||||
/*******************************************************************************
|
||||
* The Win32 port by default saves the trace to file and then kills the
|
||||
* program when the recorder is stopped, to facilitate quick, simple tests
|
||||
* of the recorder.
|
||||
******************************************************************************/
|
||||
#define WIN32_PORT_SAVE_WHEN_STOPPED 1
|
||||
#define WIN32_PORT_EXIT_WHEN_STOPPED 1
|
||||
|
||||
#endif
|
||||
|
||||
#define DIRECTION_INCREMENTING 1
|
||||
#define DIRECTION_DECREMENTING 2
|
||||
|
||||
/******************************************************************************
|
||||
* Supported ports
|
||||
*
|
||||
* PORT_HWIndependent
|
||||
* A hardware independent fallback option for event timestamping. Provides low
|
||||
* resolution timestamps based on the OS tick.
|
||||
* This may be used on the Win32 port, but may also be used on embedded hardware
|
||||
* platforms. Note that this gives suboptimal display in FreeRTOS+Trace. All
|
||||
* time durations will be truncated to the OS tick frequency, typically 1 KHz.
|
||||
* This means that a task or ISR that executes in less than 1 ms get an exection
|
||||
* time of zero. They are however still visible in FreeRTOS+Trace.
|
||||
*
|
||||
* PORT_Win32
|
||||
* "Accurate" timestamping based on the Windows permance counter. Note that
|
||||
* this gives the host machine time, not the simulated FreeRTOS time (tick
|
||||
* count). The timing of the Win32 FreeRTOS build is not real-time, since it
|
||||
* depends on the scheduling and tick rate of Windows, which is very slow.
|
||||
*
|
||||
* Officially supported hardware specific ports included are:
|
||||
* - PORT_Atmel_AT91SAM7
|
||||
* - PORT_ARM_CortexM
|
||||
* - PORT_Renesas_RX600
|
||||
*
|
||||
* We also provide several "unofficial" hardware-specific ports. There have
|
||||
* been developed by external contributors, and have not yet been verified
|
||||
* by Percepio AB. Let us know if you have problems getting these to work.
|
||||
*
|
||||
* Unoffical hardware specific ports provided are:
|
||||
* - PORT_TEXAS_INSTRUMENTS_TMS570
|
||||
* - PORT_TEXAS_INSTRUMENTS_MSP430
|
||||
* - PORT_MICROCHIP_PIC32
|
||||
* - PORT_MICROCHIP_dsPIC_AND_PIC24
|
||||
* - PORT_XILINX_PPC405
|
||||
* - PORT_XILINX_PPC440
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#define PORT_NOT_SET -1
|
||||
|
||||
/* Officially supported ports */
|
||||
#define PORT_HWIndependent 0
|
||||
#define PORT_Win32 1
|
||||
#define PORT_Atmel_AT91SAM7 2
|
||||
#define PORT_ARM_CortexM 3
|
||||
#define PORT_Renesas_RX600 4
|
||||
|
||||
/* Unofficial ports, provided by external developers and not yet verified */
|
||||
#define PORT_TEXAS_INSTRUMENTS_TMS570 6
|
||||
#define PORT_TEXAS_INSTRUMENTS_MSP430 7
|
||||
#define PORT_MICROCHIP_PIC32 8
|
||||
#define PORT_MICROCHIP_dsPIC_AND_PIC24 9
|
||||
#define PORT_XILINX_PPC405 10
|
||||
#define PORT_XILINX_PPC440 11
|
||||
|
||||
/*** Select your port here! **************************************************/
|
||||
#define SELECTED_PORT PORT_Win32
|
||||
/*****************************************************************************/
|
||||
|
||||
/*******************************************************************************
|
||||
* IRQ_PRIORITY_ORDER
|
||||
*
|
||||
* Macro which should be defined as an integer of 0 or 1.
|
||||
*
|
||||
* This should be 0 if lower irq priority values implies higher priority
|
||||
* levels, such as on ARM Cortex M. If the opposite scheme is used, i.e.,
|
||||
* if higher irq priority values means higher priority, this should be 1.
|
||||
*
|
||||
* This setting is not critical. It is used only to sort and colorize the
|
||||
* interrupts in priority order, in case you record interrupts using
|
||||
* the vTraceStoreISRBegin and vTraceStoreISREnd routines.
|
||||
*
|
||||
* We provide this setting for some hardware architectures below:
|
||||
* - ARM Cortex M: 0 (lower irq priority values are more significant)
|
||||
* - Atmel AT91SAM7x: 1 (higher irq priority values are more significant)
|
||||
* - Renesas RX62N: 1 (higher irq priority values are more significant)
|
||||
* - Microchip PIC24: 0 (lower irq priority values are more significant)
|
||||
* - Microchip dsPIC: 0 (lower irq priority values are more significant)
|
||||
* - TI TMS570 (ARM Cortex R4F): 0 (lower irq priority values are more significant)
|
||||
* - Freescale HCS08: 0 (lower irq priority values are more significant)
|
||||
* - Freescale HCS12: 0 (lower irq priority values are more significant)
|
||||
* - Freescale ColdFire: 1 (higher irq priority values are more significant)
|
||||
*
|
||||
* If your chip is not on the above list, and you perhaps know this detail by
|
||||
* heart, please inform us by e-mail to support@percepio.se.
|
||||
******************************************************************************/
|
||||
#define IRQ_PRIORITY_ORDER 0
|
||||
|
||||
/*******************************************************************************
|
||||
* HWTC macros
|
||||
*
|
||||
* These four macros provides a hardware isolation layer, representing a
|
||||
* generic hardware timer/counter used for driving the operating system tick,
|
||||
* such as the SysTick feature of ARM Cortex M3/M4, or the PIT of the Atmel
|
||||
* AT91SAM7X.
|
||||
*
|
||||
* HWTC_COUNT: The current value of the counter. This is expected to be reset
|
||||
* a each tick interrupt. Thus, when the tick handler starts, the counter has
|
||||
* already wrapped.
|
||||
*
|
||||
* HWTC_COUNT_DIRECTION: Should be one of:
|
||||
* - DIRECTION_INCREMENTING - for hardware timer/counters of incrementing type
|
||||
* such as the PIT on Atmel AT91SAM7X.
|
||||
* When the counter value reach HWTC_PERIOD, it is reset to zero and the
|
||||
* interrupt is signaled.
|
||||
* - DIRECTION_DECREMENTING - for hardware timer/counters of decrementing type
|
||||
* such as the SysTick on ARM Cortex M3/M4 chips.
|
||||
* When the counter value reach 0, it is reset to HWTC_PERIOD and the
|
||||
* interrupt is signaled.
|
||||
*
|
||||
* HWTC_PERIOD: The number of increments or decrements of HWTC_COUNT between
|
||||
* two tick interrupts. This should preferably be mapped to the reload
|
||||
* register of the hardware timer, to make it more portable between chips in the
|
||||
* same family. The macro should in most cases be (reload register + 1).
|
||||
*
|
||||
* HWTC_DIVISOR: If the timer frequency is very high, like on the Cortex M chips
|
||||
* (where the SysTick runs at the core clock frequency), the "differential
|
||||
* timestamping" used in the recorder will more frequently insert extra XTS
|
||||
* events to store the timestamps, which increases the event buffer usage.
|
||||
* In such cases, to reduce the number of XTS events and thereby get a longer
|
||||
* traces, you use HWTC_DIVISOR to scale down the timestamps and frequency.
|
||||
* Assuming a OS tick rate of 1 KHz, it is suggested to keep the effective timer
|
||||
* frequency below 65 MHz to avoid an excessive amount of XTS events. Thus, a
|
||||
* Cortex M chip running at 72 MHZ should use a HWTC_DIVISOR of 2, while a
|
||||
* faster chip require a higher HWTC_DIVISOR value.
|
||||
*
|
||||
* The HWTC macros and uiTracePortGetTimeStamp is the main porting issue
|
||||
* or the trace recorder library. Typically you should not need to change
|
||||
* the code of uiTracePortGetTimeStamp if using the HWTC macros.
|
||||
*
|
||||
* OFFER FROM PERCEPIO:
|
||||
* For silicon companies and non-corporate FreeRTOS users (researchers, students,
|
||||
* hobbyists or early-phase startups) we have an attractive offer:
|
||||
* Provide a hardware timer port and get a FREE single-user licence for
|
||||
* FreeRTOS+Trace Professional Edition. Read more about this offer at
|
||||
* www.percepio.se or contact us directly at support@percepio.se.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#if (SELECTED_PORT == PORT_Win32)
|
||||
|
||||
#define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING
|
||||
#define HWTC_COUNT (ulGetRunTimeCounterValue())
|
||||
#define HWTC_PERIOD 0
|
||||
#define HWTC_DIVISOR 1
|
||||
|
||||
#elif (SELECTED_PORT == PORT_HWIndependent)
|
||||
|
||||
#define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING
|
||||
#define HWTC_COUNT 0
|
||||
#define HWTC_PERIOD 1
|
||||
#define HWTC_DIVISOR 1
|
||||
|
||||
#elif (SELECTED_PORT == PORT_Atmel_AT91SAM7)
|
||||
|
||||
/* HWTC_PERIOD is hardcoded for AT91SAM7X256-EK Board (48 MHz)
|
||||
A more generic solution is to get the period from pxPIT->PITC_PIMR */
|
||||
|
||||
#define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING
|
||||
#define HWTC_COUNT (AT91C_BASE_PITC->PITC_PIIR & 0xFFFFF)
|
||||
#define HWTC_PERIOD 2995
|
||||
#define HWTC_DIVISOR 1
|
||||
|
||||
#elif (SELECTED_PORT == PORT_ARM_CortexM)
|
||||
|
||||
/* For all chips using ARM Cortex M cores */
|
||||
|
||||
#define HWTC_COUNT_DIRECTION DIRECTION_DECREMENTING
|
||||
#define HWTC_COUNT (*((uint32_t*)0xE000E018))
|
||||
#define HWTC_PERIOD ((*(uint32_t*)0xE000E014) + 1)
|
||||
#define HWTC_DIVISOR 2
|
||||
|
||||
#elif (SELECTED_PORT == PORT_Renesas_RX600)
|
||||
|
||||
#include "iodefine.h"
|
||||
|
||||
#define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING
|
||||
#define HWTC_COUNT (CMT0.CMCNT)
|
||||
#define HWTC_PERIOD ((((configPERIPHERAL_CLOCK_HZ/configTICK_RATE_HZ)-1)/8))
|
||||
#define HWTC_DIVISOR 1
|
||||
|
||||
#elif (SELECTED_PORT == PORT_TEXAS_INSTRUMENTS_TMS570) /* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */
|
||||
|
||||
#define RTIFRC0 *((uint32_t *)0xFFFFFC10)
|
||||
#define RTICOMP0 *((uint32_t *)0xFFFFFC50)
|
||||
#define RTIUDCP0 *((uint32_t *)0xFFFFFC54)
|
||||
#define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING
|
||||
#define HWTC_COUNT (RTIFRC0 - (RTICOMP0 - RTIUDCP0))
|
||||
#define HWTC_PERIOD (RTIUDCP0)
|
||||
#define HWTC_DIVISOR 1
|
||||
|
||||
#elif (SELECTED_PORT == PORT_TEXAS_INSTRUMENTS_MSP430)
|
||||
/* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */
|
||||
|
||||
#define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING
|
||||
#define HWTC_COUNT (TA0R)
|
||||
#define HWTC_PERIOD configCPU_CLOCKS_PER_TICK
|
||||
#define HWTC_DIVISOR 1
|
||||
|
||||
#elif (SELECTED_PORT == PORT_MICROCHIP_PIC32)
|
||||
/* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */
|
||||
|
||||
#define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING
|
||||
#define HWTC_COUNT (ReadTimer1()) /* Should be available in BSP */
|
||||
#define HWTC_PERIOD (ReadPeriod1()+1) /* Should be available in BSP */
|
||||
#define HWTC_DIVISOR 1
|
||||
|
||||
#elif (SELECTED_PORT == PORT_MICROCHIP_dsPIC_AND_PIC24)
|
||||
/* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */
|
||||
|
||||
#define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING
|
||||
#define HWTC_COUNT (PR1)
|
||||
#define HWTC_PERIOD ((configCPU_CLOCK_HZ/portTIMER_PRESCALE)/configTICK_RATE_HZ)
|
||||
#define HWTC_DIVISOR 1
|
||||
|
||||
#elif (SELECTED_PORT == PORT_XILINX_PPC405)
|
||||
/* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */
|
||||
|
||||
#define HWTC_COUNT_DIRECTION DIRECTION_DECREMENTING
|
||||
#define HWTC_COUNT mfspr( 0x3db)
|
||||
#define HWTC_PERIOD ( configCPU_CLOCK_HZ / configTICK_RATE_HZ )
|
||||
#define HWTC_DIVISOR 1
|
||||
|
||||
#elif (SELECTED_PORT == PORT_XILINX_PPC440)
|
||||
/* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */
|
||||
|
||||
/* This should work with most PowerPC chips */
|
||||
|
||||
#define HWTC_COUNT_DIRECTION DIRECTION_DECREMENTING
|
||||
#define HWTC_COUNT mfspr( 0x016 )
|
||||
#define HWTC_PERIOD ( configCPU_CLOCK_HZ / configTICK_RATE_HZ )
|
||||
#define HWTC_DIVISOR 1
|
||||
|
||||
#else
|
||||
SELECTED_PORT is not set, or had unsupported value!
|
||||
(This is to intentionally cause a compiler error.)
|
||||
#endif
|
||||
|
||||
#ifndef HWTC_COUNT_DIRECTION
|
||||
HWTC_COUNT_DIRECTION is not set!
|
||||
(This is to intentionally cause a compiler error.)
|
||||
#endif
|
||||
|
||||
#ifndef HWTC_COUNT
|
||||
HWTC_COUNT is not set!
|
||||
(This is to intentionally cause a compiler error.)
|
||||
#endif
|
||||
|
||||
#ifndef HWTC_PERIOD
|
||||
HWTC_PERIOD is not set!
|
||||
(This is to intentionally cause a compiler error.)
|
||||
#endif
|
||||
|
||||
#ifndef HWTC_DIVISOR
|
||||
HWTC_DIVISOR is not set!
|
||||
(This is to intentionally cause a compiler error.)
|
||||
#endif
|
||||
|
||||
#ifndef IRQ_PRIORITY_ORDER
|
||||
IRQ_PRIORITY_ORDER is not set!
|
||||
(This is to intentionally cause a compiler error.)
|
||||
#endif
|
||||
|
||||
#if (IRQ_PRIORITY_ORDER != 0) && (IRQ_PRIORITY_ORDER != 1)
|
||||
IRQ_PRIORITY_ORDER has bad value!
|
||||
(This is to intentionally cause a compiler error.)
|
||||
#endif
|
||||
|
||||
#if (HWTC_DIVISOR < 1)
|
||||
HWTC_DIVISOR must be a non-zero positive value!
|
||||
(This is to intentionally cause a compiler error.)
|
||||
#endif
|
||||
|
||||
#if ((IRQ_PRIORITY_ORDER != 0) && (IRQ_PRIORITY_ORDER != 1))
|
||||
IRQ_PRIORITY_ORDER not set!
|
||||
(This is to intentionally cause a compiler error.)
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
* vTraceConsoleMessage
|
||||
*
|
||||
* A wrapper for your system-specific console "printf" console output function.
|
||||
* This needs to be correctly defined to see status reports from the trace
|
||||
* status monitor task (this is defined in trcUser.c).
|
||||
******************************************************************************/
|
||||
#define vTraceConsoleMessage printf
|
||||
|
||||
/*******************************************************************************
|
||||
* uiTracePortGetTimeStamp
|
||||
*
|
||||
* Returns the current time based on the HWTC macros which provide a hardware
|
||||
* isolation layer towards the hardware timer/counter.
|
||||
*
|
||||
* The HWTC macros and uiTracePortGetTimeStamp is the main porting issue
|
||||
* or the trace recorder library. Typically you should not need to change
|
||||
* the code of uiTracePortGetTimeStamp if using the HWTC macros.
|
||||
*
|
||||
* OFFER FROM PERCEPIO:
|
||||
* For silicon companies and non-corporate FreeRTOS users (researchers,
|
||||
* students, hobbyists or early-phase startups) we have an attractive offer:
|
||||
* Provide a hardware timer port and get a FREE single-user licence for
|
||||
* FreeRTOS+Trace Professional Edition. Read more about this offer at
|
||||
* www.percepio.se or contact us directly at support@percepio.se.
|
||||
******************************************************************************/
|
||||
uint32_t uiTracePortGetTimeStamp(void);
|
||||
|
||||
/*******************************************************************************
|
||||
* vTracePortSetFrequency
|
||||
*
|
||||
* Registers the frequency of the timer used. This is normally calculated
|
||||
* automatically from the HWTC macros, but the Win32 port requires a special
|
||||
* solution where the frequency can be set independently of the HWTC macros.
|
||||
* This is called from main in the Win32 demo program.
|
||||
******************************************************************************/
|
||||
void vTracePortSetFrequency(uint32_t freq);
|
||||
|
||||
/*******************************************************************************
|
||||
* vTracePortEnd
|
||||
*
|
||||
* This function is called when the recorder is stopped due to full buffer.
|
||||
* Mainly intended to show a message in the console.
|
||||
* This is used by the Win32 port to store the trace to a file. The file path is
|
||||
* set using vTracePortSetFileName.
|
||||
******************************************************************************/
|
||||
void vTracePortEnd(void);
|
||||
|
||||
#if (INCLUDE_SAVE_TO_FILE == 1)
|
||||
|
||||
/*******************************************************************************
|
||||
* vTracePortSetOutFile
|
||||
*
|
||||
* Sets the filename/path used in vTracePortSave.
|
||||
* This is set in a separate function, since the Win32 port calls vTracePortSave
|
||||
* in vTracePortEnd if WIN32_PORT_SAVE_WHEN_STOPPED is set.
|
||||
******************************************************************************/
|
||||
void vTracePortSetOutFile(char* path);
|
||||
|
||||
/******************************************************************************
|
||||
* vTracePortSave
|
||||
*
|
||||
* Saves the trace to a file on a target-side file system. The path is set in a
|
||||
* separate function, vTracePortSetOutFile, since the Win32 port may call
|
||||
* vTracePortSave in vTracePortEnd, if using WIN32_PORT_SAVE_WHEN_STOPPED.
|
||||
******************************************************************************/
|
||||
void vTracePortSave(void);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -0,0 +1,259 @@
|
|||
/*
|
||||
FreeRTOS V7.1.1 - Copyright (C) 2012 Real Time Engineers Ltd.
|
||||
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||
* Complete, revised, and edited pdf reference manuals are also *
|
||||
* available. *
|
||||
* *
|
||||
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||
* ensuring you get running as quickly as possible and with an *
|
||||
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||
* the FreeRTOS project to continue with its mission of providing *
|
||||
* professional grade, cross platform, de facto standard solutions *
|
||||
* for microcontrollers - completely free of charge! *
|
||||
* *
|
||||
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||
* *
|
||||
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
|
||||
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. See the GNU General Public License for
|
||||
more details. You should have received a copy of the GNU General Public
|
||||
License and the FreeRTOS license exception along with FreeRTOS; if not it
|
||||
can be viewed here: http://www.freertos.org/a00114.html and also obtained
|
||||
by writing to Richard Barry, contact details for whom are available on the
|
||||
FreeRTOS WEB site.
|
||||
|
||||
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, training, latest information,
|
||||
license and contact details.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool.
|
||||
|
||||
Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell
|
||||
the code with commercial support, indemnification, and middleware, under
|
||||
the OpenRTOS brand: http://www.OpenRTOS.com. High Integrity Systems also
|
||||
provide a safety engineered and independently SIL3 certified version under
|
||||
the SafeRTOS brand: http://www.SafeRTOS.com.
|
||||
*/
|
||||
|
||||
#pragma comment( lib, "ws2_32.lib" )
|
||||
|
||||
/* Win32 includes. */
|
||||
#include <WinSock2.h>
|
||||
|
||||
/* FreeRTOS includes. */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
/* FreeRTOS+CLI includes. */
|
||||
#include "FreeRTOS_CLI.h"
|
||||
|
||||
/* Dimensions the buffer into which input characters are placed. */
|
||||
#define cmdMAX_INPUT_SIZE 60
|
||||
|
||||
/* Dimensions the buffer into which string outputs can be placed. */
|
||||
#define cmdMAX_OUTPUT_SIZE 1024
|
||||
|
||||
/* Dimensions the buffer passed to the recvfrom() call. */
|
||||
#define cmdSOCKET_INPUT_BUFFER_SIZE 60
|
||||
|
||||
/*
|
||||
* Open and configure the UDP socket.
|
||||
*/
|
||||
static SOCKET prvOpenUDPSocket( void );
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Task that provides the input and output for the FreeRTOS+CLI command
|
||||
* interpreter. In this case a UDP port is used. See the URL in the comments
|
||||
* within main.c for the location of the online documentation.
|
||||
*/
|
||||
void vUDPCommandInterpreterTask( void *pvParameters )
|
||||
{
|
||||
long lBytes, lByte;
|
||||
signed char cInChar, cInputIndex = 0;
|
||||
static signed char cInputString[ cmdMAX_INPUT_SIZE ], cOutputString[ cmdMAX_OUTPUT_SIZE ], cLocalBuffer[ cmdSOCKET_INPUT_BUFFER_SIZE ];
|
||||
portBASE_TYPE xMoreDataToFollow;
|
||||
volatile int iErrorCode = 0;
|
||||
struct sockaddr_in xClient;
|
||||
int xClientAddressLength = sizeof( struct sockaddr_in );
|
||||
SOCKET xSocket;
|
||||
|
||||
/* Just to prevent compiler warnings. */
|
||||
( void ) pvParameters;
|
||||
|
||||
/* Attempt to open the socket. */
|
||||
xSocket = prvOpenUDPSocket();
|
||||
|
||||
if( xSocket != INVALID_SOCKET )
|
||||
{
|
||||
for( ;; )
|
||||
{
|
||||
/* Wait for incoming data on the opened socket. */
|
||||
lBytes = recvfrom( xSocket, cLocalBuffer, sizeof( cLocalBuffer ), 0, ( struct sockaddr * ) &xClient, &xClientAddressLength );
|
||||
|
||||
if( lBytes == SOCKET_ERROR )
|
||||
{
|
||||
/* Something went wrong, but it is not handled by this simple
|
||||
example. */
|
||||
iErrorCode = WSAGetLastError();
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Process each received byte in turn. */
|
||||
lByte = 0;
|
||||
while( lByte < lBytes )
|
||||
{
|
||||
/* The next character in the input buffer. */
|
||||
cInChar = cLocalBuffer[ lByte ];
|
||||
lByte++;
|
||||
|
||||
/* Newline characters are taken as the end of the command
|
||||
string. */
|
||||
if( cInChar == '\n' )
|
||||
{
|
||||
/* Process the input string received prior to the
|
||||
newline. */
|
||||
do
|
||||
{
|
||||
/* Pass the string to FreeRTOS+CLI. */
|
||||
xMoreDataToFollow = FreeRTOS_CLIProcessCommand( cInputString, cOutputString, cmdMAX_OUTPUT_SIZE );
|
||||
|
||||
/* Send the output generated by the command's
|
||||
implementation. */
|
||||
sendto( xSocket, cOutputString, strlen( cOutputString ), 0, ( SOCKADDR * ) &xClient, xClientAddressLength );
|
||||
|
||||
} while( xMoreDataToFollow != pdFALSE ); /* Until the command does not generate any more output. */
|
||||
|
||||
/* All the strings generated by the command processing
|
||||
have been sent. Clear the input string ready to receive
|
||||
the next command. */
|
||||
cInputIndex = 0;
|
||||
memset( cInputString, 0x00, cmdMAX_INPUT_SIZE );
|
||||
|
||||
/* Transmit a spacer, just to make the command console
|
||||
easier to read. */
|
||||
sendto( xSocket, "\r\n", strlen( "\r\n" ), 0, ( SOCKADDR * ) &xClient, xClientAddressLength );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( cInChar == '\r' )
|
||||
{
|
||||
/* Ignore the character. Newlines are used to
|
||||
detect the end of the input string. */
|
||||
}
|
||||
else if( cInChar == '\b' )
|
||||
{
|
||||
/* Backspace was pressed. Erase the last character
|
||||
in the string - if any. */
|
||||
if( cInputIndex > 0 )
|
||||
{
|
||||
cInputIndex--;
|
||||
cInputString[ cInputIndex ] = '\0';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* A character was entered. Add it to the string
|
||||
entered so far. When a \n is entered the complete
|
||||
string will be passed to the command interpreter. */
|
||||
if( cInputIndex < cmdMAX_INPUT_SIZE )
|
||||
{
|
||||
cInputString[ cInputIndex ] = cInChar;
|
||||
cInputIndex++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The socket could not be opened. */
|
||||
vTaskDelete( NULL );
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static SOCKET prvOpenUDPSocket( void )
|
||||
{
|
||||
WSADATA xWSAData;
|
||||
WORD wVersionRequested;
|
||||
struct sockaddr_in xServer;
|
||||
SOCKET xSocket = INVALID_SOCKET;
|
||||
|
||||
wVersionRequested = MAKEWORD( 2, 2 );
|
||||
|
||||
/* Prepare to use WinSock. */
|
||||
if( WSAStartup( wVersionRequested, &xWSAData ) != 0 )
|
||||
{
|
||||
fprintf( stderr, "Could not open Windows connection.\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
xSocket = socket( AF_INET, SOCK_DGRAM, 0 );
|
||||
if( xSocket == INVALID_SOCKET)
|
||||
{
|
||||
fprintf( stderr, "Could not create socket.\n" );
|
||||
WSACleanup();
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Zero out the server structure. */
|
||||
memset( ( void * ) &xServer, 0x00, sizeof( struct sockaddr_in ) );
|
||||
|
||||
/* Set family and port. */
|
||||
xServer.sin_family = AF_INET;
|
||||
xServer.sin_port = htons( configUDP_CLI_PORT_NUMBER );
|
||||
|
||||
/* Assign the loopback address */
|
||||
xServer.sin_addr.S_un.S_un_b.s_b1 = 127;
|
||||
xServer.sin_addr.S_un.S_un_b.s_b2 = 0;
|
||||
xServer.sin_addr.S_un.S_un_b.s_b3 = 0;
|
||||
xServer.sin_addr.S_un.S_un_b.s_b4 = 1;
|
||||
|
||||
/* Bind the address to the socket. */
|
||||
if( bind( xSocket, ( struct sockaddr * ) &xServer, sizeof( struct sockaddr_in ) ) == -1 )
|
||||
{
|
||||
fprintf( stderr, "Could not socket to port %d.\n", configUDP_CLI_PORT_NUMBER );
|
||||
closesocket( xSocket );
|
||||
xSocket = INVALID_SOCKET;
|
||||
WSACleanup();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return xSocket;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,166 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{C686325E-3261-42F7-AEB1-DDE5280E1CEB}</ProjectGuid>
|
||||
<ProjectName>RTOSDemo</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\Release\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\Release\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Midl>
|
||||
<TypeLibraryName>.\Debug/WIN32.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\FreeRTOS-Plus-Trace\Include;..\..\..\FreeRTOS\Source\include;..\..\..\FreeRTOS\Source\portable\MSVC-MingW;..\..\FreeRTOS-Plus-CLI;.\Trace_Recorder_Configuration;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PrecompiledHeaderOutputFile>.\Debug/WIN32.pch</PrecompiledHeaderOutputFile>
|
||||
<AssemblerListingLocation>.\Debug/</AssemblerListingLocation>
|
||||
<ObjectFileName>.\Debug/</ObjectFileName>
|
||||
<ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DisableLanguageExtensions>false</DisableLanguageExtensions>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0c09</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<OutputFile>.\Debug/RTOSDemo.exe</OutputFile>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>.\Debug/WIN32.pdb</ProgramDatabaseFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>
|
||||
</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<Bscmake>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<OutputFile>.\Debug/WIN32.bsc</OutputFile>
|
||||
</Bscmake>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Midl>
|
||||
<TypeLibraryName>.\Release/WIN32.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<PreprocessorDefinitions>_WINSOCKAPI_;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeaderOutputFile>.\Release/WIN32.pch</PrecompiledHeaderOutputFile>
|
||||
<AssemblerListingLocation>.\Release/</AssemblerListingLocation>
|
||||
<ObjectFileName>.\Release/</ObjectFileName>
|
||||
<ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<AdditionalIncludeDirectories>..\Common\Utils;..\Common\ethernet\lwip-1.4.0\ports\win32\WinPCap;..\Common\ethernet\lwip-1.4.0\src\include\ipv4;..\Common\ethernet\lwip-1.4.0\src\include;..\..\Source\include;..\..\Source\portable\MSVC-MingW;..\Common\ethernet\lwip-1.4.0\ports\win32\include;..\Common\Include;.\lwIP_Apps;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0c09</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<OutputFile>.\Release/RTOSDemo.exe</OutputFile>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<ProgramDatabaseFile>.\Release/WIN32.pdb</ProgramDatabaseFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<AdditionalLibraryDirectories>..\Common\ethernet\lwip-1.4.0\ports\win32\WinPCap</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>wpcap.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<Bscmake>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<OutputFile>.\Release/WIN32.bsc</OutputFile>
|
||||
</Bscmake>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\FreeRTOS-Plus-CLI\FreeRTOS_CLI.c" />
|
||||
<ClCompile Include="..\..\FreeRTOS-Plus-Trace\trcBase.c" />
|
||||
<ClCompile Include="..\..\FreeRTOS-Plus-Trace\trcKernel.c" />
|
||||
<ClCompile Include="..\..\FreeRTOS-Plus-Trace\trcPort.c" />
|
||||
<ClCompile Include="..\..\FreeRTOS-Plus-Trace\trcUser.c" />
|
||||
<ClCompile Include="..\..\..\FreeRTOS\Source\list.c" />
|
||||
<ClCompile Include="..\..\..\FreeRTOS\Source\portable\MemMang\heap_3.c" />
|
||||
<ClCompile Include="..\..\..\FreeRTOS\Source\portable\MSVC-MingW\port.c" />
|
||||
<ClCompile Include="..\..\..\FreeRTOS\Source\queue.c" />
|
||||
<ClCompile Include="..\..\..\FreeRTOS\Source\tasks.c" />
|
||||
<ClCompile Include="..\..\..\FreeRTOS\Source\timers.c" />
|
||||
<ClCompile Include="CLI-commands.c" />
|
||||
<ClCompile Include="main.c">
|
||||
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Run-time-stats-utils.c" />
|
||||
<ClCompile Include="UDPCommandServer.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\FreeRTOS-Plus-Trace\Include\trcBase.h" />
|
||||
<ClInclude Include="..\..\FreeRTOS-Plus-Trace\Include\trcConfig.h" />
|
||||
<ClInclude Include="..\..\FreeRTOS-Plus-Trace\Include\trcHooks.h" />
|
||||
<ClInclude Include="..\..\FreeRTOS-Plus-Trace\Include\trcKernel.h" />
|
||||
<ClInclude Include="..\..\FreeRTOS-Plus-Trace\Include\trcPort.h" />
|
||||
<ClInclude Include="..\..\FreeRTOS-Plus-Trace\Include\trcTypes.h" />
|
||||
<ClInclude Include="..\..\FreeRTOS-Plus-Trace\Include\trcUser.h" />
|
||||
<ClInclude Include="FreeRTOSConfig.h" />
|
||||
<ClInclude Include="Trace_Recorder_Configuration\trcConfig.h" />
|
||||
<ClInclude Include="Trace_Recorder_Configuration\trcPort.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -0,0 +1,124 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{38712199-cebf-4124-bf15-398f7c3419ea}</UniqueIdentifier>
|
||||
<Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Demo App Source">
|
||||
<UniqueIdentifier>{34567deb-d5ab-4a56-8640-0aaec609521a}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS">
|
||||
<UniqueIdentifier>{af3445a1-4908-4170-89ed-39345d90d30c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS\Source">
|
||||
<UniqueIdentifier>{f32be356-4763-4cae-9020-974a2638cb08}</UniqueIdentifier>
|
||||
<Extensions>*.c</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS\Source\Portable">
|
||||
<UniqueIdentifier>{88f409e6-d396-4ac5-94bd-7a99c914be46}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS+">
|
||||
<UniqueIdentifier>{e5ad4ec7-23dc-4295-8add-2acaee488f5a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS+\FreeRTOS+Trace">
|
||||
<UniqueIdentifier>{629e761f-e8a8-430e-b44e-f38d83292b54}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS+\FreeRTOS+Trace\Include">
|
||||
<UniqueIdentifier>{e17028e8-51ed-45af-8aa4-22ade709b3fb}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS+\FreeRTOS+Trace\Configuration Files">
|
||||
<UniqueIdentifier>{c0e94729-2842-4a9f-8549-a84a12f6f755}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS\Configuration Files">
|
||||
<UniqueIdentifier>{19ff1a34-36de-4c48-9d10-3fb1fa0d1fa4}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS+\FreeRTOS+CLI">
|
||||
<UniqueIdentifier>{fd43c0ed-fdbc-437f-a5a3-c50399690bd7}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Demo App Source\Trace Recorder Configuration">
|
||||
<UniqueIdentifier>{91dffc7b-279b-44f6-a2b2-f5d2e132a85d}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.c">
|
||||
<Filter>Demo App Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\FreeRTOS\Source\portable\MSVC-MingW\port.c">
|
||||
<Filter>FreeRTOS\Source\Portable</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\FreeRTOS\Source\portable\MemMang\heap_3.c">
|
||||
<Filter>FreeRTOS\Source\Portable</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\FreeRTOS\Source\timers.c">
|
||||
<Filter>FreeRTOS\Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\FreeRTOS\Source\list.c">
|
||||
<Filter>FreeRTOS\Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\FreeRTOS\Source\queue.c">
|
||||
<Filter>FreeRTOS\Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\FreeRTOS\Source\tasks.c">
|
||||
<Filter>FreeRTOS\Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\FreeRTOS-Plus-Trace\trcUser.c">
|
||||
<Filter>FreeRTOS+\FreeRTOS+Trace</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\FreeRTOS-Plus-Trace\trcBase.c">
|
||||
<Filter>FreeRTOS+\FreeRTOS+Trace</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\FreeRTOS-Plus-Trace\trcKernel.c">
|
||||
<Filter>FreeRTOS+\FreeRTOS+Trace</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\FreeRTOS-Plus-Trace\trcPort.c">
|
||||
<Filter>FreeRTOS+\FreeRTOS+Trace</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\FreeRTOS-Plus-CLI\FreeRTOS_CLI.c">
|
||||
<Filter>FreeRTOS+\FreeRTOS+CLI</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UDPCommandServer.c">
|
||||
<Filter>Demo App Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CLI-commands.c">
|
||||
<Filter>Demo App Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Run-time-stats-utils.c">
|
||||
<Filter>Demo App Source</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="FreeRTOSConfig.h">
|
||||
<Filter>FreeRTOS\Configuration Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\FreeRTOS-Plus-Trace\Include\trcUser.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS+Trace\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\FreeRTOS-Plus-Trace\Include\trcBase.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS+Trace\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\FreeRTOS-Plus-Trace\Include\trcHooks.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS+Trace\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\FreeRTOS-Plus-Trace\Include\trcKernel.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS+Trace\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\FreeRTOS-Plus-Trace\Include\trcTypes.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS+Trace\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\FreeRTOS-Plus-Trace\Include\trcConfig.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS+Trace\Configuration Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\FreeRTOS-Plus-Trace\Include\trcPort.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS+Trace\Configuration Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Trace_Recorder_Configuration\trcPort.h">
|
||||
<Filter>Demo App Source\Trace Recorder Configuration</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Trace_Recorder_Configuration\trcConfig.h">
|
||||
<Filter>Demo App Source\Trace Recorder Configuration</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,3 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
</Project>
|
|
@ -0,0 +1,288 @@
|
|||
/*
|
||||
FreeRTOS V7.1.1 - Copyright (C) 2012 Real Time Engineers Ltd.
|
||||
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||
* Complete, revised, and edited pdf reference manuals are also *
|
||||
* available. *
|
||||
* *
|
||||
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||
* ensuring you get running as quickly as possible and with an *
|
||||
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||
* the FreeRTOS project to continue with its mission of providing *
|
||||
* professional grade, cross platform, de facto standard solutions *
|
||||
* for microcontrollers - completely free of charge! *
|
||||
* *
|
||||
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||
* *
|
||||
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
|
||||
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. See the GNU General Public License for
|
||||
more details. You should have received a copy of the GNU General Public
|
||||
License and the FreeRTOS license exception along with FreeRTOS; if not it
|
||||
can be viewed here: http://www.freertos.org/a00114.html and also obtained
|
||||
by writing to Richard Barry, contact details for whom are available on the
|
||||
FreeRTOS WEB site.
|
||||
|
||||
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, training, latest information,
|
||||
license and contact details.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool.
|
||||
|
||||
Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell
|
||||
the code with commercial support, indemnification, and middleware, under
|
||||
the OpenRTOS brand: http://www.OpenRTOS.com. High Integrity Systems also
|
||||
provide a safety engineered and independently SIL3 certified version under
|
||||
the SafeRTOS brand: http://www.SafeRTOS.com.
|
||||
*/
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* -NOTE- The Win32 port is a simulation (or is that emulation?) only! Do not
|
||||
* expect to get real time behaviour from the Win32 port or this demo
|
||||
* application. It is provided as a convenient development and demonstration
|
||||
* test bed only. This was tested using Windows XP on a dual core laptop.
|
||||
*
|
||||
* In this example, one simulated millisecond will take approximately 40ms to
|
||||
* execute, and 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
|
||||
******************************************************************************
|
||||
*
|
||||
* This is a simple FreeRTOS Windows simulator project that makes it easy to
|
||||
* evaluate FreeRTOS+CLI and FreeRTOS+Trace on a standard desktop PC, without
|
||||
* any external hardware or interfaces being required.
|
||||
*
|
||||
* To keep everything as simple as possible, the command line interface is
|
||||
* accessed through a UDP socket on the default Windows loopback IP address of
|
||||
* 127.0.0.1. Full instructions are provided on the documentation page
|
||||
* referenced above.
|
||||
*
|
||||
* Commands are provided to both start and stop a FreeRTOS+Trace recording.
|
||||
* Stopping a recording will result in the recorded data being saved to the
|
||||
* hard disk, ready for viewing in the FreeRTOS+Trace graphical user interface.
|
||||
* Again, full instructions are provided on the documentation page referenced
|
||||
* above.
|
||||
*
|
||||
* A queue send task and a queue receive task are defined in this file. The
|
||||
* queue receive task spends most of its time blocked on the queue waiting for
|
||||
* messages to arrive. The queue send task periodically sends a message to the
|
||||
* queue, causing the queue receive task to exit the Blocked state. The
|
||||
* priority of the queue receive task is above that of the queue send task, so
|
||||
* it pre-empts the queue send task as soon as it leaves the Blocked state. It
|
||||
* then consumes the message from the queue and prints "message received" to
|
||||
* the screen before returning to block on the queue once again. This
|
||||
* sequencing is clearly visible in the recorded FreeRTOS+Trace data.
|
||||
*
|
||||
* Finally, a trace monitoring task is also created that prints out a message
|
||||
* when it determines that the status of the trace has changed since it last
|
||||
* executed. It prints out a message when the trace has started, when the
|
||||
* trace has stopped, and periodically when the trace is executing.
|
||||
*
|
||||
*/
|
||||
|
||||
/* Standard includes. */
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/* FreeRTOS includes. */
|
||||
#include <FreeRTOS.h>
|
||||
#include "task.h"
|
||||
#include "queue.h"
|
||||
|
||||
/* FreeRTOS+Trace includes. */
|
||||
#include "trcUser.h"
|
||||
|
||||
/* Priorities at which the tasks are created. */
|
||||
#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
||||
#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
|
||||
#define mainUDP_CLI_TASK_PRIORITY ( tskIDLE_PRIORITY )
|
||||
|
||||
/* The rate at which data is sent to the queue. The (simulated) 50ms value is
|
||||
converted to ticks using the portTICK_RATE_MS constant. */
|
||||
#define mainQUEUE_SEND_FREQUENCY_MS ( 50 / portTICK_RATE_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
|
||||
the queue empty. */
|
||||
#define mainQUEUE_LENGTH ( 1 )
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* The queue send and receive tasks as described in the comments at the top of
|
||||
* this file.
|
||||
*/
|
||||
static void prvQueueReceiveTask( void *pvParameters );
|
||||
static void prvQueueSendTask( void *pvParameters );
|
||||
|
||||
/*
|
||||
* The task that implements the UDP command interpreter using FreeRTOS+CLI.
|
||||
*/
|
||||
extern void vUDPCommandInterpreterTask( void *pvParameters );
|
||||
|
||||
/*
|
||||
* Register commands that can be used with FreeRTOS+CLI through the UDP socket.
|
||||
* The commands are defined in CLI-commands.c.
|
||||
*/
|
||||
extern void vRegisterCLICommands( void );
|
||||
|
||||
/* The queue used by both tasks. */
|
||||
static xQueueHandle xQueue = NULL;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
int main( void )
|
||||
{
|
||||
const uint32_t ulLongTime_ms = 250UL;
|
||||
|
||||
/* Create the queue used to pass messages from the queue send task to the
|
||||
queue receive task. */
|
||||
xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) );
|
||||
|
||||
/* Give the queue a name for the FreeRTOS+Trace log. */
|
||||
vTraceSetQueueName( xQueue, "DemoQ" );
|
||||
|
||||
/* Start the two tasks as described in the comments at the top of this
|
||||
file. */
|
||||
xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */
|
||||
( signed char * ) "Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */
|
||||
configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. Not actually used as a stack in the Win32 simulator port. */
|
||||
NULL, /* The parameter passed to the task - not used in this example. */
|
||||
mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */
|
||||
NULL ); /* The task handle is not required, so NULL is passed. */
|
||||
|
||||
xTaskCreate( prvQueueSendTask, ( signed char * ) "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
||||
|
||||
/* Create the task that handles the CLI on a UDP port. The port number
|
||||
is set using the configUDP_CLI_PORT_NUMBER setting in FreeRTOSConfig.h. */
|
||||
xTaskCreate( vUDPCommandInterpreterTask, ( signed char * ) "CLI", configMINIMAL_STACK_SIZE, NULL, mainUDP_CLI_TASK_PRIORITY, NULL );
|
||||
|
||||
/* Create the task that monitors the trace recording status, printing
|
||||
periodic information to the display. */
|
||||
vTraceStartStatusMonitor();
|
||||
|
||||
/* Register commands with the FreeRTOS+CLI command interpreter. */
|
||||
vRegisterCLICommands();
|
||||
|
||||
/* Start the tasks and timer running. */
|
||||
vTaskStartScheduler();
|
||||
|
||||
/* If all is well, the scheduler will now be running, and the following
|
||||
line will never be reached. If the following line does execute, then
|
||||
there was insufficient FreeRTOS heap memory available for the idle and/or
|
||||
timer tasks to be created. See the memory management section on the
|
||||
FreeRTOS web site for more details (this is standard text that is not not
|
||||
really applicable to the Win32 simulator port). */
|
||||
for( ;; )
|
||||
{
|
||||
Sleep( ulLongTime_ms );
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvQueueSendTask( void *pvParameters )
|
||||
{
|
||||
portTickType xNextWakeTime;
|
||||
const unsigned long ulValueToSend = 100UL;
|
||||
|
||||
/* Remove warning about unused parameters. */
|
||||
( void ) pvParameters;
|
||||
|
||||
/* Initialise xNextWakeTime - this only needs to be done once. */
|
||||
xNextWakeTime = xTaskGetTickCount();
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
/* Place this task in the blocked state until it is time to run again.
|
||||
While in the Blocked state this task will not consume any CPU time. */
|
||||
vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS );
|
||||
|
||||
/* Send to the queue - causing the queue receive task to unblock and
|
||||
write a message to the display. 0 is used as the block time so the
|
||||
sending operation will not block - it shouldn't need to block as the
|
||||
queue should always be empty at this point in the code, and it is an
|
||||
error if it is not. */
|
||||
xQueueSend( xQueue, &ulValueToSend, 0U );
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvQueueReceiveTask( void *pvParameters )
|
||||
{
|
||||
unsigned long ulReceivedValue;
|
||||
|
||||
/* Remove warning about unused parameters. */
|
||||
( void ) pvParameters;
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
/* Wait until something arrives in the queue - this task will block
|
||||
indefinitely provided INCLUDE_vTaskSuspend is set to 1 in
|
||||
FreeRTOSConfig.h. */
|
||||
xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY );
|
||||
|
||||
/* To get here something must have been received from the queue, but
|
||||
is it the expected value? If it is, write the message to the
|
||||
display before looping back to block on the queue again. */
|
||||
if( ulReceivedValue == 100UL )
|
||||
{
|
||||
printf( "Message received!\r\n" );
|
||||
ulReceivedValue = 0U;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vApplicationIdleHook( void )
|
||||
{
|
||||
const unsigned long ulMSToSleep = 5;
|
||||
|
||||
/* This function is called on each cycle of the idle task if
|
||||
configUSE_IDLE_HOOK is set to 1 in FreeRTOSConfig.h. Sleep to reduce CPU
|
||||
load. */
|
||||
Sleep( ulMSToSleep );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vAssertCalled( void )
|
||||
{
|
||||
const unsigned long ulLongSleep = 1000UL;
|
||||
|
||||
taskDISABLE_INTERRUPTS();
|
||||
for( ;; )
|
||||
{
|
||||
Sleep( ulLongSleep );
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
|
@ -0,0 +1,136 @@
|
|||
/*
|
||||
FreeRTOS V7.1.1 - Copyright (C) 2012 Real Time Engineers Ltd.
|
||||
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||
* Complete, revised, and edited pdf reference manuals are also *
|
||||
* available. *
|
||||
* *
|
||||
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||
* ensuring you get running as quickly as possible and with an *
|
||||
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||
* the FreeRTOS project to continue with its mission of providing *
|
||||
* professional grade, cross platform, de facto standard solutions *
|
||||
* for microcontrollers - completely free of charge! *
|
||||
* *
|
||||
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||
* *
|
||||
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
|
||||
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. See the GNU General Public License for
|
||||
more details. You should have received a copy of the GNU General Public
|
||||
License and the FreeRTOS license exception along with FreeRTOS; if not it
|
||||
can be viewed here: http://www.freertos.org/a00114.html and also obtained
|
||||
by writing to Richard Barry, contact details for whom are available on the
|
||||
FreeRTOS WEB site.
|
||||
|
||||
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, training, latest information,
|
||||
license and contact details.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool.
|
||||
|
||||
Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell
|
||||
the code with commercial support, indemnification, and middleware, under
|
||||
the OpenRTOS brand: http://www.OpenRTOS.com. High Integrity Systems also
|
||||
provide a safety engineered and independently SIL3 certified version under
|
||||
the SafeRTOS brand: http://www.SafeRTOS.com.
|
||||
*/
|
||||
|
||||
#ifndef FREERTOS_CONFIG_H
|
||||
#define FREERTOS_CONFIG_H
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Application specific definitions.
|
||||
*
|
||||
* These definitions should be adjusted for your particular hardware and
|
||||
* application requirements.
|
||||
*
|
||||
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
|
||||
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
|
||||
* http://www.freertos.org/a00110.html
|
||||
*----------------------------------------------------------*/
|
||||
|
||||
#define configUSE_PREEMPTION 1
|
||||
#define configUSE_IDLE_HOOK 1
|
||||
#define configUSE_TICK_HOOK 0
|
||||
#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 ) 60 ) /* 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 ) 0 ) /* This parameter has no effect when heap_3.c is included in the project. */
|
||||
#define configMAX_TASK_NAME_LEN ( 7 )
|
||||
#define configUSE_TRACE_FACILITY 1
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
#define configIDLE_SHOULD_YIELD 1
|
||||
#define configUSE_CO_ROUTINES 0
|
||||
#define configUSE_MUTEXES 1
|
||||
#define configCHECK_FOR_STACK_OVERFLOW 0 /* Not applicable to the Win32 port. */
|
||||
#define configUSE_RECURSIVE_MUTEXES 1
|
||||
#define configQUEUE_REGISTRY_SIZE 0
|
||||
#define configUSE_MALLOC_FAILED_HOOK 0
|
||||
#define configUSE_APPLICATION_TASK_TAG 0
|
||||
#define configUSE_COUNTING_SEMAPHORES 1
|
||||
#define configUSE_ALTERNATIVE_API 0
|
||||
|
||||
#define configUSE_TIMERS 1
|
||||
#define configTIMER_TASK_PRIORITY 2
|
||||
#define configTIMER_QUEUE_LENGTH 20
|
||||
#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE * 2 )
|
||||
|
||||
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 7 )
|
||||
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
|
||||
|
||||
|
||||
/* Co-routine definitions. */
|
||||
#define configUSE_CO_ROUTINES 0
|
||||
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
|
||||
|
||||
/* Set the following definitions to 1 to include the API function, or zero
|
||||
to exclude the API function. */
|
||||
|
||||
#define INCLUDE_vTaskPrioritySet 1
|
||||
#define INCLUDE_uxTaskPriorityGet 1
|
||||
#define INCLUDE_vTaskDelete 1
|
||||
#define INCLUDE_vTaskCleanUpResources 0
|
||||
#define INCLUDE_vTaskSuspend 1
|
||||
#define INCLUDE_vTaskDelayUntil 1
|
||||
#define INCLUDE_vTaskDelay 1
|
||||
#define INCLUDE_uxTaskGetStackHighWaterMark 1
|
||||
#define INCLUDE_xTaskGetSchedulerState 1
|
||||
|
||||
/* Run time stats gathering definitions. */
|
||||
#define configGENERATE_RUN_TIME_STATS 0
|
||||
|
||||
extern void vAssertCalled( void );
|
||||
#define configASSERT( x ) if( ( x ) == 0 ) vAssertCalled()
|
||||
|
||||
/* The TCP port used by both the secure client and the secure server. */
|
||||
#define configTCP_PORT_NUMBER 5001
|
||||
|
||||
#endif /* FREERTOS_CONFIG_H */
|
|
@ -0,0 +1,20 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual C++ Express 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WIN32", "WIN32.vcxproj", "{C686325E-3261-42F7-AEB1-DDE5280E1CEB}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{C686325E-3261-42F7-AEB1-DDE5280E1CEB}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{C686325E-3261-42F7-AEB1-DDE5280E1CEB}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{C686325E-3261-42F7-AEB1-DDE5280E1CEB}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{C686325E-3261-42F7-AEB1-DDE5280E1CEB}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
Binary file not shown.
|
@ -0,0 +1,175 @@
|
|||
/*
|
||||
FreeRTOS V7.1.1 - Copyright (C) 2012 Real Time Engineers Ltd.
|
||||
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||
* Complete, revised, and edited pdf reference manuals are also *
|
||||
* available. *
|
||||
* *
|
||||
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||
* ensuring you get running as quickly as possible and with an *
|
||||
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||
* the FreeRTOS project to continue with its mission of providing *
|
||||
* professional grade, cross platform, de facto standard solutions *
|
||||
* for microcontrollers - completely free of charge! *
|
||||
* *
|
||||
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||
* *
|
||||
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
|
||||
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. See the GNU General Public License for
|
||||
more details. You should have received a copy of the GNU General Public
|
||||
License and the FreeRTOS license exception along with FreeRTOS; if not it
|
||||
can be viewed here: http://www.freertos.org/a00114.html and also obtained
|
||||
by writing to Richard Barry, contact details for whom are available on the
|
||||
FreeRTOS WEB site.
|
||||
|
||||
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, training, latest information,
|
||||
license and contact details.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool.
|
||||
|
||||
Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell
|
||||
the code with commercial support, indemnification, and middleware, under
|
||||
the OpenRTOS brand: http://www.OpenRTOS.com. High Integrity Systems also
|
||||
provide a safety engineered and independently SIL3 certified version under
|
||||
the SafeRTOS brand: http://www.SafeRTOS.com.
|
||||
*/
|
||||
|
||||
#pragma comment( lib, "ws2_32.lib" )
|
||||
|
||||
/* Win32 includes. */
|
||||
#include <WinSock2.h>
|
||||
|
||||
/* CyaSSL includes. */
|
||||
#include "cyassl/ssl.h"
|
||||
|
||||
/* Standard includes. */
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* FreeRTOS includes. */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* The CyaSSL context for the client. */
|
||||
static CYASSL_CTX* xCyaSSL_ClientContext = NULL;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* See the comments at the top of main.c. */
|
||||
void vSecureTCPClientTask( void *pvParameters )
|
||||
{
|
||||
SOCKET xClientSocket;
|
||||
struct sockaddr_in xConnection;
|
||||
CYASSL* xCyaSSL_Object;
|
||||
WORD wVersionRequested;
|
||||
WSADATA xWSAData;
|
||||
uint8_t cString[ 50 ];
|
||||
portBASE_TYPE lReturned;
|
||||
uint32_t ulCount = 0UL;
|
||||
|
||||
/* Remove compiler warning about unused parameters. */
|
||||
( void ) pvParameters;
|
||||
|
||||
/* Prepare to use WinSock. */
|
||||
wVersionRequested = MAKEWORD( 2, 2 );
|
||||
configASSERT( WSAStartup( wVersionRequested, &xWSAData ) == 0 );
|
||||
|
||||
/* Set family and port for client socket. */
|
||||
memset( ( void * ) &xConnection, 0x00, sizeof( struct sockaddr_in ) );
|
||||
xConnection.sin_family = AF_INET;
|
||||
xConnection.sin_addr.s_addr = inet_addr("127.0.0.1");
|
||||
xConnection.sin_port = htons( configTCP_PORT_NUMBER );
|
||||
|
||||
/* Attempt to create a context that uses the TLS V1 server protocol. */
|
||||
xCyaSSL_ClientContext = CyaSSL_CTX_new( CyaTLSv1_client_method() );
|
||||
configASSERT( xCyaSSL_ClientContext );
|
||||
|
||||
/* Load the CA certificate. */
|
||||
lReturned = CyaSSL_CTX_load_verify_locations( xCyaSSL_ClientContext, "ca-cert.pem", 0 );
|
||||
configASSERT( lReturned == SSL_SUCCESS );
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
/* Create the socket. */
|
||||
xClientSocket = socket( AF_INET, SOCK_STREAM, 0 );
|
||||
configASSERT( xClientSocket != INVALID_SOCKET );
|
||||
|
||||
/* Connect to the secure server. */
|
||||
if( connect( xClientSocket, ( SOCKADDR * ) &xConnection, sizeof( xConnection ) ) == 0 )
|
||||
{
|
||||
/* The connect was successful. Create a CyaSSL object to associate
|
||||
with this connection. */
|
||||
xCyaSSL_Object = CyaSSL_new( xCyaSSL_ClientContext );
|
||||
|
||||
if( xCyaSSL_Object != NULL )
|
||||
{
|
||||
/* Associate the created CyaSSL object with the connected
|
||||
socket. */
|
||||
lReturned = CyaSSL_set_fd( xCyaSSL_Object, xClientSocket );
|
||||
configASSERT( lReturned == SSL_SUCCESS );
|
||||
|
||||
/* The count is used to differentiate between messages sent to
|
||||
the server, and to break out of the do while loop below. */
|
||||
ulCount = 0UL;
|
||||
|
||||
do
|
||||
{
|
||||
/* Create the string that is sent to the secure server. */
|
||||
sprintf( ( char * ) cString, "Message number %lu\r\n", ulCount );
|
||||
|
||||
/* The next line is the secure equivalent of the standard
|
||||
sockets call:
|
||||
lReturned = send( xClientSocket, cString, strlen( cString ) + 1, 0 ); */
|
||||
lReturned = CyaSSL_write( xCyaSSL_Object, ( const char * ) cString, strlen( ( const char * ) cString ) + 1 );
|
||||
|
||||
|
||||
/* Short delay to prevent the messages streaming up the
|
||||
console too quickly. */
|
||||
vTaskDelay( 5 );
|
||||
ulCount++;
|
||||
|
||||
} while( ( lReturned != SOCKET_ERROR ) && ( ulCount < 10UL ) );
|
||||
}
|
||||
|
||||
CyaSSL_free( xCyaSSL_Object );
|
||||
closesocket( xClientSocket );
|
||||
|
||||
/* Delay for a short time before starting over. */
|
||||
vTaskDelay( 50 );
|
||||
}
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
|
@ -0,0 +1,285 @@
|
|||
/*
|
||||
FreeRTOS V7.1.1 - Copyright (C) 2012 Real Time Engineers Ltd.
|
||||
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||
* Complete, revised, and edited pdf reference manuals are also *
|
||||
* available. *
|
||||
* *
|
||||
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||
* ensuring you get running as quickly as possible and with an *
|
||||
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||
* the FreeRTOS project to continue with its mission of providing *
|
||||
* professional grade, cross platform, de facto standard solutions *
|
||||
* for microcontrollers - completely free of charge! *
|
||||
* *
|
||||
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||
* *
|
||||
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
|
||||
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. See the GNU General Public License for
|
||||
more details. You should have received a copy of the GNU General Public
|
||||
License and the FreeRTOS license exception along with FreeRTOS; if not it
|
||||
can be viewed here: http://www.freertos.org/a00114.html and also obtained
|
||||
by writing to Richard Barry, contact details for whom are available on the
|
||||
FreeRTOS WEB site.
|
||||
|
||||
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, training, latest information,
|
||||
license and contact details.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool.
|
||||
|
||||
Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell
|
||||
the code with commercial support, indemnification, and middleware, under
|
||||
the OpenRTOS brand: http://www.OpenRTOS.com. High Integrity Systems also
|
||||
provide a safety engineered and independently SIL3 certified version under
|
||||
the SafeRTOS brand: http://www.SafeRTOS.com.
|
||||
*/
|
||||
|
||||
#pragma comment( lib, "ws2_32.lib" )
|
||||
|
||||
/* Win32 includes. */
|
||||
#include <WinSock2.h>
|
||||
|
||||
/* CyaSSL includes. */
|
||||
#include "cyassl/ssl.h"
|
||||
|
||||
/* Standard includes. */
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* FreeRTOS includes. */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
/* This application is using the FreeRTOS Windows simulator, which uses the
|
||||
FreeRTOS scheduler to schedule FreeRTOS task within the Windows environment.
|
||||
The Windows envrionment must not be allowed to block any Windows threads that
|
||||
are running FreeRTOS tasks, unless the FreeRTOS task is running at the FreeRTOS
|
||||
idle priority. For simplicity, this demo uses the Windows TCP/IP stack, the
|
||||
API for which can cause Windows threads to block. Therefore, any FreeRTOS task
|
||||
that makes calls to the Windows TCP/IP stack must be assigned the idle prioity.
|
||||
Note this is only a restriction of the simulated Windows environment - real
|
||||
FreeRTOS ports do not have this restriction. */
|
||||
#define sstSECURE_CLIENT_TASK_PRIORITY ( tskIDLE_PRIORITY )
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Open, configures and binds the server's TCP socket.
|
||||
*/
|
||||
static SOCKET prvOpenServerSocket( void );
|
||||
|
||||
/*
|
||||
* Prepare the CyaSSL library for use.
|
||||
*/
|
||||
static void prvInitialiseCyaSSL( void );
|
||||
|
||||
/*
|
||||
* The task that implements the client side of the connection.
|
||||
*/
|
||||
extern void vSecureTCPClientTask( void *pvParameters );
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* The CyaSSL context for the server. */
|
||||
static CYASSL_CTX* xCyaSSL_ServerContext = NULL;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* See the comments at the top of main.c. */
|
||||
void vSecureTCPServerTask( void *pvParameters )
|
||||
{
|
||||
portBASE_TYPE xReturned;
|
||||
long lBytes;
|
||||
uint8_t cReceivedString[ 60 ];
|
||||
struct sockaddr_in xClient;
|
||||
int xClientAddressLength = sizeof( struct sockaddr_in );
|
||||
SOCKET xListeningSocket, xConnectedSocket;
|
||||
CYASSL* xCyaSSL_Object; /* Only one connection is accepted at a time, so only one object is needed at a time. */
|
||||
|
||||
/* Just to prevent compiler warnings. */
|
||||
( void ) pvParameters;
|
||||
|
||||
/* Perform the initialisation necessary before CyaSSL can be used. */
|
||||
prvInitialiseCyaSSL();
|
||||
configASSERT( xCyaSSL_ServerContext );
|
||||
|
||||
/* Attempt to open the socket. */
|
||||
xListeningSocket = prvOpenServerSocket();
|
||||
|
||||
/* Now the server socket has been created and the CyaSSL library has been
|
||||
initialised, the task that implements the client side can be created. */
|
||||
xTaskCreate( vSecureTCPClientTask, "Client", configMINIMAL_STACK_SIZE, NULL, sstSECURE_CLIENT_TASK_PRIORITY, NULL );
|
||||
|
||||
if( xListeningSocket != INVALID_SOCKET )
|
||||
{
|
||||
for( ;; )
|
||||
{
|
||||
/* Wait until the client connects. */
|
||||
printf( "Waiting for new connection\r\n" );
|
||||
xConnectedSocket = accept( xListeningSocket, ( struct sockaddr * ) &xClient, &xClientAddressLength );
|
||||
|
||||
if( xConnectedSocket != INVALID_SOCKET )
|
||||
{
|
||||
printf( "Connection established\r\n" );
|
||||
|
||||
/* A connection has been accepted by the server. Create a
|
||||
CyaSSL object for use with the newly connected socket. */
|
||||
xCyaSSL_Object = NULL;
|
||||
xCyaSSL_Object = CyaSSL_new( xCyaSSL_ServerContext );
|
||||
|
||||
if( xCyaSSL_Object != NULL )
|
||||
{
|
||||
/* Associate the created CyaSSL object with the connected
|
||||
socket. */
|
||||
xReturned = CyaSSL_set_fd( xCyaSSL_Object, xConnectedSocket );
|
||||
configASSERT( xReturned == SSL_SUCCESS );
|
||||
|
||||
do
|
||||
{
|
||||
/* The next line is the secure equivalent to the
|
||||
standard sockets call:
|
||||
lBytes = recv( xConnectedSocket, cReceivedString, 50, 0 ); */
|
||||
lBytes = CyaSSL_read( xCyaSSL_Object, cReceivedString, sizeof( cReceivedString ) );
|
||||
|
||||
/* Print the received characters. */
|
||||
if( lBytes > 0 )
|
||||
{
|
||||
printf( "Received by the secure server: %s\r\n", cReceivedString );
|
||||
}
|
||||
|
||||
} while ( lBytes > 0 );
|
||||
|
||||
/* The connection was closed, close the socket and free the
|
||||
CyaSSL object. */
|
||||
closesocket( xConnectedSocket );
|
||||
CyaSSL_free( xCyaSSL_Object );
|
||||
printf( "Connection closed, back to start\r\n\r\n" );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The socket could not be opened. */
|
||||
vTaskDelete( NULL );
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static SOCKET prvOpenServerSocket( void )
|
||||
{
|
||||
WSADATA xWSAData;
|
||||
WORD wVersionRequested;
|
||||
struct sockaddr_in xConnection;
|
||||
SOCKET xSocket = INVALID_SOCKET;
|
||||
|
||||
wVersionRequested = MAKEWORD( 2, 2 );
|
||||
|
||||
/* Prepare to use WinSock. */
|
||||
if( WSAStartup( wVersionRequested, &xWSAData ) != 0 )
|
||||
{
|
||||
fprintf( stderr, "Could not open Windows connection.\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
xSocket = socket( AF_INET, SOCK_STREAM, 0 );
|
||||
if( xSocket == INVALID_SOCKET)
|
||||
{
|
||||
fprintf( stderr, "Could not create socket.\n" );
|
||||
WSACleanup();
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Zero out the server structure. */
|
||||
memset( ( void * ) &xConnection, 0x00, sizeof( struct sockaddr_in ) );
|
||||
|
||||
xConnection.sin_family = AF_INET;
|
||||
xConnection.sin_addr.s_addr = inet_addr("127.0.0.1");
|
||||
xConnection.sin_port = htons( configTCP_PORT_NUMBER );
|
||||
|
||||
/* Bind the address to the socket. */
|
||||
if( bind( xSocket, ( struct sockaddr * ) &xConnection, sizeof( struct sockaddr_in ) ) == -1 )
|
||||
{
|
||||
fprintf( stderr, "Could not socket to port %d.\n", configTCP_PORT_NUMBER );
|
||||
closesocket( xSocket );
|
||||
xSocket = INVALID_SOCKET;
|
||||
WSACleanup();
|
||||
}
|
||||
|
||||
if( listen( xSocket, 20 ) != 0 )
|
||||
{
|
||||
closesocket( xSocket );
|
||||
xSocket = INVALID_SOCKET;
|
||||
WSACleanup();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return xSocket;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvInitialiseCyaSSL( void )
|
||||
{
|
||||
int32_t iReturn;
|
||||
|
||||
#ifdef DEBUG_CYASSL
|
||||
{
|
||||
CyaSSL_Debugging_ON();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Initialise CyaSSL. This must be done before any other CyaSSL functions
|
||||
are called. */
|
||||
CyaSSL_Init();
|
||||
|
||||
/* Attempt to create a context that uses the TLS V1 server protocol. */
|
||||
xCyaSSL_ServerContext = CyaSSL_CTX_new( CyaTLSv1_server_method() );
|
||||
|
||||
if( xCyaSSL_ServerContext != NULL )
|
||||
{
|
||||
/* Load the CA certificate. Real applications should ensure that
|
||||
CyaSSL_CTX_load_verify_locations() returns SSL_SUCCESS before
|
||||
proceeding. */
|
||||
iReturn = CyaSSL_CTX_load_verify_locations( xCyaSSL_ServerContext, "ca-cert.pem", 0 );
|
||||
configASSERT( iReturn == SSL_SUCCESS );
|
||||
|
||||
iReturn = CyaSSL_CTX_use_certificate_file( xCyaSSL_ServerContext, "server-cert.pem", SSL_FILETYPE_PEM );
|
||||
configASSERT( iReturn == SSL_SUCCESS );
|
||||
|
||||
iReturn = CyaSSL_CTX_use_PrivateKey_file( xCyaSSL_ServerContext, "server-key.pem", SSL_FILETYPE_PEM );
|
||||
configASSERT( iReturn == SSL_SUCCESS );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,177 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{C686325E-3261-42F7-AEB1-DDE5280E1CEB}</ProjectGuid>
|
||||
<ProjectName>RTOSDemo</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\Release\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\Release\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Midl>
|
||||
<TypeLibraryName>.\Debug/WIN32.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\CyaSSL;..\..\..\FreeRTOS\Source\include;..\..\..\FreeRTOS\Source\portable\MSVC-MingW;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;SIZEOF_LONG_LONG=8;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PrecompiledHeaderOutputFile>.\Debug/WIN32.pch</PrecompiledHeaderOutputFile>
|
||||
<AssemblerListingLocation>.\Debug/</AssemblerListingLocation>
|
||||
<ObjectFileName>.\Debug/</ObjectFileName>
|
||||
<ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DisableLanguageExtensions>false</DisableLanguageExtensions>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0c09</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<OutputFile>.\Debug/RTOSDemo.exe</OutputFile>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>.\Debug/WIN32.pdb</ProgramDatabaseFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>
|
||||
</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<Bscmake>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<OutputFile>.\Debug/WIN32.bsc</OutputFile>
|
||||
</Bscmake>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Midl>
|
||||
<TypeLibraryName>.\Release/WIN32.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<PreprocessorDefinitions>_WINSOCKAPI_;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeaderOutputFile>.\Release/WIN32.pch</PrecompiledHeaderOutputFile>
|
||||
<AssemblerListingLocation>.\Release/</AssemblerListingLocation>
|
||||
<ObjectFileName>.\Release/</ObjectFileName>
|
||||
<ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<AdditionalIncludeDirectories>..\..\Source\include;..\..\Source\portable\MSVC-MingW;..\Common\Include;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0c09</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<OutputFile>.\Release/RTOSDemo.exe</OutputFile>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<ProgramDatabaseFile>.\Release/WIN32.pdb</ProgramDatabaseFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<AdditionalLibraryDirectories>..\Common\ethernet\lwip-1.4.0\ports\win32\WinPCap</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>wpcap.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<Bscmake>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<OutputFile>.\Release/WIN32.bsc</OutputFile>
|
||||
</Bscmake>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\CyaSSL\ctaocrypt\src\aes.c" />
|
||||
<ClCompile Include="..\..\CyaSSL\ctaocrypt\src\arc4.c" />
|
||||
<ClCompile Include="..\..\CyaSSL\ctaocrypt\src\asn.c" />
|
||||
<ClCompile Include="..\..\CyaSSL\ctaocrypt\src\coding.c" />
|
||||
<ClCompile Include="..\..\CyaSSL\ctaocrypt\src\des3.c" />
|
||||
<ClCompile Include="..\..\CyaSSL\ctaocrypt\src\dh.c" />
|
||||
<ClCompile Include="..\..\CyaSSL\ctaocrypt\src\dsa.c" />
|
||||
<ClCompile Include="..\..\CyaSSL\ctaocrypt\src\hc128.c" />
|
||||
<ClCompile Include="..\..\CyaSSL\ctaocrypt\src\hmac.c" />
|
||||
<ClCompile Include="..\..\CyaSSL\ctaocrypt\src\integer.c" />
|
||||
<ClCompile Include="..\..\CyaSSL\ctaocrypt\src\logging.c" />
|
||||
<ClCompile Include="..\..\CyaSSL\ctaocrypt\src\md4.c" />
|
||||
<ClCompile Include="..\..\CyaSSL\ctaocrypt\src\md5.c" />
|
||||
<ClCompile Include="..\..\CyaSSL\ctaocrypt\src\memory.c" />
|
||||
<ClCompile Include="..\..\CyaSSL\ctaocrypt\src\misc.c" />
|
||||
<ClCompile Include="..\..\CyaSSL\ctaocrypt\src\pwdbased.c" />
|
||||
<ClCompile Include="..\..\CyaSSL\ctaocrypt\src\rabbit.c" />
|
||||
<ClCompile Include="..\..\CyaSSL\ctaocrypt\src\random.c" />
|
||||
<ClCompile Include="..\..\CyaSSL\ctaocrypt\src\rsa.c" />
|
||||
<ClCompile Include="..\..\CyaSSL\ctaocrypt\src\sha.c" />
|
||||
<ClCompile Include="..\..\CyaSSL\ctaocrypt\src\sha256.c" />
|
||||
<ClCompile Include="..\..\CyaSSL\src\internal.c" />
|
||||
<ClCompile Include="..\..\CyaSSL\src\io.c" />
|
||||
<ClCompile Include="..\..\CyaSSL\src\keys.c" />
|
||||
<ClCompile Include="..\..\CyaSSL\src\ssl.c" />
|
||||
<ClCompile Include="..\..\CyaSSL\src\tls.c" />
|
||||
<ClCompile Include="..\..\..\FreeRTOS\Source\list.c" />
|
||||
<ClCompile Include="..\..\..\FreeRTOS\Source\portable\MemMang\heap_3.c" />
|
||||
<ClCompile Include="..\..\..\FreeRTOS\Source\portable\MSVC-MingW\port.c" />
|
||||
<ClCompile Include="..\..\..\FreeRTOS\Source\queue.c" />
|
||||
<ClCompile Include="..\..\..\FreeRTOS\Source\tasks.c" />
|
||||
<ClCompile Include="..\..\..\FreeRTOS\Source\timers.c" />
|
||||
<ClCompile Include="main.c">
|
||||
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SecureTCPClientTask.c" />
|
||||
<ClCompile Include="SecureTCPServerTask.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="FreeRTOSConfig.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -0,0 +1,144 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{38712199-cebf-4124-bf15-398f7c3419ea}</UniqueIdentifier>
|
||||
<Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Demo App Source">
|
||||
<UniqueIdentifier>{34567deb-d5ab-4a56-8640-0aaec609521a}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS">
|
||||
<UniqueIdentifier>{af3445a1-4908-4170-89ed-39345d90d30c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS\Source">
|
||||
<UniqueIdentifier>{f32be356-4763-4cae-9020-974a2638cb08}</UniqueIdentifier>
|
||||
<Extensions>*.c</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS\Source\Portable">
|
||||
<UniqueIdentifier>{88f409e6-d396-4ac5-94bd-7a99c914be46}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS+">
|
||||
<UniqueIdentifier>{e5ad4ec7-23dc-4295-8add-2acaee488f5a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS+\CyaSSL">
|
||||
<UniqueIdentifier>{8b481200-a9e5-48a4-98ad-49d2783cd652}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS+\CyaSSL\ctaocrypt">
|
||||
<UniqueIdentifier>{738eaad9-4e49-4309-9074-c3d9e102fb4a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.c">
|
||||
<Filter>Demo App Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\FreeRTOS\Source\portable\MSVC-MingW\port.c">
|
||||
<Filter>FreeRTOS\Source\Portable</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\FreeRTOS\Source\portable\MemMang\heap_3.c">
|
||||
<Filter>FreeRTOS\Source\Portable</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\FreeRTOS\Source\timers.c">
|
||||
<Filter>FreeRTOS\Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\FreeRTOS\Source\list.c">
|
||||
<Filter>FreeRTOS\Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\FreeRTOS\Source\queue.c">
|
||||
<Filter>FreeRTOS\Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\FreeRTOS\Source\tasks.c">
|
||||
<Filter>FreeRTOS\Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\CyaSSL\src\internal.c">
|
||||
<Filter>FreeRTOS+\CyaSSL</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\CyaSSL\src\io.c">
|
||||
<Filter>FreeRTOS+\CyaSSL</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\CyaSSL\src\keys.c">
|
||||
<Filter>FreeRTOS+\CyaSSL</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\CyaSSL\src\ssl.c">
|
||||
<Filter>FreeRTOS+\CyaSSL</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\CyaSSL\src\tls.c">
|
||||
<Filter>FreeRTOS+\CyaSSL</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\CyaSSL\ctaocrypt\src\aes.c">
|
||||
<Filter>FreeRTOS+\CyaSSL\ctaocrypt</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\CyaSSL\ctaocrypt\src\arc4.c">
|
||||
<Filter>FreeRTOS+\CyaSSL\ctaocrypt</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\CyaSSL\ctaocrypt\src\asn.c">
|
||||
<Filter>FreeRTOS+\CyaSSL\ctaocrypt</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\CyaSSL\ctaocrypt\src\coding.c">
|
||||
<Filter>FreeRTOS+\CyaSSL\ctaocrypt</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\CyaSSL\ctaocrypt\src\des3.c">
|
||||
<Filter>FreeRTOS+\CyaSSL\ctaocrypt</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\CyaSSL\ctaocrypt\src\dh.c">
|
||||
<Filter>FreeRTOS+\CyaSSL\ctaocrypt</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\CyaSSL\ctaocrypt\src\dsa.c">
|
||||
<Filter>FreeRTOS+\CyaSSL\ctaocrypt</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\CyaSSL\ctaocrypt\src\hc128.c">
|
||||
<Filter>FreeRTOS+\CyaSSL\ctaocrypt</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\CyaSSL\ctaocrypt\src\hmac.c">
|
||||
<Filter>FreeRTOS+\CyaSSL\ctaocrypt</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\CyaSSL\ctaocrypt\src\integer.c">
|
||||
<Filter>FreeRTOS+\CyaSSL\ctaocrypt</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\CyaSSL\ctaocrypt\src\logging.c">
|
||||
<Filter>FreeRTOS+\CyaSSL\ctaocrypt</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\CyaSSL\ctaocrypt\src\md4.c">
|
||||
<Filter>FreeRTOS+\CyaSSL\ctaocrypt</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\CyaSSL\ctaocrypt\src\md5.c">
|
||||
<Filter>FreeRTOS+\CyaSSL\ctaocrypt</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\CyaSSL\ctaocrypt\src\memory.c">
|
||||
<Filter>FreeRTOS+\CyaSSL\ctaocrypt</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\CyaSSL\ctaocrypt\src\misc.c">
|
||||
<Filter>FreeRTOS+\CyaSSL\ctaocrypt</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\CyaSSL\ctaocrypt\src\pwdbased.c">
|
||||
<Filter>FreeRTOS+\CyaSSL\ctaocrypt</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\CyaSSL\ctaocrypt\src\rabbit.c">
|
||||
<Filter>FreeRTOS+\CyaSSL\ctaocrypt</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\CyaSSL\ctaocrypt\src\random.c">
|
||||
<Filter>FreeRTOS+\CyaSSL\ctaocrypt</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\CyaSSL\ctaocrypt\src\rsa.c">
|
||||
<Filter>FreeRTOS+\CyaSSL\ctaocrypt</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\CyaSSL\ctaocrypt\src\sha256.c">
|
||||
<Filter>FreeRTOS+\CyaSSL\ctaocrypt</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\CyaSSL\ctaocrypt\src\sha.c">
|
||||
<Filter>FreeRTOS+\CyaSSL\ctaocrypt</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SecureTCPServerTask.c">
|
||||
<Filter>Demo App Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SecureTCPClientTask.c">
|
||||
<Filter>Demo App Source</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="FreeRTOSConfig.h">
|
||||
<Filter>Demo App Source</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,3 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
</Project>
|
|
@ -0,0 +1,87 @@
|
|||
Certificate:
|
||||
Data:
|
||||
Version: 3 (0x2)
|
||||
Serial Number:
|
||||
e9:d0:a7:5f:79:25:f4:3c
|
||||
Signature Algorithm: sha1WithRSAEncryption
|
||||
Issuer: C=US, ST=Montana, L=Bozeman, O=Sawtooth, OU=Consulting, CN=www.yassl.com/emailAddress=info@yassl.com
|
||||
Validity
|
||||
Not Before: Oct 24 18:18:15 2011 GMT
|
||||
Not After : Jul 20 18:18:15 2014 GMT
|
||||
Subject: C=US, ST=Montana, L=Bozeman, O=Sawtooth, OU=Consulting, CN=www.yassl.com/emailAddress=info@yassl.com
|
||||
Subject Public Key Info:
|
||||
Public Key Algorithm: rsaEncryption
|
||||
RSA Public Key: (2048 bit)
|
||||
Modulus (2048 bit):
|
||||
00:bf:0c:ca:2d:14:b2:1e:84:42:5b:cd:38:1f:4a:
|
||||
f2:4d:75:10:f1:b6:35:9f:df:ca:7d:03:98:d3:ac:
|
||||
de:03:66:ee:2a:f1:d8:b0:7d:6e:07:54:0b:10:98:
|
||||
21:4d:80:cb:12:20:e7:cc:4f:de:45:7d:c9:72:77:
|
||||
32:ea:ca:90:bb:69:52:10:03:2f:a8:f3:95:c5:f1:
|
||||
8b:62:56:1b:ef:67:6f:a4:10:41:95:ad:0a:9b:e3:
|
||||
a5:c0:b0:d2:70:76:50:30:5b:a8:e8:08:2c:7c:ed:
|
||||
a7:a2:7a:8d:38:29:1c:ac:c7:ed:f2:7c:95:b0:95:
|
||||
82:7d:49:5c:38:cd:77:25:ef:bd:80:75:53:94:3c:
|
||||
3d:ca:63:5b:9f:15:b5:d3:1d:13:2f:19:d1:3c:db:
|
||||
76:3a:cc:b8:7d:c9:e5:c2:d7:da:40:6f:d8:21:dc:
|
||||
73:1b:42:2d:53:9c:fe:1a:fc:7d:ab:7a:36:3f:98:
|
||||
de:84:7c:05:67:ce:6a:14:38:87:a9:f1:8c:b5:68:
|
||||
cb:68:7f:71:20:2b:f5:a0:63:f5:56:2f:a3:26:d2:
|
||||
b7:6f:b1:5a:17:d7:38:99:08:fe:93:58:6f:fe:c3:
|
||||
13:49:08:16:0b:a7:4d:67:00:52:31:67:23:4e:98:
|
||||
ed:51:45:1d:b9:04:d9:0b:ec:d8:28:b3:4b:bd:ed:
|
||||
36:79
|
||||
Exponent: 65537 (0x10001)
|
||||
X509v3 extensions:
|
||||
X509v3 Subject Key Identifier:
|
||||
27:8E:67:11:74:C3:26:1D:3F:ED:33:63:B3:A4:D8:1D:30:E5:E8:D5
|
||||
X509v3 Authority Key Identifier:
|
||||
keyid:27:8E:67:11:74:C3:26:1D:3F:ED:33:63:B3:A4:D8:1D:30:E5:E8:D5
|
||||
DirName:/C=US/ST=Montana/L=Bozeman/O=Sawtooth/OU=Consulting/CN=www.yassl.com/emailAddress=info@yassl.com
|
||||
serial:E9:D0:A7:5F:79:25:F4:3C
|
||||
|
||||
X509v3 Basic Constraints:
|
||||
CA:TRUE
|
||||
Signature Algorithm: sha1WithRSAEncryption
|
||||
5f:86:14:f4:51:8b:bc:a5:4e:30:da:5e:ac:9a:f8:6c:d9:26:
|
||||
4b:93:f9:e3:1c:89:6f:9e:ee:b3:9d:77:3e:89:20:76:a3:e6:
|
||||
e8:86:15:21:db:e2:33:b2:34:d5:d0:9f:f3:c1:a4:87:92:5c:
|
||||
f9:d1:ff:30:2f:8e:03:bc:b3:3c:0c:32:a3:90:5f:1a:90:1e:
|
||||
af:9d:f3:9e:d7:07:02:a9:7d:27:66:63:2f:af:18:d7:ac:18:
|
||||
98:8c:83:8f:38:f3:0b:ac:36:10:75:fb:ca:76:13:50:5b:02:
|
||||
8f:73:bf:e3:a0:ee:83:52:25:54:ce:26:ce:9c:bd:2f:79:ab:
|
||||
1b:60:b8:92:f1:03:c0:fc:3b:08:d9:c0:ad:d5:72:08:25:80:
|
||||
61:2d:dc:9f:a7:83:62:07:47:e0:07:4c:4b:07:30:04:a9:87:
|
||||
1c:55:7f:07:12:d0:cb:42:5d:cb:cf:66:01:1a:17:ee:f9:0f:
|
||||
60:b7:db:6f:68:e5:4e:41:62:6e:d3:6f:60:4f:4b:27:de:cf:
|
||||
18:07:f1:13:5d:cb:3f:a9:25:44:da:52:5c:c8:04:e1:56:12:
|
||||
f5:2a:90:4e:d1:e2:af:01:b5:23:a1:ec:31:da:7b:63:69:c4:
|
||||
b8:f3:e7:ce:a1:3d:c0:db:6d:f3:b2:d9:46:c8:9f:c3:b8:70:
|
||||
5a:1f:7f:ca
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIEnjCCA4agAwIBAgIJAOnQp195JfQ8MA0GCSqGSIb3DQEBBQUAMIGQMQswCQYD
|
||||
VQQGEwJVUzEQMA4GA1UECBMHTW9udGFuYTEQMA4GA1UEBxMHQm96ZW1hbjERMA8G
|
||||
A1UEChMIU2F3dG9vdGgxEzARBgNVBAsTCkNvbnN1bHRpbmcxFjAUBgNVBAMTDXd3
|
||||
dy55YXNzbC5jb20xHTAbBgkqhkiG9w0BCQEWDmluZm9AeWFzc2wuY29tMB4XDTEx
|
||||
MTAyNDE4MTgxNVoXDTE0MDcyMDE4MTgxNVowgZAxCzAJBgNVBAYTAlVTMRAwDgYD
|
||||
VQQIEwdNb250YW5hMRAwDgYDVQQHEwdCb3plbWFuMREwDwYDVQQKEwhTYXd0b290
|
||||
aDETMBEGA1UECxMKQ29uc3VsdGluZzEWMBQGA1UEAxMNd3d3Lnlhc3NsLmNvbTEd
|
||||
MBsGCSqGSIb3DQEJARYOaW5mb0B5YXNzbC5jb20wggEiMA0GCSqGSIb3DQEBAQUA
|
||||
A4IBDwAwggEKAoIBAQC/DMotFLIehEJbzTgfSvJNdRDxtjWf38p9A5jTrN4DZu4q
|
||||
8diwfW4HVAsQmCFNgMsSIOfMT95FfclydzLqypC7aVIQAy+o85XF8YtiVhvvZ2+k
|
||||
EEGVrQqb46XAsNJwdlAwW6joCCx87aeieo04KRysx+3yfJWwlYJ9SVw4zXcl772A
|
||||
dVOUPD3KY1ufFbXTHRMvGdE823Y6zLh9yeXC19pAb9gh3HMbQi1TnP4a/H2rejY/
|
||||
mN6EfAVnzmoUOIep8Yy1aMtof3EgK/WgY/VWL6Mm0rdvsVoX1ziZCP6TWG/+wxNJ
|
||||
CBYLp01nAFIxZyNOmO1RRR25BNkL7Ngos0u97TZ5AgMBAAGjgfgwgfUwHQYDVR0O
|
||||
BBYEFCeOZxF0wyYdP+0zY7Ok2B0w5ejVMIHFBgNVHSMEgb0wgbqAFCeOZxF0wyYd
|
||||
P+0zY7Ok2B0w5ejVoYGWpIGTMIGQMQswCQYDVQQGEwJVUzEQMA4GA1UECBMHTW9u
|
||||
dGFuYTEQMA4GA1UEBxMHQm96ZW1hbjERMA8GA1UEChMIU2F3dG9vdGgxEzARBgNV
|
||||
BAsTCkNvbnN1bHRpbmcxFjAUBgNVBAMTDXd3dy55YXNzbC5jb20xHTAbBgkqhkiG
|
||||
9w0BCQEWDmluZm9AeWFzc2wuY29tggkA6dCnX3kl9DwwDAYDVR0TBAUwAwEB/zAN
|
||||
BgkqhkiG9w0BAQUFAAOCAQEAX4YU9FGLvKVOMNperJr4bNkmS5P54xyJb57us513
|
||||
PokgdqPm6IYVIdviM7I01dCf88Gkh5Jc+dH/MC+OA7yzPAwyo5BfGpAer53zntcH
|
||||
Aql9J2ZjL68Y16wYmIyDjzjzC6w2EHX7ynYTUFsCj3O/46Dug1IlVM4mzpy9L3mr
|
||||
G2C4kvEDwPw7CNnArdVyCCWAYS3cn6eDYgdH4AdMSwcwBKmHHFV/BxLQy0Jdy89m
|
||||
ARoX7vkPYLfbb2jlTkFibtNvYE9LJ97PGAfxE13LP6klRNpSXMgE4VYS9SqQTtHi
|
||||
rwG1I6HsMdp7Y2nEuPPnzqE9wNtt87LZRsifw7hwWh9/yg==
|
||||
-----END CERTIFICATE-----
|
|
@ -0,0 +1,177 @@
|
|||
/*
|
||||
FreeRTOS V7.1.1 - Copyright (C) 2012 Real Time Engineers Ltd.
|
||||
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||
* Complete, revised, and edited pdf reference manuals are also *
|
||||
* available. *
|
||||
* *
|
||||
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||
* ensuring you get running as quickly as possible and with an *
|
||||
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||
* the FreeRTOS project to continue with its mission of providing *
|
||||
* professional grade, cross platform, de facto standard solutions *
|
||||
* for microcontrollers - completely free of charge! *
|
||||
* *
|
||||
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||
* *
|
||||
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
|
||||
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. See the GNU General Public License for
|
||||
more details. You should have received a copy of the GNU General Public
|
||||
License and the FreeRTOS license exception along with FreeRTOS; if not it
|
||||
can be viewed here: http://www.freertos.org/a00114.html and also obtained
|
||||
by writing to Richard Barry, contact details for whom are available on the
|
||||
FreeRTOS WEB site.
|
||||
|
||||
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, training, latest information,
|
||||
license and contact details.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool.
|
||||
|
||||
Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell
|
||||
the code with commercial support, indemnification, and middleware, under
|
||||
the OpenRTOS brand: http://www.OpenRTOS.com. High Integrity Systems also
|
||||
provide a safety engineered and independently SIL3 certified version under
|
||||
the SafeRTOS brand: http://www.SafeRTOS.com.
|
||||
*/
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* -NOTE- The Win32 port is a simulation (or is that emulation?) only! Do not
|
||||
* expect to get real time behaviour from the Win32 port or this demo
|
||||
* application. It is provided as a convenient development and demonstration
|
||||
* test bed only. This was tested using Windows XP on a dual core laptop.
|
||||
*
|
||||
* In this example, one simulated millisecond will take approximately 40ms to
|
||||
* execute. 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
|
||||
******************************************************************************
|
||||
*
|
||||
* This is a simple FreeRTOS Windows simulator project that makes it easy to
|
||||
* evaluate CyaSSL in a FreeRTOS environment on a standard desktop PC, and
|
||||
* without any external hardware or interfaces being required.
|
||||
*
|
||||
* main() creates a TCP server task, which initialises CyaSSL, before creating a
|
||||
* TCP client task. Both the server and client use TLS secured sockets.
|
||||
*
|
||||
* The client task repeatedly connects to the server, sends 10 messages, then
|
||||
* disconnects. The server task prints the contents of each message to the
|
||||
* console as they are received.
|
||||
*
|
||||
* CyaSSL objects are created and deleted as each socket connects and
|
||||
* disconnects respectively.
|
||||
*
|
||||
* The server task is implemented in SecureTCPServerTask.c, and the client task
|
||||
* in SecureTCPClientTask.c.
|
||||
*
|
||||
* Visit http://www.FreeRTOS.org/ssl for FreeRTOS + CyaSSL for demo
|
||||
* documentation.
|
||||
*
|
||||
*/
|
||||
|
||||
/* Standard includes. */
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/* FreeRTOS includes. */
|
||||
#include <FreeRTOS.h>
|
||||
#include "task.h"
|
||||
|
||||
/* This application is using the FreeRTOS Windows simulator, which uses the
|
||||
FreeRTOS scheduler to schedule FreeRTOS task within the Windows environment.
|
||||
The Windows environment must not be allowed to block any Windows threads that
|
||||
are running FreeRTOS tasks, unless the FreeRTOS task is running at the FreeRTOS
|
||||
idle priority. For simplicity, this demo uses the Windows TCP/IP stack, the
|
||||
API for which can cause Windows threads to block. Therefore, any FreeRTOS task
|
||||
that makes calls to the Windows TCP/IP stack must be assigned the idle priority.
|
||||
Note this is only a restriction of the simulated Windows environment - real
|
||||
FreeRTOS ports do not have this restriction. */
|
||||
#define mainSECURE_SERVER_TASK_PRIORITY ( tskIDLE_PRIORITY )
|
||||
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* The task that implements the server side.
|
||||
*/
|
||||
extern void vSecureTCPServerTask( void *pvParameters );
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
int main( void )
|
||||
{
|
||||
const uint32_t ulLongTime_ms = 250UL;
|
||||
|
||||
/* Create the TCP server task. This will itself create the client task
|
||||
once it has completed the CyaSSL initialisation. */
|
||||
xTaskCreate( vSecureTCPServerTask, ( signed char * ) "Server", configMINIMAL_STACK_SIZE, NULL, mainSECURE_SERVER_TASK_PRIORITY, NULL );
|
||||
|
||||
/* Start the task running. */
|
||||
vTaskStartScheduler();
|
||||
|
||||
/* If all is well, the scheduler will now be running, and the following
|
||||
line will never be reached. If the following line does execute, then
|
||||
there was insufficient FreeRTOS heap memory available for the idle and/or
|
||||
timer tasks to be created. See the memory management section on the
|
||||
FreeRTOS web site for more details (this is standard text that is not not
|
||||
really applicable to the Win32 simulator port). */
|
||||
for( ;; )
|
||||
{
|
||||
Sleep( ulLongTime_ms );
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vApplicationIdleHook( void )
|
||||
{
|
||||
const unsigned long ulMSToSleep = 5;
|
||||
|
||||
/* This function is called on each cycle of the idle task if
|
||||
configUSE_IDLE_HOOK is set to 1 in FreeRTOSConfig.h. Sleep to reduce CPU
|
||||
load. */
|
||||
Sleep( ulMSToSleep );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vAssertCalled( void )
|
||||
{
|
||||
const unsigned long ulLongSleep = 1000UL;
|
||||
|
||||
taskDISABLE_INTERRUPTS();
|
||||
for( ;; )
|
||||
{
|
||||
Sleep( ulLongSleep );
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
|
@ -0,0 +1,158 @@
|
|||
Certificate:
|
||||
Data:
|
||||
Version: 1 (0x0)
|
||||
Serial Number: 2 (0x2)
|
||||
Signature Algorithm: sha1WithRSAEncryption
|
||||
Issuer: C=US, ST=Montana, L=Bozeman, O=Sawtooth, OU=Consulting, CN=www.yassl.com/emailAddress=info@yassl.com
|
||||
Validity
|
||||
Not Before: Oct 24 18:27:13 2011 GMT
|
||||
Not After : Jul 20 18:27:13 2014 GMT
|
||||
Subject: C=US, ST=Montana, L=Bozeman, O=yaSSL, OU=Support, CN=www.yassl.com/emailAddress=info@yassl.com
|
||||
Subject Public Key Info:
|
||||
Public Key Algorithm: rsaEncryption
|
||||
RSA Public Key: (2048 bit)
|
||||
Modulus (2048 bit):
|
||||
00:c0:95:08:e1:57:41:f2:71:6d:b7:d2:45:41:27:
|
||||
01:65:c6:45:ae:f2:bc:24:30:b8:95:ce:2f:4e:d6:
|
||||
f6:1c:88:bc:7c:9f:fb:a8:67:7f:fe:5c:9c:51:75:
|
||||
f7:8a:ca:07:e7:35:2f:8f:e1:bd:7b:c0:2f:7c:ab:
|
||||
64:a8:17:fc:ca:5d:7b:ba:e0:21:e5:72:2e:6f:2e:
|
||||
86:d8:95:73:da:ac:1b:53:b9:5f:3f:d7:19:0d:25:
|
||||
4f:e1:63:63:51:8b:0b:64:3f:ad:43:b8:a5:1c:5c:
|
||||
34:b3:ae:00:a0:63:c5:f6:7f:0b:59:68:78:73:a6:
|
||||
8c:18:a9:02:6d:af:c3:19:01:2e:b8:10:e3:c6:cc:
|
||||
40:b4:69:a3:46:33:69:87:6e:c4:bb:17:a6:f3:e8:
|
||||
dd:ad:73:bc:7b:2f:21:b5:fd:66:51:0c:bd:54:b3:
|
||||
e1:6d:5f:1c:bc:23:73:d1:09:03:89:14:d2:10:b9:
|
||||
64:c3:2a:d0:a1:96:4a:bc:e1:d4:1a:5b:c7:a0:c0:
|
||||
c1:63:78:0f:44:37:30:32:96:80:32:23:95:a1:77:
|
||||
ba:13:d2:97:73:e2:5d:25:c9:6a:0d:c3:39:60:a4:
|
||||
b4:b0:69:42:42:09:e9:d8:08:bc:33:20:b3:58:22:
|
||||
a7:aa:eb:c4:e1:e6:61:83:c5:d2:96:df:d9:d0:4f:
|
||||
ad:d7
|
||||
Exponent: 65537 (0x10001)
|
||||
Signature Algorithm: sha1WithRSAEncryption
|
||||
71:4e:d3:62:df:cc:4c:f7:cd:b7:6e:52:0b:6c:6e:e0:bd:c2:
|
||||
2d:07:d7:c0:b0:6e:43:1e:35:bc:30:01:50:f0:ff:99:23:6c:
|
||||
18:1a:41:b6:11:d6:d4:19:61:fd:e4:77:97:1c:39:e1:57:ab:
|
||||
c5:15:63:77:11:36:5e:74:e2:24:0b:1f:41:78:ad:b7:81:e7:
|
||||
b4:40:66:80:f0:4b:91:a0:6d:a8:6e:3d:53:d9:8b:ce:2a:e1:
|
||||
0b:45:65:87:a1:96:ae:ee:3e:88:d5:12:1f:78:17:ae:2c:c5:
|
||||
73:44:d8:dc:f4:af:d8:cc:ae:4c:e1:0c:be:55:a4:99:f7:6e:
|
||||
96:c0:c8:45:87:bf:dc:51:57:ff:9e:73:37:6a:18:9c:c3:f9:
|
||||
22:7a:f4:b0:52:bd:fc:21:30:f8:c5:ff:1e:87:7d:ad:a2:5a:
|
||||
35:f5:22:a8:b4:0a:76:38:e6:76:b0:98:af:1b:ec:8a:0a:43:
|
||||
74:d2:85:34:37:84:07:e1:f6:23:b2:29:de:a6:b6:b7:4c:57:
|
||||
7e:96:06:cb:a9:16:25:29:3a:03:2d:55:7d:a6:8c:a4:f7:9e:
|
||||
81:c9:95:b6:7c:c1:4a:ce:94:66:0c:ca:88:eb:d2:09:f5:5b:
|
||||
19:58:82:df:27:fd:67:95:78:b7:02:06:d5:a7:61:bd:ef:3a:
|
||||
fc:b2:61:cd
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDkDCCAngCAQIwDQYJKoZIhvcNAQEFBQAwgZAxCzAJBgNVBAYTAlVTMRAwDgYD
|
||||
VQQIEwdNb250YW5hMRAwDgYDVQQHEwdCb3plbWFuMREwDwYDVQQKEwhTYXd0b290
|
||||
aDETMBEGA1UECxMKQ29uc3VsdGluZzEWMBQGA1UEAxMNd3d3Lnlhc3NsLmNvbTEd
|
||||
MBsGCSqGSIb3DQEJARYOaW5mb0B5YXNzbC5jb20wHhcNMTExMDI0MTgyNzEzWhcN
|
||||
MTQwNzIwMTgyNzEzWjCBijELMAkGA1UEBhMCVVMxEDAOBgNVBAgTB01vbnRhbmEx
|
||||
EDAOBgNVBAcTB0JvemVtYW4xDjAMBgNVBAoTBXlhU1NMMRAwDgYDVQQLEwdTdXBw
|
||||
b3J0MRYwFAYDVQQDEw13d3cueWFzc2wuY29tMR0wGwYJKoZIhvcNAQkBFg5pbmZv
|
||||
QHlhc3NsLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMCVCOFX
|
||||
QfJxbbfSRUEnAWXGRa7yvCQwuJXOL07W9hyIvHyf+6hnf/5cnFF194rKB+c1L4/h
|
||||
vXvAL3yrZKgX/Mpde7rgIeVyLm8uhtiVc9qsG1O5Xz/XGQ0lT+FjY1GLC2Q/rUO4
|
||||
pRxcNLOuAKBjxfZ/C1loeHOmjBipAm2vwxkBLrgQ48bMQLRpo0YzaYduxLsXpvPo
|
||||
3a1zvHsvIbX9ZlEMvVSz4W1fHLwjc9EJA4kU0hC5ZMMq0KGWSrzh1Bpbx6DAwWN4
|
||||
D0Q3MDKWgDIjlaF3uhPSl3PiXSXJag3DOWCktLBpQkIJ6dgIvDMgs1gip6rrxOHm
|
||||
YYPF0pbf2dBPrdcCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEAcU7TYt/MTPfNt25S
|
||||
C2xu4L3CLQfXwLBuQx41vDABUPD/mSNsGBpBthHW1Blh/eR3lxw54VerxRVjdxE2
|
||||
XnTiJAsfQXitt4HntEBmgPBLkaBtqG49U9mLzirhC0Vlh6GWru4+iNUSH3gXrizF
|
||||
c0TY3PSv2MyuTOEMvlWkmfdulsDIRYe/3FFX/55zN2oYnMP5Inr0sFK9/CEw+MX/
|
||||
Hod9raJaNfUiqLQKdjjmdrCYrxvsigpDdNKFNDeEB+H2I7Ip3qa2t0xXfpYGy6kW
|
||||
JSk6Ay1VfaaMpPeegcmVtnzBSs6UZgzKiOvSCfVbGViC3yf9Z5V4twIG1adhve86
|
||||
/LJhzQ==
|
||||
-----END CERTIFICATE-----
|
||||
Certificate:
|
||||
Data:
|
||||
Version: 3 (0x2)
|
||||
Serial Number:
|
||||
e9:d0:a7:5f:79:25:f4:3c
|
||||
Signature Algorithm: sha1WithRSAEncryption
|
||||
Issuer: C=US, ST=Montana, L=Bozeman, O=Sawtooth, OU=Consulting, CN=www.yassl.com/emailAddress=info@yassl.com
|
||||
Validity
|
||||
Not Before: Oct 24 18:18:15 2011 GMT
|
||||
Not After : Jul 20 18:18:15 2014 GMT
|
||||
Subject: C=US, ST=Montana, L=Bozeman, O=Sawtooth, OU=Consulting, CN=www.yassl.com/emailAddress=info@yassl.com
|
||||
Subject Public Key Info:
|
||||
Public Key Algorithm: rsaEncryption
|
||||
RSA Public Key: (2048 bit)
|
||||
Modulus (2048 bit):
|
||||
00:bf:0c:ca:2d:14:b2:1e:84:42:5b:cd:38:1f:4a:
|
||||
f2:4d:75:10:f1:b6:35:9f:df:ca:7d:03:98:d3:ac:
|
||||
de:03:66:ee:2a:f1:d8:b0:7d:6e:07:54:0b:10:98:
|
||||
21:4d:80:cb:12:20:e7:cc:4f:de:45:7d:c9:72:77:
|
||||
32:ea:ca:90:bb:69:52:10:03:2f:a8:f3:95:c5:f1:
|
||||
8b:62:56:1b:ef:67:6f:a4:10:41:95:ad:0a:9b:e3:
|
||||
a5:c0:b0:d2:70:76:50:30:5b:a8:e8:08:2c:7c:ed:
|
||||
a7:a2:7a:8d:38:29:1c:ac:c7:ed:f2:7c:95:b0:95:
|
||||
82:7d:49:5c:38:cd:77:25:ef:bd:80:75:53:94:3c:
|
||||
3d:ca:63:5b:9f:15:b5:d3:1d:13:2f:19:d1:3c:db:
|
||||
76:3a:cc:b8:7d:c9:e5:c2:d7:da:40:6f:d8:21:dc:
|
||||
73:1b:42:2d:53:9c:fe:1a:fc:7d:ab:7a:36:3f:98:
|
||||
de:84:7c:05:67:ce:6a:14:38:87:a9:f1:8c:b5:68:
|
||||
cb:68:7f:71:20:2b:f5:a0:63:f5:56:2f:a3:26:d2:
|
||||
b7:6f:b1:5a:17:d7:38:99:08:fe:93:58:6f:fe:c3:
|
||||
13:49:08:16:0b:a7:4d:67:00:52:31:67:23:4e:98:
|
||||
ed:51:45:1d:b9:04:d9:0b:ec:d8:28:b3:4b:bd:ed:
|
||||
36:79
|
||||
Exponent: 65537 (0x10001)
|
||||
X509v3 extensions:
|
||||
X509v3 Subject Key Identifier:
|
||||
27:8E:67:11:74:C3:26:1D:3F:ED:33:63:B3:A4:D8:1D:30:E5:E8:D5
|
||||
X509v3 Authority Key Identifier:
|
||||
keyid:27:8E:67:11:74:C3:26:1D:3F:ED:33:63:B3:A4:D8:1D:30:E5:E8:D5
|
||||
DirName:/C=US/ST=Montana/L=Bozeman/O=Sawtooth/OU=Consulting/CN=www.yassl.com/emailAddress=info@yassl.com
|
||||
serial:E9:D0:A7:5F:79:25:F4:3C
|
||||
|
||||
X509v3 Basic Constraints:
|
||||
CA:TRUE
|
||||
Signature Algorithm: sha1WithRSAEncryption
|
||||
5f:86:14:f4:51:8b:bc:a5:4e:30:da:5e:ac:9a:f8:6c:d9:26:
|
||||
4b:93:f9:e3:1c:89:6f:9e:ee:b3:9d:77:3e:89:20:76:a3:e6:
|
||||
e8:86:15:21:db:e2:33:b2:34:d5:d0:9f:f3:c1:a4:87:92:5c:
|
||||
f9:d1:ff:30:2f:8e:03:bc:b3:3c:0c:32:a3:90:5f:1a:90:1e:
|
||||
af:9d:f3:9e:d7:07:02:a9:7d:27:66:63:2f:af:18:d7:ac:18:
|
||||
98:8c:83:8f:38:f3:0b:ac:36:10:75:fb:ca:76:13:50:5b:02:
|
||||
8f:73:bf:e3:a0:ee:83:52:25:54:ce:26:ce:9c:bd:2f:79:ab:
|
||||
1b:60:b8:92:f1:03:c0:fc:3b:08:d9:c0:ad:d5:72:08:25:80:
|
||||
61:2d:dc:9f:a7:83:62:07:47:e0:07:4c:4b:07:30:04:a9:87:
|
||||
1c:55:7f:07:12:d0:cb:42:5d:cb:cf:66:01:1a:17:ee:f9:0f:
|
||||
60:b7:db:6f:68:e5:4e:41:62:6e:d3:6f:60:4f:4b:27:de:cf:
|
||||
18:07:f1:13:5d:cb:3f:a9:25:44:da:52:5c:c8:04:e1:56:12:
|
||||
f5:2a:90:4e:d1:e2:af:01:b5:23:a1:ec:31:da:7b:63:69:c4:
|
||||
b8:f3:e7:ce:a1:3d:c0:db:6d:f3:b2:d9:46:c8:9f:c3:b8:70:
|
||||
5a:1f:7f:ca
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIEnjCCA4agAwIBAgIJAOnQp195JfQ8MA0GCSqGSIb3DQEBBQUAMIGQMQswCQYD
|
||||
VQQGEwJVUzEQMA4GA1UECBMHTW9udGFuYTEQMA4GA1UEBxMHQm96ZW1hbjERMA8G
|
||||
A1UEChMIU2F3dG9vdGgxEzARBgNVBAsTCkNvbnN1bHRpbmcxFjAUBgNVBAMTDXd3
|
||||
dy55YXNzbC5jb20xHTAbBgkqhkiG9w0BCQEWDmluZm9AeWFzc2wuY29tMB4XDTEx
|
||||
MTAyNDE4MTgxNVoXDTE0MDcyMDE4MTgxNVowgZAxCzAJBgNVBAYTAlVTMRAwDgYD
|
||||
VQQIEwdNb250YW5hMRAwDgYDVQQHEwdCb3plbWFuMREwDwYDVQQKEwhTYXd0b290
|
||||
aDETMBEGA1UECxMKQ29uc3VsdGluZzEWMBQGA1UEAxMNd3d3Lnlhc3NsLmNvbTEd
|
||||
MBsGCSqGSIb3DQEJARYOaW5mb0B5YXNzbC5jb20wggEiMA0GCSqGSIb3DQEBAQUA
|
||||
A4IBDwAwggEKAoIBAQC/DMotFLIehEJbzTgfSvJNdRDxtjWf38p9A5jTrN4DZu4q
|
||||
8diwfW4HVAsQmCFNgMsSIOfMT95FfclydzLqypC7aVIQAy+o85XF8YtiVhvvZ2+k
|
||||
EEGVrQqb46XAsNJwdlAwW6joCCx87aeieo04KRysx+3yfJWwlYJ9SVw4zXcl772A
|
||||
dVOUPD3KY1ufFbXTHRMvGdE823Y6zLh9yeXC19pAb9gh3HMbQi1TnP4a/H2rejY/
|
||||
mN6EfAVnzmoUOIep8Yy1aMtof3EgK/WgY/VWL6Mm0rdvsVoX1ziZCP6TWG/+wxNJ
|
||||
CBYLp01nAFIxZyNOmO1RRR25BNkL7Ngos0u97TZ5AgMBAAGjgfgwgfUwHQYDVR0O
|
||||
BBYEFCeOZxF0wyYdP+0zY7Ok2B0w5ejVMIHFBgNVHSMEgb0wgbqAFCeOZxF0wyYd
|
||||
P+0zY7Ok2B0w5ejVoYGWpIGTMIGQMQswCQYDVQQGEwJVUzEQMA4GA1UECBMHTW9u
|
||||
dGFuYTEQMA4GA1UEBxMHQm96ZW1hbjERMA8GA1UEChMIU2F3dG9vdGgxEzARBgNV
|
||||
BAsTCkNvbnN1bHRpbmcxFjAUBgNVBAMTDXd3dy55YXNzbC5jb20xHTAbBgkqhkiG
|
||||
9w0BCQEWDmluZm9AeWFzc2wuY29tggkA6dCnX3kl9DwwDAYDVR0TBAUwAwEB/zAN
|
||||
BgkqhkiG9w0BAQUFAAOCAQEAX4YU9FGLvKVOMNperJr4bNkmS5P54xyJb57us513
|
||||
PokgdqPm6IYVIdviM7I01dCf88Gkh5Jc+dH/MC+OA7yzPAwyo5BfGpAer53zntcH
|
||||
Aql9J2ZjL68Y16wYmIyDjzjzC6w2EHX7ynYTUFsCj3O/46Dug1IlVM4mzpy9L3mr
|
||||
G2C4kvEDwPw7CNnArdVyCCWAYS3cn6eDYgdH4AdMSwcwBKmHHFV/BxLQy0Jdy89m
|
||||
ARoX7vkPYLfbb2jlTkFibtNvYE9LJ97PGAfxE13LP6klRNpSXMgE4VYS9SqQTtHi
|
||||
rwG1I6HsMdp7Y2nEuPPnzqE9wNtt87LZRsifw7hwWh9/yg==
|
||||
-----END CERTIFICATE-----
|
|
@ -0,0 +1,27 @@
|
|||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIIEpQIBAAKCAQEAwJUI4VdB8nFtt9JFQScBZcZFrvK8JDC4lc4vTtb2HIi8fJ/7
|
||||
qGd//lycUXX3isoH5zUvj+G9e8AvfKtkqBf8yl17uuAh5XIuby6G2JVz2qwbU7lf
|
||||
P9cZDSVP4WNjUYsLZD+tQ7ilHFw0s64AoGPF9n8LWWh4c6aMGKkCba/DGQEuuBDj
|
||||
xsxAtGmjRjNph27Euxem8+jdrXO8ey8htf1mUQy9VLPhbV8cvCNz0QkDiRTSELlk
|
||||
wyrQoZZKvOHUGlvHoMDBY3gPRDcwMpaAMiOVoXe6E9KXc+JdJclqDcM5YKS0sGlC
|
||||
Qgnp2Ai8MyCzWCKnquvE4eZhg8XSlt/Z0E+t1wIDAQABAoIBAQCa0DQPUmIFUAHv
|
||||
n+1kbsLE2hryhNeSEEiSxOlq64t1bMZ5OPLJckqGZFSVd8vDmp231B2kAMieTuTd
|
||||
x7pnFsF0vKnWlI8rMBr77d8hBSPZSjm9mGtlmrjcxH3upkMVLj2+HSJgKnMw1T7Y
|
||||
oqyGQy7E9WReP4l1DxHYUSVOn9iqo85gs+KK2X4b8GTKmlsFC1uqy+XjP24yIgXz
|
||||
0PrvdFKB4l90073/MYNFdfpjepcu1rYZxpIm5CgGUFAOeC6peA0Ul7QS2DFAq6EB
|
||||
QcIw+AdfFuRhd9Jg8p+N6PS662PeKpeB70xs5lU0USsoNPRTHMRYCj+7r7X3SoVD
|
||||
LTzxWFiBAoGBAPIsVHY5I2PJEDK3k62vvhl1loFk5rW4iUJB0W3QHBv4G6xpyzY8
|
||||
ZH3c9Bm4w2CxV0hfUk9ZOlV/MsAZQ1A/rs5vF/MOn0DKTq0VO8l56cBZOHNwnAp8
|
||||
yTpIMqfYSXUKhcLC/RVz2pkJKmmanwpxv7AEpox6Wm9IWlQ7xrFTF9/nAoGBAMuT
|
||||
3ncVXbdcXHzYkKmYLdZpDmOzo9ymzItqpKISjI57SCyySzfcBhh96v52odSh6T8N
|
||||
zRtfr1+elltbD6F8r7ObkNtXczrtsCNErkFPHwdCEyNMy/r0FKTV9542fFufqDzB
|
||||
hV900jkt/9CE3/uzIHoumxeu5roLrl9TpFLtG8SRAoGBAOyY2rvV/vlSSn0CVUlv
|
||||
VW5SL4SjK7OGYrNU0mNS2uOIdqDvixWl0xgUcndex6MEH54ZYrUbG57D8rUy+UzB
|
||||
qusMJn3UX0pRXKRFBnBEp1bA1CIUdp7YY1CJkNPiv4GVkjFBhzkaQwsYpVMfORpf
|
||||
H0O8h2rfbtMiAP4imHBOGhkpAoGBAIpBVihRnl/Ungs7mKNU8mxW1KrpaTOFJAza
|
||||
1AwtxL9PAmk4fNTm3Ezt1xYRwz4A58MmwFEC3rt1nG9WnHrzju/PisUr0toGakTJ
|
||||
c/5umYf4W77xfOZltU9s8MnF/xbKixsX4lg9ojerAby/QM5TjI7t7+5ZneBj5nxe
|
||||
9Y5L8TvBAoGATUX5QIzFW/QqGoq08hysa+kMVja3TnKW1eWK0uL/8fEYEz2GCbjY
|
||||
dqfJHHFSlDBD4PF4dP1hG0wJzOZoKnGtHN9DvFbbpaS+NXCkXs9P/ABVmTo9I89n
|
||||
WvUi+LUp0EQR6zUuRr79jhiyX6i/GTKh9dwD5nyaHwx8qbAOITc78bA=
|
||||
-----END RSA PRIVATE KEY-----
|
Loading…
Add table
Add a link
Reference in a new issue