SlideShare a Scribd company logo
1 of 38
ARM Training
CortexM3 Subsystem
Date – 28/03/2012
raghav.nayak@st.com
2
Agenda
 CortexM3 Subsystem
 Peripherals
 SW Development
 Debugging
 Tool Demo
CortexM3 Processor
 CortexM3 Core
 Nested Vector Interrupt Controller
 Bus Interface
 Debug Access Port
 Memory Protection Unit
 ETM, ITM and TPIU
 WIC
 Flash Patch Breakpoint
 Data Watchpoint and Trace
 ROM Table
3
Garnet Implementation
4
5
CortexM3 Core
 ARM v7M Architecture
 Harvard Architecture
 3 stage pipeline
 Thumb and Thumb-2
Instruction set
 Low latency interrupt
handling
 Speculative Branch
Prediction
 Single cycle multiplication
 H/W division support
 Unaligned access
 Big Endian support
Modes and States
 Execution State
 Thumb
 Debug
 Execution Mode
 Thread
 Handler
 Resource Access
 Privileged
 User or Unprivileged
6
Data Types and Registers
 Data Type Support
 Byte, Half-Word and Word
 32 bit pointer
 Signed or unsigned Byte, Half-Word, Word and
Double word
 Registers
 16 32-bit register
 R0-R12 general purpose register, SP, LR and PC
 Banked Stack Pointer (Main and Process)
 3 Program Status Register
 3 Mask Register
 1 Control Register – 3 bit to select access/stack
7
Registers …cont…
8
Registers …cont…
 Program Status Register (PSR)
 Application PSR
 N, C, Z, V, Q and GE[3-0] Condition flags
 Interrupt PSR
 Holds the exception number of the currently executed
exception
 Execution PSR
 T and ICI/IT bit fields
9
Registers …cont…
10
 Mask Register
 PRIMASK
 1-bit Register
 changes the execution priority to 0(Highest Priority)
 FAULTMASK
 1-bit Register
 Changes the execution priority to -1(Hard Fault)
 BASEPRI
 8-bit Register
 Changes the priority level required for preemption
Instruction Set
11
 Unified Assembly Language Syntax
 16 bit or 32 bit Instructions
 Data Processing
 MOV, ASR, LSL, ROR, ADD, SUB, REV, MUL, UDIV, CMP,
TST, CMN, AND, ORR, BIC, BFI, EOR, CPY
 Process control
 B, BX, BL, CBNZ, CBZ
 Load/Store
 LDR, STR, LDRH, STRH, LDRB, STRB, LDRD, STRD, LDM,
STM, LDREX, STREX
 Serial/Miscellaneous
 DMB, DSB, ISB, WFI, WFE, MRS, MSR, CPS, SEV, CLREX,
SVC
Exception
 Synchronous or Asynchronous events
 External or System events
 Reset, Supervisor Call, Fault or Interrupt
 Preempting exception
 Active, Pending, Active-Pending or Inactive state
 Programmable priority
 Except Reset = -3, NMI = -2 and HardFault = -1
 Stack context supports AAPCS
 Exception handler should be AAPCS compliant
12
Exception …cont…
 Entry Behavior
 Stack Alignment correction
 Hardware saves context state to stack
 Exit Behavior
 POP/LDM, LDR or BX loads 0xFxxxxxxx into PC
 Hardware restores context state from stack
 Revert Stack alignment correction
13
Exception …cont…
14
 Vector is fetched in parallel to stack activity
 R0-R3, R12, xPSR, LR and PC stored and
restored by hardware
 12 cycle latency PUSH/POP
Exception …cont…
 Tail Chaining Exception
 Optimized exception entry and exit sequence
 Six clock cycle for zero wait state memory
 No stack PUSH and POP operation
15
Exception …cont…
 Late arriving exception
 High priority exception handling during exception entry
sequence
 Optimized exception entry and exit sequence
16
Fault
17
 MemManage
 Generated by MPU
 instruction or data memory access
 BusFault
 Memory access failures due to error in Bus Activity
 Instruction and data transaction
 HardFault
 Generic fault used for escalation
 UsageFault
 Non-memory related events caused by instruction
 Undefined instruction, invalid state, exception return
Bit Banding
 enable direct access to single bit of data
 32MB alias region mapped to 1MB bit band
region
 Memory access is atomic
