Académique Documents
Professionnel Documents
Culture Documents
Introduction
Thumb has higher performance than
ARM on a processor with a 16-bit
data bus
Thumb has higher code density than
ARM
Thumb implementation takes up
around 30% less memory than the
equivalent ARM implementation
ASR, LSL, LSR, and ROR used as
separate instructions in the Thumb
ARM-Thumb Interworking
ARM-Thumb interworking is the
method of linking ARM and Thumb
code together for both assembly and
C/C++
To call a Thumb routine from an ARM
routine, the core has to change state
BX and BLX branch instructions cause
a switch between ARM and Thumb
state
Branch Instructions
B is similar to the ARM version and is
conditionally executed
branch range is limited to a signed 8bit immediate, or 256 to +254
bytes
BL instruction is not conditionally
executed and has an approximate
range of+/4 MB
Single-Register Load-Store
Thumb instruction set supports load
and storing registers
two preindexed addressing modes:
offset by register and offset by
immediate
Multiple-Register Load-Store
only support the increment after (IA)
addressing mode
always update the base register Rn
after execution
Stack Instructions
POP and PUSH instructions used for stack
operation
stack pointer is fixed as register r13 in
Thumb operations
sp is automatically updated
PUSH register list also can include the link
register lr
POP register list can include the pc
Full Descending stack alone is supported
Software Interrupt
Instruction
Thumb software interrupt (SWI) instruction
causes a software interrupt exception
If any interrupt or exception flag is raised in
Thumb state, the processor automatically
reverts back to ARM state
SWI number is limited to the range 0 to 255
Not conditionally executed
ARM Assembly
Programming
Areas
It may be CODE or DATA, and can
optionally be READONLY.
Eg. AREA |main|, CODE, READONLY
The area name must be enclosed in
vertical bars, and it may be any valid
identifier
ENTRY
For a stand-alone program ENTRY
directive tell the assembler that this
is where program start execution.
only one entry point per program.
AREA Simple,CODE,READONLY
ENTRY
MOV R1,#00000010H
MOV R2,R1
ADD R2,R0,R1,LSR #1
RSB R0,R2,R1
END