IAR C语言嵌入汇编问题

多条语句的格式如下:
void QuickCopy(INT32U *addr, INT32U len, INT32U data)
{
__asm("STMFD SP!, { R4 - R11 }\n"
"ADD R1, R0, R1\n"
"MOV R4, R2\n"
"MOV R5, R2\n"
"MOV R6, R2\n"
"MOV R7, R2\n"
"MOV R8, R2\n"
"MOV R9, R2\n"
"MOV R10, R2\n"
"MOV R11, R2\n"
"LOOP:nop\n"
"STMIA R0!, { R4 - R11 }\n"
"CMP R1, R0\n"
"BNE LOOP\n"
"LDMIA SP!, { R4 - R11 }\n"
"BX LR\n");
}
注意 多行之间使用 换行符 \n 隔开,最后一个括号要有逗号,否则编译出错;

IAR C语言嵌入汇编问题

上一篇:C++ 文件(string读写)


下一篇:常问面试题:C++中sizeof的陷阱及应答