Squeeze all SRAM memory into FreeRTOS heap

Hi All, 

I'm using Keil5 developing application on a Cortex-M0 platform with FreeRTOS example.

In FreeRTOS, there is a global buffer ucHeap[] doing the memory dynamic allocation and free, it also used as the heap for OS tasks stack.

I want to define the size of ucHeap as bigger as it can, until use up the whole SRAM memory.

So I want to realize a function in Keil5 to change the size of ucHeap everything time based on other RW/ZI usage.

For example, 

i)The total SRAM is 20KB, other RW/ZI/STACK usage is already 10KB, the Keil5 can allocate 20-10=10KB for the ucHeap.

ii)The total SRAM is 20KB, other RW/ZI/STACK usage is already 8KB, the Keil5 can allocate 20-8=12KB for the ucHeap.

Currently I manually change the size of ucHeap everytime to use up the whole SRAM. I would like to have method to achieve this function automatically.

Thanks.

Best Regards. 

More questions in this forum