18
Nested Vector Interrupt Controller
 32 external interrupts and 5-bit priority level
 Reduced interrupt latency
 Supports nesting interrupt
 Supports dynamic priority
 Controls power management scheme
 Supports both level and edge triggered interrupt
 Privileged access
 Little endian register access
 Supports Non Maskable Interrupt (NMI)
 Provides 24-bit down timer (SysTick)
19
Bus Interface
 32-bit AMBA3 AHB Lite Port
 ICode Interface
 Instruction fetch from memory range 0x0-0x1FFFFFFF
 No debug access
 DCode Interface
 Data and debug access on memory range 0x0-0x1FFFFFFF
 System Interface
 Instruction, Data and debug access on memory range
0x20000000-0xDFFFFFFF and 0xE0100000-0xFFFFFFFF
 32-bit AMBA3 APB port
 Private Peripheral Bus
 Data and debug access on memory range 0xE0000000-
0xE00FFFFF
20
System Memory Map
21
System Control Space
 32 bit registers in 4KB address space
 CPUID and vendor Identification
 Fault detection and handling
 Interrupt configuration, detection and handling
 Exception priority control
 Sleep Mode handling
 Debug control and status
22
Debug
 Invasive debug
 2 hardware and 6 software breakpoint
 Based on CoreSight debug architecture
 Serial Wire and JTAG Debug Port
 FPB supports halt, single step execution
 AHB-AP provides access to memory and
registers in the system
 Target Identification
 Read the CPUID register from System Control Space
in ROM table
 Breakpoint information from FPB in ROM table
23
Peripherals
 DMA
 8 channels, 16 requests through 16 line
 2 Master and 1 Slave port
 2 interrupt request line
 Single and Burst request with burst length 1024 bytes
 Flow control and big endian support
 UART
 Max 460800 and Min 110 baud
 Programmable baud rate, stop bit, parity bit, FIFO
trigger level, flow control
 32X8 transmit and 32X12 receive FIFO
 DMA and Interrupt support
24
Peripherals …cont…
 Dual Timer
 2 configurable 32 or 16 bit down counters
 Free running, periodic or one-shot
 Programmable 1, 16 or 256 pre-scalar values
 Runs at Core clock
 interrupt signaling on zero count
 Watchdog
 32 bit down counter
 Enabled or disabled by software
 Reset the system to recover from software failure
 Provides mechanism to avoid unauthorise access
 Runs at Core clock
25
MDK-ARM Tool
26
uVision4 IDE
 Source code editor
 Device database
 Project Manager
 Integrated Make utility
 Dialogs for
Environment Setting
 Target CPU Simulator
 Flash Program Utility
 Debug using ULINK
Debug Adapter
27
Software Development Cycle
 Create a new Project
 Configure device database and tool setting
 Create new source files and add to the project
 Build the project
 Fix build errors
 Optimize application
 Download image to Flash ROM or SRAM
 Execute the application
28
ULINK2 Pro
 Provides interfaces
 JTAG to target board
 USB to Host PC
 Supports
 Checking memory and
registers
 Breakpoints and single
step execution
 Image download and
execution in real-time
 Program memory flash
29
Coding Hint
 Speed optimization
 Size optimization
 Power optimization
 MicroLIB to reduce code size
 Use 32 bit variables for local and parameters
 Place scalars at the beginning of a struct variable
30
Startup code
31
Startup code ..cont…
32
Scatter file
33
Build Mode
34
Debug Mode
35
IP Validation
 Stand alone validation
 Independent of OS
 Independent of Flash/ROM code
 CPU Startup and Interrupt Initialization code
 Scatter file for flexible code execution
 No additional latency due to OS
 Single test or All test execution
36
Questions?
37
Reference
 Garnet Architecture specification
 ARMv7-M architecture reference manual
 CortexM3 Technical reference manual
38
10.201.59.94specs

More Related Content

What's hot

Session 8,9 PCI Express
Session 8,9 PCI ExpressSession 8,9 PCI Express
Session 8,9 PCI Express
Subhash Iyer
 

What's hot (20)

Verilog Tasks & Functions
Verilog Tasks & FunctionsVerilog Tasks & Functions
Verilog Tasks & Functions
 
Introduction to arm architecture
Introduction to arm architectureIntroduction to arm architecture
Introduction to arm architecture
 
