This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

freertos heap_4.c

Hi,

I'm using the mcu_plus_sdk_243x.

In a file C:\ti\mcu_plus_sdk_am243x_08_06_00_43\source\kernel\freertos\FreeRTOS-Kernel\portable\MemMang\heap_4.c 

I found a function inside which  an undefined variable - ucHeap

static void prvHeapInit( void ) /* PRIVILEGED_FUNCTION */
{

/* Ensure the heap starts on a correctly aligned boundary. */
uxAddress = ( size_t ) ucHeap;

}

the linker says  '......./heap_4.c:350: undefined reference to `ucHeap'

What is this variable ?

Which value is better to assign to it ?

Thanks,

Eli

 

  • Hi Eli,

    The ucHeap is defined either by the user application or by freeRTOS in heap_4.c:

    /* Allocate the memory for the heap. */
    #if ( configAPPLICATION_ALLOCATED_HEAP == 1 )

    /* The application writer has already defined the array used for the RTOS
    * heap - probably so it can be placed in a special segment or address. */
    extern uint8_t ucHeap[ configTOTAL_HEAP_SIZE ];
    #else
    PRIVILEGED_DATA static uint8_t ucHeap[ configTOTAL_HEAP_SIZE ];
    #endif /* configAPPLICATION_ALLOCATED_HEAP */

    In MCU+ SDK, configAPPLICATION_ALLOCATED_HEAP is always defined as 0, so ucHeap should be defined in heap_4.c.

    Best regards,

    Ming

  • Hi Ming,

    So I just add  uint8_t ucHeap[ configTOTAL_HEAP_SIZE ]; inside heap_4.c ?

    Thanks,

    Eli

  • Hi Eli,

    Because in MCU+ SDK, configAPPLICATION_ALLOCATED_HEAP is always defined as 0, so ucHeap should be defined in heap_4.c already:

    PRIVILEGED_DATA static uint8_t ucHeap[ configTOTAL_HEAP_SIZE ];

    If you still get "......./heap_4.c:350: undefined reference to `ucHeap", please make sure your configAPPLICATION_ALLOCATED_HEAP is NOT defined as 1.

    Which example are you building when this error occurs?

    Best regards,

    Ming

  • Hi Ming,

    your previous answer was very helpful - it works now !

    Thanks,

    Eli