Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > PSoC® 5 > stack/heap usage of PSoC5

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



stack/heap usage of PSoC5
Moderator:
ANCY

Post Reply
Follow this topic



stack/heap usage of PSoC5

H L posted on 22 Nov 2011 3:59 AM PST
Top Contributor
679 Forum Posts

 HI,

We are developing a  project using PSoC, The project is nearly finished, but we would like know if we can use a bit more RAM for some furture expansion. We sould also like to know how much RAM is being used for stack and heap, (I mean it is ACTUALLY used, not being assigned for ). Any one has any idea how we can get the information.  I have this post to Cypress support already, hope some one has done this before. 

I know there are programs to trace stack usage but not sure it is aviable for PSOoC5 or G++ lite for ARM devices.

There is another way which is to fill the stack area with a spcial pattern and let the program run and excersise the possible combination and then check the pattern again -( this is not as good as the first one, but at least give some indication of usage.) I am reading the CodeSourcery manual and would like to know if some one has the experience to modify the startup code to do this

Thanks

 




Re: stack/heap usage of PSoC5

U2 posted on 24 Nov 2011 01:07 AM PST
Cypress Employee
589 Forum Posts
  • The default for a PSoC 5 project is the stack size = 16K (0x4000) and the heap size to be 4K (0x1000).  These are settable parameters, in the .cydwr file, System tab, Configuration node.
  • In order to see the allocation of stack and heap look in to the .map file. In the .map file you can see that the stack space is located at the top of SRAM (the stack/SP/R13 grows downward), and the heap space is located under the stack space. The amount of SRAM being used for the stack at any particular time is just the top of SRAM address minus the value in R13.
  • Don't forget that the Cortex-M3 has two stack pointers, both sharing the R13 space - check PSoC 5 datasheet Table 4-2 for details. In most simple projects only the main stack pointer (MSP) is used.



Re: stack/heap usage of PSoC5

H L posted on 24 Nov 2011 02:12 PM PST
Top Contributor
679 Forum Posts

Thanks,

 
1.& 2 : I have no problem changing the size and location the address of the stack and heap from the map file.
3. I don’t want to access the SP directly unless needed to. Just wondering if anyone has done this before or Cypress already have tools to do this.


Re: stack/heap usage of PSoC5

U2 posted on 27 Nov 2011 09:59 PM PST
Cypress Employee
589 Forum Posts

The Stack Pointer value changes dynamically in the run time depending on how your code is structured. Could you tell us what kind of tool you are expecting ?






ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Spec No: None; Sunset Owner: KXP; Secondary Owner: VWA; Sunset Date: 01/01/20