Using heap_5.c

miraekim wrote on Tuesday, July 18, 2017:

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?

    const HeapRegion_t xHeapRegions[] =
    {
    { ( uint8_t * ) 0x1C00, 0x0400 }, // to use SRAM
    { ( uint8_t * ) 0x4400, 0x0400 }, // to use FRAM
    { NULL, 0 } /* Terminates the array. */
    };

    /* Pass the array into vPortDefineHeapRegions(). */
    vPortDefineHeapRegions( xHeapRegions );

  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 };

rtel wrote on Tuesday, July 18, 2017:

The answers to these questions are here:
http://www.freertos.org/a00111.html#heap_5

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

No.