Content originally posted in LPCWare by robertpalmerjr on Fri Oct 02 12:01:56 MST 2015
I am wanting to override malloc and free in my project. I am using freeRTOS and RedLib. RedLib has functions that call malloc (various printf variants, are there others?) I would like my code to override malloc so that when RedLib calls malloc it calls my code which calls the freeRTOS implementation.
In standard gcc, I see that there is a -wrap,object linker flag. That does not appear to work in LPCxpresso. I know if a symbol is WEAK linked, it can be overridden by just defining the symbol in your own code, but it appears that malloc and free are not weak linked.
Is there a way to do this?