I was wondering if FreeRTOS is compatible with C++ STL (containers such as list, vector). FreeRTOS tasks use thread safe allocators, however STLs use simple malloc, and free functions. Is there anyway to make this work?
If you can redirect the compiler to a different malloc and free implementation (common with compilers, check the command options) then use heap_3.c and redirect malloc() to pvPortMalloc() and free() to vPortFree(). That will take care of the memory allocation, not sure about the rest.
Thank you MEdwards. I am using Kinetis Design Studio which is an Eclipse based IDE and I was able to enable multiple definitions in the compiler by adding the following flag to the C/C++ linker:
-z muldefs
This allowed me to override the malloc and free functions for FreeRTOS and solved the problem. This can be done in the main.c file:
Maybe just where you have types the code in here, but note the prototype of the malloc() function you posted is not correct. It needs to return a void *, not just a void. I imagine this is correct in your real code otherwise the compiler would complain.