You are here

Managing Application Size and Speed with PSoC® Creator™ - KBA93583 | Cypress Semiconductor

Support & Community

Managing Application Size and Speed with PSoC® Creator™ - KBA93583

Last Updated: September 10, 2014

How do you manage application size and speed with PSoC® Creator™?


When your application runs solely from on-chip memory, flash ROM and SRAM size limit the amount of memory you can use in your application. Modern compilers do an excellent job of optimizing code and data space, often getting very close to user-created assembly code in terms of memory efficiency. However, the default settings in PSoC Creator do not optimize your code because the compiler optimizations make the application harder to debug.

You will commonly see this when the code you are stepping through in the debugger has been modified by the tail merging optimization, which replaces multiple sequences of identical instructions with a single sequence. When you step through the code in debug mode, the debugger may jump to unpredictable places in your source code because the code you are debugging is not where you thought it was. You need a way to turn optimizations on when you need them and off when you are designing and debugging.

PSoC Creator makes it easy to do this by offering two build configurations: Debug and Release. These are complete sets of build options for a project. By default, a new project uses the Debug configuration, which enables debugging and turns off all but the safest optimizations. With this configuration, you can use the debugger to perfect your code before switching to the Release configuration and simply rebuilding the source code.

Figure 1. Selecting a Build Configuration

The Release configuration turns on optimizations and disables debugging. If you use this configuration, your flash and SRAM usage decrease. By default, this configuration optimizes for space; however, you can quickly switch to speed optimization by going to Project > Build settings > Compiler > Optimization, as shown in Figure 2.

Figure 2. Optimization Settings


Switching configurations is simple. Use the drop-down box in the PSoC Creator main button panel, as shown in Figure 1. All you need to do is make your choice and build. This change in configuration only recompiles the source code; the hardware design does not change. Experimenting with these options is quick and easy. Using build configurations can help you make a careful, informed evaluation of compiler optimizations for your application, especially if you are on the edge of your memory budget or have a small window of time to complete a task.

Knowledge Base Tags: 

Provide feedback on this article

Browse KB By Product

Browse KB by Type