Skip to content

Commit d687545

Browse files
committed
Omit configTOTAL_HEAP_SIZE with Application Allocated Heap
See FreeRTOS#347
1 parent 9c048e0 commit d687545

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

portable/MemMang/heap_1.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656

5757
/* The application writer has already defined the array used for the RTOS
5858
* heap - probably so it can be placed in a special segment or address. */
59-
extern uint8_t ucHeap[ configTOTAL_HEAP_SIZE ];
59+
extern uint8_t ucHeap[ ];
6060
#else
6161
static uint8_t ucHeap[ configTOTAL_HEAP_SIZE ];
6262
#endif /* configAPPLICATION_ALLOCATED_HEAP */
@@ -80,8 +80,8 @@ void * pvPortMalloc( size_t xWantedSize )
8080
if ( (xWantedSize + ( portBYTE_ALIGNMENT - ( xWantedSize & portBYTE_ALIGNMENT_MASK ) )) > xWantedSize )
8181
{
8282
xWantedSize += ( portBYTE_ALIGNMENT - ( xWantedSize & portBYTE_ALIGNMENT_MASK ) );
83-
}
84-
else
83+
}
84+
else
8585
{
8686
xWantedSize = 0;
8787
}

portable/MemMang/heap_2.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ static void prvHeapInit( void );
6262

6363
/* The application writer has already defined the array used for the RTOS
6464
* heap - probably so it can be placed in a special segment or address. */
65-
extern uint8_t ucHeap[ configTOTAL_HEAP_SIZE ];
65+
extern uint8_t ucHeap[ ];
6666
#else
6767
static uint8_t ucHeap[ configTOTAL_HEAP_SIZE ];
6868
#endif /* configAPPLICATION_ALLOCATED_HEAP */
@@ -133,13 +133,13 @@ void * pvPortMalloc( size_t xWantedSize )
133133

134134
/* The wanted size must be increased so it can contain a BlockLink_t
135135
* structure in addition to the requested amount of bytes. */
136-
if( ( xWantedSize > 0 ) &&
136+
if( ( xWantedSize > 0 ) &&
137137
( ( xWantedSize + heapSTRUCT_SIZE ) > xWantedSize ) ) /* Overflow check */
138138
{
139139
xWantedSize += heapSTRUCT_SIZE;
140140

141141
/* Byte alignment required. Check for overflow. */
142-
if( ( xWantedSize + ( portBYTE_ALIGNMENT - ( xWantedSize & portBYTE_ALIGNMENT_MASK ) ) )
142+
if( ( xWantedSize + ( portBYTE_ALIGNMENT - ( xWantedSize & portBYTE_ALIGNMENT_MASK ) ) )
143143
> xWantedSize )
144144
{
145145
xWantedSize += ( portBYTE_ALIGNMENT - ( xWantedSize & portBYTE_ALIGNMENT_MASK ) );
@@ -148,11 +148,11 @@ void * pvPortMalloc( size_t xWantedSize )
148148
else
149149
{
150150
xWantedSize = 0;
151-
}
151+
}
152152
}
153-
else
153+
else
154154
{
155-
xWantedSize = 0;
155+
xWantedSize = 0;
156156
}
157157

158158

portable/MemMang/heap_4.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959

6060
/* The application writer has already defined the array used for the RTOS
6161
* heap - probably so it can be placed in a special segment or address. */
62-
extern uint8_t ucHeap[ configTOTAL_HEAP_SIZE ];
62+
extern uint8_t ucHeap[ ];
6363
#else
6464
PRIVILEGED_DATA static uint8_t ucHeap[ configTOTAL_HEAP_SIZE ];
6565
#endif /* configAPPLICATION_ALLOCATED_HEAP */
@@ -138,7 +138,7 @@ void * pvPortMalloc( size_t xWantedSize )
138138
{
139139
/* The wanted size must be increased so it can contain a BlockLink_t
140140
* structure in addition to the requested amount of bytes. */
141-
if( ( xWantedSize > 0 ) &&
141+
if( ( xWantedSize > 0 ) &&
142142
( ( xWantedSize + xHeapStructSize ) > xWantedSize ) ) /* Overflow check */
143143
{
144144
xWantedSize += xHeapStructSize;
@@ -147,7 +147,7 @@ void * pvPortMalloc( size_t xWantedSize )
147147
if( ( xWantedSize & portBYTE_ALIGNMENT_MASK ) != 0x00 )
148148
{
149149
/* Byte alignment required. Check for overflow. */
150-
if( ( xWantedSize + ( portBYTE_ALIGNMENT - ( xWantedSize & portBYTE_ALIGNMENT_MASK ) ) )
150+
if( ( xWantedSize + ( portBYTE_ALIGNMENT - ( xWantedSize & portBYTE_ALIGNMENT_MASK ) ) )
151151
> xWantedSize )
152152
{
153153
xWantedSize += ( portBYTE_ALIGNMENT - ( xWantedSize & portBYTE_ALIGNMENT_MASK ) );
@@ -156,14 +156,14 @@ void * pvPortMalloc( size_t xWantedSize )
156156
else
157157
{
158158
xWantedSize = 0;
159-
}
159+
}
160160
}
161161
else
162162
{
163163
mtCOVERAGE_TEST_MARKER();
164164
}
165-
}
166-
else
165+
}
166+
else
167167
{
168168
xWantedSize = 0;
169169
}

0 commit comments

Comments
 (0)