As Richard mentioned there are a few more functions to wrap to completely replace the newlib heap with e.g. FreeRTOS heap_4.
You need to override/wrap these heap API functions: malloc_r
, free_r
, calloc_r
and realloc_r
.
But ask yourself if it’s worth the effort if you’re fine with the newlib heap. Adding just the lock/unlock hooks is much easier.
With regard to printf see this post for an alternative implementation you can tailor/adopt by modifying the source.