]> git.sur5r.net Git - freertos/commitdiff
Adjusted the wrap checks in the QueueSet test task.
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Tue, 12 Feb 2013 14:30:12 +0000 (14:30 +0000)
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Tue, 12 Feb 2013 14:30:12 +0000 (14:30 +0000)
Added the QueueSet test to the Rowlay Stellaris and SAM4S-EK Studio demos.
Updated the MSVC demo to use heap_4.c.

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

13 files changed:
FreeRTOS/Demo/CORTEX_LM3Sxxxx_Rowley/FreeRTOSConfig.h
FreeRTOS/Demo/CORTEX_LM3Sxxxx_Rowley/RTOSDemo.hzp
FreeRTOS/Demo/CORTEX_LM3Sxxxx_Rowley/RTOSDemo.hzs
FreeRTOS/Demo/CORTEX_LM3Sxxxx_Rowley/main.c
FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/RTOSDemo.atsuo
FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/FreeRTOSConfig.h
FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main.c
FreeRTOS/Demo/Common/Minimal/QueueSet.c
FreeRTOS/Demo/WIN32-MSVC/FreeRTOSConfig.h
FreeRTOS/Demo/WIN32-MSVC/WIN32.suo
FreeRTOS/Demo/WIN32-MSVC/WIN32.vcxproj
FreeRTOS/Demo/WIN32-MSVC/WIN32.vcxproj.filters
FreeRTOS/Demo/WIN32-MSVC/main.c

index a3776d4a1bb5252970d223098d22a50fa8ffcf4c..dd1e2017847015574c71f1ff7bd6e9c15e3e3700 100644 (file)
@@ -1,7 +1,7 @@
 /*\r
     FreeRTOS V7.3.0 - Copyright (C) 2012 Real Time Engineers Ltd.\r
 \r
-    FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME.  PLEASE VISIT \r
+    FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME.  PLEASE VISIT\r
     http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
 \r
     ***************************************************************************\r
@@ -42,7 +42,7 @@
     FreeRTOS WEB site.\r
 \r
     1 tab == 4 spaces!\r
-    \r
+\r
     ***************************************************************************\r
      *                                                                       *\r
      *    Having a problem?  Start by reading the FAQ "My application does   *\r
      *                                                                       *\r
     ***************************************************************************\r
 \r
-    \r
-    http://www.FreeRTOS.org - Documentation, training, latest versions, license \r
-    and contact details.  \r
-    \r
+\r
+    http://www.FreeRTOS.org - Documentation, training, latest versions, license\r
+    and contact details.\r
+\r
     http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
     including FreeRTOS+Trace - an indispensable productivity tool.\r
 \r
-    Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell \r
-    the code with commercial support, indemnification, and middleware, under \r
+    Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell\r
+    the code with commercial support, indemnification, and middleware, under\r
     the OpenRTOS brand: http://www.OpenRTOS.com.  High Integrity Systems also\r
-    provide a safety engineered and independently SIL3 certified version under \r
+    provide a safety engineered and independently SIL3 certified version under\r
     the SafeRTOS brand: http://www.SafeRTOS.com.\r
 */\r
 \r
@@ -99,6 +99,7 @@
 #define configQUEUE_REGISTRY_SIZE              10\r
 #define configGENERATE_RUN_TIME_STATS  1\r
 #define configUSE_MALLOC_FAILED_HOOK   1\r
+#define configUSE_QUEUE_SETS                   1\r
 \r
 #define configMAX_PRIORITIES                   ( 5UL )\r
 #define configMAX_CO_ROUTINE_PRIORITIES ( 2 )\r
@@ -132,4 +133,7 @@ to zero. */
 version. */\r
 #define configUSE_PORT_OPTIMISED_TASK_SELECTION        1\r
 \r
+/* Disable interrupts and sit in a null loop if assert is called. */\r
+#define configASSERT( x ) if( ( x == 0 ) ) { taskDISABLE_INTERRUPTS(); for( ;; ); }\r
+\r
 #endif /* FREERTOS_CONFIG_H */\r
