1.编译环境:
安装binutils-arm-linux-gnueabihf,从而支持arm-linux-gnueabihf-as和arm-linux-gnueabihf-ld:
sudo apt install binutils-arm-linux-gnueabihf
2.hello world工程:
2.1新建文件hello.asm,粘贴如下代码:
.text .global _start _start: mov r0, #1 ldr r1, =message ldr r2, =len mov r7, #4 swi 0 mov r7, #1 swi 0 .data message: .asciz "hello world\n" len = .-message
2.2 编译和链接:
执行命令:
arm-linux-gnueabihf-as hello.asm -o hello.o
arm-linux-gnueabihf-ld hello.o -o hello
2.3 运行程序:
./hello