在使用S3C6410开发板时,编写了一个简单的hello.c程序,如下所示。
#include <stdio.h>
int main()
{
printf("Hello!\n");
return 0;
}
采用下面的交叉编译命令对程序进行编译。
arm-linux-gcc hello.c -o hello
生成了可执行文件hello,通过tftp把hello传到开发板中,运行程序,报如下错误。
/bin/sh: ./hello: Permission denied
经过分析,是由于hello文件没有可执行的权限,执行下面的命令
chmod 777 hello
将hello文件的权限设置为对所有用户可读可写可执行。然后再运行,则程序可以正常运行。