Professional Documents
Culture Documents
Architectures
A Comprehensive Overview
ARM University Program
September 2012
Agenda
Introduction
ARM Architecture Overview
ARMv7-AR Architecture
Programmers Model
Memory Systems
ARMv7-M Architecture
Programmers Model
Memory Systems
Floating Point Extensions
ARM Ltd
Other products fabric IP, software tools, models, cell libraries - to help partners
develop and ship ARM-based SoCs
More information about ARM and our offices on our web site:
http://www.arm.com/aboutarm/
University Program Material
Copyright ARM Ltd 2012
Embedded Processors
Application Processors
Agenda
Introduction
ARMv7-M Architecture
Programmers Model
Memory Systems
Floating Point Extensions
v5
Improved
interworking
CLZ
Saturated arithmetic
DSP MAC
instructions
Extensions:
Jazelle (5TEJ)
v6
SIMD Instructions
Multi-processing
v6 Memory architecture
Unaligned data support
Extensions:
Thumb-2 (6T2)
TrustZone (6Z)
Multicore (6K)
Thumb only (6-M)
v7
Thumb-2
Architecture Profiles
7-A - Applications
7-R - Real-time
7-M - Microcontroller
10
11
Agenda
Introduction
ARMv7-M Architecture
Programmers Model
Memory Systems
Floating Point Extensions
12
13
Cortex-A8
ARMv7-A Architecture
Thumb-2
Thumb-2EE (Jazelle-RCT)
TrustZone extensions
Custom or synthesized design
MMU
64-bit or 128-bit AXI Interface
L1 caches
16 or 32KB each
Unified L2 cache
0-2MB in size
8-way set-associative
Optional features
VFPv3 Vector Floating-Point
14
Cortex-A9
ARMv7-A Architecture
Thumb-2, Thumb-2EE
TrustZone support
Variable-length Multi-issue
pipeline
Register renaming
Speculative data prefetching
Branch Prediction & Return
Stack
16-64KB each
4-way set-associative
Optional features:
PTM instruction trace interface
15
Cortex-A15 MPCore
512KB 4MB
System-wide coherency
support with AMBA 4 ACE
Backward-compatible with
AXI3 interconnect
Integrated Interrupt Controller
CoreSight debug
Advanced Power Management
16
Agenda
Introduction
ARM Architecture Overview
ARMv7-AR Architecture
Programmers Model
Memory Systems
ARMv7-M Architecture
Programmers Model
Memory Systems
Floating Point Extensions
17
Thumb-2 technology added many extra 32- and 16-bit instructions to the original 16bit Thumb instruction set
18
Processor Modes
Exception modes
Each mode has access to its own stack space and a different subset of registers
Some operations can only be carried out in a privileged mode
Mode
Description
Supervisor
(SVC)
FIQ
IRQ
Abort
Undef
System
User
Privileged
modes
Unprivileged
mode
19
IRQ
FIQ
Undef
Abort
SVC
r13 (sp)
r14 (lr)
r8
r9
r10
r11
r12
r13 (sp)
r14 (lr)
r13 (sp)
r14 (lr)
r13 (sp)
r14 (lr)
r13 (sp)
r14 (lr)
spsr
spsr
spsr
spsr
spsr
cpsr
Current mode
University Program Material
Copyright ARM Ltd 2012
28 27
N Z C V
24
23
19
Q [de] J
GE[3:0]
s
10
16 15
IT[abc]
x
E A I F T
mode
T bit
T = 0: Processor in ARM state
T = 1: Processor in Thumb state
J bit
J = 1: Processor in Jazelle state
Mode bits
Specify the processor mode
E bit
E = 0: Data load/store is little endian
E = 1: Data load/store is bigendian
A bit
A = 1: Disable imprecise data aborts
21
Method differs between ARM and Thumb, but the principle is that most (ARM) or
all (Thumb) instructions can be executed conditionally.
22
ADC
ADD
SUB
logical
SBC
RSB
BIC
move
ORR
AND
EOR
RSC
CMN
CMP
TST
TEQ
(ADDS)
(SUBS)
(ANDS)
(EORS)
Syntax:
<Operation>{<cond>}{S} {Rd,} Rn, Operand2
Examples:
MOV
ORN
comparison
MVN
; r0 = r1 + r2
; if r0 = r1, Z flag will be set
; copy r1 to r0
23
STRB
STRH
Memory
Byte
Halfword
Signed byte load
Signed halfword load
Rd
Syntax:
Example:
31
Upper bits zero filled or
sign extended on Load
24
4 addressing modes
Increment after/before
Decrement after/before
Base Register (Rb) r10
(IA)
IB
DA
DB
r4
r4
r1
r1
r0
r0
Increasing
Address
r4
r1
r4
r0
r1
r0
Also
PUSH/POP, equivalent to STMDB/LDMIA with SP! as base register
Example
LDM
r10, {r0,r1,r4}
PUSH
{r4-r6,pc}
25
Subroutines
func1
func2
:
BL func2
:
:
BX lr
26
27
Exception Handling
0x1C
0x18
0x10
(Reserved)
Data Abort
0x0C
Prefetch Abort
0x08
Supervisor Call
0x04
Undefined Instruction
0x00
Reset
0x14
Vector Table
Cores can enter ARM state or Thumb state when
taking an exception
FIQ
IRQ
28
Main
Application
Exception
handler
<users code>
4. Return to main application
What is NEON?
Elements
Dm
Dd
Operation
Destination
Register
Lane
University Program Material
Copyright ARM Ltd 2012
30
D0
Q0
D1
D2
Q1
D3
:
D30
Q15
D31
31
+
pa
127
University Program Material
Copyright ARM Ltd 2012
0
32
Agenda
Introduction
ARM Architecture Overview
ARMv7-AR Architecture
Programmers Model
Memory Systems
ARMv7-M Architecture
Programmers Model
Memory Systems
Floating Point Extensions
33
Memory Types
34
L1 and L2 Caches
L2 Cache
ARM Core
BIU
MMU/MPU
I-Cache RAM
On-chip
SRAM
Off-chip
Memory
D-Cache RAM
L1
L2
L3
35
Cache Lockdown
Cache Lookup can hit before a Linefill is complete (also checks Linefill buffer)
Streaming, Critical-Word-First
Cache data is forwarded to the core as soon as the requested word is received in
36
Set (= Index)
31
Word
13 12
5 4
8
19
Byte
2 1
Cache line
Victim
Counter
Tag
v Data
Tag
Data
Line 0
Tag vv
Data
Line 0
Tag
v Data
Line 1
Line 0
LineLine
1 0
Line 1
Line 1
d
d
d
d
Line 254
Line 30
LineLine
25530
LineLine
31 30
Line 31
Line 31
d - dirty bit(s)
v - valid bit
Include integrated
Interrupt controller
Snoop Control Unit (SCU)
Timers and Watchdogs
38
The Snoop Control Unit (SCU) maintains coherency between L1 data caches
Duplicated Tag RAMs keep track of what data is allocated in each CPUs cache
Arbitrates accesses to L2 AXI master interface(s), for both instructions and data
AXI Master 1
D$
TAG
I$
CPU0
D$
TAG
I$
CPU1
D$
TAG
I$
CPU2
D$
I$
CPU3
39
Interrupt Controller
.......
The IC provides:
External Interrupt
Sources
Interrupt Controller
nIRQ
Global
Timer
Private
Timer
Private
Watchdog
CPU {n}
nFIQ
40
Agenda
Introduction
ARM Architecture Overview
ARMv7-AR Architecture
Programmers Model
Memory Systems
ARMv7-M Architecture
Programmers Model
Memory Systems
Floating Point Extensions
41
42
Cortex-M3
ARMv7-M Architecture
Thumb-2 only
Fully programmable in C
3-stage pipeline
von Neumann architecture
Optional MPU
AHB-Lite bus interface
Fixed memory map
1-240 interrupts
Configurable priority levels
Non-Maskable Interrupt support
Debug and Sleep control
43
Cortex-M0
ARMv6-M Architecture
16-bit Thumb-2 with system control
instructions
Fully programmable in C
3-stage pipeline
von Neuman architecture
AHB-Lite bus interface
Fixed memory map
1-32 interrupts
Configurable priority levels
Non-Maskable Interrupt support
44
Agenda
Introduction
ARM Architecture Overview
ARMv7-AR Architecture
Programmers Model
Memory Systems
ARMv7-M Architecture
Programmers Model
Memory Systems
Floating Point Extensions
45
Registers R0-R12
General-purpose registers
46
2 bits
47
28 27 26 25 24
N Z C V Q IT T
23
20 19
10 9
16 15
GE[3:0]
IT/ICI
ISR Number
IT/ICI bits
ISR Number
T=1
48
Reload on count == 0
Optionally cause SysTick interrupt on count == 0
Reload register
Calibration value
49
Modes Overview
ARM Processor
Application Code
Thread
Mode
Exception
Entry
Reset
Exception
Return
Exception Code
Handler
Mode
50
Data Processing:
MOV
r2, r5
; r2 = r5
ADD
r5, #0x24
; r5 = r5 + 36
ADD
; r2 = r3 + (r4 * 4)
LSL
r2, #3
; r2 = r2 * 8
MLA
; r0 = (r1 * r2) + r3
Memory Access:
STRB r2, [r10, r1]
LDR
Program Flow:
BL
<label>
51
Exception Handling
Exception types:
Reset
Non-maskable Interrupts (NMI)
Faults
PendSV
SVCall
External Interrupt
SysTick Interrupt
Interrupt handling
52
External Interrupts
INTISR[0]
INTISR[N]
INTNMI
NVIC
Cortex-Mx
Processor Core
53
IRQ1
IRQ2
IRQ3
Base CPU
Time
Core Execution
Foreground
ISR2
ISR1
ISR2
ISR3
Foreground
(ISR 2 resumes)
54
Implementation-defined
Maximum table size is 2048 bytes
Vector #
16 + N
External N
0x40
External 0
16
0x3C
SysTick
15
0x38
PendSV
14
0x34
Reserved
13
0x30
Debug Monitor
12
0x2C
SVC
11
0x40 + 4*N
Address
7-10
0x18
Usage Fault
0x14
Bus Fault
0x10
0x0C
Hard Fault
0x08
NMI
0x04
Reset
0x00
Initial Main SP
N/A
55
Reset Behavior
Main
5
4
Reset Handler
3
0x04
0x00
r13 (MSP)
2
1.
2.
3.
4.
5.
56
Exception Behaviour
Main
4
3
1
Exception Handler
2
Exception Vector
1. Exception occurs
57
When receiving an interrupt the processor will finish the current instruction
for most instructions
To minimize interrupt latency, the processor can take an interrupt during the
execution of a multi-cycle instruction - see next slide
During (or after) state saving the address of the ISR is read from the Vector
Table
58
Can return from interrupt with the following instructions when the PC is
loaded with magic value of 0xFFFF_FFFX (same format as EXC_RETURN)
LDR PC, ..
LDM/POP which includes loading the PC
BX LR (most common)
59
Vector Table in C
typedef void(* const ExecFuncPtr)(void) __irq;
#pragma arm section rodata="exceptions_area
ExecFuncPtr exception_table[] = {
(ExecFuncPtr)&Image$$ARM_LIB_STACK$$ZI$$Limit,
/* Initial SP */
(ExecFuncPtr)__main,
/* Initial PC */
NMIException,
The vector table at address
HardFaultException,
0x0 is minimally required to
MemManageException,
have 4 values: stack top,
BusFaultException,
reset routine location,
UsageFaultException,
NMI ISR location,
0, 0, 0, 0,
/* Reserved */
HardFault ISR location
SVCHandler,
The SVCall ISR
DebugMonitor,
location must be
0,
/* Reserved */
populated if the SVC
PendSVC,
instruction will be
SysTickHandler
/* Configurable interrupts start here...*/ Once interrupts are used
};
enabled, the vector
table (whether at 0
#pragma arm section
or in SRAM) must
then have pointers
to all enabled (by
mask) exceptions
University Program Material
Copyright ARM Ltd 2012
60
DCD
||Image$$ARM_LIB_STACK$$ZI$$Limit|| ; Top of Stack
DCD
Reset_Handler
; Reset Handler
DCD
NMI_Handler
; NMI Handler
DCD
HardFault_Handler
; Hard Fault Handler
DCD
MemManage_Handler
; MemManage Fault Handler
DCD
BusFault_Handler
; Bus Fault Handler
DCD
UsageFault_Handler
; Usage Fault Handler
DCD
0, 0, 0, 0,
; Reserved x4
DCD
SVC_Handler,
; SVCall Handler
DCD
Debug_Monitor
; Debug Monitor Handler
DCD
0
; Reserved
DCD
PendSV_Handler
; PendSV Handler
DCD
SysTick_Handler
; SysTick Handler
; External vectors start here
61
Agenda
Introduction
ARM Architecture Overview
ARMv7-AR Architecture
Programmers Model
Memory Systems
ARMv7-M Architecture
Programmers Model
Memory Systems
Floating Point Extensions
62
ROM Table
FFFF_FFFF
UNUSED
E004_2000
E004_1000
E004_0000
512MB
System
ETM
TPIU
(XN)
E000_0000
1GB
E003_FFFF
External
Peripheral
RESERVED
E000_F000
E000_E000
A000_0000
NVIC
RESERVED
E000_3000
E000_2000
E000_1000
E000_0000
FPB
1 GB
DWT
External
SRAM
ITM
6000_0000
512MB
Peripheral
4000_0000
512MB
SRAM
2000_0000
512MB
Code
0000_0000
63
Suitable for different types of memory, for example, ROM, RAM, Flash and SDRAM
Accesses may be restarted
Caches and Write Buffers are permitted to work alongside Normal memory
Caches are not permitted, but write buffers are still supported
Unaligned accesses are unpredictable
Accesses must not be restarted
Buffers are not supported and the PPB is marked Strongly Ordered
University Program Material
Copyright ARM Ltd 2012
64
Type
Reset Value
Function
0xE000E000
Read/Write
0x00000000
0xE000E004
Read Only
IMP DEFINED
0xE000ED00
Read Only
IMP DEFINED
0xE000ED04
Read/Write
0x00000000
0xE000ED08
Read/Write
0x00000000
0xE000ED0C
Read/Write
Bits[10:8] = 000
65
Type
Reset Value
Function
0xE000ED10
Read/Write
0x00000000
0xE000ED14
Read/Write
0x00000000
0xE000ED18
Read/Write
0x00000000
0xE000ED1C
Read/Write
0x00000000
0xE000ED20
Read/Write
0x00000000
0xE000ED24
Read/Write
0x00000000
0xE000ED28
Read/Write
n/a - status
0xE000ED2C
Read/Write
n/a - status
0xE000ED30
Read/Write
n/a - status
0xE000ED34
Read/Write
Unpredictable
0xE000ED38
Read/Write
Unpredictable
0xE000ED3C
Read/Write
Unpredictable
0xE000EF00
Write Only
66
Agenda
Introduction
ARM Architecture Overview
ARMv7-AR Architecture
Programmers Model
Memory Systems
ARMv7-M Architecture
Programmers Model
Memory Systems
Floating Point Extensions
67
Cortex-M4
ARMv7E-M Architecture
Thumb-2 only
DSP extensions
68
32 x 32-bit registers
16 x 64-bit doubleword registers
Any combination of the above
S0
S1
S2
S3
S4
S5
S6
S7
~
~
D1
D2
D3
~
~
S28
S29
S30
S31
University Program Material
Copyright ARM Ltd 2012
D0
~
~
~
~
D14
D15
69
ARMv7-M
Architecture
ARMv6-M
Architecture
70
Agenda
Introduction
ARM Architecture Overview
ARMv7-AR Architecture
Programmers Model
Memory Systems
ARMv7-M Architecture
Programmers Model
Memory Systems
Floating Point Extensions
71
DMA
Port
Clocks and
Reset Controller
CoreSight interface
FLASH
ARM
Processor
core
AMBA AXI
DEBUG
nIRQ
nFIQ
CoreLink
Interrupt
Controller
Other
CoreLink
Peripherals
Custom
Peripherals
External
Memory
Interface
SDRAM
On chip
memory
AMBA APB
APB
Bridge
ARM based
SoC
72
AHB
UART
Timer
APB
Bridge
Keypad
High-bandwidth
on-chip RAM
DMA
Bus Master
High Performance
Pipelined
Burst Support
Multiple Bus Masters
APB
PIO
Low Power
Non-pipelined
Simple Interface
73
AHB Structure
Arbiter
Master
#1
HADDR
HWDATA
HADDR
HWDATA
HRDATA
Slave
#1
HRDATA
Address/Control
Master
#2
Slave
#2
Write Data
Read Data
Slave
#3
Master
#3
Slave
#4
Decoder
74
ARM
Master 2
Inter-connection architecture
Slave
#1
Slave
#2
Slave
#3
Slave
#4
Master interface
Slave interface
75
Agenda
Introduction
ARM Architecture Overview
ARMv7-AR Architecture
Programmers Model
Memory Systems
ARMv7-M Architecture
Programmers Model
Memory Systems
Floating Point Extensions
76
Software Tools
DS-5
Application Edition
Linux Edition
Professional Edition
MDK: Keil
Microcontroller
Development Kit
ULINK
77
DS-5
Eclipse
Compiler
IDE
Debugger
Hardware Debug
Streamline
78
Low cost tools for ARM7, ARM9, Cortex-M and Cortex-R4 MCUs
Real-Time Library
Debug Hardware
Evaluation boards
79
ARM works with CodeSourcery to keep the GNU toolchain current with the
latest ARM processors
Linux Support
ARM does not provide technical support for the GNU toolchain, or Linux
kernel/driver development
80
ARM University
Program
August 2012
81