index 3d683eb4f3b529f2d16b1758566bcc1ba647e029..67ac5394dd3605b9d56d5df8eddfa3cd5ca7738f 100644 (file)
@@ -58,7 +58,9 @@
           <file file_name="../Common/include/death.h"/>
           <file file_name="../Common/include/GenQTest.h"/>
           <file file_name="../Common/include/integer.h"/>
+          <file file_name="../Common/include/QueueSet.h"/>
         </folder>
+        <file file_name="../Common/Minimal/QueueSet.c"/>
       </folder>
       <folder Name="WEB Server">
         <file file_name="webserver/uIP_Task.c"/>
index c67c369008417322a6edefff88739dfda7be4c99..a7a437463ef82aa0f543f4642bb92061262835a7 100644 (file)
@@ -24,9 +24,7 @@
   <ProjectSessionItem path="RTOSDemo" name="unnamed" />
   <ProjectSessionItem path="RTOSDemo;RTOSDemo" name="unnamed" />
   <ProjectSessionItem path="RTOSDemo;RTOSDemo;Source Files" name="unnamed" />
-  <ProjectSessionItem path="RTOSDemo;RTOSDemo;Source Files;FreeRTOS" name="unnamed" />
   <ProjectSessionItem path="RTOSDemo;RTOSDemo;Source Files;include" name="unnamed" />
-  <ProjectSessionItem path="RTOSDemo;RTOSDemo;Source Files;WEB Server" name="unnamed" />
  </Project>
  <Register1>
   <RegisterWindow openNodes="CPU;CPU/xPSR;CPU/CFBP" binaryNodes="" hiddenNodes="" unsignedNodes="" visibleGroups="CPU" decimalNodes="" octalNodes="" asciiNodes="" />
@@ -57,7 +55,7 @@
   <Watches active="0" update="Never" />
  </Watch4>
  <Files>
-  <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="C:\E\Dev\FreeRTOS\WorkingCopy\FreeRTOS\Demo\CORTEX_LM3Sxxxx_Rowley\main.c" y="238" path="C:\E\Dev\FreeRTOS\WorkingCopy\FreeRTOS\Demo\CORTEX_LM3Sxxxx_Rowley\main.c" left="0" selected="1" name="unnamed" top="63" />
+  <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="C:\E\Dev\FreeRTOS\WorkingCopy\FreeRTOS\Demo\CORTEX_LM3Sxxxx_Rowley\main.c" y="241" path="C:\E\Dev\FreeRTOS\WorkingCopy\FreeRTOS\Demo\CORTEX_LM3Sxxxx_Rowley\main.c" left="0" selected="1" name="unnamed" top="59" />
  </Files>
- <ARMCrossStudioWindow activeProject="RTOSDemo" autoConnectTarget="Luminary USB Debug" debugSearchFileMap="" fileDialogInitialDirectory="C:\E\Dev\FreeRTOS\WorkingCopy\FreeRTOS\Source\portable\MemMang" fileDialogDefaultFilter="*.*" autoConnectCapabilities="388991" debugSearchPath="" buildConfiguration="THUMB Flash Debug" />
+ <ARMCrossStudioWindow activeProject="RTOSDemo" autoConnectTarget="Luminary USB Debug" debugSearchFileMap="" fileDialogInitialDirectory="C:\E\Dev\FreeRTOS\WorkingCopy\FreeRTOS\Demo\Common\include" fileDialogDefaultFilter="*.*" autoConnectCapabilities="388991" debugSearchPath="" buildConfiguration="THUMB Flash Debug" />
 </session>
