ARM Assembly Language: Course Objective's
ARM Assembly Language: Course Objective's
Introduction
While testing we can run this code in debugger which will use additional registers on
the hardware to view the contents on the registers and set and clear break points.
ELF & DWARF are (executable linkable formats - just a naming convention)
Object file stores addition information i.e name of the variable in the high level code
as a asm comment e.g mov r1, #10 ; int a = 10 this is used while debugging.
Assembly Syntax
Arm Instructions have 4 fields separated by spaces or tabs.
controller - yellow
Peripherals - green
Bus - blue
Interrupt controller
AHB arbiter
AHB-APB bridge
Memory controller
Bus Master - is a logical device capable of initiating data transfer with another
device.
Bus Slave - is only capable to responding to a transfer request from the master.
Physical Level - electrical characteristics i.e bus width 16, 32 bit etc.
Memory
RAM is main memory (primary) faster than ROM (size MBs to GBs usually).
ROM is secondary memory far from processor, slowest to access (size GB’s usually)
Apart of the type (where it is located wrt process) there are other properties of
memory.
Memory width - number of bits returned on each memory access. (16, 32, 64
etc. )
Cycles required to fetch an instruction from memories with different memory widths.
On chip peripherals and IO register section can occupy in any of the empty arrays,
depending on the chip manufacturer.
SFR section is for Special Function Registers.
Peripherals
All ARM peripherals are memory mapped. This means programming interfaces to
this register is a set of memory address registers, accessed with relative offset from
specific peripheral base address.
Interrupt Controller
An Interrupt controller determines which peripheral can access processor at a
specific time.
1 PC
1 Status Register
3 Interrupt Mask Registers
r15 or pc or PC
Assembly Directives
Assist and control assembly process.
Are also called pseudo-ops.
SUB vs SUBS
LDR R0, =A
For instructions like LDRB the data byte is present in Least indexed bytes
2.
ENTRY
EXPORT __main
BX COPY
BX FILL
COPY
SUBS R2, #1
BNE L1
BX LR
FILL
SUBS R2, #1
BNE L2
BX LR
END
ARM inbuilt barrel shifter performs rotate right operation, thus the (32 - n) for left
shift operation.
If we load the address of a code (function/ label or variable) into Rd using ADR
then there will be no change in the address that is loaded into register.
If we load the address of a code (function/ label) into Rd using LDR then there
will be an change in the address by 1 that is loaded into register.
Solving Equation
C Flag:
ADDS R0, R1, R2 if R1=0xFFFFFFFF ; R2=0x5
ADC R3, R4, R5 if R3 = R4 + R5 + CARRY
V Fag:
To indicate Signed overflow
Z Flag:
To indicate if result is equal to 0.
2. Arithmetic shit
3. Rotate Right
Note : Basically for a unsigned number logical shift is performed where as for a
signed number processor performs Arithmetic shift.