Reputation: 1031
I was looking into below answer at
#define CAL_FACTOR ( 100 )
void delay (uint32_t interval)
{
uint32_t iterations = interval / CAL_FACTOR;
for(int i=0; i<iterations; ++i)
{
__asm__ volatile // gcc-ish syntax, don't know what compiler is used
(
"nop\n\t"
"nop\n\t"
:::
);
}
}
What is \n\t after nop? I looked into GCC Assembler guide but could not find answer.
Upvotes: 0
Views: 110
Reputation: 1031
I found answer at http://asm.sourceforge.net/articles/rmiyagi-inline-asm.txt
'\n\t' at the end of each line except the last, and that each line is enclosed in quotes. This is because gcc sends each as instruction to as as a string. The newline/tab combination is required so that the lines are fed to as according to the correct format (recall that each line in assembler is indented one tab stop, generally 8 characters).
Upvotes: 1
Reputation: 170
The assembly block seems to be read as plain text and instructions are separated with line breaks, if you write
"nop\n\tnop\n\t"
it should work as well.
Upvotes: 0