by ChuckMcM · 9y ago · 0 comments
For the larger parts there is also a perfectly functional memory allocator in newlib. So you can "go wild" if you want, although as the author points out, newlib is not without its race conditions for multi-threaded code.
When you set up FreeRTOS you configure which heap implementation it uses. They provide a number of heapX.c files you can choose between. heap3.c uses malloc directly for instance, the others use built-in implementations of a heap algorithm of varying complexity.
If you want to use your own allocator, you just write your own heapX.c file. Use the malloc one as a template and call the newlib allocator instead of malloc. Link that in instead of any other heapX file and voila, FreeRTOS is using newlib to allocate memory.