QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

楼主: shang79

HelloWorld on Skyeye,新手请进!

[复制链接]
发表于 2007-8-15 23:29:32 | 显示全部楼层
问个问题。

我是在FB下编译代码的。结果一切正常,没什么特别的。但是我有几点疑问。

1 不论是楼主编译的,还是我自己编译的。所编译出来的binary code 都要达到 45KB+。我认为这个体积貌似有些大了吧。
如果用 x86的cpu,实现这样一个功能也就 512kb 已经是很惊人了。

2 我记得linux的老内核有一个参数 --oformat binary 可以直接编译生成binary code。但是在 arm 下貌似不可以。

3 如果我将代码的起始地址从 0x100000 改为 0x000000。虽然代码可以被正常加载,也被skyeye正确识别,但是却无法正常运行,为什么?

希望能给出一个回答。

还有一个不知道是不是我想的那样,代码中 用

  1. mvn        r1,#0x2fc00
  2. sub        r1,r1,#0x3e0
  3. sub        r1,r1,#0x3
复制代码

将 0xfffd001c 放入 r1 寄存器中,那为什么不直接将这个数送入 r1 呢?是不是因为arm的指令编码对立即数的限制所造成的呢?那我们平时编写代码该如何进行转换?


下面是我写的一个小代码,没有使用 lds 文件。

  1. @boot.S
  2. .text
  3.         .align 4
  4.         .global begin
  5.         .type begin, function

  6. begin:
  7.         mov         r0, #0xd2
  8.         msr         cpsr, r0
  9.         mvn        r1,#0x2fc00
  10.         sub        r1,r1,#0x3e0
  11.         sub        r1,r1,#0x3
  12.         mov        r0,#0x41

  13.         str        r0,[r1]
  14. l:       
  15.         b        l
复制代码


  1. #Makefile
  2. CFLAGS=-mapcs-32 -march=armv4 -mtune=arm7tdmi
  3. LFLAGS=-e begin -Ttext 0x1000000 -s
  4. all:
  5.         arm-elf-gcc $(CFLAGS) -c boot.S -o boot.o
  6.         arm-elf-ld $(LFLAGS) -o boot boot.o
复制代码


  1. #skyeye.conf
  2. #skyeye config file sample
  3. cpu: arm7tdmi

  4. mach: at91

  5. mem_bank: map=M, type=RW, addr=0x01000000, size=0x00400000
  6. mem_bank: map=I, type=RW, addr=0xf0000000, size=0x10000000
  7. log: logon=0, logfile=./sk1.log, start=0, end=200000

复制代码


测试用的指令是 skyeye -e boot

本人今天刚开始看 arm 还请各位多多指教。
回复

使用道具 举报

发表于 2007-8-17 15:27:32 | 显示全部楼层
真所谓靠人不如靠己.
砍掉header 和 一些无用的段,现在文件体积一下子缩小很多.
不过,不能直接加载了.只能在配置脚本中定义加载的位置.

不过这才是我要的.
回复

使用道具 举报

发表于 2007-10-15 21:23:54 | 显示全部楼层
you are too cool>>>>>>>>>>>.....
回复

使用道具 举报

发表于 2008-5-17 14:25:14 | 显示全部楼层
非常感谢啊!
回复

使用道具 举报

发表于 2008-5-27 09:57:51 | 显示全部楼层

启蒙老师

谢谢shang79啦,不管是什么技术,自己会不是会,把人教会才算会。让我们在兴趣中学习,在分享中提高,在合作中共赢。希望我们越来越强,越来越多的优秀软件made in china.
回复

使用道具 举报

发表于 2008-6-9 10:39:35 | 显示全部楼层
make :nothing to be done for 'all'
why?
gcc 3.44
make 3.81
回复

使用道具 举报

发表于 2008-6-14 08:30:29 | 显示全部楼层
make :nothing to be done for 'all'
没有人遇到吗?
回复

使用道具 举报

发表于 2008-7-15 12:39:12 | 显示全部楼层

回复 #13 tropic 的帖子

还是有问题呢,不过链接时-n选项啥意思呢。
回复

使用道具 举报

发表于 2008-8-18 15:13:20 | 显示全部楼层
伪指令,还有label,立即数等等都和教科书上写的ARM程序大相径庭。这些都是GNU AS汇编编译器的统一语法。在as.info中有详细的介绍.

________________
真可惜,我第一次看文章的时候没有认真看,弄得我后来因为这个转换花了许多的时间..
汲取经验,置顶精华一定先看才行!

呵,继续努力~
回复

使用道具 举报

发表于 2008-12-3 16:55:22 | 显示全部楼层
我用的4.1.1版的gcc
-mshort-load-bytes选项和-mapcs-32都是不合法的。要怎么改呢?
版主啊,下次发布的时候文档里写上你用的编译工具的版本号吧,要不不好查怎么替换啊。

[ 本帖最后由 lenghuo 于 2008-12-3 16:57 编辑 ]
回复

使用道具 举报

发表于 2009-1-22 17:24:06 | 显示全部楼层
make后,提示如下:
make: Nothing to be done for `all'.
回复

使用道具 举报

发表于 2009-2-5 19:18:57 | 显示全部楼层
谢谢楼主,目前学习中。。。
回复

使用道具 举报

发表于 2009-4-1 19:10:48 | 显示全部楼层
用make编译时出错了

[root@localhost ~]# cd Hello4Skyeye/
[root@localhost Hello4Skyeye]# ll
total 148
-rwxrwxr-x  1 root1 root1 46727 Mar  2  2005 hello
-rw-r--r--  1 root1 root1   273 Feb 17  2005 hello.c
-rw-r--r--  1 root1 root1   822 Mar  2  2005 hello.lds
-rw-rw-r--  1 root1 root1    82 Mar  2  2005 hello.n
-rw-rw-r--  1 root1 root1  1992 Mar  2  2005 hello.o
-rw-rw-r--  1 root1 root1  3985 Mar  2  2005 hello.r
-rw-rw-r--  1 root1 root1  3645 Mar  2  2005 hello.s
-rw-r--r--  1 root1 root1   640 Mar  2  2005 makefile
-rw-r--r--  1 root1 root1  4078 Feb 17  2005 README
-rw-rw-r--  1 root1 root1     0 Apr  1 18:29 sk1.log
-rw-r--r--  1 root1 root1   225 Mar  2  2005 skyeye.conf
-rw-rw-r--  1 root1 root1  4744 Mar  2  2005 start.o
-rw-r--r--  1 root1 root1   424 Mar  2  2005 start.S
[root@localhost Hello4Skyeye]# make
make: Nothing to be done for `all'.
[root@localhost Hello4Skyeye]# make install
make: *** No rule to make target `install'.  Stop.
[root@localhost Hello4Skyeye]# make makefile
make: Nothing to be done for `makefile'.
[root@localhost Hello4Skyeye]# make install
make: *** No rule to make target `install'.  Stop.
回复

使用道具 举报

发表于 2009-4-10 10:48:37 | 显示全部楼层

好厉害

都是高手啊
回复

使用道具 举报

发表于 2009-4-17 15:26:42 | 显示全部楼层
ubuntu8.04,装好了arm-elf-tools,下载了Hello4Skyeye代码,根据楼主的步骤make clean,然后make之后skyeye hello,结果不断打印
Bus read error, can not find corresponding bank for addr 0x3c20,pc=0x3c20
这句话,当然后面的地址不断递增……这是怎么回事?
回复

使用道具 举报

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

本版积分规则

GMT+8, 2024-4-24 03:18 , Processed in 0.161866 second(s), 13 queries .

© 2021 Powered by Discuz! X3.5.

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