# Using heap\_5.c

**URL:** <https://forums.freertos.org/t/using-heap-5-c/6688>\
**Category:** Kernel\
**Created:** [July 18, 2017, 6:08am UTC](https://forums.freertos.org/t/using-heap-5-c/6688 "2017-07-18T06:08:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [July 18, 2017, 6:08am UTC](https://forums.freertos.org/t/using-heap-5-c/6688/1 "2017-07-18T06:08:55Z")

</div>

**[miraekim](https://sourceforge.net/u/miraekim/)** wrote on [Tuesday, July 18, 2017](https://sourceforge.net/p/freertos/discussion/382005/thread/d1dfe891/#fe63):

I ported FreeRTOS in TI MSP430FR5969 board.  
The memory composition of this board are both SRAM and FRAM.  
The adress space is like below.

SRAM origin : 0x1C00, length = 0x0800  
FRAM : origin = 0x4400, length = 0xBB80  
FRAM2 : origin = 0x10000,length = 0x4000

I would like to allocate heap to these memory location.  
For example, When I create 4 tasks, I would like to allocate 2 of task stack to SRAM and the others to FRAM.  
So my questions are,

1. Is it right that I can use heap\_5.c to allocate heap to non-contagious memory region?

2. when I initialize heap regions to use heap\_5.c, is it also right that I can write the code like below?

3. Should configAPPLICATION\_ALLOCATED\_HEAP to be defined 1 to use heap\_5.c ?

4. If I use heap\_5.c, Do I still need the code in main.c?

###### #ifdef ICC430

###### persistent /\* IAR version. \*/

###### #else

###### #pragma PERSISTENT( ucHeap ) /\* CCS version. \*/

###### #endif

###### uint8\_t ucHeap[configTOTAL\_HEAP\_SIZE] = { 0 };

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [July 18, 2017, 2:27pm UTC](https://forums.freertos.org/t/using-heap-5-c/6688/2 "2017-07-18T14:27:41Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Tuesday, July 18, 2017](https://sourceforge.net/p/freertos/discussion/382005/thread/d1dfe891/#fe63/1445):

> 1. 
> 2.

The answers to these questions are here:

> **[FreeRTOS - Memory management options for the FreeRTOS small footprint,...](https://www.freertos.org/a00111.html#heap_5)**
>
> Describes the memory management options in the FreeRTOS small footprint real time kernel. FreeRTOS is a portable, open source, mini Real Time kernel. A free RTOS for small embedded systems

> 1. 
> 
> ```
> Should configAPPLICATION_ALLOCATED_HEAP to be defined 1 to use
> heap_5.c ?
> 
> ```

No.
