cancel
Showing results for 
Search instead for 
Did you mean: 

Configuration of Stacksize and Heapsize when using CubeMX

Posted on November 22, 2015 at 17:01

In my Stm32F401 based project, I use CubeMX 4.11.0 for generation of initialization code. My IDE & toolchain is SW4STM32.

Within the generated code, there is also the linkerscript STM32F401VCTx_FLASH.ld, which contains:

/* Generate a link error if heap and stack don't fit into RAM */

_Min_Heap_Size = 0x200; /* required amount of heap */

_Min_Stack_Size = 0x400; /* required amount of stack */

Since I'm running FreeRtos with heap_4, I dont need this kind of heap.

And on the other side, I need the min stack size increased to 2k.

For the first, I'd adjusted the values inside of the linkerscript manually, like this:

_Min_Heap_Size = 0;      /* required amount of heap  */

_Min_Stack_Size = 0x800; /* required amount of stack */

and this works as expected.

But unfortunately, each time when I do code regeneration with CubeMX, my changes were lost.

This brings up the question, were to configure these both parameters in CubeMX?

As far as I see, this is a missing feature, isn't it?

Joe.
6 REPLIES 6
Posted on January 02, 2016 at 19:45

Still not provided in CubeMX 4.12.0 ?

Posted on November 23, 2015 at 14:05

Hi Joe,

Thank you for your feedback, this feature is planned for next releases of STM32CubeMx.

-Shahrzad-

Posted on November 25, 2015 at 23:29

After you make your modifications to the .ld file, copy it to a file with another name.  Then point your IDE to the new .ld file and you should not have the problem anymore.  When you regenerate your Cube project it will overwrite the original file, but not your renamed one, which is what your IDE will be using.

Posted on November 26, 2015 at 17:52

That's exactly the way I currently worked around this issue, but hoping for future versions of CubeMX and SW4STM32, that I could decrease the number workarounds when I setup a new project or doing code regeneration ;)

AleksBak
Associate II
Posted on February 14, 2016 at 11:48

Now it is available in 4.13!!! Cool!

Chensie
Associate II
Posted on February 15, 2016 at 09:29

Hello

You can set these values in Project >>Settings... Dialog form: Link settings