EECS 373: Design of Microprocessor-Based Systems
EECS 373: Design of Microprocessor-Based Systems
Prabal Dutta
University of Michigan
1
Announcements
2
Recap of the last lecture
3
Architecture
4
In the context of computers,
what does architecture mean?
5
Architecture has many meanings
6
What is an
Instruction Set Architecture (ISA)?
7
An ISA defines the hardware/software interface
8
ARM Architecture roadmap
9
ARM Cortex-M3 ISA
Branching
Data processing
Load/Store
Exceptions
Miscellaneous
32-bits 32-bits
Endianess Endianess
10
Registers
Mode dependent
11
Address Space
12
Instruction Encoding
ADD immediate
13
Branch
14
Data processing instructions
15
Load/Store instructions
16
Miscellaneous instructions
17
Addressing Modes
• Offset Addressing
– Offset is added or subtracted from base register
– Result used as effective address for memory access
– [<Rn>, <offset>]
• Pre-indexed Addressing
– Offset is applied to base register
– Result used as effective address for memory access
– Result written back into base register
– [<Rn>, <offset>]!
• Post-indexed Addressing
– The address from the base register is used as the EA
– The offset is applied to the base and then written back
– [<Rn>], <offset>
<offset> options
• An immediate constant
– #10
• An index register
– <Rm>
• SUB Rx, Ry
– Rx = Rx - Ry
– APSR unchanged
• SUBS
– Rx = Rx - Ry
– APSR N or Z bits might be set
• ADD Rx, Ry
– Rx = Rx + Ry
– APSR unchanged
• ADDS
– Rx = Rx + Ry
– APSR C or V bits might be set
Conditional execution:
Append to many instructions for conditional execution
The ARM architecture “books” for this class
23
The ARM software tools “books” for this class
24
An ARM assembly language program for GNU
_start:
.word STACK_TOP, start
start:
movs r0, #10
movs r1, #0
loop:
adds r1, r0
subs r0, #1
bne loop
deadloop:
b deadloop
.end
25
A simple Makefile
all:
arm-none-eabi-as -mcpu=cortex-m3 -mthumb example1.s -o example1.o
arm-none-eabi-ld -Ttext 0x0 -o example1.out example1.o
arm-none-eabi-objcopy -Obinary example1.out example.bin
arm-none-eabi-objdump -S example1.out > example1.list
26
An ARM assembly language program for GNU
_start:
.word STACK_TOP, start
start:
movs r0, #10
movs r1, #0
loop:
adds r1, r0
subs r0, #1
bne loop
deadloop:
b deadloop
.end
27
Disassembled object code
00000000 <_start>:
0: 20000800 .word 0x20000800
4: 00000009 .word 0x00000009
00000008 <start>:
8: 200a movs r0, #10
a: 2100 movs r1, #0
0000000c <loop>:
c: 1809 adds r1, r1, r0
e: 3801 subs r0, #1
10: d1fc bne.n c <loop>
00000012 <deadloop>:
12: e7fe b.n 12 <deadloop>
28
Questions?
Comments?
Discussion?
29