我正在尝试使用GNU汇编程序学习ARM汇编程序编程.我用QEmu设置了我的PC,并拥有Debian ARM-HF chroot环境.
如果我汇编并链接我的测试程序:
.text
.global _start
_start:
mov r0, #6
bx lr
Run Code Online (Sandbox Code Playgroud)
有:
as test.s -o test.o
ld test.o -o test
Run Code Online (Sandbox Code Playgroud)
然后将文件加载到gdb并在_start上设置断点:
root@Latitude-E6420:/root# gdb test GNU gdb (GDB) 7.6.1 (Debian 7.6.1-1) Copyright (C) 2013 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was …
我正在尝试自学组装。我在 C、Java 和 Python 方面有多年的经验 - 但我无法在这里取得任何进展,我即将放弃。
所以,我下载了 uVision4,并假设我可以编写一个基本的汇编程序:
MOV R1, #0x7F0E0C2D
MOV R3, #0x1048B3C5
ADCS R1, R3, ROR #0x18
END
Run Code Online (Sandbox Code Playgroud)
所以,建立两个变量,做一个操作,大功告成。一定要检查寄存器的输出和调试器的条件标志。
显然,这是不可能的。
我创建文本文件,编写代码,另存为 .asm 文件,然后尝试构建-
它讨厌那个。
好的,所以我创建一个新项目,添加 .asm 文件,
它拒绝了,要求我显然编写一个完整的设备驱动程序来做一个该死的你好世界。
如何运行简单的几行代码来开始学习?