You are here

about assembly optimize | Cypress Semiconductor

about assembly optimize

Summary: 1 Reply, Latest post by Bob Marlowe on 02 Dec 2015 12:56 AM PST
Verified Answers: 1
Last post
Log in to post new comments.
58013216_1409526's picture
24 posts

Hi, I don't want to psoc automatically optimize my code, how should I do?

My code as following,

WORD GetMsCount()
  WORD tmpCount;
    tmpCount = msCount;
  while(tmpCount != msCount);

  return tmpCount;

user_1377889's picture
9294 posts

Since msCount seems to be changed within an interrupt handler do not forget to declare it as "volatile"!!

In Project -> Build Settings -> Compiler -> Optimization you may set "Optimization Level" to "None", this setting is best for debugging.

Without the "volatile" attribute your while-loop would be prone to optimizatin taking tmpCount != msCount out of the loop because it does not change, leaving an infinite loop  behind.




Log in to post new comments.