Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > PSoC® 3 > Optimizing your C code for PSoC 3's 8051 CPU

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



Optimizing your C code for PSoC 3's 8051 CPU

Summary: 6878 Views, 1 Replies, Latest reply by vvsk on 16 Mar 2011 12:46 AM PST

Verified Answers: 0

Post Reply


vvsk posted on 16 Mar 2011 12:30 AM PST
Cypress Employee
25 Forum Posts

One of the most frequently encountered probelms while writing a C code for an application is that you may run out of code space, RAM space. PSoC 3 has relatively smaller SRAM (8 KB), Flash (64 KB) compared to PSoC 5 devices. Depending on the application you may typically end up needing to,

1.)Optimize SRAM memory utilization

2.)Optimizing Code space

3.)Reducing Code execution time for a code snippet or an Interrupt routine

The 8051 CPU has some very simple yet powerful features for solving above three scenarios. Refer the application note

<a href="http://www.cypress.com/?rID=40986">AN60630 - Optimizing 8051 Code in PSoC® 3 </a>. It explores the 8051 architecture with regards to above points and also explains how Keil compiler supports these features.

The Keil compiler help manual that comes with Creator is another excellent source of reference.

As an example, 1-bit flag variables that can either be only '1' or '0' can be declared as "sbit" rather than a byte.

Any other interesting things you found, feel free to post here.



 

vvsk posted on 16 Mar 2011 12:46 AM PST
Cypress Employee
25 Forum Posts

The AN link didn't get posted properly in previous post. Here you go again.

AN60630 - Optimizing 8051 Code in PSoC® 3



 

Post Reply






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: 06/15/20