Skip to main content
st239955_stm1_stmicro_com
Associate III
November 22, 2015
Question

Configuration of Stacksize and Heapsize when using CubeMX

  • November 22, 2015
  • 6 replies
  • 7462 views
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.
    This topic has been closed for replies.

    6 replies

    st239955_stm1_stmicro_com
    Associate III
    January 2, 2015
    Posted on January 02, 2016 at 19:45

    Still not provided in CubeMX 4.12.0 ?

    Nickname5522_O
    Visitor II
    November 23, 2015
    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-

    aaron239955_stm1_st
    Senior
    November 25, 2015
    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.

    st239955_stm1_stmicro_com
    Associate III
    November 26, 2015
    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
    February 14, 2016
    Posted on February 14, 2016 at 11:48

    Now it is available in 4.13!!! Cool!

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

    Hello

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