]> git.sur5r.net Git - freertos/blobdiff - Source/portable/MemMang/heap_2.c
Add proper 8 byte alignment support.
[freertos] / Source / portable / MemMang / heap_2.c
index 1dfd66529933071d048ea65491bfdd57c209fcec..4cd92b064b6f2a98846f55e30d57a4b82a21d7e1 100644 (file)
 alignment without using any non-portable code. */\r
 static union xRTOS_HEAP\r
 {\r
-       volatile unsigned portLONG ulDummy;\r
+       #if portBYTE_ALIGNMENT == 8\r
+               volatile portDOUBLE dDummy;\r
+       #else\r
+               volatile unsigned portLONG ulDummy;\r
+       #endif  \r
        unsigned portCHAR ucHeap[ configTOTAL_HEAP_SIZE ];\r
 } xHeap;\r
 \r
@@ -101,7 +105,7 @@ typedef struct A_BLOCK_LINK
 } xBlockLink;\r
 \r
 \r
-static const unsigned portSHORT  heapSTRUCT_SIZE       = ( sizeof( xBlockLink ) + ( sizeof( xBlockLink ) % portBYTE_ALIGNMENT ) );\r
+static const unsigned portSHORT  heapSTRUCT_SIZE       = ( sizeof( xBlockLink ) + portBYTE_ALIGNMENT - ( sizeof( xBlockLink ) % portBYTE_ALIGNMENT ) );\r
 #define heapMINIMUM_BLOCK_SIZE ( ( size_t ) ( heapSTRUCT_SIZE * 2 ) )\r
 \r
 /* Create a couple of list links to mark the start and end of the list. */\r