LPC 2148 ARM MICROCONTROLLER
LPC 2148 ARM MICROCONTROLLERLPC 2148 ARM MICROCONTROLLER
LPC 2148 ARM MICROCONTROLLER
 
Uart
UartUart
Uart
 
Part-2: Mastering microcontroller with embedded driver development
Part-2: Mastering microcontroller with embedded driver developmentPart-2: Mastering microcontroller with embedded driver development
Part-2: Mastering microcontroller with embedded driver development
 
8086 architecture By Er. Swapnil Kaware
8086 architecture By Er. Swapnil Kaware8086 architecture By Er. Swapnil Kaware
8086 architecture By Er. Swapnil Kaware
 
8086 Microprocessor
8086 Microprocessor8086 Microprocessor
8086 Microprocessor
 
Arm cortex-m4 programmer model
Arm cortex-m4 programmer modelArm cortex-m4 programmer model
Arm cortex-m4 programmer model
 
Session 8,9 PCI Express
Session 8,9 PCI ExpressSession 8,9 PCI Express
Session 8,9 PCI Express
 
PIC 16F877 micro controller by Gaurav raikar
PIC 16F877 micro controller by Gaurav raikarPIC 16F877 micro controller by Gaurav raikar
PIC 16F877 micro controller by Gaurav raikar
 
ATmega32-AVR microcontrollers-Part I
ATmega32-AVR microcontrollers-Part IATmega32-AVR microcontrollers-Part I
ATmega32-AVR microcontrollers-Part I
 
Ec8791 lpc2148
Ec8791 lpc2148Ec8791 lpc2148
Ec8791 lpc2148
 
Unit II Arm 7 Introduction
Unit II Arm 7 IntroductionUnit II Arm 7 Introduction
Unit II Arm 7 Introduction
 
Overview of LPC214x MCUs
Overview of LPC214x MCUsOverview of LPC214x MCUs
Overview of LPC214x MCUs
 
Pentium processor
Pentium processorPentium processor
Pentium processor
 
PIC 16F877A by PARTHIBAN. S.
PIC 16F877A   by PARTHIBAN. S.PIC 16F877A   by PARTHIBAN. S.
PIC 16F877A by PARTHIBAN. S.
 
Embedded systems basics
Embedded systems basicsEmbedded systems basics
Embedded systems basics
 
Important questions
Important questionsImportant questions
Important questions
 
8086 microprocessor-architecture
8086 microprocessor-architecture8086 microprocessor-architecture
8086 microprocessor-architecture
 
8086 architecture and pin description
8086 architecture and pin description 8086 architecture and pin description
8086 architecture and pin description
 

Viewers also liked

A Comparative Analysis Among PWM Control Z-source Inverter with Conventional ...
A Comparative Analysis Among PWM Control Z-source Inverter with Conventional ...A Comparative Analysis Among PWM Control Z-source Inverter with Conventional ...
A Comparative Analysis Among PWM Control Z-source Inverter with Conventional ...
Mustafa Xaved
 

Viewers also liked (20)

Lpc1768
Lpc1768Lpc1768
Lpc1768
 
Power the world with mbed LPC1768
Power the world with mbed LPC1768Power the world with mbed LPC1768
Power the world with mbed LPC1768
 
SPEED CONTROL OF INDUCTION MACHINE WITH REDUCTION IN TORQUE RIPPLE USING ROBU...
SPEED CONTROL OF INDUCTION MACHINE WITH REDUCTION IN TORQUE RIPPLE USING ROBU...SPEED CONTROL OF INDUCTION MACHINE WITH REDUCTION IN TORQUE RIPPLE USING ROBU...
SPEED CONTROL OF INDUCTION MACHINE WITH REDUCTION IN TORQUE RIPPLE USING ROBU...
 
Up and running with Teensy 3.1
Up and running with Teensy 3.1Up and running with Teensy 3.1
Up and running with Teensy 3.1
 
5 geo 2º bim
5 geo 2º bim5 geo 2º bim
5 geo 2º bim
 
Introduction to the extended essay for supervisors
Introduction to the extended essay for supervisorsIntroduction to the extended essay for supervisors
Introduction to the extended essay for supervisors
 
STM32 F4 (PWM,SPI And ADC Test Examples)
STM32 F4 (PWM,SPI And ADC Test Examples)STM32 F4 (PWM,SPI And ADC Test Examples)
STM32 F4 (PWM,SPI And ADC Test Examples)
 
