使用malloc / free FreeRTOS 1468 x

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
2 posts / 0 new
Last post
ewilson90
Offline
Last seen:3 years 3 months ago
加入:2017-04-26 21:53
使用malloc / free FreeRTOS 1468 x

I am using some C libraries that internally are using malloc/free for dynamic memory. Is it ok to use the standard C malloc/free if I'm running FreeRTOS on the 1468x? Does the compiler automatically link these to the correct implementations, or should I provide an override that maps them to OS_MALLOC/OS_FREE, similar to what RETARGET does for printf? What is Dialog's recommended method?

Thanks.

Keywords:
Device:
MT_dialog
Offline
Last seen:2 months 2 weeks ago
Staff
加入:2015-06-08 11:34
Hi ewilson90,

Hi ewilson90,

As far as i am aware the standard malloc and free function can be used and they will be linked properly, but the problem with the standard functions when operating in a free RTOS enviroment is that those functions are not thread safe and they are not deterministic, and that may cause issues to the system, therefore its not recommended. You should change the malloc that your library is using to the free RTOS method of memory allocation.

Thanks MT_dialog