Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

PSoC™ 4

EyGe_3183606
Level 3
10 replies posted 10 questions asked 10 likes given
Level 3

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 50 likes received 25 likes received 10 likes received
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 50 likes received 25 likes received 10 likes received
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

D_Sd_3235936
Level 4
25 sign-ins 50 questions asked 25 replies posted
Level 4

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 50 likes received 25 likes received 10 likes received
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
Level 1
Level 1

This document you specified does not work on BLE_OTA project.

Any other document available?

0 Likes
EyGe_3183606
Level 3
10 replies posted 10 questions asked 10 likes given
Level 3

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