index ad38a3dc0f6fde51fb513730f254d8ac5528fe76..db2873b44fb6d01b9ad39922a91c63efa647534b 100644 (file)
@@ -1,7 +1,7 @@
 /*\r
     FreeRTOS V7.3.0 - Copyright (C) 2012 Real Time Engineers Ltd.\r
 \r
-    FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME.  PLEASE VISIT \r
+    FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME.  PLEASE VISIT\r
     http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
 \r
     ***************************************************************************\r
@@ -42,7 +42,7 @@
     FreeRTOS WEB site.\r
 \r
     1 tab == 4 spaces!\r
-    \r
+\r
     ***************************************************************************\r
      *                                                                       *\r
      *    Having a problem?  Start by reading the FAQ "My application does   *\r
      *                                                                       *\r
     ***************************************************************************\r
 \r
-    \r
-    http://www.FreeRTOS.org - Documentation, training, latest versions, license \r
-    and contact details.  \r
-    \r
+\r
+    http://www.FreeRTOS.org - Documentation, training, latest versions, license\r
+    and contact details.\r
+\r
     http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
     including FreeRTOS+Trace - an indispensable productivity tool.\r
 \r
-    Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell \r
-    the code with commercial support, indemnification, and middleware, under \r
+    Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell\r
+    the code with commercial support, indemnification, and middleware, under\r
     the OpenRTOS brand: http://www.OpenRTOS.com.  High Integrity Systems also\r
-    provide a safety engineered and independently SIL3 certified version under \r
+    provide a safety engineered and independently SIL3 certified version under\r
     the SafeRTOS brand: http://www.SafeRTOS.com.\r
 */\r
 \r
 #include "QPeek.h"\r
 #include "recmutex.h"\r
 #include "IntQueue.h"\r
+#include "QueueSet.h"\r
 \r
 /*-----------------------------------------------------------*/\r
 \r
@@ -262,6 +263,7 @@ int main( void )
     vStartQueuePeekTasks();\r
     vStartRecursiveMutexTasks();\r
     vStartInterruptQueueTasks();\r
+    vStartQueueSetTasks();\r
 \r
        /* Start the tasks defined within this file/specific to this demo. */\r
        xTaskCreate( vOLEDTask, ( signed char * ) "OLED", mainOLED_TASK_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
@@ -366,12 +368,18 @@ portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
                {\r
                        xMessage.pcMessage = "ERROR IN INT QUEUE";\r
                }\r
-\r
+               else if( xAreQueueSetTasksStillRunning() != pdTRUE )\r
+               {\r
+               xMessage.pcMessage = "ERROR IN QUEUE SET";\r
+               }\r
 \r
                /* Send the message to the OLED gatekeeper for display. */\r
                xHigherPriorityTaskWoken = pdFALSE;\r
                xQueueSendFromISR( xOLEDQueue, &xMessage, &xHigherPriorityTaskWoken );\r
        }\r
+\r
+       /* Exercise the queue sets from an ISR. */\r
+    vQueueSetAccessQueueSetFromISR();\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
index 5e8db2c57e9ee3cce8fab469e962e5d805d2f0de..9e0627d8022f81611163c87eb35e3c8874d672c8 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 1cfa33cb152368560e6b88e7890d550f16b6655d..94dcbd37b6ad6c957c5c512bfed82944e9cb9376 100644 (file)
 #include <stdint.h>\r
 extern uint32_t SystemCoreClock;\r
 \r
