]> git.sur5r.net Git - freertos/commitdiff
Complete tidy up of SAMD20 demo.
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Wed, 9 Oct 2013 13:26:34 +0000 (13:26 +0000)
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Wed, 9 Oct 2013 13:26:34 +0000 (13:26 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@2059 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo.atsln
FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo.atsuo
FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/main-full.c
FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/main.c

index fabb32ace7b7cc2f9dadf4770173b163a077644d..961acf6338a13bf716888a23f149ca1f78a86c5e 100644 (file)
@@ -6,13 +6,10 @@ EndProject
 Global\r
        GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
                Debug|ARM = Debug|ARM\r
 Global\r
        GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
                Debug|ARM = Debug|ARM\r
-               Release|ARM = Release|ARM\r
        EndGlobalSection\r
        GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
                {2A475B6A-78B0-4237-8947-341BD379AB5C}.Debug|ARM.ActiveCfg = Debug|ARM\r
                {2A475B6A-78B0-4237-8947-341BD379AB5C}.Debug|ARM.Build.0 = Debug|ARM\r
        EndGlobalSection\r
        GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
                {2A475B6A-78B0-4237-8947-341BD379AB5C}.Debug|ARM.ActiveCfg = Debug|ARM\r
                {2A475B6A-78B0-4237-8947-341BD379AB5C}.Debug|ARM.Build.0 = Debug|ARM\r
-               {2A475B6A-78B0-4237-8947-341BD379AB5C}.Release|ARM.ActiveCfg = Release|ARM\r
-               {2A475B6A-78B0-4237-8947-341BD379AB5C}.Release|ARM.Build.0 = Release|ARM\r
        EndGlobalSection\r
        GlobalSection(SolutionProperties) = preSolution\r
                HideSolutionNode = FALSE\r
        EndGlobalSection\r
        GlobalSection(SolutionProperties) = preSolution\r
                HideSolutionNode = FALSE\r
index deb7a887dfad740137ab7e0b6926d6d968b4794f..e01ab62659199a278de740c466a9442450f66d3f 100644 (file)
Binary files a/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo.atsuo and b/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo.atsuo differ
index 618bd8a8359973332a550b78b552a06b30bbfadd..cebfae121f79b5a09a221e45558d3b1aae771ab9 100644 (file)
  * In addition to the standard demo tasks, the following tasks and timer are\r
  * defined and/or created within this file:\r
  *\r
  * In addition to the standard demo tasks, the following tasks and timer are\r
  * defined and/or created within this file:\r
  *\r
+ * "Command console task" - This uses the Atmel USART driver to provide the\r
+ * input and output to FreeRTOS+CLI - the FreeRTOS Command Line Interface.  To\r
+ * use the CLI:\r
+ *  - Power the SAMD20 XPlained board through the USB debugger connector.  This\r
+ *    will create a virtual COM port through the USB.\r
+ *  - Build and run the demo application.  \r
+ *  - Start a dumb terminal program such as TerraTerm or Hyper Terminal.\r
+ *  - In the dumb terminal select the UART port associated with the XPlained\r
+ *    debugger connection, using 19200 baud.\r
+ *  - Type 'help' in the terminal window to see a lit of command registered by\r
+ *    the demo.\r
+ *\r
  * "Reg test" tasks - These fill the registers with known values, then check\r
  * that each register maintains its expected value for the lifetime of the\r
  * task.  Each task uses a different set of values.  The reg test tasks execute\r
  * "Reg test" tasks - These fill the registers with known values, then check\r
  * that each register maintains its expected value for the lifetime of the\r
  * task.  Each task uses a different set of values.  The reg test tasks execute\r
@@ -144,7 +156,7 @@ extern void vRegTest1Task( void *pvParameters );
 extern void vRegTest2Task( void *pvParameters );\r
 \r
 /*\r
 extern void vRegTest2Task( void *pvParameters );\r
 \r
 /*\r
- * Function that starts the command console.\r
+ * Function that starts the command console task.\r
  */\r
 extern void vUARTCommandConsoleStart( uint16_t usStackSize, unsigned portBASE_TYPE uxPriority );\r
 \r
  */\r
 extern void vUARTCommandConsoleStart( uint16_t usStackSize, unsigned portBASE_TYPE uxPriority );\r
 \r
@@ -222,6 +234,7 @@ const size_t xRegTestStackSize = 25U;
        actually start running until the scheduler starts.  A block time of\r
        zero is used in this call, although any value could be used as the block\r
        time will be ignored because the scheduler has not started yet. */\r
        actually start running until the scheduler starts.  A block time of\r
        zero is used in this call, although any value could be used as the block\r
        time will be ignored because the scheduler has not started yet. */\r
+       configASSERT( xTimer );\r
        if( xTimer != NULL )\r
        {\r
                xTimerStart( xTimer, mainDONT_BLOCK );\r
        if( xTimer != NULL )\r
        {\r
                xTimerStart( xTimer, mainDONT_BLOCK );\r
@@ -250,58 +263,59 @@ unsigned long ulErrorFound = pdFALSE;
        running, and that none have detected an error. */\r
        if( xAreDynamicPriorityTasksStillRunning() != pdPASS )\r
        {\r
        running, and that none have detected an error. */\r
        if( xAreDynamicPriorityTasksStillRunning() != pdPASS )\r
        {\r
-               ulErrorFound |= ( 0x01UL << 0UL );\r
+               ulErrorFound = pdTRUE;\r
        }\r
 \r
        if( xAreBlockTimeTestTasksStillRunning() != pdPASS )\r
        {\r
        }\r
 \r
        if( xAreBlockTimeTestTasksStillRunning() != pdPASS )\r
        {\r
-               ulErrorFound |= ( 0x01UL << 1UL );\r
+               ulErrorFound = pdTRUE;\r
        }\r
 \r
        if( xAreCountingSemaphoreTasksStillRunning() != pdPASS )\r
        {\r
        }\r
 \r
        if( xAreCountingSemaphoreTasksStillRunning() != pdPASS )\r
        {\r
-               ulErrorFound |= ( 0x01UL << 2UL );\r
+               ulErrorFound = pdTRUE;\r
        }\r
 \r
        if( xAreRecursiveMutexTasksStillRunning() != pdPASS )\r
        {\r
        }\r
 \r
        if( xAreRecursiveMutexTasksStillRunning() != pdPASS )\r
        {\r
-               ulErrorFound |= ( 0x01UL << 3UL );\r
+               ulErrorFound = pdTRUE;\r
        }\r
 \r
        /* Check that the register test 1 task is still running. */\r
        if( ulLastRegTest1Value == ulRegTest1LoopCounter )\r
        {\r
        }\r
 \r
        /* Check that the register test 1 task is still running. */\r
        if( ulLastRegTest1Value == ulRegTest1LoopCounter )\r
        {\r
-               ulErrorFound |= ( 0x01UL << 4UL );\r
+               ulErrorFound = pdTRUE;\r
        }\r
        ulLastRegTest1Value = ulRegTest1LoopCounter;\r
 \r
        /* Check that the register test 2 task is still running. */\r
        if( ulLastRegTest2Value == ulRegTest2LoopCounter )\r
        {\r
        }\r
        ulLastRegTest1Value = ulRegTest1LoopCounter;\r
 \r
        /* Check that the register test 2 task is still running. */\r
        if( ulLastRegTest2Value == ulRegTest2LoopCounter )\r
        {\r
-               ulErrorFound |= ( 0x01UL << 5UL );\r
+               ulErrorFound = pdTRUE;\r
        }\r
        ulLastRegTest2Value = ulRegTest2LoopCounter;\r
 \r
        }\r
        ulLastRegTest2Value = ulRegTest2LoopCounter;\r
 \r
+       \r
        if( xAreQueueSetTasksStillRunning() != pdPASS )\r
        {\r
        if( xAreQueueSetTasksStillRunning() != pdPASS )\r
        {\r
-               ulErrorFound |= ( 0x01UL << 6UL );\r
+               ulErrorFound = pdTRUE;\r
        }\r
 \r
        if( xIsQueueOverwriteTaskStillRunning() != pdPASS )\r
        {\r
        }\r
 \r
        if( xIsQueueOverwriteTaskStillRunning() != pdPASS )\r
        {\r
-               ulErrorFound |= ( 0x01UL << 7UL );\r
+               ulErrorFound = pdTRUE;\r
        }\r
        \r
        if( xAreGenericQueueTasksStillRunning() != pdPASS )\r
        {\r
        }\r
        \r
        if( xAreGenericQueueTasksStillRunning() != pdPASS )\r
        {\r
-               ulErrorFound |= ( 0x01UL << 8UL );\r
+               ulErrorFound = pdTRUE;\r
        }\r
        \r
        if( xAreQueuePeekTasksStillRunning() != pdPASS )\r
        {\r
        }\r
        \r
        if( xAreQueuePeekTasksStillRunning() != pdPASS )\r
        {\r
-               ulErrorFound |= ( 0x01UL << 9UL );\r
+               ulErrorFound = pdTRUE;\r
        }\r
        }\r
-       \r
+\r
        /* Toggle the check LED to give an indication of the system status.  If\r
        the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then\r
        everything is ok.  A faster toggle indicates an error. */\r
        /* Toggle the check LED to give an indication of the system status.  If\r
        the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then\r
        everything is ok.  A faster toggle indicates an error. */\r
index 080586c31086ff5a22e9ff7e7e88a0a18d905fa0..2e26593b936e9174775c7dfb2591d59ccee5b01b 100644 (file)
@@ -98,8 +98,7 @@ or 0 to run the more comprehensive test and demo application. */
 /*-----------------------------------------------------------*/\r
 \r
 /*\r
 /*-----------------------------------------------------------*/\r
 \r
 /*\r
- * Perform any application specific hardware configuration.  The clocks,\r
- * memory, etc. are configured before main() is called.\r
+ * Perform any application specific hardware configuration.  \r
  */\r
 static void prvSetupHardware( void );\r
 \r
  */\r
 static void prvSetupHardware( void );\r
 \r
@@ -202,12 +201,7 @@ void vApplicationTickHook( void )
        configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h.  User code can be\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
        configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h.  User code can be\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()).  The code in this\r
-       tick hook implementation is for demonstration only - it has no real\r
-       purpose.  It just gives a semaphore every 50ms.  The semaphore unblocks a\r
-       task that then toggles an LED.  Additionally, the call to\r
-       vQueueSetAccessQueueSetFromISR() is part of the "standard demo tasks"\r
-       functionality. */\r
+       functions can be used (those that end in FromISR()). */\r
 \r
        /* The semaphore and associated task are not created when the simple blinky\r
        demo is used. */\r
 \r
        /* The semaphore and associated task are not created when the simple blinky\r
        demo is used. */\r
@@ -223,6 +217,8 @@ void vApplicationTickHook( void )
 \r
 void vMainConfigureTimerForRunTimeStats( void )\r
 {\r
 \r
 void vMainConfigureTimerForRunTimeStats( void )\r
 {\r
+       /* Used by the optional run-time stats gathering functionality. */\r
+       \r
        /* How many clocks are there per tenth of a millisecond? */\r
        ulClocksPer10thOfAMilliSecond = configCPU_CLOCK_HZ / 10000UL;\r
 }\r
        /* How many clocks are there per tenth of a millisecond? */\r
        ulClocksPer10thOfAMilliSecond = configCPU_CLOCK_HZ / 10000UL;\r
 }\r
@@ -236,6 +232,9 @@ volatile unsigned long * const pulCurrentSysTickCount = ( ( volatile unsigned lo
 volatile unsigned long * const pulInterruptCTRLState = ( ( volatile unsigned long *) 0xe000ed04 );\r
 const unsigned long ulSysTickPendingBit = 0x04000000UL;\r
 \r
 volatile unsigned long * const pulInterruptCTRLState = ( ( volatile unsigned long *) 0xe000ed04 );\r
 const unsigned long ulSysTickPendingBit = 0x04000000UL;\r
 \r
+       /* Used by the optional run-time stats gathering functionality. */\r
+\r
+\r
        /* NOTE: There are potentially race conditions here.  However, it is used\r
        anyway to keep the examples simple, and to avoid reliance on a separate\r
        timer peripheral. */\r
        /* NOTE: There are potentially race conditions here.  However, it is used\r
        anyway to keep the examples simple, and to avoid reliance on a separate\r
        timer peripheral. */\r
@@ -276,4 +275,33 @@ const unsigned long ulSysTickPendingBit = 0x04000000UL;
        \r
        return ulReturn;        \r
 }\r
        \r
        return ulReturn;        \r
 }\r
+/*-----------------------------------------------------------*/\r
+\r
+#ifdef JUST_AN_EXAMPLE_ISR\r
+\r
+void Dummy_IRQHandler(void)\r
+{\r
+long lHigherPriorityTaskWoken = pdFALSE;\r
+\r
+       /* Clear the interrupt if necessary. */\r
+       Dummy_ClearITPendingBit();\r
+\r
+       /* This interrupt does nothing more than demonstrate how to synchronise a\r
+       task with an interrupt.  A semaphore is used for this purpose.  Note\r
+       lHigherPriorityTaskWoken is initialised to zero. Only FreeRTOS API functions\r
+       that end in "FromISR" can be called from an ISR. */\r
+       xSemaphoreGiveFromISR( xTestSemaphore, &lHigherPriorityTaskWoken );\r
+\r
+       /* If there was a task that was blocked on the semaphore, and giving the\r
+       semaphore caused the task to unblock, and the unblocked task has a priority\r
+       higher than the current Running state task (the task that this interrupt\r
+       interrupted), then lHigherPriorityTaskWoken will have been set to pdTRUE\r
+       internally within xSemaphoreGiveFromISR().  Passing pdTRUE into the\r
+       portEND_SWITCHING_ISR() macro will result in a context switch being pended to\r
+       ensure this interrupt returns directly to the unblocked, higher priority,\r
+       task.  Passing pdFALSE into portEND_SWITCHING_ISR() has no effect. */\r
+       portEND_SWITCHING_ISR( lHigherPriorityTaskWoken );\r
+}\r
+\r
+#endif /* JUST_AN_EXAMPLE_ISR */\r
 \r
 \r