Proc Emb - Ch2
Proc Emb - Ch2
1
Chapter Syllabus
ARM Architectures and Processors
What is ARM Architecture
ARM Processor Families
ARM Cortex-M Series
Cortex-M4 Processor
ARM Processor vs. ARM Architectures
2
ARM ARCHITECTURES AND
PROCESSORS
3
What is ARM Architecture
ARM architecture is a family of RISC-based processor architectures
Well-known for its power efficiency;
Hence widely used in mobile devices, such as smartphones and tablets
Designed and licensed to a wide eco-system by ARM
ARM Holdings
The company designs ARM-based processors;
Does not manufacture, but licenses designs to semiconductor partners who add their own Intellectual Property
(IP) on top of ARM’s IP, fabricate and sell to customers;
Also offer other IP apart from processors, such as physical IPs, interconnect IPs, graphics cores, and development
tools.
4
ARM Processor Families
Cortex-A57
Cortex-A series (Application) Cortex-A53
Cortex-A15
High performance processors capable of full Operating System (OS) support;
Cortex-A9 Cortex-A
Applications include smartphones, digital TV, smart books, home gateways etc. Cortex-A8
Cortex-A7
Cortex-R series (Real-time) Cortex-A5
Cortex-R7
High performance for real-time applications;
Cortex-R5 Cortex-R
High reliability Cortex-R4
Cortex-M4
Applications include automotive braking system, powertrains etc. Cortex-M3
IP libraries SoC
Cortex-A9 Cortex-R5 Cortex-M4 ARM
ROM RAM
processor
ARM7 ARM9 ARM11
System bus ARM-based
DRAM ctrl FLASH ctrl SRAM ctrl SoC
Peripherals
AXI bus AHB bus APB bus
6
ARM Cortex-M Series
Cortex-M series: Cortex-M0, M0+, M1, M3, M4.
Energy-efficiency
Lower energy cost, longer battery life
Smaller code
Lower silicon costs
Ease of use
Faster software development and reuse
Embedded applications
Smart metering, human interface devices, automotive and industrial control systems, white goods,
consumer products and medical instrumentation
As of Dec 2013
7
ARM Processors vs. ARM Architectures
ARM architecture
Describes the details of instruction set, programmer’s model, exception model, and memory map
Documented in the Architecture Reference Manual
ARM processor
Developed using one of the ARM architectures
More implementation details, such as timing information
Documented in processor’s Technical Reference Manual
Von 1 or 32
Cortex-M0 ARMv6-M Most Subset No No Software No
Neumann cycle
Von 1 or 32
Cortex-M0+ ARMv6-M Most Subset No No Software No
Neumann cycle
Von 3 or 33
Cortex-M1 ARMv6-M Most Subset No No Software No
Neumann cycle
Cortex-M4 ARMv7E-M Harvard Entire Entire 1 cycle Yes Yes Hardware Optional
9
ARM CORTEX-M4 PROCESSOR
OVERVIEW
10
Cortex-M4 Processor Overview
Cortex-M4 Processor
Introduced in 2010
Designed with a large variety of highly efficient signal processing features
Features extended single-cycle multiply accumulate instructions, optimized SIMD arithmetic, saturating
arithmetic and an optional Floating Point Unit.
High Performance Efficiency
1.25 DMIPS/MHz (Dhrystone Million Instructions Per Second / MHz) at the order of µWatts / MHz
Enhanced Determinism
The critical tasks and interrupt routines can be served quickly in a known number of cycles
11
Cortex-M4 Processor Features
32-bit Reduced Instruction Set Computing (RISC) processor
Harvard architecture
Separated data bus and instruction bus
Instruction set
Include the entire Thumb®-1 (16-bit) and Thumb®-2 (16/ 32-bit) instruction sets
Supported Interrupts
Non-maskable Interrupt (NMI) + 1 to 240 physical interrupts
8 to 256 interrupt priority levels
12
Cortex-M4 Processor Features
Supports Sleep Modes
Integrated WFI (Wait For Interrupt) and WFE (Wait For Event) Instructions and Sleep On Exit capability (to be covered in more detail
later)
Sleep & Deep Sleep Signals
Debug
Optional JTAG & Serial-Wire Debug (SWD) Ports
Optional FPU
Nested Vector Optional
Optional Interrupt
WIC Embedded
Controller Processor core Trace Macrocell
(Wakeup (NVIC)
Interrupt
Controller)
Optional
Optional Memory Optional Serial
Debug
protection unit Wire Viewer
Access Port
Optional Optional
Flash Data
patch watchpoints
Bus matrix
SRAM and
Code interface
peripheral interface
14
Cortex-M4 Block Diagram
Processor core
Contains internal registers, the ALU, data path, and some control logic
Registers include sixteen 32-bit registers for both general and special usage
Some instructions may take multiple cycles to execute, in which case the pipeline will be stalled
Time
15
Cortex-M4 Block Diagram
16
Cortex-M4 Block Diagram
Bus interconnect
Allows data transfer to take place on different buses simultaneously
Provides data transfer management, e.g. a write buffer, bit-oriented operations (bit-band)
May include bus bridges (e.g. AHB-to-APB bus bridge) to connect different buses into a network
using a single global memory space
Includes the internal bus system, the data path in the processor core, and the AHB LITE interface
unit
Debug subsystem
Handles debug control, program breakpoints, and data watchpoints
When a debug event occurs, it can put the processor core in a halted state, where developers can
analyse the status of the processor at that point, such as register values and flags
17
ARM CORTEX-M4 PROCESSOR
REGISTERS
18
Cortex-M4 Registers
Processor registers
The internal registers are used to store and process temporary data within the processor core
All registers are inside the processor core, hence they can be accessed quickly
Load-store architecture
◦ To process memory data, they have to be first loaded from memory to registers, processed inside the
processor core using register data only, and then written back to memory if needed
Cortex-M4 registers
Register bank
◦ Sixteen 32-bit registers (thirteen are used for general-purpose);
Special registers
19
Cortex-M4 Registers R0
R1
R2
R3
Low
Registers
R4
Register bank
R5
General purpose
register R6
R7
R8
R9
R10 High
Registers
R11
R12 MSP
Stack Pointer (SP) Main Stack Pointer
R13(banked)
Link Register (LR) R14 PSP
Program Counter (PC) Process Stack Pointer
R15
Special registers Program Status Registers (PSR) x PSR APSR EPSR IPSR
BASEPRI
Stack definition CONTROL
20
Cortex-M4 Registers
R0 – R12: general purpose registers
Low registers (R0 – R7) can be accessed by any instruction Data Data
High registers (R8 – R12) sometimes cannot be accessed e.g. by some Thumb (16-bit) PUSH POP
instructions
Low
Current PC Current LR
PC LR
1. Save current Main Main
PC to LR Program Program
Code region
code
Code region
LR Load PC with the code
address in LR to
return to the main
2. Load PC with program
the starting
address of the
subroutine subroutine
subroutine Current PC
PC
22
Cortex-M4 Registers
xPSR, combined Program Status Register
Provides information about program execution and ALU flags
Application PSR (APSR)
Interrupt PSR (IPSR)
Execution PSR (EPSR)
23
Cortex-M4 Registers
APSR
N: negative flag – set to one if the result from ALU is negative
Q: sticky saturation flag – set to one if saturation has occurred in saturating arithmetic instructions, or overflow has occurred
in certain multiply instructions
IPSR
ISR number – current executing interrupt service routine number
EPSR
T: Thumb state – always one since Cortex-M4 only supports the Thumb state (more on processor states in the next module)
24
ARM CORTEX-M4 PROCESSOR
MEMORY MAP
25
Cortex-M4 Memory Map
Nevertheless, despite of the default memory map, the actual usage of the memory map
can also be flexibly defined by the user, except some fixed memory addresses, such as
internal private peripheral bus
26
Cortex-M4 Memory Map
Reserved for other purposes Vendor specific 0xFFFFFFFF
ROM table
Memory 0xE0100000
512MB
Private peripherals Private Peripheral Bus 0xE00FFFFF External PPB
e.g. NVIC, SCS (PPB) 0xE0000000
External PPB
0xDFFFFFFF
Embedded trace macrocell
Mainly used for external peripherals Trace port interface unit
e.g. SD card External device 1GB
Reserved
0xA0000000
0x9FFFFFFF System Control Space, including
Mainly used for external memories Nested Vectored Interrupt
e.g. external DDR, FLASH, LCD External RAM 1GB Controller (NVIC) Internal PPB
0x60000000 Reserved
Mainly used for on-chip peripherals 0x5FFFFFFF
Fetch patch and breakpoint unit
e.g. AHB, APB peripherals Peripherals 512MB
0x40000000 Data watchpoint and trace unit
0x3FFFFFFF
Mainly used for data memory
e.g. on-chip SRAM, SDRAM SRAM 512MB Instrumentation trace macrocell
0x20000000
0x1FFFFFFF
Mainly used for program code
Code 512MB
e.g. on-chip FLASH 0x00000000
27
Cortex-M4 Memory Map
Code Region
Primarily used to store program code
Can also be used for data memory
On-chip memory, such as on-chip FLASH
SRAM Region
Primarily used to store data, such as heaps and stacks
Can also be used for program code
On-chip memory; despite its name “SRAM”, the actual device could be SRAM, SDRAM or other types
Peripheral Region
Primarily used for peripherals, such as Advanced High-performance Bus (AHB) or Advanced Peripheral Bus
(APB) peripherals
On-chip peripherals
28
Cortex-M4 Memory Map
29