- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We notice that the documentation http://www.cypress.com/file/385921/download states there is 288 KB of available integrated SRAM. But we are changing the stack and heap sizes and, by trial and error, we notice we are capped off at 61352 bytes for the stack and heap sizes (total of 122704 bytes which doesn't match the stated 288 KB). How can we maximize the available space?
Note: we are only using single core cm0 and following method (1) in thread https://community.cypress.com/thread/32113 to change the stack and heap sizes.
Steve
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Steve,
You can disable the SRAM blocks with 32 KB granularity which are not used. Say you need to use only 32 KB SRAM (1 block of SRAM), you can disable the rest as follows:
for(int8 i = 1; i<9;i++)
CPUSS->RAM0_PWR_MACRO_CTL= 0x05FA0000;
Thanks,
Vaisakh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Steve,
Are you using Global Variables ( initialized too ) in your project.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi anks,
We resize by adding __STACK_SIZE=61352 and __HEAP_SIZE=61352 under Project > Build Settings > CM0+ ARM GCC > Compiler > General > Preprocessor Definitions since we are only using single core cm0. Should we also initialize the variables at another location as well?
Best,
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Steve,
Can you please provide us with your project. Are you using Global Variables ( initialized too ) in your project.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi anks,
Could you specify which global variables we should have initialized and where they should be initialized? Also is there a way to look at the available space so that we could maximize allocation to the stack and heap?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am asking have you initialized or declared any global variables (not any specific kind), because they also take space in SRAM and global variables in startup code may also take space in SRAM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Anks,
Sorry for the confusion. Yes, we have global variables initialized. Is there a way to see how much space in SRAM is being used and by what (global variables, etc.)?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Presently, I can't find any feature in Creator itself to show the space taken by all the gLobal Variables.But, you can calculate for the ones declared in the application.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Anks,
We see in the datasheet that there are 9 x 32 KB SRAM blocks, is it possible to disable the blocks that we are not using? For instance, if we know that we are not using more than 32KB SRAM, we would like to turn disable 8 of the 9 SRAM blocks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Steve,
You can disable the SRAM blocks with 32 KB granularity which are not used. Say you need to use only 32 KB SRAM (1 block of SRAM), you can disable the rest as follows:
for(int8 i = 1; i<9;i++)
CPUSS->RAM0_PWR_MACRO_CTL= 0x05FA0000;
Thanks,
Vaisakh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Not sure if the main question was answered or if you figured it out yourself - to increase or change the amount of SRAM allocated to CM0+, you can edit the "cy8c6xx7_cm0plus.ld" (for CM0+ and GCC compiler) file in the Workspace explorer. Change the "ram" LENGTH to the desired size. By default, both CM0+ and CM4 gets 0x24000 bytes each. You will need to adjust ram in both cy8c6xx7_cm0plus.ld and cy8c6xx7_cm4.ld files to fit in the device's 288 KB SRAM. It should be noted that the last 0x200 bytes of SRAM is used by system calls and should not be used in the application. That is why the SRAM length in CM4 is capped to 0x23800 by default.
Regards,
Meenakshi Sundaram R
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Meenakshi,
Does PSoC provide a way to see how much SRAM is used in a project? We have thought of initializing all memory to a certain value and seeing up until what memory address the project uses by observation of change from the initialized memory value. However we were the memory address where SRAM begins.
Best,
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Steve,
If you are using GCC, then after compilation in the output window you should see the code and sram consumption details (last line before Build succeeded message appears). But note that this does not include Stack and Heap size.
If you are changing the RAM allocation for the cores, please follow the recommendation of 0x100 SRAM start address alignment for CM0+ and 0x400 for CM4 i.e. SRAM should start at an address that is aligned 0x100 for CM0+ and 0x400 for CM4.
Regards,
Meenakshi Sundaram R