-#define configUSE_PREEMPTION                   1\r
-#define configUSE_IDLE_HOOK                            0\r
-#define configUSE_TICK_HOOK                            1\r
-#define configCPU_CLOCK_HZ                             ( SystemCoreClock )\r
-#define configTICK_RATE_HZ                             ( ( portTickType ) 1000 )\r
-#define configMAX_PRIORITIES                   ( ( unsigned portBASE_TYPE ) 5 )\r
-#define configMINIMAL_STACK_SIZE               ( ( unsigned short ) 130 )\r
-#define configTOTAL_HEAP_SIZE                  ( ( size_t ) ( 40960 ) )\r
-#define configMAX_TASK_NAME_LEN                        ( 10 )\r
-#define configUSE_TRACE_FACILITY               0\r
-#define configUSE_16_BIT_TICKS                 0\r
-#define configIDLE_SHOULD_YIELD                        1\r
-#define configUSE_MUTEXES                              1\r
-#define configQUEUE_REGISTRY_SIZE              0\r
-#define configCHECK_FOR_STACK_OVERFLOW 2\r
-#define configUSE_RECURSIVE_MUTEXES            1\r
-#define configUSE_MALLOC_FAILED_HOOK   1\r
-#define configUSE_APPLICATION_TASK_TAG 0\r
-#define configUSE_COUNTING_SEMAPHORES  1\r
-#define configUSE_QUEUE_SETS                   1\r
-#define configGENERATE_RUN_TIME_STATS  0\r
+#define configUSE_PREEMPTION                                   1\r
+#define configUSE_PORT_OPTIMISED_TASK_SELECTION        1\r
+#define configUSE_IDLE_HOOK                                            0\r
+#define configUSE_TICK_HOOK                                            1\r
+#define configCPU_CLOCK_HZ                                             ( SystemCoreClock )\r
+#define configTICK_RATE_HZ                                             ( ( portTickType ) 1000 )\r
+#define configMAX_PRIORITIES                                   ( 5 )\r
+#define configMINIMAL_STACK_SIZE                               ( ( unsigned short ) 130 )\r
+#define configTOTAL_HEAP_SIZE                                  ( ( size_t ) ( 40960 ) )\r
+#define configMAX_TASK_NAME_LEN                                        ( 10 )\r
+#define configUSE_TRACE_FACILITY                               0\r
+#define configUSE_16_BIT_TICKS                                 0\r
+#define configIDLE_SHOULD_YIELD                                        1\r
+#define configUSE_MUTEXES                                              1\r
+#define configQUEUE_REGISTRY_SIZE                              0\r
+#define configCHECK_FOR_STACK_OVERFLOW                 2\r
+#define configUSE_RECURSIVE_MUTEXES                            1\r
+#define configUSE_MALLOC_FAILED_HOOK                   1\r
+#define configUSE_APPLICATION_TASK_TAG                 0\r
+#define configUSE_COUNTING_SEMAPHORES                  1\r
+#define configUSE_QUEUE_SETS                                   1\r
+#define configGENERATE_RUN_TIME_STATS                  0\r
 \r
 /* Co-routine definitions. */\r
 #define configUSE_CO_ROUTINES                  0\r
index f1c8cfec3847983d7bb19247f3f3de8f748c3ee5..a4a5691c4b3f30451d459c41d7fc8af86976f9b5 100644 (file)
@@ -211,7 +211,7 @@ void vApplicationTickHook( void )
        #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
-               vQueueSetWriteToQueueFromISR();\r
+               vQueueSetAccessQueueSetFromISR();\r
        }\r
        #endif /* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY */\r
 }\r
index 59dbcd3d24ff8848da2fc8fec37cf645d9f912ab..b7e37c008b6baa7acee1e28596c2383d0aab0887 100644 (file)
@@ -116,13 +116,18 @@ queuesetPRIORITY_CHANGE_LOOPS number of values are sent to a queue. */
 #define queuesetPRIORITY_CHANGE_LOOPS  100UL\r
 \r
 /* The ISR sends to the queue every queuesetISR_TX_PERIOD ticks. */\r
-#define queuesetISR_TX_PERIOD  2//( 100UL )\r
+#define queuesetISR_TX_PERIOD  ( 100UL )\r
 \r
 /* The allowable maximum deviation between a received value and the expected\r
 received value.  A deviation will occur when data is received from a queue\r
 inside an ISR in between a task receiving from a queue and the task checking\r
 the received value. */\r
