__NOP is declared as a function, with the prototype void __NOP(void). You need to call it like "__NOP()", not just "__NOP".
You did not say what specific ARM part you where using.
NOP is not necessarily a time-consuming depending on the processor. The processor might remove it from the pipeline before it reaches the execution stage. One of the barrier instructions might be more appropriate, for example:
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0552a/CHDEBIEG.html
Also as others noted a NOP must be marked volatile, some compilers such as GCC will remove instructions that have no side-effects. Marking the instruction volatile will make sure that it is not removed by the optimizer.
I found __NOP, it means no use for delay?
Hi Jake,
from your code __NOP can be used for delay. can you please test to step over the __NOP, can it work normal?
if you increase the value of delay_cnt, can you see the time cost for delay_us() increased with scope?
Have a great day,
Jennie Zhang
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi,
I try __asm("nop"),and can work.
But __NOP is not work,and jump over the __NOP.It is maybe unbelivable:smileyconfused:.
Hi Jake,
__asm("nop") is the right inline assembly syntax.
I would like to suggest you look this article on this related topic.
Extended Inline Assembly with Kinetis Design Studio
can this help you?
Have a great day,
Jennie Zhang
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------