<Value>../../../../FreeRTOS-Plus/Source/FreeRTOS-Plus-CLI</Value>\r
<Value>../../../../FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/api</Value>\r
<Value>../../../../FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_UDP_Demos/CLICommands</Value>\r
+ <Value>../../Common/include</Value>\r
</ListValues>\r
</armgcc.compiler.directories.IncludePaths>\r
<armgcc.compiler.optimization.OtherFlags>-fdata-sections</armgcc.compiler.optimization.OtherFlags>\r
<SubType>compile</SubType>\r
<Link>src\FreeRTOS+\FreeRTOS+FAT SL\PSP\Target\RTC\psp_rtc.c</Link>\r
</Compile>\r
+ <Compile Include="..\Common\Minimal\blocktim.c">\r
+ <SubType>compile</SubType>\r
+ <Link>src\Common Demo Tasks\blocktim.c</Link>\r
+ </Compile>\r
+ <Compile Include="..\Common\Minimal\countsem.c">\r
+ <SubType>compile</SubType>\r
+ <Link>src\Common Demo Tasks\countsem.c</Link>\r
+ </Compile>\r
+ <Compile Include="..\Common\Minimal\dynamic.c">\r
+ <SubType>compile</SubType>\r
+ <Link>src\Common Demo Tasks\dynamic.c</Link>\r
+ </Compile>\r
+ <Compile Include="..\Common\Minimal\flash_timer.c">\r
+ <SubType>compile</SubType>\r
+ <Link>src\Common Demo Tasks\flash_timer.c</Link>\r
+ </Compile>\r
+ <Compile Include="..\Common\Minimal\GenQTest.c">\r
+ <SubType>compile</SubType>\r
+ <Link>src\Common Demo Tasks\GenQTest.c</Link>\r
+ </Compile>\r
+ <Compile Include="..\Common\Minimal\QPeek.c">\r
+ <SubType>compile</SubType>\r
+ <Link>src\Common Demo Tasks\QPeek.c</Link>\r
+ </Compile>\r
+ <Compile Include="..\Common\Minimal\QueueOverwrite.c">\r
+ <SubType>compile</SubType>\r
+ <Link>src\Common Demo Tasks\QueueOverwrite.c</Link>\r
+ </Compile>\r
+ <Compile Include="..\Common\Minimal\QueueSet.c">\r
+ <SubType>compile</SubType>\r
+ <Link>src\Common Demo Tasks\QueueSet.c</Link>\r
+ </Compile>\r
+ <Compile Include="..\Common\Minimal\recmutex.c">\r
+ <SubType>compile</SubType>\r
+ <Link>src\Common Demo Tasks\recmutex.c</Link>\r
+ </Compile>\r
+ <Compile Include="..\Common\Minimal\semtest.c">\r
+ <SubType>compile</SubType>\r
+ <Link>src\Common Demo Tasks\semtest.c</Link>\r
+ </Compile>\r
<Compile Include="src\ASF\sam\utils\syscalls\gcc\syscalls.c">\r
<SubType>compile</SubType>\r
</Compile>\r
<Compile Include="src\main_full.c">\r
<SubType>compile</SubType>\r
</Compile>\r
+ <Compile Include="src\ParTest.c">\r
+ <SubType>compile</SubType>\r
+ </Compile>\r
<Compile Include="src\printf-stdarg.c">\r
<SubType>compile</SubType>\r
</Compile>\r
<Folder Include="src\FreeRTOS+\FreeRTOS+CLI" />\r
<Folder Include="src\FreeRTOS+\FreeRTOS+FAT SL" />\r
<Folder Include="src\FreeRTOS\portable" />\r
+ <Folder Include="src\Common Demo Tasks" />\r
</ItemGroup>\r
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />\r
</Project>
\ No newline at end of file
/* @endcond */\r
\r
#ifdef __GNUC__\r
+void Dummy_Hardfault_Handler( void );\r
/* Cortex-M4 core handlers */\r
void Reset_Handler (void ) __attribute__ ((weak, alias("Dummy_Handler")));\r
void NMI_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));\r
-void HardFault_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));\r
+void HardFault_Handler ( void ) __attribute__ ((weak, alias("Dummy_Hardfault_Handler")));\r
void MemManage_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));\r
void BusFault_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));\r
void UsageFault_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));\r
}\r
}\r
\r
+void Dummy_Hardfault_Handler(void)\r
+{\r
+ while (1) {\r
+ }\r
+}\r
+\r
/* @cond 0 */\r
/**INDENT-OFF**/\r
#ifdef __cplusplus\r
--- /dev/null
+/*\r
+ FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. \r
+ All rights reserved\r
+\r
+ VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
+\r
+ ***************************************************************************\r
+ * *\r
+ * FreeRTOS provides completely free yet professionally developed, *\r
+ * robust, strictly quality controlled, supported, and cross *\r
+ * platform software that has become a de facto standard. *\r
+ * *\r
+ * Help yourself get started quickly and support the FreeRTOS *\r
+ * project by purchasing a FreeRTOS tutorial book, reference *\r
+ * manual, or both from: http://www.FreeRTOS.org/Documentation *\r
+ * *\r
+ * Thank you! *\r
+ * *\r
+ ***************************************************************************\r
+\r
+ This file is part of the FreeRTOS distribution.\r
+\r
+ FreeRTOS is free software; you can redistribute it and/or modify it under\r
+ the terms of the GNU General Public License (version 2) as published by the\r
+ Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
+\r
+ >>! NOTE: The modification to the GPL is included to allow you to distribute\r
+ >>! a combined work that includes FreeRTOS without being obliged to provide\r
+ >>! the source code for proprietary components outside of the FreeRTOS\r
+ >>! kernel.\r
+\r
+ FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
+ FOR A PARTICULAR PURPOSE. Full license text is available from the following\r
+ link: http://www.freertos.org/a00114.html\r
+\r
+ 1 tab == 4 spaces!\r
+\r
+ ***************************************************************************\r
+ * *\r
+ * Having a problem? Start by reading the FAQ "My application does *\r
+ * not run, what could be wrong?" *\r
+ * *\r
+ * http://www.FreeRTOS.org/FAQHelp.html *\r
+ * *\r
+ ***************************************************************************\r
+\r
+ http://www.FreeRTOS.org - Documentation, books, training, latest versions,\r
+ license and Real Time Engineers Ltd. contact details.\r
+\r
+ http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
+ including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
+ compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
+\r
+ http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High\r
+ Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS\r
+ licenses offer ticketed support, indemnification and middleware.\r
+\r
+ http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
+ engineered and independently SIL3 certified version for use in safety and\r
+ mission critical applications that require provable dependability.\r
+\r
+ 1 tab == 4 spaces!\r
+*/\r
+\r
+/*-----------------------------------------------------------\r
+ * Simple IO routines to control the LEDs.\r
+ *-----------------------------------------------------------*/\r
+\r
+/* Scheduler includes. */\r
+#include "FreeRTOS.h"\r
+#include "task.h"\r
+\r
+/* Demo includes. */\r
+#include "partest.h"\r
+\r
+/* The number of LEDs available to the user on the evaluation kit. */\r
+#define partestNUM_LEDS ( 3UL )\r
+\r
+/* The index of the pins to which the LEDs are connected. The ordering of the\r
+LEDs in this array is intentional and matches the order they appear on the \r
+hardware. */\r
+static const uint32_t ulLED[] = { LED0_GPIO, LED1_GPIO, LED2_GPIO };\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+void vParTestInitialise( void )\r
+{\r
+ /* LEDs are initialised in the Atmel provided board initialisation \r
+ function. */\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )\r
+{ \r
+ if( uxLED < partestNUM_LEDS )\r
+ {\r
+ /* Turn the LED off. */\r
+ taskENTER_CRITICAL();\r
+ {\r
+ ioport_set_pin_level( ulLED[ uxLED ], !xValue );\r
+ }\r
+ taskEXIT_CRITICAL();\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vParTestToggleLED( unsigned portBASE_TYPE uxLED )\r
+{\r
+ if( uxLED < partestNUM_LEDS )\r
+ {\r
+ taskENTER_CRITICAL();\r
+ { \r
+ ioport_toggle_pin_level( ulLED[ uxLED ] );\r
+ }\r
+ taskEXIT_CRITICAL(); \r
+ }\r
+}\r
+ \r
+\r
+\r
\r
#define configUSE_PREEMPTION 1\r
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1\r
+#define configUSE_QUEUE_SETS 1\r
#define configUSE_IDLE_HOOK 0\r
-#define configUSE_TICK_HOOK 0\r
+#define configUSE_TICK_HOOK 1\r
#define configCPU_CLOCK_HZ ( ( unsigned long ) CHIP_FREQ_CPU_MAX )\r
#define configTICK_RATE_HZ ( 1000 )\r
#define configMAX_PRIORITIES ( 5 )\r
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 130 )\r
-#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 22800 ) )\r
+#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 34 * 1024 ) )\r
#define configMAX_TASK_NAME_LEN ( 10 )\r
#define configUSE_TRACE_FACILITY 1\r
#define configUSE_16_BIT_TICKS 0\r
#include "FreeRTOS.h"\r
#include "task.h"\r
\r
+/* Demo application includes. */\r
+#include "partest.h"\r
+\r
/* Set mainCREATE_SIMPLE_BLINKY_DEMO_ONLY to one to run the simple blinky demo,\r
or 0 to run the more comprehensive demo application that includes add-on \r
components. */\r
board_init();\r
sysclk_init();\r
pmc_enable_periph_clk( ID_GMAC );\r
+ vParTestInitialise();\r
}\r
/*-----------------------------------------------------------*/\r
\r
FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used\r
to query the size of free heap space that remains (although it does not\r
provide information on how the remaining heap might be fragmented). */\r
- taskDISABLE_INTERRUPTS();\r
- for( ;; );\r
+ vAssertCalled( __LINE__, __FILE__ );\r
}\r
/*-----------------------------------------------------------*/\r
\r
/* Run time stack overflow checking is performed if\r
configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook\r
function is called if a stack overflow is detected. */\r
- taskDISABLE_INTERRUPTS();\r
- for( ;; );\r
+ vAssertCalled( __LINE__, __FILE__ );\r
}\r
/*-----------------------------------------------------------*/\r
\r
added here, but the tick hook is called from an interrupt context, so\r
code must not attempt to block, and only the interrupt safe FreeRTOS API\r
functions can be used (those that end in FromISR()). */\r
+ \r
+ /* The simple blinky demo does not use the tick hook - the full demo does. */\r
+ #if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 )\r
+ {\r
+ extern void vFullDemoTickHook( void );\r
+ \r
+ vFullDemoTickHook();\r
+ }\r
+ #endif\r
}\r
/*-----------------------------------------------------------*/\r
\r
#include "queue.h"\r
#include "timers.h"\r
\r
+/* Demo application includes. */\r
+#include "partest.h"\r
+\r
/* Priorities at which the tasks are created. */\r
#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )\r
#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )\r
#define mainDONT_BLOCK ( 0 )\r
\r
/* The LEDs toggled by the timer and queue receive task respectively. */\r
-#define mainTIMER_LED LED0_GPIO\r
-#define mainTASK_LED LED1_GPIO\r
+#define mainTIMER_LED 0\r
+#define mainTASK_LED 1\r
\r
/*-----------------------------------------------------------*/\r
\r
is it the expected value? If it is, toggle the LED. */\r
if( ulReceivedValue == 100UL )\r
{\r
- ioport_toggle_pin_level( mainTASK_LED );\r
+ vParTestToggleLED( mainTASK_LED );\r
ulReceivedValue = 0U;\r
}\r
}\r
/* This function is called when the blinky software time expires. All the\r
function does is toggle the LED. LED mainTIMER_LED should therefore toggle\r
with the period set by mainBLINKY_TIMER_PERIOD. */\r
- ioport_toggle_pin_level( mainTIMER_LED );\r
+ vParTestToggleLED( mainTIMER_LED );\r
}\r
/*-----------------------------------------------------------*/\r
\r
\r
/* Demo application includes. */\r
#include "UDPCommandInterpreter.h"\r
+#include "partest.h"\r
+#include "blocktim.h"\r
+#include "flash_timer.h"\r
+#include "semtest.h"\r
+#include "GenQTest.h"\r
+#include "QPeek.h"\r
+#include "IntQueue.h"\r
+#include "countsem.h"\r
+#include "dynamic.h"\r
+#include "QueueOverwrite.h"\r
+#include "QueueSet.h"\r
+#include "recmutex.h"\r
+\r
+/* The period after which the check timer will expire, in ms, provided no errors\r
+have been reported by any of the standard demo tasks. ms are converted to the\r
+equivalent in ticks using the portTICK_RATE_MS constant. */\r
+#define mainCHECK_TIMER_PERIOD_MS ( 3000UL / portTICK_RATE_MS )\r
+\r
+/* The period at which the check timer will expire, in ms, if an error has been\r
+reported in one of the standard demo tasks. ms are converted to the equivalent\r
+in ticks using the portTICK_RATE_MS constant. */\r
+#define mainERROR_CHECK_TIMER_PERIOD_MS ( 200UL / portTICK_RATE_MS )\r
+\r
+/* The priorities of the various demo application tasks. */\r
+#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 )\r
+#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 )\r
+#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 )\r
+#define mainINTEGER_TASK_PRIORITY ( tskIDLE_PRIORITY )\r
+#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY )\r
+#define mainQUEUE_OVERWRITE_TASK_PRIORITY ( tskIDLE_PRIORITY )\r
+\r
+/* The LED controlled by the 'check' software timer. */\r
+#define mainCHECK_LED ( 2 )\r
+\r
+/* The number of LEDs that should be controlled by the flash software timer\r
+standard demo. In this case it is only 1 as the starter kit has three LEDs, one\r
+of which is controlled by the check timer and one of which is controlled by the\r
+ISR triggered task. */\r
+#define mainNUM_FLASH_TIMER_LEDS ( 1 )\r
+\r
+/* Misc. */\r
+#define mainDONT_BLOCK ( 0 )\r
\r
/* Note: If the application is started without the network cable plugged in \r
then ipconfigUDP_TASK_PRIORITY should be set to 0 in FreeRTOSIPConfig.h to\r
#define mainUDP_CLI_PORT_NUMBER ( 5001UL )\r
#define mainUDP_CLI_TASK_STACK_SIZE ( configMINIMAL_STACK_SIZE * 2U )\r
\r
-/* Simple toggles an LED to show the program is running. */\r
-static void prvFlashTimerCallback( xTimerHandle xTimer );\r
+/*-----------------------------------------------------------*/\r
+\r
+/*\r
+ * The check timer callback function, as described at the top of this file.\r
+ */\r
+static void prvCheckTimerCallback( xTimerHandle xTimer );\r
\r
-/* Creates a set of sample files on a RAM disk. */\r
+/* \r
+ * Creates a set of sample files on a RAM disk. \r
+ */\r
extern void vCreateAndVerifySampleFiles( void );\r
\r
/*\r
/*-----------------------------------------------------------*/\r
int main_full( void )\r
{\r
-xTimerHandle xFlashTimer;\r
+xTimerHandle xTimer = NULL;\r
\r
/* If the file system is only going to be accessed from one task then\r
F_FS_THREAD_AWARE can be set to 0 and the set of example files are created\r
interpreter. */\r
vRegisterFileSystemCLICommands();\r
\r
- /* Create the timer that just toggles an LED to indicate that the \r
- application is running. */\r
- xFlashTimer = xTimerCreate( ( const signed char * const ) "Flash", 200 / portTICK_RATE_MS, pdTRUE, NULL, prvFlashTimerCallback );\r
- configASSERT( xFlashTimer );\r
- \r
- /* Start the timer. As the scheduler is not running a block time cannot be\r
- used and is set to 0. */\r
- xTimerStart( xFlashTimer, 0 );\r
-\r
/* Initialise the network interface. Tasks that use the network are\r
created in the network event hook when the network is connected and ready\r
for use. The address values passed in here are used if ipconfigUSE_DHCP is\r
ipconfigFREERTOS_PLUS_NABTO is set to 1 in FreeRTOSIPConfig.h. */\r
FreeRTOS_IPInit( ucIPAddress, ucNetMask, ucGatewayAddress, ucDNSServerAddress, ucMACAddress );\r
\r
+ /* Create all the other standard demo tasks. */\r
+ vStartLEDFlashTimers( mainNUM_FLASH_TIMER_LEDS );\r
+ vCreateBlockTimeTasks();\r
+ vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );\r
+ vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );\r
+ vStartQueuePeekTasks();\r
+ vStartCountingSemaphoreTasks();\r
+ vStartDynamicPriorityTasks();\r
+ vStartQueueOverwriteTask( mainQUEUE_OVERWRITE_TASK_PRIORITY );\r
+ vStartQueueSetTasks();\r
+ vStartRecursiveMutexTasks();\r
+\r
+ /* Create the software timer that performs the 'check' functionality, as\r
+ described at the top of this file. */\r
+ xTimer = xTimerCreate( ( const signed char * ) "CheckTimer",/* A text name, purely to help debugging. */\r
+ ( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */\r
+ pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */\r
+ ( void * ) 0, /* The ID is not used, so can be set to anything. */\r
+ prvCheckTimerCallback ); /* The callback function that inspects the status of all the other tasks. */\r
+\r
+ if( xTimer != NULL )\r
+ {\r
+ xTimerStart( xTimer, mainDONT_BLOCK );\r
+ }\r
+\r
/* Start the scheduler itself. */\r
vTaskStartScheduler();\r
\r
}\r
/*-----------------------------------------------------------*/\r
\r
-static void prvFlashTimerCallback( xTimerHandle xTimer )\r
+static void prvCheckTimerCallback( xTimerHandle xTimer )\r
{\r
- /* The parameter is not used. */\r
+static long lChangedTimerPeriodAlready = pdFALSE;\r
+unsigned long ulErrorOccurred = pdFALSE;\r
+\r
+ /* Avoid compiler warnings. */\r
( void ) xTimer;\r
- \r
- /* Timer callback function that does nothing other than toggle an LED to\r
- indicate that the application is still running. */\r
- ioport_toggle_pin_level( LED0_GPIO );\r
+\r
+ /* Have any of the standard demo tasks detected an error in their\r
+ operation? */\r
+ if( xAreGenericQueueTasksStillRunning() != pdTRUE )\r
+ {\r
+ ulErrorOccurred |= ( 0x01UL << 3UL );\r
+ }\r
+ else if( xAreQueuePeekTasksStillRunning() != pdTRUE )\r
+ {\r
+ ulErrorOccurred |= ( 0x01UL << 4UL );\r
+ }\r
+ else if( xAreBlockTimeTestTasksStillRunning() != pdTRUE )\r
+ {\r
+ ulErrorOccurred |= ( 0x01UL << 5UL );\r
+ }\r
+ else if( xAreSemaphoreTasksStillRunning() != pdTRUE )\r
+ {\r
+ ulErrorOccurred |= ( 0x01UL << 6UL );\r
+ }\r
+ else if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE )\r
+ {\r
+ ulErrorOccurred |= ( 0x01UL << 8UL );\r
+ }\r
+ else if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )\r
+ {\r
+ ulErrorOccurred |= ( 0x01UL << 9UL );\r
+ }\r
+ else if( xIsQueueOverwriteTaskStillRunning() != pdTRUE )\r
+ {\r
+ ulErrorOccurred |= ( 0x01UL << 10UL );\r
+ }\r
+ else if( xAreQueueSetTasksStillRunning() != pdTRUE )\r
+ {\r
+ ulErrorOccurred |= ( 0x01UL << 11UL );\r
+ }\r
+ else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )\r
+ {\r
+ ulErrorOccurred |= ( 0x01UL << 12UL );\r
+ }\r
+\r
+ if( ulErrorOccurred != pdFALSE )\r
+ {\r
+ /* An error occurred. Increase the frequency at which the check timer\r
+ toggles its LED to give visual feedback of the potential error\r
+ condition. */\r
+ if( lChangedTimerPeriodAlready == pdFALSE )\r
+ {\r
+ lChangedTimerPeriodAlready = pdTRUE;\r
+\r
+ /* This call to xTimerChangePeriod() uses a zero block time.\r
+ Functions called from inside of a timer callback function must\r
+ *never* attempt to block as to do so could impact other software\r
+ timers. */\r
+ xTimerChangePeriod( xTimer, ( mainERROR_CHECK_TIMER_PERIOD_MS ), mainDONT_BLOCK );\r
+ }\r
+ }\r
+\r
+ vParTestToggleLED( mainCHECK_LED );\r
}\r
/*-----------------------------------------------------------*/\r
\r
}\r
#endif\r
}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vFullDemoTickHook( void )\r
+{\r
+ /* Call the periodic queue overwrite from ISR demo. */\r
+ vQueueOverwritePeriodicISRDemo();\r
+\r
+ /* Call the queue set ISR test function. */\r
+ vQueueSetAccessQueueSetFromISR();\r
+}\r
\r
\r
\r