]> git.sur5r.net Git - freertos/commitdiff
Kernel changes:
authorrtel <rtel@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Fri, 19 Dec 2014 16:27:56 +0000 (16:27 +0000)
committerrtel <rtel@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Fri, 19 Dec 2014 16:27:56 +0000 (16:27 +0000)
+ Do not attempt to free the stack of a deleted task if the stack was statically allocated.
+ Introduce configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES - which optionally writes known values into the list and list item data structures in order to assist with the detection of memory corruptions.

Microblase port:
+Change occurrences of #if XPAR_MICROBLAZE_0_USE_FPU == 1 to  #if XPAR_MICROBLAZE_0_USE_FPU != 0 as the value can also be 2 or 3.

Demo app modifications:
+ Update Zynq project to use the 2014.4 tools and add in tests for the new task notification feature.
+ Update SAM4S project to include tests for the new task notification feature.

git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@2316 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

18 files changed:
FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/FreeRTOSConfig.h
FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/Full_Demo/main_full.c
FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/main.c
FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/CreateProjectDirectoryStructure.bat
FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/RTOSDemo.atsuo
FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/RTOSDemo.cproj
FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/FreeRTOSConfig.h
FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main.c
FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main_full.c
FreeRTOS/Demo/WIN32-MSVC/FreeRTOSConfig.h
FreeRTOS/Demo/WIN32-MSVC/main.c
FreeRTOS/Source/include/list.h
FreeRTOS/Source/include/projdefs.h
FreeRTOS/Source/list.c
FreeRTOS/Source/portable/GCC/MicroBlazeV8/port.c
FreeRTOS/Source/portable/GCC/MicroBlazeV8/port_exceptions.c
FreeRTOS/Source/portable/GCC/MicroBlazeV8/portasm.S
FreeRTOS/Source/tasks.c

index d0bf8b2ed02d0a8f7b279e1ee2dc4cc53a3b173d..038fc634806ab58e61655adf5ef50da8ff0ed009 100644 (file)
  */\r
 #define configMAX_API_CALL_INTERRUPT_PRIORITY  18\r
 \r
-\r
 #define configCPU_CLOCK_HZ                                             100000000UL\r
 #define configUSE_PORT_OPTIMISED_TASK_SELECTION        1\r
 #define configUSE_TICKLESS_IDLE                                        0\r
index 36cd22b0be2aec59eb1ea242a61da3778bdf9813..f11db5ac7a6021884765258a69327cb74baa0893 100644 (file)
 #include "QueueOverwrite.h"\r
 #include "IntQueue.h"\r
 #include "EventGroupsDemo.h"\r
+#include "TaskNotify.h"\r
+#include "IntSemTest.h"\r
 \r
 /* Priorities for the demo application tasks. */\r
 #define mainSEM_TEST_PRIORITY                          ( tskIDLE_PRIORITY + 1UL )\r
@@ -250,6 +252,9 @@ void main_full( void )
        vStartTimerDemoTask( mainTIMER_TEST_PERIOD );\r
        vStartQueueOverwriteTask( mainQUEUE_OVERWRITE_PRIORITY );\r
        vStartEventGroupTasks();\r
+       vStartTaskNotifyTask();\r
+       vStartInterruptSemaphoreTasks();\r
+\r
 \r
        /* Start the tasks that implements the command console on the UART, as\r
        described above. */\r
@@ -318,80 +323,90 @@ unsigned long ulErrorFound = pdFALSE;
                that they are all still running, and that none have detected an error. */\r
                if( xAreIntQueueTasksStillRunning() != pdTRUE )\r
                {\r
-                       ulErrorFound = pdTRUE;\r
+                       ulErrorFound |= 1UL << 0UL;\r
                }\r
 \r
                if( xAreMathsTaskStillRunning() != pdTRUE )\r
                {\r
-                       ulErrorFound = pdTRUE;\r
+                       ulErrorFound |= 1UL << 1UL;\r
                }\r
 \r
                if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )\r
                {\r
-                       ulErrorFound = pdTRUE;\r
+                       ulErrorFound |= 1UL << 2UL;\r
                }\r
 \r
                if( xAreBlockingQueuesStillRunning() != pdTRUE )\r
                {\r
-                       ulErrorFound = pdTRUE;\r
+                       ulErrorFound |= 1UL << 3UL;\r
                }\r
 \r
                if ( xAreBlockTimeTestTasksStillRunning() != pdTRUE )\r
                {\r
-                       ulErrorFound = pdTRUE;\r
+                       ulErrorFound |= 1UL << 4UL;\r
                }\r
 \r
                if ( xAreGenericQueueTasksStillRunning() != pdTRUE )\r
                {\r
-                       ulErrorFound = pdTRUE;\r
+                       ulErrorFound |= 1UL << 5UL;\r
                }\r
 \r
                if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE )\r
                {\r
-                       ulErrorFound = pdTRUE;\r
+                       ulErrorFound |= 1UL << 6UL;\r
                }\r
 \r
                if( xIsCreateTaskStillRunning() != pdTRUE )\r
                {\r
-                       ulErrorFound = pdTRUE;\r
+                       ulErrorFound |= 1UL << 7UL;\r
                }\r
 \r
                if( xAreSemaphoreTasksStillRunning() != pdTRUE )\r
                {\r
-                       ulErrorFound = pdTRUE;\r
+                       ulErrorFound |= 1UL << 8UL;\r
                }\r
 \r
                if( xAreTimerDemoTasksStillRunning( ( TickType_t ) mainNO_ERROR_CHECK_TASK_PERIOD ) != pdPASS )\r
                {\r
-                       ulErrorFound = pdTRUE;\r
+                       ulErrorFound |= 1UL << 9UL;\r
                }\r
 \r
                if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE )\r
                {\r
-                       ulErrorFound = pdTRUE;\r
+                       ulErrorFound |= 1UL << 10UL;\r
                }\r
 \r
                if( xIsQueueOverwriteTaskStillRunning() != pdPASS )\r
                {\r
-                       ulErrorFound = pdTRUE;\r
+                       ulErrorFound |= 1UL << 11UL;\r
                }\r
 \r
                if( xAreEventGroupTasksStillRunning() != pdPASS )\r
                {\r
-                       ulErrorFound = pdTRUE;\r
+                       ulErrorFound |= 1UL << 12UL;\r
+               }\r
+\r
+               if( xAreTaskNotificationTasksStillRunning() != pdTRUE )\r
+               {\r
+                       ulErrorFound |= 1UL << 13UL;\r
+               }\r
+\r
+               if( xAreInterruptSemaphoreTasksStillRunning() != pdTRUE )\r
+               {\r
+                       ulErrorFound |= 1UL << 14UL;\r
                }\r
 \r
                /* Check that the register test 1 task is still running. */\r
                if( ulLastRegTest1Value == ulRegTest1LoopCounter )\r
                {\r
-                       ulErrorFound = pdTRUE;\r
+                       ulErrorFound |= 1UL << 15UL;\r
                }\r
                ulLastRegTest1Value = ulRegTest1LoopCounter;\r
 \r
                /* Check that the register test 2 task is still running. */\r
                if( ulLastRegTest2Value == ulRegTest2LoopCounter )\r
                {\r
-                       ulErrorFound = pdTRUE;\r
+                       ulErrorFound |= 1UL << 16UL;\r
                }\r
                ulLastRegTest2Value = ulRegTest2LoopCounter;\r
 \r
