STMicroelectronics / x-cube-azrtos-h7

X-CUBE-AZRTOS-H7 (Azure RTOS Software Expansion for STM32Cube) provides a full integration of Microsoft Azure RTOS in the STM32Cube environment for the STM32H7 series of microcontrollers.

Home Page:https://www.st.com/en/embedded-software/x-cube-azrtos-h7.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

newLib heap and ThreadX memory managment

bytesontherocks opened this issue · comments

Hello,

I have some experience with FreeRTOS, and the integration with the newLib heap and the heap mechanism for FreeRTOS was not fully integrated (see http://www.nadler.com/embedded/newlibAndFreeRTOS.html).

In the current ThreadX example I understand that the RAM map looks like that

image

The newLib heap can expand to _estack (ORIGIN(RAM) + LENGTH(RAM)) - _Min_Stack_Size according to the current "_sbrk" implementation that would mean that if you use malloc/new() at any point in your system, you could potentially be overwriting the ThreadX memory pool.

The NewLib heap and the ThreadX allocation are working completely unaware one of an other. If it is up to the user to be aware of that, that should be documented, it can cause quite a lot of problems. Otherwise, are you planing to offer a better integration?

Looking forward to reading your thoughts.

Thanks.

Hi @bytesontherocks,

Thank you for this contribution. Your report will be forwarded to our development teams. I will get back to you as soon as they provide me with their feedback.

With regards,

Hi @bytesontherocks,

Our development teams confirmed your point. However, they said good management of allocations in both NewLib heap and ThreadX memory pool falls on the "shoulders" of the user application.

From our side, we will try to highlight such an important point in our documentation.

Thank you again for having reported this point.

With regards,

ST Internal Reference: 107765