Skip to main content
Hobbyist
Associate II
December 24, 2019
Question

FreeRTOS heap size adjustment in stm32CubeMX

  • December 24, 2019
  • 2 replies
  • 3416 views

I am using stm32cubeIDE for FreeRTOS on stm32f429. As cubemx has option to adjust heap and stack size on generating code in "Project Manager" project tab. While FreeRTOS has also column of heap adjustment in config parameter in cubeMX.

Question:

  1. From where FreeRTOS take heap size as per defined in code generation project tab or column in config parameter?
  2. should i need to adjust both code generation or config parameter column?

Please anyone suggest to best way to avoid any heap/stack overflow.

Thanks to all

This topic has been closed for replies.

2 replies

Pavel A.
December 25, 2019

There are two independent heaps:

  1. in "Project Manager" project tab you define size of the C library heap (malloc/free).
  2. In FreeRTOS parameters you define the size of FreeRTOS own heap.

FreeRTOS has also an option to use the C (malloc) as its heap, in this case there is only one heap and FreeRTOS size parameter is not used.

Start from reading this discussion:

https://community.st.com/s/question/0D50X0000BB1eL7SQJ/bug-cubemx-freertos-projects-corrupt-memory

-- pa

T J
Senior III
December 25, 2019

You can manually change the heap size in the flash programming file.. stm32F742AG.lds for example...