cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 4 MCU

ToVa_285016
Contributor

Hi,

   

See the attached image.  When I am debugging the project, the processor gets inside an if statement that it absolutely should not be able to.  I must be missing something very simple, but this is baffling...

   

Thank you,
Tom

0 Likes
Reply
9 Replies
ETRO_SSN583
Esteemed Contributor

Not an optimization result of compiler ? Turn it off in build

   

settings and see what happens.

   

 

   

Regards, Dana.

0 Likes
Reply
ToVa_285016
Contributor

Pardon my ignorance, where can I find this option?

   

Thank you,
Tom

0 Likes
Reply
ETRO_SSN583
Esteemed Contributor

Here (build settings) -

   

 

   

http://www.cypress.com/documentation/application-notes/an89610-psoc-4-and-psoc-5lp-arm-cortex-code-o...     AN89610 - PSoC® 4 and PSoC 5LP ARM Cortex Code Optimization

   

 

   

Regards, Dana.

0 Likes
Reply
ToVa_285016
Contributor

Hi,

   

I turned off Arm GCC/Compiler/Optimization/Optimization Level.  This seemed to fix the problem.  Here are my results with the settings,

   

None:  Enters the if statement correctly

   

Debug:  Enters into if statement even if conditions are not true

   

Minimal:  Enters into if statement even if conditions are not true

   

High:  Does not enter into statement, break points give an error

   

Speed:  Does not enter into statement, break points give an error

   

Size:  Does not enter into statement, break points give an error

   

 

   

See attached project.  I have not run into this before - seems strange for a project so simple, I swear I have had similar projects before...  Can someone explain why one kind does not allow me to enter into an if statement, and other kinds do it even when they should not?

   

Regards,
Tom

0 Likes
Reply
ETRO_SSN583
Esteemed Contributor
        Consider filing a CASE on this - To create a technical or issue case at Cypress - www.cypress.com “Support” “Technical Support” “Create a Case” You have to be registered on Cypress web site first. If you would not mind post back the results for the benefit of the forum. Regards, Dana.   
0 Likes
Reply
JoMe_264151
Expert II

My experiences with single-stepping are quite the same. On the other hand I was able to proof that the program flow was quite correct, only the breakpoints were reached or not reached reproducably but not as expected. The real program flow was exactly as expected. So I decided for me to always set the optimization to "none" while debugging.

   

 

   

Bob

0 Likes
Reply
ETRO_SSN583
Esteemed Contributor
        Of course setting optimization to none works great as long as you are not up against FLASH (code) size limitations, which if the case you have no choice but to optimize. Been there, done that. Regards, Dana.   
0 Likes
Reply
JoMe_264151
Expert II

Since the optimization level can be set individually for every file you can save lots of bits and mips when lowering the level only for the files under test.

   

At the recent Customer Advisory Board (CAB) at Cypress in Portland we suggested to default the optimization level for the generated files to a high level.

   

 

   

Bob

0 Likes
Reply
ETRO_SSN583
Esteemed Contributor

Actually the optimization level can be set to the f() level.

   

 

   

Regards, Dana.

0 Likes
Reply