Hi,
I am using the sample project "frdmk66f_lwip_httpsrv_mbedTLS_httpsrv" to build my application.
It works fine. In my application, there is other task that is using lot of memory from heap. So, when they are together, it stop working after certain time...
It is possible to set up two heaps in different memory section because I have SDRAM, one for http server, other is for other task?
Thanks,
Christie
Hi @a8Chcx ,
maybe this:
https://mcuoneclipse.com/2017/09/18/using-multiple-memory-regions-with-the-freertos-heap/
?
I hope this helps,
Erich
HI Erich,
Thank you. And I have the following questions:
1) I am using heap_3.c for now. I have to get heap_5.c. What is the major difference between hap_3 and heap_5? will it cause any problem on existing project? Where can I get heap_5.c?
2) I want to use the different heap for the different task. Can you tell me if it is possible and how to do it?
Thanks,
Christie
Hi Christie,
1) see https://www.freertos.org/a00111.html. Heap_3 is basically a wrapper around malloc()/free() with thread safety. But I would not recommend using Heap_3 if you are using malloc()/free() from your application in other places. Use Heap_6 for this, see https://mcuoneclipse.com/2017/07/02/using-freertos-with-newlib-and-newlib-nano/
Heap_4 is usually what I would recommend, and Heap_5 is simply the same but with multiple regions.
2) No, you cannot use different heaps for different tasks. I would suggest that you consider using static memory for tasks instead which has been introduced with FreeRTOS v9.0.0, see https://mcuoneclipse.com/2016/05/29/freertos-v9-0-0-with-static-memory-allocation/
I hope this helps,
Erich
NXP had that heap_6 as part of their SDK FreeRTOS, but somehow it is not present any more in the latest SDK (not sure why).
Anyway, I'm using the FreeRTOS from the McuLib (https://github.com/ErichStyger/McuOnEclipseLibrary), see https://github.com/ErichStyger/McuOnEclipseLibrary/tree/master/lib/FreeRTOS/Source/portable/MemMang where you can find heap_useNewlib.c.
You can copy it from there, or use that FreeRTOS port (this is what I do).
I hope this helps,
Erich
Hi Erich,
I am trying to change to heap_4.c for "frdmk66f_lwip_httpsrv_mbedTLS" sample project(Use heap_3.c) and it stop working.
Can you help me to see why it cannot switch to heap_4.c?
Thanks,
Christie