PSoC5 optimization

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
MaTr_1730276
Level 4
Level 4
First like given 10 sign-ins First solution authored

Hello everybody,

in my project I must optimaze a file as SPEED.

How to exclude  a single instruction from being optimazed?

There some instruction that said to compiler to do not optimize the instruction?

 

I think in my case, the compiler makes optimization of CY_NOP instructions that I used as small delay and my routine do not works correctly. Is there something label to write before the CY_NOP to say to compiler that have not to optimize the instruction?

 

Something like the "volatile" for the variables..

 

Thank you

0 Likes
1 Solution
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

MaTr,

How do you know that CY_NOP is being optimized out? Did you check the delay in execution time?

One way to save code from being optimized out is to encapsulate it into custom component. Basically, make empty component, add add some API to it. Just a header file will suffice in your case. Then call that function containing CY_NOP code.

      Miraculously (and unfortunately) Creator will not optimize out the dead code inside the component. I believe that this is a big, at least I didn't find the way to clean up dead code inside  components' API.

/odissey1

View solution in original post

0 Likes
1 Reply
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

MaTr,

How do you know that CY_NOP is being optimized out? Did you check the delay in execution time?

One way to save code from being optimized out is to encapsulate it into custom component. Basically, make empty component, add add some API to it. Just a header file will suffice in your case. Then call that function containing CY_NOP code.

      Miraculously (and unfortunately) Creator will not optimize out the dead code inside the component. I believe that this is a big, at least I didn't find the way to clean up dead code inside  components' API.

/odissey1

0 Likes