\r
void vApplicationIdleHook( void )\r
{\r
-volatile size_t xFreeHeapSpace;\r
-\r
- /* vApplicationIdleHook() will only be called if configUSE_IDLE_HOOK is set \r
- to 1 in FreeRTOSConfig.h. It will be called on each iteration of the idle \r
- task. It is essential that code added to this hook function never attempts \r
- to block in any way (for example, call xQueueReceive() with a block time \r
- specified, or call vTaskDelay()). If the application makes use of the \r
- vTaskDelete() API function (as this demo application does) then it is also \r
- 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
- /* This implementation of vApplicationIdleHook() simply demonstrates how\r
- the xPortGetFreeHeapSize() function can be used. */\r
- xFreeHeapSpace = xPortGetFreeHeapSize();\r
-\r
- if( xFreeHeapSpace > 100 )\r
- {\r
- /* By now, the kernel has allocated everything it is going to, so\r
- if there is a lot of heap remaining unallocated then\r
- the value of configTOTAL_HEAP_SIZE in FreeRTOSConfig.h can be\r
- reduced accordingly. */\r
- }\r
+#ifdef EXAMPLE_CODE_ONLY\r
+\r
+ The following code can only be included if heap_1.c or heap_2.c is used in\r
+ the project. By default, heap_3.c is used, so the example code is\r
+ excluded. See http://www.freertos.org/a00111.html for more information on\r
+ memory management options.\r
+\r
+ volatile size_t xFreeHeapSpace;\r
+\r
+ /* vApplicationIdleHook() will only be called if configUSE_IDLE_HOOK is set\r
+ to 1 in FreeRTOSConfig.h. It will be called on each iteration of the idle\r
+ task. It is essential that code added to this hook function never attempts\r
+ to block in any way (for example, call xQueueReceive() with a block time\r
+ specified, or call vTaskDelay()). If the application makes use of the\r
+ vTaskDelete() API function (as this demo application does) then it is also\r
+ 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
+ /* This implementation of vApplicationIdleHook() simply demonstrates how\r
+ the xPortGetFreeHeapSize() function can be used. */\r
+ xFreeHeapSpace = xPortGetFreeHeapSize();\r
+\r
+ if( xFreeHeapSpace > 100 )\r
+ {\r
+ /* By now, the kernel has allocated everything it is going to, so\r
+ if there is a lot of heap remaining unallocated then\r
+ the value of configTOTAL_HEAP_SIZE in FreeRTOSConfig.h can be\r
+ reduced accordingly. */\r
+ }\r
+#endif\r
}\r
/*-----------------------------------------------------------*/\r
\r