-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
heap-management: Use C memory management APIs
We shouldn't be allocating heap using C and FreeRTOS heap management APIs as we might end up with both FreeRTOS heap and C heap. This can lead to several unexpected issues. C standard heap functions are used to unify heap allocations as we can't use FreeRTOS heap management APIs because this would require patching lots of file as part of ml-embedded-evaluation-kit library which use C standard heap functions for heap allocations. Heap space is increased by `0x10000` as C standard heap management APIs requires more heap space for the existing FRI applications because it is less optimised than FreeRTOS heap management APIS (heap_4). Signed-off-by: Ahmed Ismail <[email protected]>
- Loading branch information
1 parent
148e59d
commit b5f3193
Showing
10 changed files
with
46 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
components/freertos_kernel/integration/src/heap_management.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* Copyright 2024 Arm Limited and/or its affiliates | ||
* <[email protected]> | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
#include <stdlib.h> | ||
|
||
void * pvPortMalloc( size_t xWantedSize ) | ||
{ | ||
return malloc( xWantedSize ); | ||
} | ||
|
||
void vPortFree( void * pv ) | ||
{ | ||
free( pv ); | ||
} | ||
|
||
void * pvPortCalloc( size_t xNum, | ||
size_t xSize ) | ||
{ | ||
return calloc( xNum, xSize ); | ||
} | ||
|
||
/* These are dummy implementations as C standard library does not provide | ||
* functions to get the statistics of heap memory. These dummy implementation are needed | ||
* as these APIs are used as part of FreeRTOS Plus TCP code which is unused in the FRI code (removed by the linker) | ||
* but ARMClang linker requires all the compiled symbols to be defined. | ||
*/ | ||
size_t xPortGetFreeHeapSize( void ) | ||
{ | ||
return 0; | ||
} | ||
|
||
size_t xPortGetMinimumEverFreeHeapSize( void ) | ||
{ | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
heap-management: Use C memory management APIs. |