What's the best way to redefine malloc Et Al. functions for FreeRTOS ?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

What's the best way to redefine malloc Et Al. functions for FreeRTOS ?

1,522 Views
i_kamal
Contributor III

Hi,

We have C++ projects, using Newlib, and noticed that internal functions of newlib (like printf() ) call malloc (and other functions of the same family like malloc_r, etc.).

This is problematic for many reasons that are obvious and I'm not going to list here.

We would like to redefine all memory allocation function to use FreeRTOS memory allocation function like pvPortMalloc.

Is there an exhaustive list of functions that need to be re-implemented and example implemnetation for FreeRTOS?

Or should i just do it myself and reeimplement all these functions ? (although I'm not sure i fully understand all of them, like malloc_r() for example)

I feel like it's a known problem, and i wouldn't want to reinvent the wheel.

Any advice would be greatly apreciated.

Labels (1)
2 Replies

1,459 Views
ErichStyger
Senior Contributor V

I recommend you have a look at newlib and FreeRTOS 

and Using FreeRTOS with newlib and newlib-nano | MCU on Eclipse 

Check out as well the latest SDK v2.8 which includes that heap_useNewlib.c too.

I hope this helps,

Erich

1,459 Views
i_kamal
Contributor III

Thanks Erich,

That's interesting.  I'll have look, do some tests and share my results :smileyhappy:

0 Kudos