@@ -444,7 +444,6 @@ void * pvPortCalloc( size_t xNum,
444444static void prvHeapInit ( void ) /* PRIVILEGED_FUNCTION */
445445{
446446 BlockLink_t * pxFirstFreeBlock ;
447- void * pvAlignedHeap ;
448447 portPOINTER_SIZE_TYPE uxAddress ;
449448 size_t xTotalHeapSize = configTOTAL_HEAP_SIZE ;
450449
@@ -458,7 +457,6 @@ static void prvHeapInit( void ) /* PRIVILEGED_FUNCTION */
458457 xTotalHeapSize -= ( size_t ) ( uxAddress - ( portPOINTER_SIZE_TYPE ) ucHeap );
459458 }
460459
461- pvAlignedHeap = ( uint8_t * ) uxAddress ;
462460
463461 #if ( configENABLE_HEAP_PROTECTOR == 1 )
464462 {
@@ -468,12 +466,12 @@ static void prvHeapInit( void ) /* PRIVILEGED_FUNCTION */
468466
469467 /* xStart is used to hold a pointer to the first item in the list of free
470468 * blocks. The void cast is used to prevent compiler warnings. */
471- xStart .pxNextFreeBlock = ( void * ) heapPROTECT_BLOCK_POINTER ( pvAlignedHeap );
469+ xStart .pxNextFreeBlock = ( void * ) heapPROTECT_BLOCK_POINTER ( uxAddress );
472470 xStart .xBlockSize = ( size_t ) 0 ;
473471
474472 /* pxEnd is used to mark the end of the list of free blocks and is inserted
475473 * at the end of the heap space. */
476- uxAddress = ( portPOINTER_SIZE_TYPE ) ( ( ( uint8_t * ) pvAlignedHeap ) + xTotalHeapSize );
474+ uxAddress = ( portPOINTER_SIZE_TYPE ) ( uxAddress + xTotalHeapSize );
477475 uxAddress -= ( portPOINTER_SIZE_TYPE ) xHeapStructSize ;
478476 uxAddress &= ~( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK );
479477 pxEnd = ( BlockLink_t * ) uxAddress ;
@@ -482,7 +480,7 @@ static void prvHeapInit( void ) /* PRIVILEGED_FUNCTION */
482480
483481 /* To start with there is a single free block that is sized to take up the
484482 * entire heap space, minus the space taken by pxEnd. */
485- pxFirstFreeBlock = ( BlockLink_t * ) pvAlignedHeap ;
483+ pxFirstFreeBlock = ( BlockLink_t * ) uxAddress ;
486484 pxFirstFreeBlock -> xBlockSize = ( size_t ) ( uxAddress - ( portPOINTER_SIZE_TYPE ) pxFirstFreeBlock );
487485 pxFirstFreeBlock -> pxNextFreeBlock = heapPROTECT_BLOCK_POINTER ( pxEnd );
488486
0 commit comments