présentation STM32
présentation STM32présentation STM32
présentation STM32
 
Design Report
Design ReportDesign Report
Design Report
 
Single Phase PWM Rectifier In Traction Application
Single Phase PWM Rectifier In Traction ApplicationSingle Phase PWM Rectifier In Traction Application
Single Phase PWM Rectifier In Traction Application
 
Deploy mbed IoT cloud
Deploy mbed IoT cloudDeploy mbed IoT cloud
Deploy mbed IoT cloud
 
A Comparative Analysis Among PWM Control Z-source Inverter with Conventional ...
A Comparative Analysis Among PWM Control Z-source Inverter with Conventional ...A Comparative Analysis Among PWM Control Z-source Inverter with Conventional ...
A Comparative Analysis Among PWM Control Z-source Inverter with Conventional ...
 
Matrix Converter based Direct Torque Control of Induction Motor
Matrix Converter based Direct Torque Control of Induction MotorMatrix Converter based Direct Torque Control of Induction Motor
Matrix Converter based Direct Torque Control of Induction Motor
 
Direct Torque Control of Matrix Converter fed BLDC motor
Direct Torque Control of Matrix Converter fed BLDC motorDirect Torque Control of Matrix Converter fed BLDC motor
Direct Torque Control of Matrix Converter fed BLDC motor
 
Simulation of sinosoidal pulse width modulation
Simulation of sinosoidal pulse width modulationSimulation of sinosoidal pulse width modulation
Simulation of sinosoidal pulse width modulation
 
Brochure postgraduate 2017
Brochure postgraduate 2017Brochure postgraduate 2017
Brochure postgraduate 2017
 
Dc motor speed controller by pwm technique
Dc motor speed controller by pwm techniqueDc motor speed controller by pwm technique
Dc motor speed controller by pwm technique
 
AVR_Course_Day8 motor drive and pwm techniques
AVR_Course_Day8 motor drive and pwm techniquesAVR_Course_Day8 motor drive and pwm techniques
AVR_Course_Day8 motor drive and pwm techniques
 
DIRECT TORQUE CONTROL OF THREE PHASE INDUCTION MOTOR USING FOUR SWITCH THREE ...
DIRECT TORQUE CONTROL OF THREE PHASE INDUCTION MOTOR USING FOUR SWITCH THREE ...DIRECT TORQUE CONTROL OF THREE PHASE INDUCTION MOTOR USING FOUR SWITCH THREE ...
DIRECT TORQUE CONTROL OF THREE PHASE INDUCTION MOTOR USING FOUR SWITCH THREE ...
 
vector control of induction motor
vector control of induction motorvector control of induction motor
vector control of induction motor
 

Similar to ARM Cortex-M3 Training

Arm cortex-m3 by-joe_bungo_arm
Arm cortex-m3 by-joe_bungo_armArm cortex-m3 by-joe_bungo_arm
Arm cortex-m3 by-joe_bungo_arm
Prashant Ahire
 
Chp1 68000 microprocessor copy
Chp1 68000 microprocessor   copyChp1 68000 microprocessor   copy
Chp1 68000 microprocessor copy
mkazree
 
Intel x86 Architecture
Intel x86 ArchitectureIntel x86 Architecture
Intel x86 Architecture
ChangWoo Min
 
03 Mcu Day 2009 (C2000) 8 13 Editado
03   Mcu Day 2009 (C2000) 8 13   Editado03   Mcu Day 2009 (C2000) 8 13   Editado
03 Mcu Day 2009 (C2000) 8 13 Editado
Texas Instruments
 

Similar to ARM Cortex-M3 Training (20)

PIC32MX Microcontroller Family
PIC32MX Microcontroller FamilyPIC32MX Microcontroller Family
PIC32MX Microcontroller Family
 
Arm cortex-m3 by-joe_bungo_arm
Arm cortex-m3 by-joe_bungo_armArm cortex-m3 by-joe_bungo_arm
Arm cortex-m3 by-joe_bungo_arm
 
Overview Study on PIC32MX3XX / 4XX 32-Bit Controller
Overview Study on PIC32MX3XX / 4XX 32-Bit ControllerOverview Study on PIC32MX3XX / 4XX 32-Bit Controller
Overview Study on PIC32MX3XX / 4XX 32-Bit Controller
 
