@@ -444,17 +444,17 @@ void * pvPortCalloc( size_t xNum,
444
444
static void prvHeapInit ( void ) /* PRIVILEGED_FUNCTION */
445
445
{
446
446
BlockLink_t * pxFirstFreeBlock ;
447
- portPOINTER_SIZE_TYPE uxAddress ;
447
+ portPOINTER_SIZE_TYPE uxStartAddress , uxEndAddress ;
448
448
size_t xTotalHeapSize = configTOTAL_HEAP_SIZE ;
449
449
450
450
/* Ensure the heap starts on a correctly aligned boundary. */
451
- uxAddress = ( portPOINTER_SIZE_TYPE ) ucHeap ;
451
+ uxStartAddress = ( portPOINTER_SIZE_TYPE ) ucHeap ;
452
452
453
- if ( ( uxAddress & portBYTE_ALIGNMENT_MASK ) != 0 )
453
+ if ( ( uxStartAddress & portBYTE_ALIGNMENT_MASK ) != 0 )
454
454
{
455
- uxAddress += ( portBYTE_ALIGNMENT - 1 );
456
- uxAddress &= ~( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK );
457
- xTotalHeapSize -= ( size_t ) ( uxAddress - ( portPOINTER_SIZE_TYPE ) ucHeap );
455
+ uxStartAddress += ( portBYTE_ALIGNMENT - 1 );
456
+ uxStartAddress &= ~( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK );
457
+ xTotalHeapSize -= ( size_t ) ( uxStartAddress - ( portPOINTER_SIZE_TYPE ) ucHeap );
458
458
}
459
459
460
460
#if ( configENABLE_HEAP_PROTECTOR == 1 )
@@ -465,22 +465,22 @@ static void prvHeapInit( void ) /* PRIVILEGED_FUNCTION */
465
465
466
466
/* xStart is used to hold a pointer to the first item in the list of free
467
467
* blocks. The void cast is used to prevent compiler warnings. */
468
- xStart .pxNextFreeBlock = ( void * ) heapPROTECT_BLOCK_POINTER ( uxAddress );
468
+ xStart .pxNextFreeBlock = ( void * ) heapPROTECT_BLOCK_POINTER ( uxStartAddress );
469
469
xStart .xBlockSize = ( size_t ) 0 ;
470
470
471
471
/* pxEnd is used to mark the end of the list of free blocks and is inserted
472
472
* at the end of the heap space. */
473
- uxAddress = ( portPOINTER_SIZE_TYPE ) ( uxAddress + xTotalHeapSize ) ;
474
- uxAddress -= ( portPOINTER_SIZE_TYPE ) xHeapStructSize ;
475
- uxAddress &= ~( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK );
476
- pxEnd = ( BlockLink_t * ) uxAddress ;
473
+ uxEndAddress = uxStartAddress + ( portPOINTER_SIZE_TYPE ) xTotalHeapSize ;
474
+ uxEndAddress -= ( portPOINTER_SIZE_TYPE ) xHeapStructSize ;
475
+ uxEndAddress &= ~( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK );
476
+ pxEnd = ( BlockLink_t * ) uxEndAddress ;
477
477
pxEnd -> xBlockSize = 0 ;
478
478
pxEnd -> pxNextFreeBlock = heapPROTECT_BLOCK_POINTER ( NULL );
479
479
480
480
/* To start with there is a single free block that is sized to take up the
481
481
* entire heap space, minus the space taken by pxEnd. */
482
- pxFirstFreeBlock = ( BlockLink_t * ) uxAddress ;
483
- pxFirstFreeBlock -> xBlockSize = ( size_t ) ( uxAddress - ( portPOINTER_SIZE_TYPE ) pxFirstFreeBlock );
482
+ pxFirstFreeBlock = ( BlockLink_t * ) uxStartAddress ;
483
+ pxFirstFreeBlock -> xBlockSize = ( size_t ) ( uxEndAddress - ( portPOINTER_SIZE_TYPE ) pxFirstFreeBlock );
484
484
pxFirstFreeBlock -> pxNextFreeBlock = heapPROTECT_BLOCK_POINTER ( pxEnd );
485
485
486
486
/* Only one block exists - and it covers the entire usable heap space. */
0 commit comments