-#define queuesetALLOWABLE_RX_DEVIATION 5\r
+#define queuesetALLOWABLE_RX_DEVIATION 3\r
+\r
+/* Ignore values that are at the boundaries of allowable values to make the\r
+testing of limits easier (don't have to deal with wrapping values). */\r
+#define queuesetIGNORED_BOUNDARY       ( queuesetALLOWABLE_RX_DEVIATION * 2 )\r
+\r
 /*\r
  * The task that periodically sends to the queue set.\r
  */\r
@@ -414,17 +419,21 @@ static unsigned long ulExpectedReceivedFromTask = 0, ulExpectedReceivedFromISR =
        if( ulReceived >= queuesetINITIAL_ISR_TX_VALUE )\r
        {\r
                /* The value was sent from the ISR. */\r
-               if( ( ulReceived - queuesetINITIAL_ISR_TX_VALUE ) < queuesetALLOWABLE_RX_DEVIATION )\r
+               if( ( ulReceived - queuesetINITIAL_ISR_TX_VALUE ) < queuesetIGNORED_BOUNDARY )\r
                {\r
                        /* The value received is at the lower limit of the expected range.\r
                        Don't test it and expect to receive one higher next time. */\r
                        ulExpectedReceivedFromISR++;\r
                }\r
-               else if( ( ULONG_MAX - ulReceived ) <= queuesetALLOWABLE_RX_DEVIATION )\r
+               else if( ( ULONG_MAX - ulReceived ) <= queuesetIGNORED_BOUNDARY )\r
                {\r
                        /* The value received is at the higher limit of the expected range.\r
                        Don't test it and expect to wrap soon. */\r
-                       ulExpectedReceivedFromISR = queuesetINITIAL_ISR_TX_VALUE;\r
+                       ulExpectedReceivedFromISR++;\r
+                       if( ulExpectedReceivedFromISR == 0 )\r
+                       {\r
+                               ulExpectedReceivedFromISR = queuesetINITIAL_ISR_TX_VALUE;\r
+                       }\r
                }\r
                else\r
                {\r
@@ -443,17 +452,21 @@ static unsigned long ulExpectedReceivedFromTask = 0, ulExpectedReceivedFromISR =
        else\r
        {\r
                /* The value was sent from the Tx task. */\r
-               if( ulReceived < queuesetALLOWABLE_RX_DEVIATION )\r
+               if( ulReceived < queuesetIGNORED_BOUNDARY )\r
                {\r
                        /* The value received is at the lower limit of the expected range.\r
                        Don't test it, and expect to receive one higher next time. */\r
                        ulExpectedReceivedFromTask++;\r
                }\r
-               else if( ( ( queuesetINITIAL_ISR_TX_VALUE - 1 ) - ulReceived ) <= queuesetALLOWABLE_RX_DEVIATION )\r
+               else if( ( ( queuesetINITIAL_ISR_TX_VALUE - 1 ) - ulReceived ) <= queuesetIGNORED_BOUNDARY )\r
                {\r
                        /* The value received is at the higher limit of the expected range.\r
                        Don't test it and expect to wrap soon. */\r
-                       ulExpectedReceivedFromTask = 0;\r
+                       ulExpectedReceivedFromTask++;\r
+                       if( ulExpectedReceivedFromTask >= queuesetINITIAL_ISR_TX_VALUE )\r
+                       {\r
+                               ulExpectedReceivedFromTask = 0;\r
+                       }\r
                }\r
                else\r
                {\r
index 31bb3115e462a8e219cd96469aa4a43c47a0e066..d0c1f936828ebab6ce02272f680608f81ae0e077 100644 (file)
@@ -85,7 +85,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 ) 0 ) /* This parameter has no effect when heap_3.c is included in the project. */\r
+#define configTOTAL_HEAP_SIZE                  ( ( size_t ) ( 20 * 1024 ) )\r
 #define configMAX_TASK_NAME_LEN                        ( 12 )\r
 #define configUSE_TRACE_FACILITY               1\r
 #define configUSE_16_BIT_TICKS                 0\r
index 4e80022d32b0d9ed1fd873e8ead1634e135544b4..3a7a7394625471baeaf0808291c1c9f62a586e56 100644 (file)
Binary files a/FreeRTOS/Demo/WIN32-MSVC/WIN32.suo and b/FreeRTOS/Demo/WIN32-MSVC/WIN32.suo differ
index 5429533dc32b03823327a08f806ede89f8195d6c..6ea0af09d543ace8dc6276169549b55ed4b7b2d2 100644 (file)
     <ClCompile Include="..\..\..\FreeRTOS-Plus\FreeRTOS-Plus-Trace\trcKernel.c" />\r
     <ClCompile Include="..\..\..\FreeRTOS-Plus\FreeRTOS-Plus-Trace\trcPort.c" />\r
     <ClCompile Include="..\..\..\FreeRTOS-Plus\FreeRTOS-Plus-Trace\trcUser.c" />\r
-    <ClCompile Include="..\..\Source\portable\MemMang\heap_3.c" />\r
+    <ClCompile Include="..\..\Source\portable\MemMang\heap_4.c" />\r
     <ClCompile Include="..\..\Source\timers.c" />\r
     <ClCompile Include="..\Common\Minimal\BlockQ.c" />\r
     <ClCompile Include="..\Common\Minimal\blocktim.c" />\r
index bbd24de02e335444e95a3bf4ca1637c2cb5a7c3f..1c628ea6aa0432f1899d66ce3a2e449c09f1946d 100644 (file)
@@ -49,9 +49,6 @@
     <ClCompile Include="..\..\Source\tasks.c">\r
       <Filter>FreeRTOS Source\Source</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="..\..\Source\portable\MemMang\heap_3.c">\r
-      <Filter>FreeRTOS Source\Source</Filter>\r
-    </ClCompile>\r
     <ClCompile Include="..\..\Source\portable\MSVC-MingW\port.c">\r
       <Filter>FreeRTOS Source\Source\Portable</Filter>\r
     </ClCompile>\r
     <ClCompile Include="Run-time-stats-utils.c">\r
       <Filter>Demo App Source</Filter>\r
     </ClCompile>\r
+    <ClCompile Include="..\..\Source\portable\MemMang\heap_4.c">\r
+      <Filter>FreeRTOS Source\Source\Portable</Filter>\r
+    </ClCompile>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ClInclude Include="FreeRTOSConfig.h">\r
index 2cc0a9b04e8ccb9b13865b45cab6114dbc4d41da..9b01642337e7ea6b6be1b1bf696f92a8cde8747e 100644 (file)
@@ -96,6 +96,7 @@
 \r
 /* Standard includes. */\r
 #include <stdio.h>\r
+#include <stdlib.h>\r
 \r
 /* Kernel includes. */\r
 #include <FreeRTOS.h>\r
@@ -292,6 +293,7 @@ const unsigned long ulMSToSleep = 15;
 xTaskHandle xIdleTaskHandle, xTimerTaskHandle, xTestTask;\r
 signed char *pcTaskName;\r
 const unsigned char ucConstQueueNumber = 0xaaU, ucConstTaskNumber = 0x55U;\r
+void *pvAllocated;\r
 \r
 /* These three functions are only meant for use by trace code, and not for\r
 direct use from application code, hence their prototypes are not in queue.h. */\r
@@ -386,13 +388,17 @@ extern unsigned portBASE_TYPE uxTaskGetTaskNumber( xTaskHandle xTask );
                        }\r
                }\r
        }\r
+\r
+       /* Exercise heap_4 a bit.  The malloc failed hook will trap failed \r
+       allocations so there is no need to test here. */\r
+       pvAllocated = pvPortMalloc( ( rand() % 100 ) + 1 );\r
+       vPortFree( pvAllocated );\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
 void vApplicationMallocFailedHook( void )\r
 {\r
-       /* Can be implemented if required, but probably not required in this \r
-       environment and running this demo. */\r
+       vAssertCalled();\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r