I need to learn ARM assembly, and I use Linux.
来源:互联网 发布:中国农大网络远程教育 编辑:程序博客网 时间:2024/05/16 06:54
http://ubuntuforums.org/archive/index.php/t-2010979.html
View Full Version : [SOLVED] ARM assembly under Linux
chuchi
June 26th, 2012, 04:53 PM
Hi there!!
I need to learn ARM assembly, and I use Linux. Please, could you give me any starting point about how to install it?? I do not pretend that you teach me ARM assembly. Just a link.
thank you very much!!!
I need to learn ARM assembly, and I use Linux. Please, could you give me any starting point about how to install it?? I do not pretend that you teach me ARM assembly. Just a link.
thank you very much!!!
youknowme
June 27th, 2012, 05:03 AM
Hi there!!
I need to learn ARM assembly, and I use Linux. Please, could you give me any starting point about how to install it?? I do not pretend that you teach me ARM assembly. Just a link.
thank you very much!!!
This might be useful to start you off
http://www.coranac.com/tonc/text/asm.htm
I need to learn ARM assembly, and I use Linux. Please, could you give me any starting point about how to install it?? I do not pretend that you teach me ARM assembly. Just a link.
thank you very much!!!
This might be useful to start you off
http://www.coranac.com/tonc/text/asm.htm
SevenMachines
June 27th, 2012, 08:11 AM
Been a year or so, but i think this works? Although personally I recommend setting up a chroot or pbuilder arm environment, its less hassle with more complicated programs, or at least was in my previous experience.
$ apt-get install gcc-4.6-arm-linux-gnueabi libc6-dev-armel-cross
$ cat hello.s
.data
msg:
.ascii "Hello, ARM World!\n"
len = . - msg
.text
.globl _start
_start:
/* write syscall */
mov %r0, $1
ldr %r1, =msg
ldr %r2, =len
mov %r7, $4
swi $0
/* exit syscall */
mov %r0, $0
mov %r7, $1
swi $0
$ arm-linux-gnueabi-as -o hello.o hello.s
$ arm-linux-gnueabi-ld -o hello hello.o
$ file hello
hello: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, not stripped
$ ./hello
Hello, ARM World!
$ apt-get install gcc-4.6-arm-linux-gnueabi libc6-dev-armel-cross
$ cat hello.s
.data
msg:
.ascii "Hello, ARM World!\n"
len = . - msg
.text
.globl _start
_start:
/* write syscall */
mov %r0, $1
ldr %r1, =msg
ldr %r2, =len
mov %r7, $4
swi $0
/* exit syscall */
mov %r0, $0
mov %r7, $1
swi $0
$ arm-linux-gnueabi-as -o hello.o hello.s
$ arm-linux-gnueabi-ld -o hello hello.o
$ file hello
hello: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, not stripped
$ ./hello
Hello, ARM World!
chuchi
June 27th, 2012, 06:35 PM
Hi!! thank you very much for reply. But that type of instructions is of the form: Mov source,dest. The syntax instructions on ARM is : Mov dest,source. This is what I need
Thank you very much!
Thank you very much!
chuchi
June 27th, 2012, 06:49 PM
Ok I was wrong, your code is right!! I am very sorry!!
Everything is ok, except when I type ./hello I get
bash: ./hello: cannot execute binary file
Why??
Thank you very much!
Everything is ok, except when I type ./hello I get
bash: ./hello: cannot execute binary file
Why??
Thank you very much!
SevenMachines
June 27th, 2012, 07:17 PM
Yes. its just at&t syntax versus intel.
Sorry, obviously the binary is arm and not x86 so wont run, I just forgot I had qemu emulation enabled. Try,
$ ./hello
bash: ./hello: cannot execute binary file
# Set up qemu arm emulation
$ sudo apt-get install qemu-user-static
$ ./hello
Hello, ARM World!
Sorry, obviously the binary is arm and not x86 so wont run, I just forgot I had qemu emulation enabled. Try,
$ ./hello
bash: ./hello: cannot execute binary file
# Set up qemu arm emulation
$ sudo apt-get install qemu-user-static
$ ./hello
Hello, ARM World!
chuchi
June 27th, 2012, 07:25 PM
HI!! now it works!! thank you very very much!!
chuchi
June 28th, 2012, 09:48 AM
Hi again!!
Do you know any way of debugging in qemu?
Surfing the net they say you have to install and configure a new kernel. Is there any other way??
thank you very much!!
Do you know any way of debugging in qemu?
Surfing the net they say you have to install and configure a new kernel. Is there any other way??
thank you very much!!
SevenMachines
June 28th, 2012, 11:21 PM
You can set qemu to wait on a gdb connection
# In a terminal
$ qemu-arm-static -g 10101 ./hello
# In a new terminal
$ sudo apt-get install gdb-multiarch
Then start gdb-multiarch, load symbols, and connect gdb to qemu, eg
$gdb-multiarch
(gdb) list _start
8.text
9
10.globl _start
11_start:
12/* write syscall */
13mov %r0, $1
14ldr %r1, =msg
15ldr %r2, =len
16mov %r7, $4
17swi $0
(gdb) b 16
Breakpoint 1 at 0x8080: file hello.s, line 16.
(gdb) target remote :10101
Remote debugging using :10101
[New Remote target]
[Switching to Remote target]
_start () at hello.s:13
13mov %r0, $1
(gdb) c
Continuing.
Breakpoint 1, _start () at hello.s:16
16mov %r7, $4
(gdb) n
17swi $0
(gdb) n
20mov %r0, $0
(gdb) c
Continuing.
[Inferior 1 (Remote target) exited normally]
[EDIT] You'll want debugging information ie
$ arm-linux-gnueabi-as -gstabs -o hello.o hello.s
# In a terminal
$ qemu-arm-static -g 10101 ./hello
# In a new terminal
$ sudo apt-get install gdb-multiarch
Then start gdb-multiarch, load symbols, and connect gdb to qemu, eg
$gdb-multiarch
(gdb) list _start
8.text
9
10.globl _start
11_start:
12/* write syscall */
13mov %r0, $1
14ldr %r1, =msg
15ldr %r2, =len
16mov %r7, $4
17swi $0
(gdb) b 16
Breakpoint 1 at 0x8080: file hello.s, line 16.
(gdb) target remote :10101
Remote debugging using :10101
[New Remote target]
[Switching to Remote target]
_start () at hello.s:13
13mov %r0, $1
(gdb) c
Continuing.
Breakpoint 1, _start () at hello.s:16
16mov %r7, $4
(gdb) n
17swi $0
(gdb) n
20mov %r0, $0
(gdb) c
Continuing.
[Inferior 1 (Remote target) exited normally]
[EDIT] You'll want debugging information ie
$ arm-linux-gnueabi-as -gstabs -o hello.o hello.s
0
上一篇:Using QEMU for Embedded Systems Development, Part 3
下一篇:‘Hello World!’ in ARM assembly
相关热门文章
- SHTML是什么_SSI有什么用...
- shell中字符串操作
- 卡尔曼滤波的原理说明...
- 关于java中的“错误:找不到或...
- shell中的特殊字符
- linux dhcp peizhi roc
- 关于Unix文件的软链接
- 求教这个命令什么意思,我是新...
- sed -e "/grep/d" 是什么意思...
- 谁能够帮我解决LINUX 2.6 10...
给主人留下些什么吧!~~
评论热议
0 0
- I need to learn ARM assembly, and I use Linux.
- initrd, initramfs, which I need and how to use???
- Why do I need to use DAC from Oracle BI?
- I need to improve myself
- Do I need to have 64 bit Processor to use 64 bit data type
- 【转】Programmers Need To Learn Statistics Or I Will Kill Them All
- 【转】Programmers Need To Learn Statistics Or I Will Kill Them All
- I decided to learn English
- I restart to learn Android
- Use exceptions to watch for and handle I/O errors.
- Use exceptions to watch for and handle I/O errors.
- How do I install and use fonts in Linux?
- What do I Need to Get Started?
- Some good motto I need to remember
- I may need to give up smoking
- Use Jokes and Humor to Learn English
- Why does a statically built Qt use the dynamic Visual Studio runtime libraries ? Do I need to deploy
- I am starting to learn Java again.
- ARM汇编调试
- Using QEMU for Embedded Systems Development, Part 1
- Using QEMU for Embedded Systems Development, Part 2
- C#委托的介绍(delegate、Action、Func、predicate)
- Using QEMU for Embedded Systems Development, Part 3
- I need to learn ARM assembly, and I use Linux.
- 290. Word Pattern
- easy ui 隐藏textbox
- ‘Hello World!’ in ARM assembly
- 虚拟机中PXE-MOF:Exiting intel PXE ROM.Operating system not found
- hibernate 4.3.X遇到的一些问题收集
- [leetcode] 339. Nested List Weight Sum 解题报告
- An exploration of ARM assembly language
- java 抽象方法
原创粉丝点击
热门IT博客
热门问题
老师的惩罚
人脸识别
我在镇武司摸鱼那些年
重生之率土为王
我在大康的咸鱼生活
盘龙之生命进化
天生仙种
凡人之先天五行
春回大明朝
姑娘不必设防,我是瞎子
投影灯
地摊玩具
手工网
运动会入场式创意队形
鲁信创投
鲁信创投股票
红岭创投社区
600783鲁信创投
红领创投
红岭创投宣布清盘
深创投
创投公司
大河创投
创投板块
鲁信创投股吧
紫辉创投
创投公司排名
张江创投
创投企业
红岭创投 怎么样
创投是什么意思
创投圈
创投概念股
创投概念
创投基金排名
创投基金是什么
创投基金
创投概念股龙头
创投平台
帮客创投
公益创投
国泰创投
博大创投
中兴创投
中汽创投
创投节目
融汇创投
深创投投资
创投季
创业投资基金
锂电池股票龙头