From 2f25351ee6b9735a1fccec3d43f04db85354e709 Mon Sep 17 00:00:00 2001 From: richardbarry Date: Wed, 24 Aug 2011 12:38:38 +0000 Subject: [PATCH] Changed the MicroBlaze demo back to using heap_3.c having updated the linker script generation. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1550 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- .../CreateProjectDirectoryStructure.bat | 2 +- .../SDKProjects/RTOSDemoSource/main-blinky.c | 54 +++++++++++-------- .../SDKProjects/RTOSDemoSource/src/lscript.ld | 2 +- 3 files changed, 33 insertions(+), 25 deletions(-) diff --git a/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/CreateProjectDirectoryStructure.bat b/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/CreateProjectDirectoryStructure.bat index cd78c1e89..3ed26c633 100644 --- a/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/CreateProjectDirectoryStructure.bat +++ b/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/CreateProjectDirectoryStructure.bat @@ -68,7 +68,7 @@ IF EXIST FreeRTOS_Source Goto END copy %FREERTOS_SOURCE%\portable\MemMang\heap_3.c FreeRTOS_Source\portable\MemMang REM Copy the basic memory allocation files into the BSP directory - copy %FREERTOS_SOURCE%\portable\MemMang\heap_2.c %BSP_SOURCE%\portable\MemMang + copy %FREERTOS_SOURCE%\portable\MemMang\heap_3.c %BSP_SOURCE%\portable\MemMang REM Copy the files that define the common demo tasks. copy %COMMON_SOURCE%\dynamic.c Demo_Source diff --git a/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/main-blinky.c b/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/main-blinky.c index 73af0591f..1f04da041 100644 --- a/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/main-blinky.c +++ b/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/main-blinky.c @@ -422,29 +422,37 @@ void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName void vApplicationIdleHook( void ) { -volatile size_t xFreeHeapSpace; - - /* vApplicationIdleHook() will only be called if configUSE_IDLE_HOOK is set - to 1 in FreeRTOSConfig.h. It will be called on each iteration of the idle - task. It is essential that code added to this hook function never attempts - to block in any way (for example, call xQueueReceive() with a block time - specified, or call vTaskDelay()). If the application makes use of the - vTaskDelete() API function (as this demo application does) then it is also - important that vApplicationIdleHook() is permitted to return to its calling - function, because it is the responsibility of the idle task to clean up - memory allocated by the kernel to any task that has since been deleted. */ - - /* This implementation of vApplicationIdleHook() simply demonstrates how - the xPortGetFreeHeapSize() function can be used. */ - xFreeHeapSpace = xPortGetFreeHeapSize(); - - if( xFreeHeapSpace > 100 ) - { - /* By now, the kernel has allocated everything it is going to, so - if there is a lot of heap remaining unallocated then - the value of configTOTAL_HEAP_SIZE in FreeRTOSConfig.h can be - reduced accordingly. */ - } +#ifdef EXAMPLE_CODE_ONLY + + The following code can only be included if heap_1.c or heap_2.c is used in + the project. By default, heap_3.c is used, so the example code is + excluded. See http://www.freertos.org/a00111.html for more information on + memory management options. + + volatile size_t xFreeHeapSpace; + + /* vApplicationIdleHook() will only be called if configUSE_IDLE_HOOK is set + to 1 in FreeRTOSConfig.h. It will be called on each iteration of the idle + task. It is essential that code added to this hook function never attempts + to block in any way (for example, call xQueueReceive() with a block time + specified, or call vTaskDelay()). If the application makes use of the + vTaskDelete() API function (as this demo application does) then it is also + important that vApplicationIdleHook() is permitted to return to its calling + function, because it is the responsibility of the idle task to clean up + memory allocated by the kernel to any task that has since been deleted. */ + + /* This implementation of vApplicationIdleHook() simply demonstrates how + the xPortGetFreeHeapSize() function can be used. */ + xFreeHeapSpace = xPortGetFreeHeapSize(); + + if( xFreeHeapSpace > 100 ) + { + /* By now, the kernel has allocated everything it is going to, so + if there is a lot of heap remaining unallocated then + the value of configTOTAL_HEAP_SIZE in FreeRTOSConfig.h can be + reduced accordingly. */ + } +#endif } /*-----------------------------------------------------------*/ diff --git a/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/src/lscript.ld b/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/src/lscript.ld index c076755fb..76fb76b28 100644 --- a/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/src/lscript.ld +++ b/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/src/lscript.ld @@ -11,7 +11,7 @@ /*******************************************************************/ _STACK_SIZE = DEFINED(_STACK_SIZE) ? _STACK_SIZE : 0x400; -_HEAP_SIZE = DEFINED(_HEAP_SIZE) ? _HEAP_SIZE : 0x8; +_HEAP_SIZE = DEFINED(_HEAP_SIZE) ? _HEAP_SIZE : 0x10400; /* Define Memories in the system */ -- 2.39.5