cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 4 MCU

EyGe_3183606
New Contributor II

Hi,

My team and I are trying to decrease the heap and stack sizes of the bootloadable but it doesn't seem to work. We have a PSOC 4 MCU and are using PSOC Creator 4.2.

We encountered this forum discussion: Bug - Stack/heap sizes in cm0gcc.ld file for BLE OTA do not change with .cydwr entries? - here cypress confirms that there is a bug and that it is not possible to change the heap and stack sizes from within PSOC Creator in the case of bootloader projects and that they should be changed manually within the linker files.

That's OK, except that my team and I are not sure exactly what we need to change in the linker files and what files are they exactly.

Could you please provide some more detailed explanation as to how to do this manually?

Thanks,

David

0 Likes
1 Solution
GeonaP_26
Moderator
Moderator

For customization Fixed Stack OTA bootloader project use custom linker scripts. The location of custom linker script is added as part of Project > Build Settings > Linker > Custom Linker Script. Please update size values in following lines of code in custom linker script to modify heap and stack sizes.

PROVIDE(__cy_heap_end = __cy_stack - 0x0800);

    .heap (NOLOAD) :

    {

      . = _end;

      . += 0x80;

      __cy_heap_limit = .;

    } >ram

    .stack (__cy_stack - 0x0800) (NOLOAD) :

    {

      __cy_stack_limit = .;

      . += 0x0800;

    } >ram

View solution in original post

5 Replies
GeonaP_26
Moderator
Moderator

For customization Fixed Stack OTA bootloader project use custom linker scripts. The location of custom linker script is added as part of Project > Build Settings > Linker > Custom Linker Script. Please update size values in following lines of code in custom linker script to modify heap and stack sizes.

PROVIDE(__cy_heap_end = __cy_stack - 0x0800);

    .heap (NOLOAD) :

    {

      . = _end;

      . += 0x80;

      __cy_heap_limit = .;

    } >ram

    .stack (__cy_stack - 0x0800) (NOLOAD) :

    {

      __cy_stack_limit = .;

      . += 0x0800;

    } >ram

View solution in original post

D_Sd_3235936
New Contributor II

Hi

Can you provide more detail on the code snippet?

e.g. What are the new sizes of ram componenets in your exmaple?

Thanks.

0 Likes
GeonaP_26
Moderator
Moderator

The fixed stack code example by default uses hardcoded heap and stack sizes. The required amount of heap and stack size depend on the end application. Please refer to Controlling SRAM Usage in PSoC® Applications - KBA93584 to get a better idea on SRAM usage.

0 Likes
scsc_2908381
New Contributor

This document you specified does not work on BLE_OTA project.

Any other document available?

0 Likes
EyGe_3183606
New Contributor II

In GeonaM's post above, if you change all the places that have 0x800 then that is the size of the stack. If you change the value of 0x80 then you would be changing the size of the heap.

The file that GeonaM is referring to is called cm0gcc.ld

0 Likes