index 108b39ee68c221865c223c89014462c1b1d0775b..fe97be62e72d7f7639f954a13d9da31290ed2491 100644 (file)
 #include "TimerDemo.h"\r
 #include "QueueOverwrite.h"\r
 #include "EventGroupsDemo.h"\r
+#include "TaskNotify.h"\r
+#include "IntSemTest.h"\r
 \r
 /* Xilinx includes. */\r
 #include "platform.h"\r
@@ -311,6 +313,12 @@ void vApplicationTickHook( void )
 \r
                /* Call the periodic event group from ISR demo. */\r
                vPeriodicEventGroupsProcessing();\r
+\r
+               /* Use task notifications from an interrupt. */\r
+               xNotifyTaskFromISR();\r
+\r
+               /* Use mutexes from interrupts. */\r
+               vInterruptSemaphorePeriodicTest();\r
        }\r
        #endif\r
 }\r
index 26df7ce1dfa297197652f6d69e1c534b22903b15..4150f521e7a0d72417c5bf97c5fa38793a98f712 100644 (file)
@@ -24,6 +24,7 @@ IF EXIST src\asf\thirdparty\FreeRTOS Goto END
     copy %FREERTOS_SOURCE%\queue.c src\asf\thirdparty\FreeRTOS\r
     copy %FREERTOS_SOURCE%\list.c src\asf\thirdparty\FreeRTOS\r
     copy %FREERTOS_SOURCE%\timers.c src\asf\thirdparty\FreeRTOS\r
+    copy %FREERTOS_SOURCE%\event_groups.c src\asf\thirdparty\FreeRTOS\r
 \r
     REM Copy the common header files into the project directory\r
     copy %FREERTOS_SOURCE%\include\*.* src\asf\thirdparty\FreeRTOS\include\r
@@ -48,6 +49,10 @@ IF EXIST src\asf\thirdparty\FreeRTOS Goto END
     copy %COMMON_SOURCE%\integer.c         src\Common-Demo-Source\r
     copy %COMMON_SOURCE%\QueueSet.c        src\Common-Demo-Source\r
     COPY %COMMON_SOURCE%\IntQueue.c        src\Common-Demo-Source\r
+    COPY %COMMON_SOURCE%\TaskNotify.c      src\Common-Demo-Source\r
+    COPY %COMMON_SOURCE%\TimerDemo.c       src\Common-Demo-Source\r
+    COPY %COMMON_SOURCE%\EventGroupsDemo.c src\Common-Demo-Source\r
+    COPY %COMMON_SOURCE%\IntSemTest.c      src\Common-Demo-Source\r
 \r
     REM Copy the common demo file headers.\r
     copy %COMMON_INCLUDE%\*.h              src\Common-Demo-Source\include\r
index e72f99e07a5dbf3d7453108ab8bd0f541b39d0ea..a19959c2db33b42d383adc4c5bb5a835049ac0bb 100644 (file)
Binary files a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/RTOSDemo.atsuo and b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/RTOSDemo.atsuo differ
index d97e4ff1635567d3df3242bf222f85e5081a2f2c..f953787d32d20269983af36579cac9242513a998 100644 (file)
   <documentation help="" />\r
   <offline-documentation help="" />\r
   <dependencies>\r
-    <content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.6.0" />\r
+    <content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.10.1" />\r
   </dependencies>\r
 </framework-data>\r
     </AsfFrameworkConfig>\r
   </armgcc.linker.libraries.LibrarySearchPaths>\r
   <armgcc.linker.optimization.GarbageCollectUnusedSections>True</armgcc.linker.optimization.GarbageCollectUnusedSections>\r
   <armgcc.linker.miscellaneous.LinkerFlags>-T../src/asf/sam/utils/linker_scripts/sam4s/sam4s16/gcc/flash.ld -Wl,--cref -Wl,--entry=Reset_Handler -mthumb</armgcc.linker.miscellaneous.LinkerFlags>\r
-  <armgcc.assembler.general.IncludePaths>\r
-    <ListValues>\r
-      <Value>../src/ASF/sam/drivers/tc</Value>\r
-    </ListValues>\r
-  </armgcc.assembler.general.IncludePaths>\r
   <armgcc.preprocessingassembler.general.AssemblerFlags>-DARM_MATH_CM4=true -DBOARD=SAM4S_EK -D__SAM4S16C__</armgcc.preprocessingassembler.general.AssemblerFlags>\r
   <armgcc.preprocessingassembler.general.IncludePaths>\r
     <ListValues>\r
     </ListValues>\r
   </armgcc.linker.libraries.LibrarySearchPaths>\r
   <armgcc.linker.optimization.GarbageCollectUnusedSections>True</armgcc.linker.optimization.GarbageCollectUnusedSections>\r
+  <armgcc.linker.memorysettings.ExternalRAM />\r
   <armgcc.linker.miscellaneous.LinkerFlags>-T../src/asf/sam/utils/linker_scripts/sam4s/sam4s16/gcc/flash.ld -Wl,--cref -Wl,--entry=Reset_Handler -mthumb</armgcc.linker.miscellaneous.LinkerFlags>\r
-  <armgcc.assembler.general.IncludePaths>\r
-    <ListValues>\r
-      <Value>../src/ASF/sam/drivers/tc</Value>\r
-    </ListValues>\r
-  </armgcc.assembler.general.IncludePaths>\r
   <armgcc.preprocessingassembler.general.AssemblerFlags>-DARM_MATH_CM4=true -DBOARD=SAM4S_EK -D__SAM4S16C__</armgcc.preprocessingassembler.general.AssemblerFlags>\r
   <armgcc.preprocessingassembler.general.IncludePaths>\r
     <ListValues>\r
     <None Include="src\asf\sam\drivers\usart\usart.h">\r
       <SubType>compile</SubType>\r
     </None>\r
+    <Compile Include="src\asf\thirdparty\FreeRTOS\event_groups.c">\r
+      <SubType>compile</SubType>\r
+    </Compile>\r
     <Compile Include="src\asf\thirdparty\FreeRTOS\portable\MemMang\heap_4.c">\r
       <SubType>compile</SubType>\r
     </Compile>\r
