Can I do something like this:
#ifdef FREERTOS
#define malloc(size) pvPortMalloc(size)
#define free(ptr) pvPortFree(ptr)
#endif
and expect it to always call pvPortMalloc()
instead of malloc()
?
Also, what difference would it make putting this before/after #include <stdlib.h>
?
I have some code that I would like to run both in and out of FreeRTOS, I would like to replace all the calls to malloc()
with calls to pvPortMalloc()
when using FreeRTOS.