STM32 MCU Family
STM32 MCU FamilySTM32 MCU Family
STM32 MCU Family
 
computer architecture
computer architecture computer architecture
computer architecture
 
ARM stacks, subroutines, Cortex M3, LPC 214X
ARM  stacks, subroutines, Cortex M3, LPC 214XARM  stacks, subroutines, Cortex M3, LPC 214X
ARM stacks, subroutines, Cortex M3, LPC 214X
 
Introduction to i.MX27 Multimedia Applications Processors
Introduction to i.MX27 Multimedia Applications ProcessorsIntroduction to i.MX27 Multimedia Applications Processors
Introduction to i.MX27 Multimedia Applications Processors
 
PIC32MX5XX/6XX/7XX USB, CAN and Ethernet 32-Bit Flash Microcontrollers
PIC32MX5XX/6XX/7XX USB, CAN and Ethernet 32-Bit Flash MicrocontrollersPIC32MX5XX/6XX/7XX USB, CAN and Ethernet 32-Bit Flash Microcontrollers
PIC32MX5XX/6XX/7XX USB, CAN and Ethernet 32-Bit Flash Microcontrollers
 
soc ip core based for spacecraft application
soc ip core based for spacecraft applicationsoc ip core based for spacecraft application
soc ip core based for spacecraft application
 
MCF5223x: Integrated ColdFire V2 Ethernet Microcontrollers
MCF5223x: Integrated ColdFire V2 Ethernet MicrocontrollersMCF5223x: Integrated ColdFire V2 Ethernet Microcontrollers
MCF5223x: Integrated ColdFire V2 Ethernet Microcontrollers
 
Lec02
Lec02Lec02
Lec02
 
Chp1 68000 microprocessor copy
Chp1 68000 microprocessor   copyChp1 68000 microprocessor   copy
Chp1 68000 microprocessor copy
 
Intel x86 Architecture
Intel x86 ArchitectureIntel x86 Architecture
Intel x86 Architecture
 
Arm architecture
Arm architectureArm architecture
Arm architecture
 
Introducing OMAP-L138/AM1808 Processor Architecture and Hawkboard Peripherals
Introducing OMAP-L138/AM1808 Processor Architecture and Hawkboard PeripheralsIntroducing OMAP-L138/AM1808 Processor Architecture and Hawkboard Peripherals
Introducing OMAP-L138/AM1808 Processor Architecture and Hawkboard Peripherals
 
x86_1.ppt
x86_1.pptx86_1.ppt
x86_1.ppt
 
Study on 32-bit Cortex - M3 Powered MCU: STM32F101
Study on 32-bit Cortex - M3 Powered MCU: STM32F101Study on 32-bit Cortex - M3 Powered MCU: STM32F101
Study on 32-bit Cortex - M3 Powered MCU: STM32F101
 
03 Mcu Day 2009 (C2000) 8 13 Editado
03   Mcu Day 2009 (C2000) 8 13   Editado03   Mcu Day 2009 (C2000) 8 13   Editado
03 Mcu Day 2009 (C2000) 8 13 Editado
 
Q4.11: ARM Architecture
Q4.11: ARM ArchitectureQ4.11: ARM Architecture
Q4.11: ARM Architecture
 
MPC854XE: PowerQUICC III Processors
MPC854XE: PowerQUICC III ProcessorsMPC854XE: PowerQUICC III Processors
MPC854XE: PowerQUICC III Processors
 

Recently uploaded

"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
mphochane1998
 
Introduction to Robotics in Mechanical Engineering.pptx
Introduction to Robotics in Mechanical Engineering.pptxIntroduction to Robotics in Mechanical Engineering.pptx
Introduction to Robotics in Mechanical Engineering.pptx
hublikarsn
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
Epec Engineered Technologies
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ssuser89054b
 
Query optimization and processing for advanced database systems
Query optimization and processing for advanced database systemsQuery optimization and processing for advanced database systems
Query optimization and processing for advanced database systems
meharikiros2
 

Recently uploaded (20)

"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
 
Introduction to Robotics in Mechanical Engineering.pptx
Introduction to Robotics in Mechanical Engineering.pptxIntroduction to Robotics in Mechanical Engineering.pptx
Introduction to Robotics in Mechanical Engineering.pptx
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdf
 
Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
 