+    <Compile Include="src\Common-Demo-Source\EventGroupsDemo.c">\r
+      <SubType>compile</SubType>\r
+    </Compile>\r
     <Compile Include="src\Common-Demo-Source\include\demo_serial.h">\r
       <SubType>compile</SubType>\r
     </Compile>\r
+    <Compile Include="src\Common-Demo-Source\include\TaskNotify.h">\r
+      <SubType>compile</SubType>\r
+    </Compile>\r
     <Compile Include="src\Common-Demo-Source\IntQueue.c">\r
       <SubType>compile</SubType>\r
     </Compile>\r
+    <Compile Include="src\Common-Demo-Source\IntSemTest.c">\r
+      <SubType>compile</SubType>\r
+    </Compile>\r
     <Compile Include="src\Common-Demo-Source\QueueSet.c">\r
       <SubType>compile</SubType>\r
     </Compile>\r
+    <Compile Include="src\Common-Demo-Source\TaskNotify.c">\r
+      <SubType>compile</SubType>\r
+    </Compile>\r
+    <Compile Include="src\Common-Demo-Source\TimerDemo.c">\r
+      <SubType>compile</SubType>\r
+    </Compile>\r
     <Compile Include="src\IntQueueTimer.c">\r
       <SubType>compile</SubType>\r
     </Compile>\r
index f55e4c763dca69d0f2a233a4fdae3d70553c2588..c0e105e37b5e308ea3e43146f4ffbe3ec690de74 100644 (file)
@@ -91,7 +91,7 @@ extern uint32_t SystemCoreClock;
 \r
 #define configUSE_PREEMPTION                                   1\r
 #define configUSE_PORT_OPTIMISED_TASK_SELECTION        1\r
-#define configUSE_IDLE_HOOK                                            0\r
+#define configUSE_IDLE_HOOK                                            1\r
 #define configUSE_TICK_HOOK                                            1\r
 #define configCPU_CLOCK_HZ                                             ( SystemCoreClock )\r
 #define configTICK_RATE_HZ                                             ( ( TickType_t ) 1000 )\r
@@ -132,6 +132,7 @@ to exclude the API function. */
 #define INCLUDE_vTaskDelayUntil                        1\r
 #define INCLUDE_vTaskDelay                             1\r
 #define INCLUDE_eTaskGetState                  1\r
+#define INCLUDE_xTimerPendFunctionCall 1\r
 \r
 /* Cortex-M specific definitions. */\r
 #ifdef __NVIC_PRIO_BITS\r
index ed98eb91ff364dff946f99f4c46accd6fe7b8202..ad69a329b7d431b7e92fe3ffe9ed9f06aa1e1f9a 100644 (file)
@@ -85,7 +85,6 @@
 \r
 /* Standard demo includes. */\r
 #include "partest.h"\r
-#include "QueueSet.h"\r
 \r
 /* Atmel library includes. */\r
 #include <asf.h>\r
@@ -181,6 +180,14 @@ void vApplicationIdleHook( void )
        important that vApplicationIdleHook() is permitted to return to its calling\r
        function, because it is the responsibility of the idle task to clean up\r
        memory allocated by the kernel to any task that has since been deleted. */\r
+       \r
+       #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 )\r
+       {\r
+       extern void vFullDemoIdleHook( void );\r
+       \r
+               vFullDemoIdleHook();\r
+       }\r
+       #endif /* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY */\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
@@ -207,8 +214,9 @@ void vApplicationTickHook( void )
 \r
        #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 )\r
        {\r
-               /* In this case the tick hook is used as part of the queue set test. */\r
-               vQueueSetAccessQueueSetFromISR();\r
+       extern void vFullDemoTickHook( void );\r
+       \r
+               vFullDemoTickHook();\r
        }\r
        #endif /* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY */\r
 }\r
index 2067f66bbf3e5a32a342f59e611022e31b82af8b..4e4495cec286c84e42122d4e52320401565d132a 100644 (file)
 #include "comtest2.h"\r
 #include "QueueSet.h"\r
 #include "IntQueue.h"\r
+#include "TaskNotify.h"\r
+#include "TimerDemo.h"\r
+#include "EventGroupsDemo.h"\r
+#include "IntSemTest.h"\r
 \r
 /* Atmel library includes. */\r
 #include "asf.h"\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_PERIOD_MS constant. */\r
-#define mainCHECK_TIMER_PERIOD_MS                      ( 3000UL / portTICK_PERIOD_MS )\r
+#define mainCHECK_TIMER_PERIOD_MS                      ( pdMS_TO_TICKS( 3000UL ) )\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_PERIOD_MS constant. */\r
-#define mainERROR_CHECK_TIMER_PERIOD_MS        ( 200UL / portTICK_PERIOD_MS )\r
+#define mainERROR_CHECK_TIMER_PERIOD_MS        ( pdMS_TO_TICKS( 200UL ) )\r
 \r
 /* The standard demo flash timers can be used to flash any number of LEDs.  In\r
 this case, because only three LEDs are available, and one is in use by the\r
@@ -165,8 +169,23 @@ standard demo flash timers. */
 for the comtest, so the LED number is deliberately out of range. */\r
 #define mainCOM_TEST_LED                                       ( 3 )\r
 \r
+/* Used by the standard demo timer tasks. */\r
+#define mainTIMER_TEST_PERIOD                          ( 50 )\r
+\r
 /*-----------------------------------------------------------*/\r
 \r
+/*\r
+ * Called by the idle hook function when the project is configured to run the\r
+ * full (as opposed to the blinky) demo.\r
+ */\r
+void vFullDemoIdleHook( void );\r
+\r
+/*\r
+ * Called by the tick hook function when the project is configured to run the\r
+ * full (as opposed to the blinky) demo.\r
+ */\r
+void vFullDemoTickHook( void );\r
+\r
 /*\r
  * The check timer callback function, as described at the top of this file.\r
  */\r
@@ -176,8 +195,6 @@ static void prvCheckTimerCallback( TimerHandle_t xTimer );
 \r
 void main_full( void )\r
 {\r
-TimerHandle_t xCheckTimer = NULL;\r
-\r
        /* Start all the other standard demo/test tasks.  The have not particular\r
        functionality, but do demonstrate how to use the FreeRTOS API and test the\r
        kernel port. */\r
@@ -191,23 +208,12 @@ TimerHandle_t xCheckTimer = NULL;
        vStartRecursiveMutexTasks();\r
        vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );\r
        vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );\r
-       vStartLEDFlashTimers( mainNUMBER_OF_FLASH_TIMERS_LEDS );\r
        vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );\r
        vStartQueueSetTasks();\r
