Cortex-M3 Exceptions RTLAB. Hyeonggon Jo.  Exceptions Exception types & priority Abort model SVC and PendSV  Interrupt operation Pre-emption & Exit.

Slides:



Advertisements
Similar presentations
Processes and Threads Chapter 3 and 4 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
Advertisements

More on Processes Chapter 3. Process image _the physical representation of a process in the OS _an address space consisting of code, data and stack segments.
ECE 353 Introduction to Microprocessor Systems
Lab III Real-Time Embedded Operating System for a SoC System.
Developing a Generic Hard Fault handler for ARM Cortex-M3/Cortex-M4
Cortex-M3 Exceptions and Interrupts
Interrupts Chapter 8 – pp Chapter 10 – pp Appendix A – pp 537 &
HW/SW Interface Operating Systems Design and Implementation.
COMP3221: Microprocessors and Embedded Systems Lecture 15: Interrupts I Lecturer: Hui Wu Session 1, 2005.
Architectural Support for OS March 29, 2000 Instructor: Gary Kimura Slides courtesy of Hank Levy.
Exception Processing ECE511: Digital System & Microprocessor.
7/23 Coldfire Exceptions and Interrupts Computer Science & Engineering Department Arizona State University Tempe, AZ Dr. Yann-Hang Lee
Interrupt Processing Haibo Wang ECE Department
Chapter 7 Interupts DMA Channels Context Switching.
Midterm Tuesday October 23 Covers Chapters 3 through 6 - Buses, Clocks, Timing, Edge Triggering, Level Triggering - Cache Memory Systems - Internal Memory.
Computer System Structures memory memory controller disk controller disk controller printer controller printer controller tape-drive controller tape-drive.
1 Interrupts INPUT/OUTPUT ORGANIZATION: Interrupts CS 147 JOKO SUTOMO.
COMP3221 lec27-exception-I.1 Saeid Nooshabadi COMP 3221 Microprocessors and Embedded Systems Lectures 27: Exceptions & Interrupts - I
1 Process Description and Control Chapter 3 = Why process? = What is a process? = How to represent processes? = How to control processes?
Process Description and Control A process is sometimes called a task, it is a program in execution.
The Cortex-M3 Embedded Systems: Cortex-M3 Exceptions and Interrupts Refer to Chapter 7, 8, 9 in the reference book “The Definitive Guide the ARM Cortex-M3”
1 Computer System Overview Chapter 1 Review of basic hardware concepts.
The Cortex-M3 Embedded Systems: The Cortex-M3 Processor Basics
The ARM Programmer’s Model
What are Exception and Interrupts? MIPS terminology Exception: any unexpected change in the internal control flow – Invoking an operating system service.
Exception and Interrupt Handling
Introduction to Embedded Systems
Protection and the Kernel: Mode, Space, and Context.
Lecture 23: LM3S9B96 Microcontroller - Interrupts.
CORTEX-M0 Structure Discussion 2 – Core Peripherals
1 Computer System Overview Chapter 1. 2 n An Operating System makes the computing power available to users by controlling the hardware n Let us review.
CHAPTER 3 TOP LEVEL VIEW OF COMPUTER FUNCTION AND INTERCONNECTION
Introduction to Embedded Systems Rabie A. Ramadan 6.
Khaled A. Al-Utaibi  Interrupt-Driven I/O  Hardware Interrupts  Responding to Hardware Interrupts  INTR and NMI  Computing the.
1 CS/COE0447 Computer Organization & Assembly Language Chapter 5 part 4 Exceptions.
Department of Electrical Engineering, National Taiwan Ocean University ARM Cortex-M0 Introduction 3/1/2012 Richard Kuo Assistant Professor.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction Purpose  This training course provides an overview of the CPU architecture.
ARM Cortex-M0 August 23, 2012 Paul Nickelsberg Orchid Technologies Engineering and Consulting, Inc. CORTEX-M0 Structure Discussion.
AT91 Interrupt Handling. 2 Stops the execution of main software Redirects the program flow, based on an event, to execute a different software subroutine.
Operating Systems 1 K. Salah Module 1.2: Fundamental Concepts Interrupts System Calls.
6-1 Infineon 167 Interrupts The C167CS provides 56 separate interrupt sources that may be assigned to 16 priority levels. The C167CS uses a vectored interrupt.
Resets & Interrupts MTT CPU08 Core Motorola CPU08 RESETS & INTERRUPTS.
9/20/6Lecture 3 - Instruction Set - Al1 Exception Handling.
Renesas Electronics America Inc. © 2011 Renesas Electronics America Inc. All rights reserved. RX Interrupt Control Unit (ICU) Ver
The Cortex-M3 Embedded Systems: LM3S9B96 Microcontroller – Interrupts Refer to Chapter 4 in the reference book “Stellaris® LM3S9B96 Microcontroller - DATA.
Interrupts and Exception Handling. Execution We are quite aware of the Fetch, Execute process of the control unit of the CPU –Fetch and instruction as.
ARM7 TDMI INTRODUCTION.
Introduction to Exceptions 1 Introduction to Exceptions ARM Advanced RISC Machines.
Interrupt 마이크로 프로세서 (Micro Processor) 2015년 2학기 충북대학교 전자공학과 박 찬식
Exceptions and Interrupts Chap 7, 8 Tae-min Hwang.
-Low Power and System Control Features
ARM Cortex M3 & M4 Chapter 4 - Architecture
Interrupt and Exception Programming
Microprocessor Systems Design I
Refer to Chapter 7, 8, 9 in the reference book
Mon. Oct 2 Announcements Quiz Postponed to Wednesday – still only on 2.a + 2.b Video lecture for 2.a posted Lab 6 experiment extension You must come to.
Timer and Interrupts.
ARM Cortex-M3 RTLAB 박 유 진.
Day 08 Processes.
Day 09 Processes.
Interrupt and Exception Programming
Interrupt and Exception Programming
Interrupt and Exception Programming
Computer System Overview
Interrupt and Exception Programming
Interrupt and Exception Programming
Interrupt handling Explain how interrupts are used to obtain processor time and how processing of interrupted jobs may later be resumed, (typical.
ARM Introduction.
Computer System Overview
COMP3221: Microprocessors and Embedded Systems
Presentation transcript:

Cortex-M3 Exceptions RTLAB. Hyeonggon Jo

 Exceptions Exception types & priority Abort model SVC and PendSV  Interrupt operation Pre-emption & Exit Tail-chaining & Late-arriving Exception control transfer Contents.

 Automatic state saving and restoring  Automatic reading of the vector table entry  Support for tail-chaining, late-arriving  Dynamic reprioritization  Configurable number of interrupt, from 1 to 240, interrupt priorities, from 3 to 8 bits  The processor supports two separate stacks Exceptions

Address Exception number Value 0x MSP initial value 0x Reset vector ( LSB = 1 to represent thumb mode) 0x NMI handler start address 0x C3Hard fault handler start address ……Another exception handler start address Vector Table  Vector table offset register Aligned by size of vector table  4 records of vector table are must needed on boot image head

EXCEPTION TYPEPOSITIONPRIORITY -0- Reset1-3 (highest) NMI2-2 Hard Fault3 Memory Management Fault4Configurable Bus Fault5Configurable Usage Fault6Configurable SVC11Configurable Debug Monitor12Configurable -13- PendSV14Configurable SysTick15Configurable External Interrupt16 and aboveConfigurable Exception types

 Priority level – from 0 to 255 Control register length – 3 ~ 8 bits (number of priorities – 8 ~ 256 level) Pre-emptive & interrupt pending Pre-emption level – 128 Exception priority MSB to control lengthRemain bits Valid number for priorityReading for 0

Exception priority (cont’) Binary position Pre- emption field Sub priority field Number of pre- emption priorities Number of subpriorities 0XXXXXXX.Y[7:1][0]1282 1XXXXXX.YY[7:2][1:0]644 2XXXXX.YYY[7:3][2:0]328 3XXXX.YYYY[7:4][3:0]16 4XXX.YYYYY[7:5][4:0]832 5XX.YYYYYY[7:6][5:0]464 6X.YYYYYYY[7:7][6:0] YYYYYYYYNone[7:0]0256

Interrupt pending Interrupt request Interrupt Pending state Processor mode Thread mode handler mode

 Bus fault (BFSR, BFAR)  Memory management fault (MMSR, MMAR)  Usage fault (UFSR)  Hard fault (HFSR) Abort model

 To occur system call  Change privilege mode  SVC vs. SWI SVC & PendSV User program SVC kernel API Device driver peripheral OS User mode Privilege mode

 SVC may occur usage fault  Pend SV is Possible Pending (lowest priority) SVC & PendSV (cont’) time Context switch SYSTICK IRQ thread OS Task A IRQ OS Task B OS IRQ Task A Priority Context switch Usage fault IRQ delay

SVC & PendSV (cont’) Context switch SYSTICK IRQ thread Task A IRQ OS IRQ Task A Priority Context switch SVC pendSV SVC Pend svc Task B Pend svc SYSTICK

 Pre-emption & Exit Stacking – Un-stacking PC, xPSR, r0-r3, r12, LR Vector fetch Register update – update SP,PSR,PC,LR Interrupt sequence Pre SP(N)- N-4xPSR N-8PC N-12LR N-16R12 N-20R3 N-24R2 N-28R1 New SP (N-32) R0

Tail-chaining Interrupt#1 (lower priority) Interrupt#2 (higher priority) Processor state Main program ISR #1 ISR #2 Interrupt#1 event StackingUn-Stacking Interrupt exit Interrupt exit Thread mode handler mode handler mode Thread mode

threadException sequenceISR #2 stacking threadHandler instruction fetch Late-arriving Interrupt#1 (lower priority) Interrupt#2 (higher priority) Processor state Data bus Instruction bus Vector fetch

Processor activity at assertion of exception Transfer to exception processing Non-memory instructionTakes exception on completion of cycle. Load/Store singleCompletes or abandons depending on bus status. Load/Store multiple Completes or abandons current register and sets continuation counter into EPSR. Exception entryThis is a late-arriving exception. Tail-chainingThis is a late-arriving exception. Exception post ambleThis is a tail-chains exception. Exception control transfer

Q&A