This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2650MODA: How to configure the size of stack+peak? How to adjust it?

Part Number: CC2650MODA

Hi team,

The system stack overflow error occurs: adjusting the stack size through ble_app.cfg, the heap size changes. For example, when the stack size becomes larger, the heap size becomes smaller, which totally is 2307.

Thanks!

Best Regards,

Cherry

  • Hi Cherry,

    At link time, the toolchain is configured to allocate all the remaining RAM as heap. Hence the behavior you are seeing.

    This behavior can be modified however I do NOT recommend to do this and this will NOT lead to have a larger heap.

    I hope this will help,

    Best regards,

  • Hi,

    Thanks!

    And there are some follow-up questions:

    At link time, the toolchain is configured to allocate all the remaining RAM as heap. Hence the behavior you are seeing.

    The heap size will be set to 0 because of this kind of setting, is it right?

    which totally is 2307

    How to set the stack value, is it right to set just as the following figure show? The customer has calculated 2307, but it shows 256.

    And customer has adjusted the heap size and stack size, 0x800. And there is no change after checking the map.

    How is this setting reflected in the program?

    Thanks!

    Regards,

    Cherry

  • Hi,

    The heap size will be set to 0 because of this kind of setting, is it right?

    It could but, in this case it won't work at all.

    How to set the stack value, is it right to set just as the following figure show?

    I guess the following thread will help you.

    Best regards,

  • Hi,

    Thanks for your patient reply!

    The customer are still confusing about following info:

    It could but, in this case it won't work at all.

    There is a definition: HEAPMGR_size=0 in the engineering precompilation. Is the heap size dynamic because of this setting? The heap+stack size is fixed, so the heap size changes as the stack size is adjusted via ble_app.cfg.

    And the customer does intends to know is it possible to set the size of heap+stac and how to set it.

    I guess the following thread will help you.

    And for the link you given, if the system stack and heap size can be set through the interface, the size of heap+stack can be set as much as I can, is that right?

    Thanks!

    Best Regards,

    Cherry

  • Hi,

    There is a definition: HEAPMGR_size=0 in the engineering precompilation. Is the heap size dynamic because of this setting? The heap+stack size is fixed, so the heap size changes as the stack size is adjusted via ble_app.cfg.

    To be clear, I was saying "allocating 0 bytes to the heap will lead to issues".
    Now, if we are talking about the symbol HEAPMGR_SIZE in the .cfg file, then you are correct: "HEAPMGR_SIZE value of  zero (0) autosizes the heap to a size equal to the amount of available free RAM not allocated by the linker. By default,the simple_peripheral project uses the autosize feature." (cf. https://www.ti.com/lit/swru393 §3.11.14)

    And the customer does intends to know is it possible to set the size of heap+stac and how to set it.

    This value corresponds to the maximum available RAM. The only way to change it is to change the device.

    And for the link you given, if the system stack and heap size can be set through the interface, the size of heap+stack can be set as much as I can, is that right?

    I recommend to use the method shown in the link. I guess the .cfg overwrites some settings set through the GUI.

    Best regards, 

  • Hi,

    Thanks for your patient reply!

    And the customer finds there is still space left for the sram display of the map file, could you please help to check this? Thanks.

    This value corresponds to the maximum available RAM. The only way to change it is to change the device.

    Best Regards,

    Cherry

  • Hi,

    May I know is there any updates about the latest question?

    Thanks!

    Best Regards,

    Cherry

  • Hi,

    The heap is allocated on the remaining RAM. It may not appear in the map file.

    You can review the linker command file (.cmd) for more details on the way RAM is allocated.

    Best regards,