-\r
-       /* Create the software timer that performs the 'check' functionality,\r
-       as described at the top of this file. */\r
-       xCheckTimer = xTimerCreate( "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
-\r
-       if( xCheckTimer != NULL )\r
-       {\r
-               xTimerStart( xCheckTimer, mainDONT_BLOCK );\r
-       }\r
+       vStartTaskNotifyTask();\r
+       vStartTimerDemoTask( mainTIMER_TEST_PERIOD );\r
+       vStartEventGroupTasks();\r
+       vStartInterruptSemaphoreTasks();\r
 \r
        /* The set of tasks created by the following function call have to be\r
        created last as they keep account of the number of tasks they expect to see\r
@@ -236,63 +242,84 @@ unsigned long ulErrorFound = pdFALSE;
 \r
        if( xAreIntQueueTasksStillRunning() != pdTRUE )\r
        {\r
-               ulErrorFound = pdTRUE;\r
+               ulErrorFound |= 1UL << 0UL;\r
        }\r
 \r
        if( xAreIntegerMathsTaskStillRunning() != pdTRUE )\r
        {\r
-               ulErrorFound = pdTRUE;\r
+               ulErrorFound |= 1UL << 1UL;\r
        }\r
 \r
        if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )\r
        {\r
-               ulErrorFound = pdTRUE;\r
+               ulErrorFound |= 1UL << 2UL;\r
        }\r
 \r
        if( xAreBlockingQueuesStillRunning() != pdTRUE )\r
        {\r
-               ulErrorFound = pdTRUE;\r
+               ulErrorFound |= 1UL << 3UL;\r
        }\r
 \r
        if ( xAreBlockTimeTestTasksStillRunning() != pdTRUE )\r
        {\r
-               ulErrorFound = pdTRUE;\r
+               ulErrorFound |= 1UL << 4UL;\r
        }\r
 \r
        if ( xAreGenericQueueTasksStillRunning() != pdTRUE )\r
        {\r
-               ulErrorFound = pdTRUE;\r
+               ulErrorFound |= 1UL << 5UL;\r
        }\r
 \r
        if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE )\r
        {\r
-               ulErrorFound = pdTRUE;\r
+               ulErrorFound |= 1UL << 6UL;\r
        }\r
 \r
        if( xIsCreateTaskStillRunning() != pdTRUE )\r
        {\r
-               ulErrorFound = pdTRUE;\r
+               ulErrorFound |= 1UL << 7UL;\r
        }\r
 \r
        if( xArePollingQueuesStillRunning() != pdTRUE )\r
        {\r
-               ulErrorFound = pdTRUE;\r
+               ulErrorFound |= 1UL << 8UL;\r
        }\r
 \r
        if( xAreSemaphoreTasksStillRunning() != pdTRUE )\r
        {\r
-               ulErrorFound = pdTRUE;\r
+               ulErrorFound |= 1UL << 9UL;\r
        }\r
 \r
        if( xAreComTestTasksStillRunning() != pdTRUE )\r
        {\r
-               ulErrorFound = pdTRUE;\r
+               ulErrorFound |= 1UL << 10UL;\r
        }\r
 \r
-       if( xAreQueueSetTasksStillRunning() != pdPASS )\r
+       if( xAreQueueSetTasksStillRunning() != pdTRUE )\r
+       {\r
+               ulErrorFound |= 1UL << 11UL;\r
+       }\r
+       \r
+       if( xAreTaskNotificationTasksStillRunning() != pdTRUE )\r
+       {\r
+               ulErrorFound |= 1UL << 12UL;\r
+       }\r
+       \r
+       if( xAreTimerDemoTasksStillRunning( mainCHECK_TIMER_PERIOD_MS ) != pdTRUE )\r
+       {\r
+               ulErrorFound |= 1UL << 13UL;\r
+       }\r
+       \r
+       if( xAreEventGroupTasksStillRunning() != pdTRUE )\r
+       {\r
+               ulErrorFound |= 1UL << 14UL;\r
+       }\r
+       \r
+       if( xAreInterruptSemaphoreTasksStillRunning() != pdTRUE )\r
        {\r
-               ulErrorFound = pdTRUE;\r
+               ulErrorFound |= 1UL << 15UL;\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
@@ -318,3 +345,49 @@ unsigned long ulErrorFound = pdFALSE;
 }\r
 /*-----------------------------------------------------------*/\r
 \r
+void vFullDemoIdleHook( void )\r
+{\r
+static TimerHandle_t xCheckTimer = NULL;\r
+               \r
+       if( xCheckTimer == NULL )\r
+       {\r
+               /* Create the software timer that performs the 'check' \r
+               functionality, in the full demo.  This is not done before the\r
+               scheduler is started as to do so would prevent the standard demo\r
+               timer tasks from passing their tests (they expect the timer\r
+               command queue to be empty. */\r
+               xCheckTimer = xTimerCreate( "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
+\r
+               if( xCheckTimer != NULL )\r
+               {\r
+                       xTimerStart( xCheckTimer, mainDONT_BLOCK );\r
+               }\r
+               \r
+               /* Also start some timers that just flash LEDs. */\r
+               vStartLEDFlashTimers( mainNUMBER_OF_FLASH_TIMERS_LEDS );\r
+       }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vFullDemoTickHook( void )\r
+{\r
+       /* In this case the tick hook is used as part of the queue set test. */\r
+       vQueueSetAccessQueueSetFromISR();\r
+               \r
+       /* Use task notifications from an interrupt. */\r
+       xNotifyTaskFromISR();\r
+               \r
+       /* Use timers from an interrupt. */\r
+       vTimerPeriodicISRTests();\r
+       \r
+       /* Use event groups from an interrupt. */\r
+       vPeriodicEventGroupsProcessing();\r
+       \r
+       /* Use mutexes from interrupts. */\r
+       vInterruptSemaphorePeriodicTest();\r
+}\r
index e4f6ce87b2275eaa9531d5effc6137983720b2bc..03f9f68aa0e6ed38b7d739afb0a8ae3478793b76 100644 (file)
@@ -83,7 +83,7 @@
 #define configUSE_TICK_HOOK                                            1\r
 #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. */\r
 #define configMINIMAL_STACK_SIZE                               ( ( unsigned short ) 50 ) /* In this simulated case, the stack only has to hold one small structure as the real stack is part of the win32 thread. */\r
-#define configTOTAL_HEAP_SIZE                                  ( ( size_t ) ( 23 * 1024 ) )\r
+#define configTOTAL_HEAP_SIZE                                  ( ( size_t ) ( 24 * 1024 ) )\r
 #define configMAX_TASK_NAME_LEN                                        ( 12 )\r
 #define configUSE_TRACE_FACILITY                               1\r
 #define configUSE_16_BIT_TICKS                                 0\r
index 6c10d8dde191c0d97aa283ca44bd81067c813f57..21332acc3af3c76eceb8b53f43d98210f0577f0d 100644 (file)
@@ -112,9 +112,9 @@ that make up the total heap.  This is only done to provide an example of heap_5
 being used as this demo could easily create one large heap region instead of\r
 multiple smaller heap regions - in which case heap_4.c would be the more\r
 appropriate choice. */\r
-#define mainREGION_1_SIZE      3001\r
+#define mainREGION_1_SIZE      4001\r
 #define mainREGION_2_SIZE      18105\r
-#define mainREGION_3_SIZE      1407\r
+#define mainREGION_3_SIZE      1807\r
 \r
 /*\r
  * main_blinky() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1.\r
@@ -228,10 +228,10 @@ void vApplicationIdleHook( void )
        function, because it is the responsibility of the idle task to clean up\r
        memory allocated by the kernel to any task that has since been deleted. */\r
 \r
-       /* Uncomment the following code to allow the trace to be stopped with any \r
+       /* Uncomment the following code to allow the trace to be stopped with any\r
        key press.  The code is commented out by default as the kbhit() function\r
        interferes with the run time behaviour. */\r
-       /* \r
+       /*\r
                if( _kbhit() != pdFALSE )\r
                {\r
                        if( xTraceRunning == pdTRUE )\r
@@ -367,6 +367,9 @@ const HeapRegion_t xHeapRegions[] =
        array. */\r
        configASSERT( ( ulAdditionalOffset + mainREGION_1_SIZE + mainREGION_2_SIZE + mainREGION_3_SIZE ) < configTOTAL_HEAP_SIZE );\r
 \r
+       /* Prevent compiler warnings when configASSERT() is not defined. */\r
+       ( void ) ulAdditionalOffset;\r
+\r
        vPortDefineHeapRegions( xHeapRegions );\r
 }\r
 /*-----------------------------------------------------------*/\r
index 99be287fcf34f4ebd7479c4fde339ef21f5dc56a..70d53da0a5b8c61befde3e2cff34d2be30e9023a 100644 (file)
@@ -91,6 +91,9 @@
  * \ingroup FreeRTOSIntro\r
  */\r
 \r
+#ifndef INC_FREERTOS_H\r
+       #error FreeRTOS.h must be included before list.h\r
+#endif\r
 \r
 #ifndef LIST_H\r
 #define LIST_H\r
 #ifdef __cplusplus\r
 extern "C" {\r
 #endif\r
+\r
+/* Macros that can be used to place known values within the list structures,\r
+then check that the known values do not get corrupted during the execution of\r
+the application.   These may catch the list data structures being overwritten in\r
+memory.  They will not catch data errors caused by incorrect configuration or\r
+use of FreeRTOS.*/\r
+#if( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 0 )\r
+       /* Define the macros to do nothing. */\r
+       #define listLIST_ITEM_INTEGRITY_CHECK_VALUE_1\r
+       #define listLIST_ITEM_INTEGRITY_CHECK_VALUE_2\r
+       #define listLIST_INTEGRITY_CHECK_VALUE_1\r
+       #define listLIST_INTEGRITY_CHECK_VALUE_2\r
+       #define listSET_LIST_ITEM_INTEGRITY_CHECK_1_VALUE( pxItem )\r
+       #define listSET_LIST_ITEM_INTEGRITY_CHECK_2_VALUE( pxItem )\r
+       #define listSET_LIST_INTEGRITY_CHECK_1_VALUE( pxList )\r
+       #define listSET_LIST_INTEGRITY_CHECK_2_VALUE( pxList )\r
+       #define listTEST_LIST_ITEM_INTEGRITY( pxItem )\r
+       #define listTEST_LIST_INTEGRITY( pxList )\r
+#else\r
+       /* Define macros that add new members into the list structures. */\r
+       #define listLIST_ITEM_INTEGRITY_CHECK_VALUE_1                           TickType_t xListItemIntegrityValue1;\r
+       #define listLIST_ITEM_INTEGRITY_CHECK_VALUE_2                           TickType_t xListItemIntegrityValue2;\r
+       #define listLIST_INTEGRITY_CHECK_VALUE_1                                        TickType_t xListIntegrityValue1;\r
+       #define listLIST_INTEGRITY_CHECK_VALUE_2                                        TickType_t xListIntegrityValue2;\r
+\r
+       /* Define macros that set the new structure members to known values. */\r
+       #define listSET_LIST_ITEM_INTEGRITY_CHECK_1_VALUE( pxItem )     ( pxItem )->xListItemIntegrityValue1 = pdINTEGRITY_CHECK_VALUE\r
+       #define listSET_LIST_ITEM_INTEGRITY_CHECK_2_VALUE( pxItem )     ( pxItem )->xListItemIntegrityValue2 = pdINTEGRITY_CHECK_VALUE\r
+       #define listSET_LIST_INTEGRITY_CHECK_1_VALUE( pxList )          ( pxList )->xListIntegrityValue1 = pdINTEGRITY_CHECK_VALUE\r
+       #define listSET_LIST_INTEGRITY_CHECK_2_VALUE( pxList )          ( pxList )->xListIntegrityValue2 = pdINTEGRITY_CHECK_VALUE\r
+\r
+       /* Define macros that will assert if one of the structure members does not\r
+       contain its expected value. */\r
+       #define listTEST_LIST_ITEM_INTEGRITY( pxItem )          configASSERT( ( ( pxItem )->xListItemIntegrityValue1 == pdINTEGRITY_CHECK_VALUE ) && ( ( pxItem )->xListItemIntegrityValue2 == pdINTEGRITY_CHECK_VALUE ) )\r
+       #define listTEST_LIST_INTEGRITY( pxList )                       configASSERT( ( ( pxList )->xListIntegrityValue1 == pdINTEGRITY_CHECK_VALUE ) && ( ( pxList )->xListIntegrityValue2 == pdINTEGRITY_CHECK_VALUE ) )\r
+#endif /* configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES */\r
+\r
+\r
 /*\r
  * Definition of the only type of object that a list can contain.\r
  */\r
 struct xLIST_ITEM\r
 {\r
+       listLIST_ITEM_INTEGRITY_CHECK_VALUE_1                           /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */\r
        configLIST_VOLATILE TickType_t xItemValue;                      /*< The value being listed.  In most cases this is used to sort the list in descending order. */\r
        struct xLIST_ITEM * configLIST_VOLATILE pxNext;         /*< Pointer to the next ListItem_t in the list. */\r
        struct xLIST_ITEM * configLIST_VOLATILE pxPrevious;     /*< Pointer to the previous ListItem_t in the list. */\r
        void * pvOwner;                                                                         /*< Pointer to the object (normally a TCB) that contains the list item.  There is therefore a two way link between the object containing the list item and the list item itself. */\r
        void * configLIST_VOLATILE pvContainer;                         /*< Pointer to the list in which this list item is placed (if any). */\r
+       listLIST_ITEM_INTEGRITY_CHECK_VALUE_2                           /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */\r
 };\r
 typedef struct xLIST_ITEM ListItem_t;                                  /* For some reason lint wants this as two separate definitions. */\r
 \r
 struct xMINI_LIST_ITEM\r
 {\r
+       listLIST_ITEM_INTEGRITY_CHECK_VALUE_1                           /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */\r
        configLIST_VOLATILE TickType_t xItemValue;\r
        struct xLIST_ITEM * configLIST_VOLATILE pxNext;\r
        struct xLIST_ITEM * configLIST_VOLATILE pxPrevious;\r
@@ -156,9 +200,11 @@ typedef struct xMINI_LIST_ITEM MiniListItem_t;
  */\r
 typedef struct xLIST\r
 {\r
+       listLIST_INTEGRITY_CHECK_VALUE_1                                /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */\r
        configLIST_VOLATILE UBaseType_t uxNumberOfItems;\r
        ListItem_t * configLIST_VOLATILE pxIndex;               /*< Used to walk through the list.  Points to the last item returned by a call to listGET_OWNER_OF_NEXT_ENTRY (). */\r
        MiniListItem_t xListEnd;                                                /*< List item that contains the maximum possible item value meaning it is always at the end of the list and is therefore used as a marker. */\r
+       listLIST_INTEGRITY_CHECK_VALUE_2                                /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */\r
 } List_t;\r
 \r
 /*\r
index 0062738aff9839954329b4a80d41a0b431be4529..8aa75125513d9d7d9e50b152fff6e2983a2caf7d 100644 (file)
@@ -88,6 +88,17 @@ typedef void (*TaskFunction_t)( void * );
 #define errQUEUE_BLOCKED                                               ( -4 )\r
 #define errQUEUE_YIELD                                                 ( -5 )\r
 \r
+/* Macros used for basic data corruption checks. */\r
+#ifndef configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES\r
+       #define configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES 0\r
+#endif\r
+\r
+#if( configUSE_16_BIT_TICKS == 1 )\r
+       #define pdINTEGRITY_CHECK_VALUE 0x5a5a\r
+#else\r
+       #define pdINTEGRITY_CHECK_VALUE 0x5a5a5a5aUL\r
+#endif\r
+\r
 #endif /* PROJDEFS_H */\r
 \r
 \r
index a8d9d5b90670d5fedb59702b077960ce6e4bc566..d256fae4c68d56600d62b7da667664e0f18d05ae 100644 (file)
@@ -89,6 +89,11 @@ void vListInitialise( List_t * const pxList )
        pxList->xListEnd.pxPrevious = ( ListItem_t * ) &( pxList->xListEnd );/*lint !e826 !e740 The mini list structure is used as the list end to save RAM.  This is checked and valid. */\r
 \r
        pxList->uxNumberOfItems = ( UBaseType_t ) 0U;\r
+\r
+       /* Write known values into the list if\r
+       configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */\r
+       listSET_LIST_INTEGRITY_CHECK_1_VALUE( pxList );\r
+       listSET_LIST_INTEGRITY_CHECK_2_VALUE( pxList );\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
@@ -96,6 +101,11 @@ void vListInitialiseItem( ListItem_t * const pxItem )
 {\r
        /* Make sure the list item is not recorded as being on a list. */\r
        pxItem->pvContainer = NULL;\r
+\r
+       /* Write known values into the list item if\r
+       configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */\r
+       listSET_LIST_ITEM_INTEGRITY_CHECK_1_VALUE( pxItem );\r
+       listSET_LIST_ITEM_INTEGRITY_CHECK_2_VALUE( pxItem );\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
@@ -103,6 +113,12 @@ void vListInsertEnd( List_t * const pxList, ListItem_t * const pxNewListItem )
 {\r
 ListItem_t * const pxIndex = pxList->pxIndex;\r
 \r
+       /* Only effective when configASSERT() is also defined, these tests may catch\r
+       the list data structures being overwritten in memory.  They will not catch\r
+       data errors caused by incorrect configuration or use of FreeRTOS. */\r
+       listTEST_LIST_INTEGRITY( pxList );\r
+       listTEST_LIST_ITEM_INTEGRITY( pxNewListItem );\r
+\r
        /* Insert a new list item into pxList, but rather than sort the list,\r
        makes the new list item the last item to be removed by a call to\r
        listGET_OWNER_OF_NEXT_ENTRY(). */\r
@@ -123,6 +139,12 @@ void vListInsert( List_t * const pxList, ListItem_t * const pxNewListItem )
 ListItem_t *pxIterator;\r
 const TickType_t xValueOfInsertion = pxNewListItem->xItemValue;\r
 \r
+       /* Only effective when configASSERT() is also defined, these tests may catch\r
+       the list data structures being overwritten in memory.  They will not catch\r
+       data errors caused by incorrect configuration or use of FreeRTOS. */\r
+       listTEST_LIST_INTEGRITY( pxList );\r
+       listTEST_LIST_ITEM_INTEGRITY( pxNewListItem );\r
+\r
        /* Insert the new list item into the list, sorted in xItemValue order.\r
 \r
        If the list already contains a list item with the same item value then the\r
index 25b04f49b5abee822989552424a4706753ab43ad..c4a24cbeae0987212d983eb5cd6a595ca9176268 100644 (file)
@@ -155,7 +155,7 @@ const uint32_t ulR13 = ( uint32_t ) &_SDA_BASE_;
        *pxTopOfStack = ( StackType_t ) 0x00000000;\r
        pxTopOfStack--;\r
 \r
-       #if XPAR_MICROBLAZE_0_USE_FPU == 1\r
+       #if XPAR_MICROBLAZE_0_USE_FPU != 0\r
                /* The FSR value placed in the initial task context is just 0. */\r
                *pxTopOfStack = portINITIAL_FSR;\r
                pxTopOfStack--;\r
index 800eaa2039b7ad0105d745c0b59c1ae4bd2f6643..d25fe5aeeec5da2b7696bc3dc57db2e320074f1b 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-    FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd. \r
+    FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.\r
     All rights reserved\r
 \r
     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
@@ -120,10 +120,10 @@ extern void vPortExceptionHandlerEntry( void *pvExceptionID );
 \r
 /*-----------------------------------------------------------*/\r
 \r
-/* vApplicationExceptionRegisterDump() is a callback function that the \r
+/* vApplicationExceptionRegisterDump() is a callback function that the\r
 application can optionally define to receive a populated xPortRegisterDump\r
-structure.  If the application chooses not to define a version of \r
-vApplicationExceptionRegisterDump() then this weekly defined default \r
+structure.  If the application chooses not to define a version of\r
+vApplicationExceptionRegisterDump() then this weekly defined default\r
 implementation will be called instead. */\r
 extern void vApplicationExceptionRegisterDump( xPortRegisterDump *xRegisterDump ) __attribute__((weak));\r
 void vApplicationExceptionRegisterDump( xPortRegisterDump *xRegisterDump )\r
@@ -143,8 +143,8 @@ extern void *pxCurrentTCB;
 \r
        /* Fill an xPortRegisterDump structure with the MicroBlaze context as it\r
        was immediately before the exception occurrence. */\r
-       \r
-       /* First fill in the name and handle of the task that was in the Running \r
+\r
+       /* First fill in the name and handle of the task that was in the Running\r
        state when the exception occurred. */\r
        xRegisterDump.xCurrentTaskHandle = pxCurrentTCB;\r
        xRegisterDump.pcCurrentTaskName = pcTaskGetTaskName( NULL );\r
@@ -167,7 +167,7 @@ extern void *pxCurrentTCB;
        xRegisterDump.ulR18 = pulStackPointerOnFunctionEntry[ portexR18_STACK_OFFSET ];\r
        xRegisterDump.ulR19 = pulStackPointerOnFunctionEntry[ portexR19_STACK_OFFSET ];\r
        xRegisterDump.ulMSR = pulStackPointerOnFunctionEntry[ portexMSR_STACK_OFFSET ];\r
-       \r
+\r
        /* Obtain the value of all other registers. */\r
        xRegisterDump.ulR2_small_data_area = mfgpr( R2 );\r
        xRegisterDump.ulR13_read_write_small_data_area = mfgpr( R13 );\r
@@ -190,13 +190,13 @@ extern void *pxCurrentTCB;
        xRegisterDump.ulEAR = mfear();\r
        xRegisterDump.ulESR = mfesr();\r
        xRegisterDump.ulEDR = mfedr();\r
-       \r
+\r
        /* Move the saved program counter back to the instruction that was executed\r
        when the exception occurred.  This is only valid for certain types of\r
        exception. */\r
        xRegisterDump.ulPC = xRegisterDump.ulR17_return_address_from_exceptions - portexINSTRUCTION_SIZE;\r
 \r
-       #if XPAR_MICROBLAZE_0_USE_FPU == 1\r
+       #if XPAR_MICROBLAZE_0_USE_FPU != 0\r
        {\r
                xRegisterDump.ulFSR = mffsr();\r
        }\r
@@ -239,7 +239,7 @@ extern void *pxCurrentTCB;
                                xRegisterDump.pcExceptionCause = ( int8_t * const ) "XEXC_ID_STACK_VIOLATION or XEXC_ID_MMU";\r
                                break;\r
 \r
-               #if XPAR_MICROBLAZE_0_USE_FPU == 1\r
+               #if XPAR_MICROBLAZE_0_USE_FPU != 0\r
 \r
                        case XEXC_ID_FPU :\r
                                                xRegisterDump.pcExceptionCause = ( int8_t * const ) "XEXC_ID_FPU see ulFSR value";\r
@@ -248,10 +248,10 @@ extern void *pxCurrentTCB;
                #endif /* XPAR_MICROBLAZE_0_USE_FPU */\r
        }\r
 \r
-       /* vApplicationExceptionRegisterDump() is a callback function that the \r
+       /* vApplicationExceptionRegisterDump() is a callback function that the\r
        application can optionally define to receive the populated xPortRegisterDump\r
-       structure.  If the application chooses not to define a version of \r
-       vApplicationExceptionRegisterDump() then the weekly defined default \r
+       structure.  If the application chooses not to define a version of\r
+       vApplicationExceptionRegisterDump() then the weekly defined default\r
        implementation within this file will be called instead. */\r
        vApplicationExceptionRegisterDump( &xRegisterDump );\r
 \r
@@ -310,7 +310,7 @@ static uint32_t ulHandlersAlreadyInstalled = pdFALSE;
 }\r
 \r
 /* Exclude the entire file if the MicroBlaze is not configured to handle\r
-exceptions, or the application defined configuration item \r
+exceptions, or the application defined configuration item\r
 configINSTALL_EXCEPTION_HANDLERS is not set to 1. */\r
 #endif /* ( MICROBLAZE_EXCEPTIONS_ENABLED == 1 ) && ( configINSTALL_EXCEPTION_HANDLERS == 1 ) */\r
 \r
index 44cc1ff3103873e6a05eb08e955b9efcde6e563c..cf5d3389a9cf0cb06ef9d538c11634d5f85d4a52 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-    FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd. \r
+    FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.\r
     All rights reserved\r
 \r
     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
@@ -72,7 +72,7 @@
 \r
 /* The context is oversized to allow functions called from the ISR to write\r
 back into the caller stack. */\r
-#if XPAR_MICROBLAZE_0_USE_FPU == 1\r
+#if XPAR_MICROBLAZE_0_USE_FPU != 0\r
        #define portCONTEXT_SIZE 136\r
        #define portMINUS_CONTEXT_SIZE -136\r
 #else\r
@@ -175,7 +175,7 @@ back into the caller stack. */
        mfs r18, rmsr\r
        swi r18, r1, portMSR_OFFSET\r
 \r
-       #if XPAR_MICROBLAZE_0_USE_FPU == 1\r
+       #if XPAR_MICROBLAZE_0_USE_FPU != 0\r
                /* Stack FSR. */\r
                mfs r18, rfsr\r
                swi r18, r1, portFSR_OFFSET\r
@@ -184,7 +184,7 @@ back into the caller stack. */
        /* Save the top of stack value to the TCB. */\r
        lwi r3, r0, pxCurrentTCB\r
        sw      r1, r0, r3\r
-       \r
+\r
        .endm\r
 \r
 .macro portRESTORE_CONTEXT\r
@@ -228,7 +228,7 @@ back into the caller stack. */
        lwi r18, r1, portMSR_OFFSET\r
        mts rmsr, r18\r
 \r
-       #if XPAR_MICROBLAZE_0_USE_FPU == 1\r
+       #if XPAR_MICROBLAZE_0_USE_FPU != 0\r
                /* Reload the FSR from the stack. */\r
                lwi r18, r1, portFSR_OFFSET\r
                mts rfsr, r18\r
@@ -345,11 +345,11 @@ VPortYieldASM:
 vPortStartFirstTask:\r
 \r
        portRESTORE_CONTEXT\r
-       \r
+\r
 \r
 \r
 #if MICROBLAZE_EXCEPTIONS_ENABLED == 1\r
-       \r
+\r
        .text\r
        .align 2\r
 vPortExceptionHandlerEntry:\r
index 99c005fcce2b1c1a561b075b7b47fff031fbd759..69aaebb76b1f8fc2d46ddd05871ebb9064e9049c 100644 (file)
@@ -133,6 +133,7 @@ typedef struct tskTaskControlBlock
 \r
        #if ( portUSING_MPU_WRAPPERS == 1 )\r
                xMPU_SETTINGS   xMPUSettings;           /*< The MPU settings are defined as part of the port layer.  THIS MUST BE THE SECOND MEMBER OF THE TCB STRUCT. */\r
+               BaseType_t              xUsingStaticallyAllocatedStack; /* Set to pdTRUE if the stack is a statically allocated array, and pdFALSE if the stack is dynamically allocated. */\r
        #endif\r
 \r
        ListItem_t                      xGenericListItem;       /*< The list that the state list item of a task is reference from denotes the state of that task (Ready, Blocked, Suspended ). */\r
@@ -543,6 +544,7 @@ BaseType_t xTaskGenericCreate( TaskFunction_t pxTaskCode, const char * const pcN
 {\r
 BaseType_t xReturn;\r
 TCB_t * pxNewTCB;\r
+StackType_t *pxTopOfStack;\r
 \r
        configASSERT( pxTaskCode );\r
        configASSERT( ( ( uxPriority & ( ~portPRIVILEGE_BIT ) ) < configMAX_PRIORITIES ) );\r
@@ -553,8 +555,6 @@ TCB_t * pxNewTCB;
 \r
        if( pxNewTCB != NULL )\r
        {\r
-               StackType_t *pxTopOfStack;\r
-\r
                #if( portUSING_MPU_WRAPPERS == 1 )\r
                        /* Should the task be created in privileged mode? */\r
                        BaseType_t xRunPrivileged;\r
@@ -567,6 +567,20 @@ TCB_t * pxNewTCB;
                                xRunPrivileged = pdFALSE;\r
                        }\r
                        uxPriority &= ~portPRIVILEGE_BIT;\r
+\r
+                       if( puxStackBuffer != NULL )\r
+                       {\r
+                               /* The application provided its own stack.  Note this so no\r
+                               attempt is made to delete the stack should that task be\r
+                               deleted. */\r
+                               pxNewTCB->xUsingStaticallyAllocatedStack = pdTRUE;\r
+                       }\r
+                       else\r
+                       {\r
+                               /* The stack was allocated dynamically.  Note this so it can be\r
+                               deleted again if the task is deleted. */\r
+                               pxNewTCB->xUsingStaticallyAllocatedStack = pdFALSE;\r
+                       }\r
                #endif /* portUSING_MPU_WRAPPERS == 1 */\r
 \r
                /* Calculate the top of stack address.  This depends on whether the\r
@@ -3222,7 +3236,22 @@ TCB_t *pxNewTCB;
                        _reclaim_reent( &( pxTCB->xNewLib_reent ) );\r
                }\r
                #endif /* configUSE_NEWLIB_REENTRANT */\r
-               vPortFreeAligned( pxTCB->pxStack );\r
+\r
+               #if( portUSING_MPU_WRAPPERS == 1 )\r
+               {\r
+                       /* Only free the stack if it was allocated dynamically in the first\r
+                       place. */\r
+                       if( pxTCB->xUsingStaticallyAllocatedStack == pdFALSE )\r
+                       {\r
+                               vPortFreeAligned( pxTCB->pxStack );\r
+                       }\r
+               }\r
+               #else\r
+               {\r
+                       vPortFreeAligned( pxTCB->pxStack );\r
+               }\r
+               #endif\r
+\r
                vPortFree( pxTCB );\r
        }\r
 \r
@@ -3601,7 +3630,7 @@ TCB_t *pxTCB;
                                pcWriteBuffer = prvWriteNameToBuffer( pcWriteBuffer, pxTaskStatusArray[ x ].pcTaskName );\r
 \r
                                /* Write the rest of the string. */\r
-                               sprintf( pcWriteBuffer, "\t\t%c\t%u\t%u\t%u\r\n", cStatus, ( unsigned int ) pxTaskStatusArray[ x ].uxCurrentPriority, ( unsigned int ) pxTaskStatusArray[ x ].usStackHighWaterMark, ( unsigned int ) pxTaskStatusArray[ x ].xTaskNumber );\r
+                               sprintf( pcWriteBuffer, "\t%c\t%u\t%u\t%u\r\n", cStatus, ( unsigned int ) pxTaskStatusArray[ x ].uxCurrentPriority, ( unsigned int ) pxTaskStatusArray[ x ].usStackHighWaterMark, ( unsigned int ) pxTaskStatusArray[ x ].xTaskNumber );\r
                                pcWriteBuffer += strlen( pcWriteBuffer );\r
                        }\r
 \r
@@ -3694,13 +3723,13 @@ TCB_t *pxTCB;
                                        {\r
                                                #ifdef portLU_PRINTF_SPECIFIER_REQUIRED\r
                                                {\r
-                                                       sprintf( pcWriteBuffer, "\t\t%lu\t\t%lu%%\r\n", pxTaskStatusArray[ x ].ulRunTimeCounter, ulStatsAsPercentage );\r
+                                                       sprintf( pcWriteBuffer, "\t%lu\t\t%lu%%\r\n", pxTaskStatusArray[ x ].ulRunTimeCounter, ulStatsAsPercentage );\r
                                                }\r
                                                #else\r
                                                {\r
                                                        /* sizeof( int ) == sizeof( long ) so a smaller\r
                                                        printf() library can be used. */\r
-                                                       sprintf( pcWriteBuffer, "\t\t%u\t\t%u%%\r\n", ( unsigned int ) pxTaskStatusArray[ x ].ulRunTimeCounter, ( unsigned int ) ulStatsAsPercentage );\r
+                                                       sprintf( pcWriteBuffer, "\t%u\t\t%u%%\r\n", ( unsigned int ) pxTaskStatusArray[ x ].ulRunTimeCounter, ( unsigned int ) ulStatsAsPercentage );\r
                                                }\r
                                                #endif\r
                                        }\r
@@ -3710,13 +3739,13 @@ TCB_t *pxTCB;
                                                consumed less than 1% of the total run time. */\r
                                                #ifdef portLU_PRINTF_SPECIFIER_REQUIRED\r
                                                {\r
-                                                       sprintf( pcWriteBuffer, "\t\t%lu\t\t<1%%\r\n", pxTaskStatusArray[ x ].pcTaskName, pxTaskStatusArray[ x ].ulRunTimeCounter );\r
+                                                       sprintf( pcWriteBuffer, "\t%lu\t\t<1%%\r\n", pxTaskStatusArray[ x ].ulRunTimeCounter );\r
                                                }\r
                                                #else\r
                                                {\r
                                                        /* sizeof( int ) == sizeof( long ) so a smaller\r
                                                        printf() library can be used. */\r
-                                                       sprintf( pcWriteBuffer, "\t\t%u\t\t<1%%\r\n", pxTaskStatusArray[ x ].pcTaskName, ( unsigned int ) pxTaskStatusArray[ x ].ulRunTimeCounter );\r
+                                                       sprintf( pcWriteBuffer, "\t%u\t\t<1%%\r\n", ( unsigned int ) pxTaskStatusArray[ x ].ulRunTimeCounter );\r
                                                }\r
                                                #endif\r
                                        }\r