Below is a list of random arm (Advanced RISC Machines) information for my reference.
Random arm Information
001 – How to compile assembly language on linux
- as -o object.o source.asm
- ld -s -o program object.o
You run the program using: ./program
002 – Simple makefile for helloworld
To run the make file use the "make" command, the make command can have a label as a parameter, so "make clean" will run the "clean" section in the makefile
hello: hello.o
ld -s -o hello hello.o
hello.o: hello.asm
as -o hello.o hello.asm
clean:
rm *.o hello
003 – helloworld in arm64 assembly
Source: hello.asm
.globl _start
.section .text
_start:
// Get address of counter
adr x15, counter
// Get the value at address counter
ldrb w15, [x15]
loop:
// Print Hello, World!
bl print_hello
sub w15, w15, #1
cmp w15, #0
beq endpgm
b loop
print_hello:
mov x0, _stdout
adr x1, msg
mov x2, msglen
mov w8, _write
svc #0
ret
endpgm:
mov x0, #0
mov w8, _exit
svc #0
.section .data
// Constants
.equ _stdout, 1
.equ _write, 64
.equ _exit, 93
// Variables in memory
msg:
.ascii "Hello, World!\n"
msglen = . - msg // Length of msg
counter:
.byte 3