Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > PSoC® Software > Comments on AN60630 - PSoC® 3 – 8051 Code and Memory Optimization

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



Comments on AN60630 - PSoC® 3 – 8051 Code and Memory Optimization
Moderator:
JFMD

Post Reply
Follow this topic



Comments on AN60630 - PSoC® 3 – 8051 Code and Memory Optimization

PeterT posted on 27 Apr 2012 10:02 AM PST
Member
10 Forum Posts

 This is a great app note.  I used a lot of the tips in here to free up a lot of space in my project.  Another technique that was not mentioned in the app note that I found in the Keil documentation is using the "small" and "compact" Keil keywords at the end of function declarations and definitions.  This instructs the compiler more clearly how you want it to handle arguments and returned values in memory.

I tried one of the techniques that ended up using more space than before I changed the code.  I have a global array of structs.  The array is stored in pdata memory and I was passing a pointer of a struct array element to a function and using the -> operator to access the struct members.  Since it is a global struct, I thought I would change the function argument to simply the uint8 index of the array element I wanted to work with and then access the members of the struct directly with the index.  After making the changes, and replacing probably two dozen -> operators, the code size was about 40 bytes larger.  I'm not really saying that the app note is wrong.  It may have been simply accessing of the array with the index.  In any case, it's food for thought.




Re: Comments on AN60630 - PSoC® 3 – 8051 Code and Memory Optimization

Robert-CY posted on 06 May 2012 04:34 PM PST
Cypress Employee
129 Forum Posts

Peter,

this is what forums are all about. Exchange of experience, talking about the good stuff, talking about the not so good stuff, what was missing and sharing your thoughts. As you said, it is food for thoughts and your point about the "small" and "compact" key words is well taken.

You tried out the tips, you got mostly success and reduced your code size (and probably even sped up some routines) and you also found one instance where the code size increased.

If all developers would study the application notes like you did with this one, there would be more happy campers :)

Thank you for sharing your experience and the good hints with the Keil key words

Robert






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: GRAA; Secondary Owner: RAIK; Sunset Date: 01/01/20