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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

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

1,797 次查看
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.

标签 (1)
2 回复数

1,734 次查看
ErichStyger
Specialist I

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,734 次查看
i_kamal
Contributor III

Thanks Erich,

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

0 项奖励
回复