Skip to content

Commit

Permalink
Change the memory management on FreeRTOS to heap_4
Browse files Browse the repository at this point in the history
We're migrating from heap_2 to heap_4 to avoid memory fragmentation,
since we're making several alls to pvMalloc() with different sizes.
  • Loading branch information
Henrique Silva committed Sep 30, 2015
1 parent 17a3493 commit 7ac1625
Show file tree
Hide file tree
Showing 3 changed files with 484 additions and 0 deletions.
4 changes: 4 additions & 0 deletions FreeRTOS/heap_2.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
* See heap_1.c, heap_3.c and heap_4.c for alternative implementations, and the
* memory management pages of http://www.FreeRTOS.org for more information.
*/

#include <stdlib.h>

/* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining
Expand All @@ -88,6 +89,8 @@ task.h is included from an application file. */

#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE

#ifdef USE_HEAP_2

/* A few bytes might be lost to byte aligning the heap start address. */
#define configADJUSTED_HEAP_SIZE ( configTOTAL_HEAP_SIZE - portBYTE_ALIGNMENT )

Expand Down Expand Up @@ -301,3 +304,4 @@ uint8_t *pucAlignedHeap;
pxFirstFreeBlock->pxNextFreeBlock = &xEnd;
}
/*-----------------------------------------------------------*/
#endif
Loading

0 comments on commit 7ac1625

Please sign in to comment.