extern void strcopy(char *d,const char * s);
int main(void)
{const char * srcstr="first string" ;
char dststr[]="second string-destination";
printf("before:\n");
printf(" '%s'\n '%s'\n",srcstr,dststr);
strcopy(dststr,srcstr);
printf("after coping:\n");
printf(" '%s'\n '%s'\n",srcstr,dststr);
return(0);
}
/*strcopy.s*/
area scopy,code,readonly
export strcopy
strcopy
ldrb r0,[r1],#1
strb r2,[r0],#1
cmp r2,#0
bne strcopy
mov pc,lr
end
为什么我用keil for arm 编译以上代码不能通过,编译器说export strcopy语法错误,谁能告诉我,跪谢。
编译后你再用ASM把函数内容换掉,就可以了。
如果用汇编写你的程序,应当用"strcopy?A"或"strcopy?T"这样的名字。这是keil的规则。