Cortex-M Architecture: Microprocessor Systems
Cortex-M Architecture: Microprocessor Systems
Microprocessor Systems
Cortex-M Architecture
Contents
1 Introduction
2 Microprocessor Architecture
2/43
Introduction Microprocessor Architecture Data Path and Address Map NVIC and Bus System Memory and Peripherals
Processor
Family ARM7TDMI ARM9E ARM11, Cortex-M0, Cortex-M1 Cortex-M, Cortex-R, Cortex-A
Cortex-M3/M4,
ARM1136, Cortex-R4, Cortex-
1176, A8
1156T2
Processor
Cores
ARM926, 946, Cortex-M0,
966, Cortex-M1
ARM7TDMI, Intel XScale (FPGA)
920T,
Intel StrongARM
Architecture
ARMv4/v4T ARMv5/v5E ARMv6 ARMv7
Version
3/43
Introduction Microprocessor Architecture Data Path and Address Map NVIC and Bus System Memory and Peripherals
4/43
Introduction Microprocessor Architecture Data Path and Address Map NVIC and Bus System Memory and Peripherals
Microcontroller Architecture
5/43
Introduction Microprocessor Architecture Data Path and Address Map NVIC and Bus System Memory and Peripherals
Microcontroller Architecture
Microprocessor Core
(Cortex-M4/M3) Debug
NVIC
Interface
Instruction Data
SysTick
Bus Matrix
Developed by ARM
Peripherals
Memory
I/Os
Developed by ARM
or Chip Manufacturers
6/43
Introduction Microprocessor Architecture Data Path and Address Map NVIC and Bus System Memory and Peripherals
ARM Cortex-M
Cortex-M3
Cortex-M4
7/43
Introduction Microprocessor Architecture Data Path and Address Map NVIC and Bus System Memory and Peripherals
8/43
Introduction Microprocessor Architecture Data Path and Address Map NVIC and Bus System Memory and Peripherals
ARM ISA
Cortex-M3
(ARMv7-M) Thumb Instructions
(16-bit)
9/43
Introduction Microprocessor Architecture Data Path and Address Map NVIC and Bus System Memory and Peripherals
10/43
Introduction Microprocessor Architecture Data Path and Address Map NVIC and Bus System Memory and Peripherals
100 100
80 80
Processing Speed
Memory Usage
60 60
40 40
20 20
0 0
ARM Thumb-2 Thumb ARM Thumb-2 Thumb
11/43
Introduction Microprocessor Architecture Data Path and Address Map NVIC and Bus System Memory and Peripherals
Register Set
• General-purpose registers, R0-R12
1. Registers R0-R7 are called low registers.
2. Registers R8-R12 are called high registers (not accesible by any
THUMB instruction).
• Stack Pointer (SP): Register R13 is used as the Stack Pointer
(SP). It is a banked register with two copies, namely Main
Stack Pointer (MSP) and Process Stack Pointer (PSP).
• Link Register (LR): Register R14 is the subroutine Link
Register (LR).
• Program Counter (PC): Register R15 is called the program
counter register. PC contains the current program or
instruction address that is to be executed.
12/43
Introduction Microprocessor Architecture Data Path and Address Map NVIC and Bus System Memory and Peripherals
R0 R8
R1 R9
R3 R11
General-purpose
Low registers
R4 R12
Figure: General purpose along with some special purpose registers. All of
the registers are 32-bit.
13/43
Introduction Microprocessor Architecture Data Path and Address Map NVIC and Bus System Memory and Peripherals
14/43
Introduction Microprocessor Architecture Data Path and Address Map NVIC and Bus System Memory and Peripherals
APSR N Z C V Q
15/43
Introduction Microprocessor Architecture Data Path and Address Map NVIC and Bus System Memory and Peripherals
16/43
Introduction Microprocessor Architecture Data Path and Address Map NVIC and Bus System Memory and Peripherals
17/43
Introduction Microprocessor Architecture Data Path and Address Map NVIC and Bus System Memory and Peripherals
18/43
Introduction Microprocessor Architecture Data Path and Address Map NVIC and Bus System Memory and Peripherals
Figure: Write port indexed via RW on falling edge when WE=1. Read
ports indexed via RA, RB
19/43
Introduction Microprocessor Architecture Data Path and Address Map NVIC and Bus System Memory and Peripherals
20/43
Introduction Microprocessor Architecture Data Path and Address Map NVIC and Bus System Memory and Peripherals
Thread Mode
CONTROL-Bit0 (Unprivileged or User)
0→1
Operating System
(Privileged & Main Stack)
21/43
Introduction Microprocessor Architecture Data Path and Address Map NVIC and Bus System Memory and Peripherals
Thread
CONTROL-Bit0 (Unprivilege
0→1
Operating System
(Privileged & Main Stack)
User Application
(Unprivileged & Process
Stack)
22/43
Introduction Microprocessor Architecture Data Path and Address Map NVIC and Bus System Memory and Peripherals
23/43
Introduction Microprocessor Architecture Data Path and Address Map NVIC and Bus System Memory and Peripherals
24/43
Introduction Microprocessor Architecture Data Path and Address Map NVIC and Bus System Memory and Peripherals
25/43
Introduction Microprocessor Architecture Data Path and Address Map NVIC and Bus System Memory and Peripherals
26/43
Introduction Microprocessor Architecture Data Path and Address Map NVIC and Bus System Memory and Peripherals
Data Path
27/43
Introduction Microprocessor Architecture Data Path and Address Map NVIC and Bus System Memory and Peripherals
(a)
Fetch Decode Execute Instruction 1
Execution Sequence
28/43
Introduction Microprocessor Architecture Data Path and Address Map NVIC and Bus System Memory and Peripherals
Register
Bank Barrel
Mul/Div
Shifter
ALU
Address
incrementer A
Address
Register
Write Back
IBUS-Address
Address
Incrementer
INT-Address
Address
Register
DBus-Address
29/43
Introduction Microprocessor Architecture Data Path and Address Map NVIC and Bus System Memory and Peripherals
30/43
Introduction Microprocessor Architecture Data Path and Address Map NVIC and Bus System Memory and Peripherals
External Peripherals
0xA0000000
0x60000000
Peripherals
0x40000000
SRAM
0x20000000
32/43
Introduction Microprocessor Architecture Data Path and Address Map NVIC and Bus System Memory and Peripherals
33/43
Introduction Microprocessor Architecture Data Path and Address Map NVIC and Bus System Memory and Peripherals
34/43
Introduction Microprocessor Architecture Data Path and Address Map NVIC and Bus System Memory and Peripherals
External PPB
Bus Matrix (APB) debug
interface
AHB-AP Bus
(DAP)
ICode Bus Dcode Bus System
(AHB) (AHB) Bus (AHB)
System Bus (AHB)
Bus
Multiplexer
Timer
Keypad
Digital/
Analog I/O
35/43
Introduction Microprocessor Architecture Data Path and Address Map NVIC and Bus System Memory and Peripherals
0xE0100000
External Peripheral
Instruction
Bus
External RAM
Cortex-M3
Bus Matrix With
Bit-Bander SYSTEM AHB
Aligner Peripherals
Data Bus
Peripheral
RAM
0x20000000
ICODE AHB
Code Space
DCODE AHB
Debug Access 0x00000000
Port (DAP)
36/43
Introduction Microprocessor Architecture Data Path and Address Map NVIC and Bus System Memory and Peripherals
Address Data
A0 D0 LS Byte
A1 D1
A2 D2
A3 D3 MS Byte
Register
D3 D2 D1 D0 Word Transfer D0 D1 D2 D3
31 16 15 0 31 16 15 0
D1 D0 Half-Word Transfer D0 D1
31 16 15 0 31 16 15 0
D0 Byte Transfer D0
37/43
Introduction Microprocessor Architecture Data Path and Address Map NVIC and Bus System Memory and Peripherals
Bit Banding
• Each bit in the bit-band region is accessed separately in the
LSB of 32-bit contents at word-aligned bit-band alias address
Bit-band Alias
Bit-band Region Region
x 1 0x23FFFF84
0x200FFFFC 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1
x 1 0x23FFFF80
...
...
x 0 0x22000090
x 1 0x2200008C
...
0x20000004 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
x 1 0x22000004
0x20000000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 x 0 0x22000000
38/43
Introduction Microprocessor Architecture Data Path and Address Map NVIC and Bus System Memory and Peripherals
39/43
Introduction Microprocessor Architecture Data Path and Address Map NVIC and Bus System Memory and Peripherals
Stack Implementation
40/43
Introduction Microprocessor Architecture Data Path and Address Map NVIC and Bus System Memory and Peripherals
time time
(a) (a)
...
...
Peripherals Peripherals
0x40000000
SRAM
SRAM
PSP
Process stack region (accessed by PSP)
MSP
Main stack region (Accessed using MSP)
When stack is Main stack region (accessed using MSP)
empty MSP
0x20000000
0x00000000
(b) (b)
41/43
Introduction Microprocessor Architecture Data Path and Address Map NVIC and Bus System Memory and Peripherals
time time
(a) (a)
...
...
Peripherals Peripherals
0x40000000 0x40000000
SRAM
SRAM
PSP
Process stack region (accessed by PSP)
0x20000000 0x20000000
0x00000000 0x00000000
(b) (b)
42/43
Introduction Microprocessor Architecture Data Path and Address Map NVIC and Bus System Memory and Peripherals
References
43/43