QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1284|回复: 1

运行自己的程序出错!不解

[复制链接]
发表于 2006-11-7 10:08:02 | 显示全部楼层 |阅读模式
自己编辑hello.c程序
#include <stdio.h>
int main(void)
{
    int i;
    for(i = 0; i < 6; i++){
        printf("i = %d  ",i);
        printf("Hello, embedded linux!\n");
    }
    return 0;
}
执行命令:arm-elf-gcc -Wl,-elf2flt -o hello hello.c

得到名为hello的执行文件,还有另外一个hello.gdb文件
把hello文件copy到romfs/文件夹下的bin/子文件夹中
执行命令
genromfs -f romfs.img -d romfs
产生的romfs.img 文件便可以用来启动uclinux
在skyeye.conf 中指定romfs.img的位置

然后可在skyeye目录下执行
#./skyeye -e  linux-2.4.x/linux
进入uclinux系统后
执行hello命令
结果为
Sash command shell (version 1.1.1)
/> hello
/>Bad Command or File Name
分析,步骤没错,但是无法识别hello,测试发现,uClinux-dist/romfs/bin下有20个文件,其中包括添加的hello。

再次运行uClinux,
Sash command shell (version 1.1.1)
/> ls
/> 只有19个文件,没有hello,问题出现,但不解?
发表于 2006-11-7 14:25:21 | 显示全部楼层
碰到过,但是可能和你的情况不太一样,我是移植虚拟机,便以出来的可执行程序也是格式不对,后来发现是由于使用了-fPIC的变异参数引起的,去掉就没事了。你用file xx看看test 和可以执行的程序有什么区别。贴上来看看
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-6-6 19:40 , Processed in 0.144900 second(s), 16 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表