]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Source/portable/MemMang/heap_1.c
FreeRTOS source changes:
[freertos] / FreeRTOS / Source / portable / MemMang / heap_1.c
index aeca28735c9913d0418a62cf69f9ae731a2294c9..bd98d5409eb2abb29727164e64fad1b747cd014a 100644 (file)
@@ -91,7 +91,15 @@ task.h is included from an application file. */
 #define configADJUSTED_HEAP_SIZE       ( configTOTAL_HEAP_SIZE - portBYTE_ALIGNMENT )\r
 \r
 /* Allocate the memory for the heap. */\r
-static uint8_t ucHeap[ configTOTAL_HEAP_SIZE ];\r
+/* Allocate the memory for the heap. */\r
+#if( configAPPLICATION_ALLOCATED_HEAP == 1 )\r
+       /* The application writer has already defined the array used for the RTOS\r
+       heap - probably so it can be placed in a special segment or address. */\r
+       extern uint8_t ucHeap[ configTOTAL_HEAP_SIZE ];\r
+#else\r
+       static uint8_t ucHeap[ configTOTAL_HEAP_SIZE ];\r
+#endif /* configAPPLICATION_ALLOCATED_HEAP */\r
+\r
 static size_t xNextFreeByte = ( size_t ) 0;\r
 \r
 /*-----------------------------------------------------------*/\r
@@ -102,12 +110,14 @@ void *pvReturn = NULL;
 static uint8_t *pucAlignedHeap = NULL;\r
 \r
        /* Ensure that blocks are always aligned to the required number of bytes. */\r
-       #if portBYTE_ALIGNMENT != 1\r
+       #if( portBYTE_ALIGNMENT != 1 )\r
+       {\r
                if( xWantedSize & portBYTE_ALIGNMENT_MASK )\r
                {\r
                        /* Byte alignment required. */\r
                        xWantedSize += ( portBYTE_ALIGNMENT - ( xWantedSize & portBYTE_ALIGNMENT_MASK ) );\r
                }\r
+       }\r
        #endif\r
 \r
        vTaskSuspendAll();\r