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.
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 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!
-----------------------------------------------------------------------------------------------------------------------