- Descriptions of the various FreeRTOS-supported heaps can be found here. Heap4 aims to provide a small, threadsafe implementation of malloc/free functions. Newlib (and newlib-nano) provides a minimal-size library which includes malloc/free functions. Newlib includes additional functions that the FreeRTOS heap will not.
- The FreeRTOS supported heaps should be the most easy to integrate with a FreeRTOS solution on an embedded device.
- I don’t know all of what newlib offers but I believe this solution would be preferred if you needed many of the functions newlib provides. I was unable to find an exact API list in a quick search but you may find it on https://sourceware.org/newlib/docs.html.
- This is up to you to choose as the application developer. Newlib is popular which is why it has a configuration macro as mentioned here. I cannot say if it is more popular than a FreeRTOS-supported heap.
It might be possible to override newlib to use thepvPortMalloc
,vPortFree
, etc. APIs. This might allow you to use newlib functions which call the FreeRTOS heap under the hood.
Looks like its actually recommended NOT to use a FreeRTOS heap with newlib. See newlib and FreeRTOS
1 Like