about FreeRTOS heap

Showing results for 
Search instead for 
Did you mean: 

about FreeRTOS heap

Contributor III

Dear expert

I develop S32K144 with FreeRTOS V10.1.1the SDK version is RTM_3_0_0. 

I describe my question in detail with the attachment.

Could you kindly help me again?

Labels (1)
Tags (2)
0 Kudos
1 Reply

NXP TechSupport
NXP TechSupport


1, when FreeRTOS is used, how to set the address of ucHeap[]?

In the FreeRTOS processor expert view, you need to click in the Application allocated heap option if you want to select where the ucHeap will be allocated. And you will need to add a line like the next one to place in some certain section in the linker file, the custom section is already defined in the linker file but you can define a new one:


uint8_t __attribute__ ((section (".customSection"))) ucHeap[configTOTAL_HEAP_SIZE];


  /* Custom Section Block that can be used to place data at absolute address. */
  /* Use __attribute__((section (".customSection"))) to place data here. */
  .customSectionBlock  ORIGIN(m_data_2) : AT(__CUSTOM_ROM)
    __customSection_start__ = .;
    KEEP(*(.customSection))  /* Keep section even if not referenced. */
    __customSection_end__ = .;
  } > m_data_2
  __CUSTOM_END = __CUSTOM_ROM + (__customSection_end__ - __customSection_start__);

If you check the following image, it shows the total heap size and the map file and where this the ucHeap is allocated:


2, In linker file, m_data_2 is set as heap space, but because freeRTOS does not use the linker file(*.ld), does it means m_data_2 section becomes to leave unused section?

If the Application allocated heap option is not used, the ucHeap will be placed in the BSS section that is placed in the m_data_2.


3,HeapSize in FreeRTOS is set as 16KB, but the project cannot run normally for memory is not enough, what may be the reason?

After setting the memory at 16 KB I can configure two tasks with 1000 size and an extra timer, maybe the memory needs it for your program is not enough.

Let me know your findings.

Best Regards,

Alexis Andalon

0 Kudos