heap_5 choose heap region on allocation

nxsquentin wrote on Wednesday, February 14, 2018:


freeRTOS version: 10.0.0
uC: stm32f217
Compiler IAR 7.60.0 C99

I’m using now the heap_4 with 1 region heap available for the dynamic allocation. I’m using the linker script to define where is the region start address. All is ok with my implementation.

Now I want use heap_5 with the possibility to define several heap region. With this concept all is ok.
My question is about the fact to use this regions.
How to choose on which region we ant to make the allocation ?

I want allocate a “object” A into the region 1 and “object” B into region 2.
How to make this with the unique pvPortMalloc() ?

Thanks in advance,


rtel wrote on Friday, February 16, 2018:

Currently heap_5 doesn’t give you the ability to select the regions - it just uses all the regions as a single heap. Maybe this is something we could add in future - possible as a separate allocation function with an extra parameter.

nxsquentin wrote on Friday, February 16, 2018:

Thanks for the response.
Pity that we doesn’t have this feature. Hope this can be implement in the future.
For the moment I will implement a second heap management from the heap_4 with new functions Malloc() and free().

Thanks again,

heinbali01 wrote on Sunday, February 25, 2018:

Maybe the following solution is not very elegant, but for the time being it could solve your problem:
In one project I had two memories: external SDRAM and fast internal memory. I had heap_4.c manage the SDRAM, and I made a copy of heap_4.c to manage the internal memory.
I adapted vPortFree() to recognise the type of memory and call the proper routine.