Electromagnetic relays used for power system .pptx
Electromagnetic relays used for power system .pptxElectromagnetic relays used for power system .pptx
Electromagnetic relays used for power system .pptx
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
Query optimization and processing for advanced database systems
Query optimization and processing for advanced database systemsQuery optimization and processing for advanced database systems
Query optimization and processing for advanced database systems
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
Worksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptxWorksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptx
 
Augmented Reality (AR) with Augin Software.pptx
Augmented Reality (AR) with Augin Software.pptxAugmented Reality (AR) with Augin Software.pptx
Augmented Reality (AR) with Augin Software.pptx
 
Linux Systems Programming: Inter Process Communication (IPC) using Pipes
Linux Systems Programming: Inter Process Communication (IPC) using PipesLinux Systems Programming: Inter Process Communication (IPC) using Pipes
Linux Systems Programming: Inter Process Communication (IPC) using Pipes
 
Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)
 
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
 
Introduction to Geographic Information Systems
Introduction to Geographic Information SystemsIntroduction to Geographic Information Systems
Introduction to Geographic Information Systems
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...
 

ARM Cortex-M3 Training

  • 1. ARM Training CortexM3 Subsystem Date – 28/03/2012 raghav.nayak@st.com
  • 2. 2 Agenda  CortexM3 Subsystem  Peripherals  SW Development  Debugging  Tool Demo
  • 3. CortexM3 Processor  CortexM3 Core  Nested Vector Interrupt Controller  Bus Interface  Debug Access Port  Memory Protection Unit  ETM, ITM and TPIU  WIC  Flash Patch Breakpoint  Data Watchpoint and Trace  ROM Table 3
  • 5. 5 CortexM3 Core  ARM v7M Architecture  Harvard Architecture  3 stage pipeline  Thumb and Thumb-2 Instruction set  Low latency interrupt handling  Speculative Branch Prediction  Single cycle multiplication  H/W division support  Unaligned access  Big Endian support
  • 6. Modes and States  Execution State  Thumb  Debug  Execution Mode  Thread  Handler  Resource Access  Privileged  User or Unprivileged 6
  • 7. Data Types and Registers  Data Type Support  Byte, Half-Word and Word  32 bit pointer  Signed or unsigned Byte, Half-Word, Word and Double word  Registers  16 32-bit register  R0-R12 general purpose register, SP, LR and PC  Banked Stack Pointer (Main and Process)  3 Program Status Register  3 Mask Register  1 Control Register – 3 bit to select access/stack 7
  • 9. Registers …cont…  Program Status Register (PSR)  Application PSR  N, C, Z, V, Q and GE[3-0] Condition flags  Interrupt PSR  Holds the exception number of the currently executed exception  Execution PSR  T and ICI/IT bit fields 9
  • 10. Registers …cont… 10  Mask Register  PRIMASK  1-bit Register  changes the execution priority to 0(Highest Priority)  FAULTMASK  1-bit Register  Changes the execution priority to -1(Hard Fault)  BASEPRI  8-bit Register  Changes the priority level required for preemption
  • 11. Instruction Set 11  Unified Assembly Language Syntax  16 bit or 32 bit Instructions  Data Processing  MOV, ASR, LSL, ROR, ADD, SUB, REV, MUL, UDIV, CMP, TST, CMN, AND, ORR, BIC, BFI, EOR, CPY  Process control  B, BX, BL, CBNZ, CBZ  Load/Store  LDR, STR, LDRH, STRH, LDRB, STRB, LDRD, STRD, LDM, STM, LDREX, STREX  Serial/Miscellaneous  DMB, DSB, ISB, WFI, WFE, MRS, MSR, CPS, SEV, CLREX, SVC
  • 12. Exception  Synchronous or Asynchronous events  External or System events  Reset, Supervisor Call, Fault or Interrupt  Preempting exception  Active, Pending, Active-Pending or Inactive state  Programmable priority  Except Reset = -3, NMI = -2 and HardFault = -1  Stack context supports AAPCS  Exception handler should be AAPCS compliant 12
  • 13. Exception …cont…  Entry Behavior  Stack Alignment correction  Hardware saves context state to stack  Exit Behavior  POP/LDM, LDR or BX loads 0xFxxxxxxx into PC  Hardware restores context state from stack  Revert Stack alignment correction 13
  • 14. Exception …cont… 14  Vector is fetched in parallel to stack activity  R0-R3, R12, xPSR, LR and PC stored and restored by hardware  12 cycle latency PUSH/POP
  • 15. Exception …cont…  Tail Chaining Exception  Optimized exception entry and exit sequence  Six clock cycle for zero wait state memory  No stack PUSH and POP operation 15
  • 16. Exception …cont…  Late arriving exception  High priority exception handling during exception entry sequence  Optimized exception entry and exit sequence 16
  • 17. Fault 17  MemManage  Generated by MPU  instruction or data memory access  BusFault  Memory access failures due to error in Bus Activity  Instruction and data transaction  HardFault  Generic fault used for escalation  UsageFault  Non-memory related events caused by instruction  Undefined instruction, invalid state, exception return
  • 18. Bit Banding  enable direct access to single bit of data  32MB alias region mapped to 1MB bit band region  Memory access is atomic 18
  • 19. Nested Vector Interrupt Controller  32 external interrupts and 5-bit priority level  Reduced interrupt latency  Supports nesting interrupt  Supports dynamic priority  Controls power management scheme  Supports both level and edge triggered interrupt  Privileged access  Little endian register access  Supports Non Maskable Interrupt (NMI)  Provides 24-bit down timer (SysTick) 19
  • 20. Bus Interface  32-bit AMBA3 AHB Lite Port  ICode Interface  Instruction fetch from memory range 0x0-0x1FFFFFFF  No debug access  DCode Interface  Data and debug access on memory range 0x0-0x1FFFFFFF  System Interface  Instruction, Data and debug access on memory range 0x20000000-0xDFFFFFFF and 0xE0100000-0xFFFFFFFF  32-bit AMBA3 APB port  Private Peripheral Bus  Data and debug access on memory range 0xE0000000- 0xE00FFFFF 20
  • 22. System Control Space  32 bit registers in 4KB address space  CPUID and vendor Identification  Fault detection and handling  Interrupt configuration, detection and handling  Exception priority control  Sleep Mode handling  Debug control and status 22
  • 23. Debug  Invasive debug  2 hardware and 6 software breakpoint  Based on CoreSight debug architecture  Serial Wire and JTAG Debug Port  FPB supports halt, single step execution  AHB-AP provides access to memory and registers in the system  Target Identification  Read the CPUID register from System Control Space in ROM table  Breakpoint information from FPB in ROM table 23
  • 24. Peripherals  DMA  8 channels, 16 requests through 16 line  2 Master and 1 Slave port  2 interrupt request line  Single and Burst request with burst length 1024 bytes  Flow control and big endian support  UART  Max 460800 and Min 110 baud  Programmable baud rate, stop bit, parity bit, FIFO trigger level, flow control  32X8 transmit and 32X12 receive FIFO  DMA and Interrupt support 24
  • 25. Peripherals …cont…  Dual Timer  2 configurable 32 or 16 bit down counters  Free running, periodic or one-shot  Programmable 1, 16 or 256 pre-scalar values  Runs at Core clock  interrupt signaling on zero count  Watchdog  32 bit down counter  Enabled or disabled by software  Reset the system to recover from software failure  Provides mechanism to avoid unauthorise access  Runs at Core clock 25
  • 27. uVision4 IDE  Source code editor  Device database  Project Manager  Integrated Make utility  Dialogs for Environment Setting  Target CPU Simulator  Flash Program Utility  Debug using ULINK Debug Adapter 27
  • 28. Software Development Cycle  Create a new Project  Configure device database and tool setting  Create new source files and add to the project  Build the project  Fix build errors  Optimize application  Download image to Flash ROM or SRAM  Execute the application 28
  • 29. ULINK2 Pro  Provides interfaces  JTAG to target board  USB to Host PC  Supports  Checking memory and registers  Breakpoints and single step execution  Image download and execution in real-time  Program memory flash 29
  • 30. Coding Hint  Speed optimization  Size optimization  Power optimization  MicroLIB to reduce code size  Use 32 bit variables for local and parameters  Place scalars at the beginning of a struct variable 30
  • 36. IP Validation  Stand alone validation  Independent of OS  Independent of Flash/ROM code  CPU Startup and Interrupt Initialization code  Scatter file for flexible code execution  No additional latency due to OS  Single test or All test execution 36
  • 38. Reference  Garnet Architecture specification  ARMv7-M architecture reference manual  CortexM3 Technical reference manual 38 10.201.59.94specs