introduction to interrupts

Size: px
Start display at page:

Download "introduction to interrupts"

Transcription

1 introduction to interrupts Geoffrey Brown Chris Haynes Bryce Himebaugh C335 Fall 2013

2 Overview Why interrupts? Basic interrupt processing Sources of interrupts Handling interrupts Issues with interrupt handlers 2

3 Polling Continually query devices for work. Consider putchar -- if we have to wait for the UART, then every character will consume (at 9600 baud) roughly 1ms -- this is wasted time Polling makes it challenging to meet real-time constraints -- consider feeding an audio signal to an external amplifier. Every sample must be provided at exactly the right interval. 3

4 Interrupts! Interrupts provide a general architecture for satisfying real-time software requirements. Rather than repeatedly asking devices if they need anything (polling them), let them interrupt the processor. 4

5 the big idea For each type of event that needs real-time handling, define a subroutinelike handler that is called when (or not long after) the hardware is informed the service of the need and returns when done. Handlers are sometimes known as callbacks and are also used in related situations such as handling GUI events. Handlers are said to run in the foreground, while other code runs in the background. Before every background instruction is executed, check if any event needs to be handled, and if so synchronize an interrupt by calling the associated handler. When the handler returns, continue with the instruction that was about to be executed. What must be saved with each handler call and restored when the handler returns? 5

6 Interrupt Service Background program code Interrupt handler some inst next inst some sort of ReTurn from Interrupt instruction RETI 6

7 Fetch-execute cycle with interrupts while(1) { if (I && Enabled(I)) } {// Synchronize interrupt I push pc; push sr; Disable(I); pc = Handler(I); } else { inst = Mem[pc]; pc += 4; eval(inst); } Processor External I Device Three processor specific functions Enabled(I) Disable(I) Handler(I) 7

8 Why SR Must be Saved Interrupted Program Interrupt Handler adds r2,... adc r3,... adds r5 RETI Many instructions effect SR Interrupt bit must be cleared to prevent handler being interrupted before it starts 8

9 general Interrupt state diagram Reset Disabled Enable Disable Disable Enabled IRQ Pending Synch Handling RETI 9

10 Key PoinTs If interrupts are enabled, they can occur at any point in the execution of a program. Interrupts must be disabled when when the handler is called (at least those from the same source) and re-enabled when the handler returns. Interrupt handlers are similar to procedures with some important caveats. They must save everything: not just the program counter, but also all other registers they use, including status bits. Other caveats discussed soon. 10

11 Preserving Registers Interrupted Program Interrupt Handler adds r2,... addc r3,... push r2 add r2,... pop r2 RETI 11

12 Memory Layout Interrupt Stack User Stack Heap Separating user and interrupt stacks makes it easier to guarantee interrupts will have the stack space they need. Code Vector Table 12

13 Sources of Interrupts External device interrupts, such as timer UART (serial interface) button Processor exceptions, such as memory faults Software interrupts (special program instructions) Interrupts of all kinds are more generally called exceptions. 13

14 cortex processor modes Depending on their source, exceptions may have very different requirements for latency: response time efficiency: some may be very frequent, others rare Exceptions require privileged assess to memory and other processor resources that is best denied user code. Hence Cortex processors have two modes with differing priority (latency), privilege and other characteristics. each mode can have its own stack space 14

15 Modes Processor mode and privilege levels for software execution The processor modes are: Thread mode Handler mode Used to execute application software. The processor enters Thread mode when it comes out of reset. Used to handle exceptions. The processor returns to Thread mode when it has finished exception processing. The privilege levels for software execution are: Unprivileged The software: Has limited access to the MSR and MRS instructions, and cannot use the CPS instruction Cannot access the system timer, NVIC, or system control block Might have restricted access to memory or peripherals. Unprivileged software executes at the unprivileged level. Privileged options The software can use all the instructions and has access to all resources. Privileged software executes at the privileged level. Processor mode Used to execute Privilege level for software execution Stack used Thread Applications Privileged or unprivileged (1) Main stack or process stack (1) Handler Exception handlers Always privileged Main stack 1. See CONTROL register on page

16 Cortex Registers Figure 2. Processor core registers R0 R1 R2 Low registers R3 R4 R5 R6 General-purpose registers R7 R8 R9 High registers R10 R11 R12 Stack Pointer SP (R13) PSP MSP Banked version of SP Link Register LR (R14) Program Counter PC (R15) PSR PRIMASK Program status register FAULTMASK Exception mask registers Special registers BASEPRI CONTROL CONTROL register ai

17 Privilege and Stacks The processor supports two separate stacks: Process stack Main stack You can configure Thread mode to use the process stack. Thread mode uses the main stack out of reset. SP_process is the Stack Pointer (SP) register for the process stack. Handler mode uses the main stack. SP_main is the SP register for the main stack. Only one stack, the process stack or the main stack, is visible at any time. After pushing the eight registers, the ISR uses the main stack, and all subsequent interrupt pre-emptions use the main stack. The stack that saves context is as follows: Thread mode uses either the main stack or the process stack, depending on the value of the CONTROL bit [1] that Move to Status Register (MSR) or Move to Register from Status (MRS) can access. Appropriate EXC_RETURN values can also set this bit when exiting an ISR. An exception that pre-empts a user thread saves the context of the user thread on the stack that the Thread mode is using. All exceptions use the main stack for their own local variables. Using the process stack for the Thread mode and the main stack for exceptions supports Operating System (OS) scheduling. To reschedule, the kernel only requires to save the eight registers not pushed by hardware, r4-r11, and to copy SP_process into the Thread Control Block (TCB). If the processor saved the context on the main stack, the kernel would have to copy the 16 registers to the TCB. Note M S R a n d M R S i n s t r u c t i o n s h ave v i s i b i l i t y o17 f b o t h s t a c k s.

18 Stacking When the processor invokes an exception, it automatically pushes the following eight registers to the SP in the following order: Program Counter (PC) Processor Status Register (xpsr) r0-r3 r12 Link Register (LR). The SP is decremented by eight words by the completion of the stack push. Figure 5-1 shows the contents of the stack after an exception pre-empts the current program flow. Old SP SP <previous> xpsr PC LR r12 r3 r2 r1 r0 Figure 5-1 Stack contents after a pre-emption Note 18

19 Exceptions The exception types are: Reset NMI Hard fault Reset is invoked on power up or a warm reset. The exception model treats reset as a special form of exception. When reset is asserted, the operation of the processor stops, potentially at any point in an instruction. When reset is deasserted, execution restarts from the address provided by the reset entry in the vector table. Execution restarts as privileged execution in Thread mode. A NonMaskable Interrupt (NMI) can be signalled by a peripheral or triggered by software. This is the highest priority exception other than reset. It is permanently enabled and has a fixed priority of -2. NMIs cannot be: Masked or prevented from activation by any other exception Preempted by any exception other than Reset. A hard fault is an exception that occurs because of an error during exception processing, or because an exception cannot be managed by any other exception mechanism. Hard faults have a fixed priority of -1, meaning they have higher priority than any exception with configurable priority. Memory management fault A memory management fault is an exception that occurs because of a memory protection related fault. The fixed memory protection constraints determines this fault, for both instruction and data memory transactions. This fault is used to abort instruction accesses to Execute Never (XN) memory regions. 19

20 Exceptions Bus fault Usage fault SVCall PendSV SysTick Interrupt (IRQ) A bus fault is an exception that occurs because of a memory related fault for an instruction or data memory transaction. This might be from an error detected on a bus in the memory system. A usage fault is an exception that occurs because of a fault related to instruction execution. This includes: An undefined instruction An illegal unaligned access Invalid state on instruction execution An error on exception return. The following can cause a usage fault when the core is configured to report them: An unaligned address on word and halfword memory access Division by zero A supervisor call (SVC) is an exception that is triggered by the SVC instruction. In an OS environment, applications can use SVC instructions to access OS kernel functions and device drivers. PendSV is an interrupt-driven request for system-level service. In an OS environment, use PendSV for context switching when no other exception is active. A SysTick exception is an exception the system timer generates when it reaches zero. Software can also generate a SysTick exception. In an OS environment, the processor can use this exception as system tick. A interrupt, or IRQ, is an exception signalled by a peripheral, or generated by a software request. All interrupts are asynchronous to instruction execution. In the system, peripherals use interrupts to communicate with the processor. 20

21 Vector Table Figure 12. Vector table Exception number IRQ number Offset Vector x014C IRQ x004C 0x0048 0x0044 0x0040 0x003C 0x0038 IRQ2 IRQ1 IRQ0 Systick PendSV Reserved 12 Reserved for Debug x002C SVCall 9 8 Reserved x0018 0x0014 0x0010 0x000C 0x0008 0x0004 0x0000 Usage fault Bus fault Memory management fault Hard fault NMI Reset Initial SP value 21 ai15995

22 Some Interrupts Table 50. Vector table for STM32F100xx devices (continued) Position Priority Type of priority Acronym Description Address settable EXTI9_5 EXTI Line[9:5] interrupts 0x0000_009C settable TIM1_BRK_TIM settable TIM1_UP_TIM16 TIM1 Break and TIM15 global interrupt TIM1 Update and TIM16 global interrupts 0x0000_00A0 0x0000_00A settable TIM1_TRG_COM_T IM17 TIM1 Trigger and Commutation and TIM17 global interrupts 0x0000_00A settable TIM1_CC TIM1 Capture Compare interrupt 0x0000_00AC settable TIM2 TIM2 global interrupt 0x0000_00B settable TIM3 TIM3 global interrupt 0x0000_00B settable TIM4 TIM4 global interrupt 0x0000_00B settable I2C1_EV I 2 C1 event interrupt 0x0000_00BC settable I2C1_ER I 2 C1 error interrupt 0x0000_00C settable I2C2_EV I 2 C2 event interrupt 0x0000_00C settable I2C2_ER I 2 C2 error interrupt 0x0000_00C settable SPI1 SPI1 global interrupt 0x0000_00CC settable SPI2 SPI2 global interrupt 0x0000_00D settable USART1 USART1 global interrupt 0x0000_00D settable USART2 USART2 global interrupt 0x0000_00D settable USART3 USART3 global interrupt 0x0000_00DC settable EXTI15_10 EXTI Line[15:10] interrupts 0x0000_00E0 RTC Alarms (A and B) through EXTI 22

23 Placement in Memory 23

24 startup Code startup_stm32f10x.c 24

25 Cortex-M3 Figure 1. STM32 Cortex-M3 implementation STM32 Cortex-M3 processor NVIC Processor core Embedded Trace Macrocell Debug access port Flash patch Data watchpoints Serial wire viewer Code interface Bus matrix SRAM and peripheral interface ai

26 NVIC 4.3 Nested vectored interrupt controller (NVIC) This section describes the Nested Vectored Interrupt Controller (NVIC) and the registers it uses. The NVIC supports: up to 81 interrupts (depends on the STM32 device type, refer to the datasheets) A programmable priority level of 0-15 for each interrupt. A higher level corresponds to a lower priority, so level 0 is the highest interrupt priority Level and pulse detection of interrupt signals Dynamic reprioritization of interrupts Grouping of priority values into group priority and subpriority fields Interrupt tail-chaining An external Non-maskable interrupt (NMI) The processor automatically stacks its state on exception entry and unstacks this state on exception exit, with no instruction overhead. This provides low latency exception handling. The hardware implementation of the NVIC registers is: 26

27 NVIC -- interrupt enable Interrupt set-enable registers (NVIC_ISERx) Address offset: 0x00-0x0B Reset value: 0x Required privilege: Privileged SETENA[31:16] rs rs rs rs rs rs rs rs rs rs rs rs rs rs rs rs SETENA[15:0] rs rs rs rs rs rs rs rs rs rs rs rs rs rs rs rs Bits 31:0 SETENA[31:0]: Interrupt set-enable bits. Write: 0: No effect 1: Enable interrupt Read: 0: Interrupt disabled 1: Interrupt enabled. See Table 41: Mapping of interrupts to the interrupt variables on page 120 for the 27

28 Interrupt Active Interrupt active bit registers (NVIC_IABRx) Address offset: 0x00-0x0B Reset value: 0x Required privilege: Privileged The IABR0-IABR2 registers indicate which interrupts are active. The bit assignments are: ACTIVE[31:16] r r r r r r r r r r r r r r r r ACTIVE[15:0] r r r r r r r r r r r r r r r r Bits 31:0 ACTIVE[31:0]: Interrupt active flags 0: Interrupt not active 1: Interrupt active 28

29 Pending Interrupt clear-pending registers (NVIC_ICPRx) Address offset: 0x00-0x0B Reset value: 0x Required privilege: Privileged The ICPR0-ICPR2 registers remove the pending state from interrupts, and show which interrupts are pending CLRPEND[31:16] rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w CLRPEND[15:0] rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 Bits 31:0 CLRPEND[31:0]: Interrupt clear-pending bits Write: 0: No effect 1: Removes the pending state of an interrupt Read: 0: Interrupt is not pending 1: Interrupt is pending See Table 41: Mapping of interrupts to the interrupt variables on page 120 for the 29

30 Software Trigger Software trigger interrupt register (NVIC_STIR) Address offset: 0xE00 Reset value: 0x Required privilege: When the USERSETMPEND bit in the SCR is set to 1, unprivileged software can access the STIR, see Section 4.4.6: System control register (SCB_SCR). Only privileged software can enable unprivileged access to the STIR Reserved Reserved INTID[8:0] w w w w w w w w w Bits 31:9 Reserved, must be kept cleared. Bits 8:0 NTID[8:0] Software generated interrupt ID Write to the STIR to generate a Software Generated Interrupt (SGI). The value to be written is the Interrupt ID of the required SGI, in the range For example, a value of 0b specifies interrupt IRQ3. 30

31 Interrupt Priority Interrupt priority registers (NVIC_IPRx) Address offset: 0x00-0x0B Reset value: 0x Required privilege: Privileged The IPR0-IPR16 registers provide a 4-bit priority field for each interrupt. These registers are byte-accessible. Each register holds four priority fields, that map to four elements in the CMSIS interrupt priority array IP[0] to IP[67], as shown in Figure 19. Figure 19. NVIC IPRx register mapping IPR20 Reserved Reserved Reserved IP[80] IPRm IP[4m + 3] IP[4m + 2] IP[4m + 1] IP[4m ] IPR0 IP[3] IP[2] IP[1] IP[0] Table 42. IPR bit assignments Bits Name Function [31:24] Priority, byte offset 3 [23:16] Priority, byte offset 2 [15:8] Priority, byte offset 1 [7:0] Priority, byte offset 0 Each priority field holds a priority value, The lower the value, the greater the priority of the corresponding interrupt. The processor implements only bits[7:4] of each field, bits[3:0] read as zero and ignore writes. See The CMSIS mapping of the Cortex-M3 NVIC registers on page 120 for more 31

32 Tasks For Interrupt Handler 1. Determine interrupt cause 2. Remove interrupt cause (e.g. clear bit, reset timer, read data) 3. Do anything else that needs to be done 4. Re-enable interrupt and return 32

33 Systick Interrupt void default_handler (void) { while(1); } void SysTick_Handler (void) attribute ((weak, alias ("default_handler"))); 33

34 Vector names For F3, vectors are in file: startup_stm32f30x.s 34

35 Handler Template 35

36 Enabling Interrupts 36

37 External Interrupts 37

38 Configuring External Interrupts 38

39 Preserve, Preserve, Preserve Interrupt handlers must not have unintended side effects. Save and restore all registers used. Don t modify application data. Don t use application I/O resources. 39

40 Issues With Interrupts Shared Procedures Handler 1 Main() Shared Data Shared Devices Handler n Main code and handlers execute asynchronously to each other. 40

41 what could it print? include <stdio.h> int c = 0xff; // volatile prevents use in register volatile int done = 0; void handler(void) { c = c >> 1; done = 1; } int main () { // enable handler c++; while (!done); printf("%d", c); return 0; } 41

42 Shocking answer! 128 or 256 What s going on! 42

43 Here s the assembly handler: ldr r3,.l2 ldr r2, [r3, #0] asr r2, r2, #1 str r2, [r3, #0] mov r2, #1 ldr r3,.l2+4 str r2, [r3, #0] bx lr.l3:.align 2.L2:.word.LANCHOR0.word.LANCHOR1 main:.l5:.l8:.l7: push {r3, lr} ldr r3,.l7 ldr r1, [r3, #0] add r1, r1, #1 str r1, [r3, #0] ldr r2,.l7+4 ldr r3, [r2, #0] cmp r3, #0 beq.l5 ldr r0,.l7+8 bl printf mov r0, #0 pop {r3, pc}.align 2.word.word.word.LANCHOR0.LANCHOR1.LC0

44 Synchronization problem! If the handler interrupt comes after the FETCH instruction but before the STORE instruction, the handler store value is lost due to the main STORE, based on the FETCH value. This is an example of a read/write synchronization problem. If the handler could itself be interrupted and main execution resume before the handler finishes (as might be possible in a more complex operating environment), or if the handler ran on a separate processor (core), the value 127 might also be printed! 44

Design and Implementation Interrupt Mechanism

Design and Implementation Interrupt Mechanism Design and Implementation Interrupt Mechanism 1 Module Overview Study processor interruption; Design and implement of an interrupt mechanism which responds to interrupts from timer and UART; Program interrupt

More information

Exceptions and Interrupts ARM Cortex M3

Exceptions and Interrupts ARM Cortex M3 Exceptions and Interrupts ARM Cortex M3 ผศ.ดร. ส ร นทร ก ตต ธรก ล และ อ.สรย ทธ กลมกล อม 1 Introduction! Exception are events! They occur during the execution of the program! ARM exceptions! Exceptions

More information

Interrupts (Exceptions) Gary J. Minden September 11, 2014

Interrupts (Exceptions) Gary J. Minden September 11, 2014 Interrupts (Exceptions) Gary J. Minden September 11, 2014 1 Interrupts Motivation Implementation Material from Stellaris LM3S1968 Micro-controller Datasheet Sections 2.5 and 2.6 2 Motivation Our current

More information

Interrupts (Exceptions) (From LM3S1968) Gary J. Minden August 29, 2016

Interrupts (Exceptions) (From LM3S1968) Gary J. Minden August 29, 2016 Interrupts (Exceptions) (From LM3S1968) Gary J. Minden August 29, 2016 1 Interrupts Motivation Implementation Material from Stellaris LM3S1968 Micro-controller Datasheet Sections 2.5 and 2.6 2 Motivation

More information

ECE251: Thursday September 27

ECE251: Thursday September 27 ECE251: Thursday September 27 Exceptions: Interrupts and Resets Chapter in text and Lab #6. READ ALL this material! This will NOT be on the mid-term exam. Lab Practical Exam #1 Homework # due today at

More information

COEN-4720 Embedded Systems Design Lecture 4 Interrupts (Part 1) Cristinel Ababei Dept. of Electrical and Computer Engineering Marquette University

COEN-4720 Embedded Systems Design Lecture 4 Interrupts (Part 1) Cristinel Ababei Dept. of Electrical and Computer Engineering Marquette University COEN-4720 Embedded Systems Design Lecture 4 Interrupts (Part 1) Cristinel Ababei Dept. of Electrical and Computer Engineering Marquette University Outline Introduction NVIC and Interrupt Control Interrupt

More information

Interrupts and Low Power Features

Interrupts and Low Power Features ARM University Program 1 Copyright ARM Ltd 2013 Interrupts and Low Power Features Module Syllabus Interrupts What are interrupts? Why use interrupts? Interrupts Entering an Exception Handler Exiting an

More information

ECE254 Lab3 Tutorial. Introduction to Keil LPC1768 Hardware and Programmers Model. Irene Huang

ECE254 Lab3 Tutorial. Introduction to Keil LPC1768 Hardware and Programmers Model. Irene Huang ECE254 Lab3 Tutorial Introduction to Keil LPC1768 Hardware and Programmers Model Irene Huang Lab3 Part A Requirements (1) A function to obtain the task information OS_RESULT os_tsk_get(os_tid task_id,

More information

Cortex-M3 Reference Manual

Cortex-M3 Reference Manual Cortex-M3 Reference Manual EFM32 Microcontroller Family 32-bit ARM Cortex-M3 processor running up to 32 MHz Up to 128 KB Flash and 16 KB RAM memory Energy efficient and fast autonomous peripherals Ultra

More information

ARM Interrupts. EE383: Introduction to Embedded Systems University of Kentucky. James E. Lumpp

ARM Interrupts. EE383: Introduction to Embedded Systems University of Kentucky. James E. Lumpp ARM Interrupts EE383: Introduction to Embedded Systems University of Kentucky James E. Lumpp Includes material from: - Jonathan Valvano, Introduction to ARM Cortex-M Microcontrollers, Volume 1 Ebook, EE

More information

Multitasking on Cortex-M(0) class MCU A deepdive into the Chromium-EC scheduler

Multitasking on Cortex-M(0) class MCU A deepdive into the Chromium-EC scheduler Multitasking on Cortex-M(0) class MCU A deepdive into the Chromium-EC scheduler $whoami Embedded Software Engineer at National Instruments We just finished our first product using Chromium-EC and future

More information

Introduction. ! Exception*are*events*! They*occur*during*the*execution*of*the*program! Type*of*ARM*exceptions*! Exceptions*that*result*by*a*command

Introduction. ! Exception*are*events*! They*occur*during*the*execution*of*the*program! Type*of*ARM*exceptions*! Exceptions*that*result*by*a*command Exceptions and Interrupts ARM Cortex M3 ผศ.ดร. ส ร นทร ก ตต ธรก ล และ อ.สรย ทธ กลมกล อม ภาคว ชาว ศวกรรมคอมพ วเตอร คณะว ศวกรรมศาสตร สถาบ นเทคโนโลย พระจอมเกล าเจ าค ณทหารลาดกระบ ง Introduction! Exception*are*events*!

More information

ARM architecture road map. NuMicro Overview of Cortex M. Cortex M Processor Family (2/3) All binary upwards compatible

ARM architecture road map. NuMicro Overview of Cortex M. Cortex M Processor Family (2/3) All binary upwards compatible ARM architecture road map NuMicro Overview of Cortex M NuMicro@nuvoton.com 1 2 Cortex M Processor Family (1/3) Cortex M0 Cortex M0+ Cortex M3 Cortex M4 Low cost, ultra low power deeply embedded applications

More information

ARM Cortex core microcontrollers

ARM Cortex core microcontrollers ARM Cortex core microcontrollers 2 nd Cortex-M3 core Balázs Scherer Budapest University of Technology and Economics Department of Measurement and Information Systems BME-MIT 2016 The Cortex-M3 core BME-MIT

More information

Embedded System Design

Embedded System Design ĐẠI HỌC QUỐC GIA TP.HỒ CHÍ MINH TRƯỜNG ĐẠI HỌC BÁCH KHOA KHOA ĐIỆN-ĐIỆN TỬ BỘ MÔN KỸ THUẬT ĐIỆN TỬ Embedded System Design Chapter 2: Microcontroller Series (Part 1) 1. Introduction to ARM processors 2.

More information

Lab 4 Interrupt-driven operations

Lab 4 Interrupt-driven operations Lab 4 Interrupt-driven operations Interrupt handling in Cortex-M CPUs Nested Vectored Interrupt Controller (NVIC) Externally-triggered interrupts via GPIO pins Software setup for interrupt-driven applications

More information

The ARM Cortex-M0 Processor Architecture Part-1

The ARM Cortex-M0 Processor Architecture Part-1 The ARM Cortex-M0 Processor Architecture Part-1 1 Module Syllabus ARM Architectures and Processors What is ARM Architecture ARM Processors Families ARM Cortex-M Series Family Cortex-M0 Processor ARM Processor

More information

ECE254 Lab3 Tutorial. Introduction to MCB1700 Hardware Programming. Irene Huang

ECE254 Lab3 Tutorial. Introduction to MCB1700 Hardware Programming. Irene Huang ECE254 Lab3 Tutorial Introduction to MCB1700 Hardware Programming Irene Huang Lab3 Requirements : API Dynamic Memory Management: void * os_mem_alloc (int size, unsigned char flag) Flag takes two values:

More information

EECS 373 Design of Microprocessor-Based Systems

EECS 373 Design of Microprocessor-Based Systems EECS 373 Design of Microprocessor-Based Systems Mark Brehob University of Michigan Lecture 6 & 7: Interrupts (please bring slides again on Wednesday) Sept. 24 th and 26 th Exceptions, Traps, Faults & ARM

More information

OUTLINE. STM32F0 Architecture Overview STM32F0 Core Motivation for RISC and Pipelining Cortex-M0 Programming Model Toolchain and Project Structure

OUTLINE. STM32F0 Architecture Overview STM32F0 Core Motivation for RISC and Pipelining Cortex-M0 Programming Model Toolchain and Project Structure ARCHITECTURE AND PROGRAMMING George E Hadley, Timothy Rogers, and David G Meyer 2018, Images Property of their Respective Owners OUTLINE STM32F0 Architecture Overview STM32F0 Core Motivation for RISC and

More information

ELC4438: Embedded System Design ARM Cortex-M Architecture II

ELC4438: Embedded System Design ARM Cortex-M Architecture II ELC4438: Embedded System Design ARM Cortex-M Architecture II Liang Dong Electrical and Computer Engineering Baylor University Memory system The memory systems in microcontrollers often contain two or more

More information

AND SOLUTION FIRST INTERNAL TEST

AND SOLUTION FIRST INTERNAL TEST Faculty: Dr. Bajarangbali P.E.S. Institute of Technology( Bangalore South Campus) Hosur Road, ( 1Km Before Electronic City), Bangalore 560100. Department of Electronics and Communication SCHEME AND SOLUTION

More information

Input/Output Programming

Input/Output Programming Input/Output Programming Chapter 3: Section 3.1, 3.2 Input and output (I/O) programming Communicating with I/O devices Busy-wait I/O Interrupt-driven I/O I/O devices Devices may include digital and non-digital

More information

Modes and Levels. Registers. Registers. Cortex-M3 programming

Modes and Levels. Registers. Registers. Cortex-M3 programming Modes and Levels Cortex-M3 programming Texas Instruments, www.ti.com CortexM3InstructionSet.pdf STMicroelectronics, www.st.com CortexM3Programmer.pdf PM0056 Registers Registers R0-R3 parameters R4-R11

More information

Interrupt-Driven Input/Output

Interrupt-Driven Input/Output Interrupt-Driven Input/Output Textbook: Chapter 11 (Interrupts) ARM Cortex-M4 User Guide (Interrupts, exceptions, NVIC) Sections 2.1.4, 2.3 Exceptions and interrupts Section 4.2 Nested Vectored Interrupt

More information

Cortex-M4 Exceptions and Interrupts

Cortex-M4 Exceptions and Interrupts Cortex-M4 Exceptions and Interrupts 1 Overview Exception and Interrupt Concepts Entering an Exception Handler Exiting an Exception Handler Cortex-M4 Interrupts Using Port Module and External Interrupts

More information

Cortex-M4 Processor Overview. with ARM Processors and Architectures

Cortex-M4 Processor Overview. with ARM Processors and Architectures Cortex-M4 Processor Overview with ARM Processors and Architectures 1 Introduction 2 ARM ARM was developed at Acorn Computer Limited of Cambridge, UK (between 1983 & 1985) RISC concept introduced in 1980

More information

Interrupts and Exceptions

Interrupts and Exceptions Interrupts and Exceptions ECE 362 https://engineering.purdue.edu/ee362/ Rick Reading assignment: Reading Assignment STM32F0x1 Family Reference, Chapter 12, pages 217 228, "Interrupts and events" Your textbook,

More information

The Definitive Guide to the ARM Cortex-M3

The Definitive Guide to the ARM Cortex-M3 The Definitive Guide to the ARM Cortex-M3 Joseph Yiu AMSTERDAM BOSTON HEIDELBERG LONDON NEW YORK OXFORD PARIS SAN DIEGO SAN FRANCISCO SINGAPORE SYDNEY TOKYO Newnes is an imprint of Elsevier Newnes Forewopd

More information

Cortex-M Software Development

Cortex-M Software Development Cortex-M Software Development Course Description Cortex-M7 software development is a 4 days ARM official course. The course goes into great depth and provides all necessary know-how to develop software

More information

Programming Embedded Systems

Programming Embedded Systems Programming Embedded Systems Lecture 5 Interrupts, modes of multi-tasking Wednesday Feb 1, 2012 Philipp Rümmer Uppsala University Philipp.Ruemmer@it.uu.se 1/31 Lecture outline Interrupts Internal, external,

More information

Implementing Secure Software Systems on ARMv8-M Microcontrollers

Implementing Secure Software Systems on ARMv8-M Microcontrollers Implementing Secure Software Systems on ARMv8-M Microcontrollers Chris Shore, ARM TrustZone: A comprehensive security foundation Non-trusted Trusted Security separation with TrustZone Isolate trusted resources

More information

EE4144: ARM Cortex-M Processor

EE4144: ARM Cortex-M Processor EE4144: ARM Cortex-M Processor EE4144 Fall 2014 EE4144 EE4144: ARM Cortex-M Processor Fall 2014 1 / 10 ARM Cortex-M 32-bit RISC processor Cortex-M4F Cortex-M3 + DSP instructions + floating point unit (FPU)

More information

AN2585 Application note

AN2585 Application note AN2585 Application note Application examples of the STM32F101xx and STM32F103xx core and system peripherals Introduction The STM32F10xxx is built around the latest Cortex -M3 core from ARM designed for

More information

Arm Cortex -M33 Devices

Arm Cortex -M33 Devices Arm Cortex -M33 Devices Revision: r0p3 Generic User Guide Copyright 2017 Arm Limited (or its affiliates). All rights reserved. 100235_0003_00_en Arm Cortex -M33 Devices Arm Cortex -M33 Devices Generic

More information

ARM Cortex-M and RTOSs Are Meant for Each Other

ARM Cortex-M and RTOSs Are Meant for Each Other ARM Cortex-M and RTOSs Are Meant for Each Other FEBRUARY 2018 JEAN J. LABROSSE Introduction Author µc/os series of software and books Numerous articles and blogs Lecturer Conferences Training Entrepreneur

More information

Interrupt/Timer/DMA 1

Interrupt/Timer/DMA 1 Interrupt/Timer/DMA 1 Exception An exception is any condition that needs to halt normal execution of the instructions Examples - Reset - HWI - SWI 2 Interrupt Hardware interrupt Software interrupt Trap

More information

Migrating ARM7 Code to a Cortex-M3 MCU By Todd Hixon, Atmel

Migrating ARM7 Code to a Cortex-M3 MCU By Todd Hixon, Atmel Migrating ARM7 Code to a Cortex-M3 MCU By Todd Hixon, Atmel The ARM Cortex-M3 core has enhancements to its architecture that result in increased code execution speed, lower power consumption, and easier

More information

Application Note. Analyzing HardFaults on Cortex-M CPU

Application Note. Analyzing HardFaults on Cortex-M CPU Application Note Analyzing HardFaults on Cortex-M CPU Document: AN00016 Revision: 10 Date: January 23, 2017 A product of SEGGER Microcontroller GmbH & Co. KG www.segger.com 2 Disclaimer Specifications

More information

Interrupts. Why Interrupts

Interrupts. Why Interrupts Why Interrupts I/O operations Peripherals and external devices can let the processor know they are ready vs. the processor polling each device Routine tasks Updating the time Making sure the processor

More information

AN316 Determining the stack usage of applications

AN316 Determining the stack usage of applications Determining the stack usage of applications AN 316, Summer 2018, V 1.0 feedback@keil.com Abstract Determining the required stack sizes for a software project is a crucial part of the development process.

More information

Application Note. Migrating from 8051 to Cortex Microcontrollers. Document number: ARM DAI 0237 Issued: July 2010 Copyright ARM Limited 2010

Application Note. Migrating from 8051 to Cortex Microcontrollers. Document number: ARM DAI 0237 Issued: July 2010 Copyright ARM Limited 2010 Application Note 237 Migrating from 8051 to Cortex Microcontrollers Document number: ARM DAI 0237 Issued: July 2010 Copyright ARM Limited 2010 Application Note 237 Copyright 2010 ARM Limited. All rights

More information

CODE TIME TECHNOLOGIES. Abassi RTOS. Porting Document. ARM Cortex-M3 CCS

CODE TIME TECHNOLOGIES. Abassi RTOS. Porting Document. ARM Cortex-M3 CCS CODE TIME TECHNOLOGIES Abassi RTOS Porting Document ARM Cortex-M3 CCS Copyright Information This document is copyright Code Time Technologies Inc. 2011,2012. All rights reserved. No part of this document

More information

Embedded Operating Systems

Embedded Operating Systems Embedded Operating Systems Condensed version of Embedded Operating Systems course. Or how to write a TinyOS Part 2 Context Switching John Hatch Covered in Part One ARM registers and modes ARM calling standard

More information

32-Bit RISC Microcontroller. TMPM3H Group(2) Reference Manual Exception (EXCEPT-M3H(2)) Revision

32-Bit RISC Microcontroller. TMPM3H Group(2) Reference Manual Exception (EXCEPT-M3H(2)) Revision 2-Bit RISC icrocontroller Reference anual (EXCEPT-(2)) Revision 2.0 2018-07 2018-07-1 1 / 99 Rev. 2.0 2017-2018 Toshiba Electronic Devices & Storage Corporation Contents Preface... 5 Related document...

More information

References & Terminology

References & Terminology , 2/22/2018 Embedded and Real-Time Systems/ Real-Time Operating Systems : RTOS, OS Kernel, Operating Modes, Context Switch 1 References & Terminology μc/os-iii, The Real-Time Kernel, or a High Performance,

More information

Computer Organization Laboratory. Class Notes. Instructor: Ken Q. Yang Dept. of ECE, URI

Computer Organization Laboratory. Class Notes. Instructor: Ken Q. Yang Dept. of ECE, URI Computer Organization Laboratory Class Notes Instructor: Ken Q. Yang Dept. of ECE, URI Section 0 Course Objectives, Plans, and Lab Tools Course Objectives: What to learn? Computer Architecture Concepts

More information

Exception and fault checking on S32K1xx

Exception and fault checking on S32K1xx NXP Semiconductors Document Number: AN12201 Application Notes Rev. 0, 07/2018 Exception and fault checking on S32K1xx by: NXP Semiconductors 1. Introduction The S32K1xx product series further extends the

More information

NVIC and SCB Registers Quick Reference

NVIC and SCB Registers Quick Reference NVIC and SCB Registers Quick Reference F.1 NVIC registers F.1.1 Interrupt set enable registers Table F.1 Interrupt Set Enable Registers (0xE000E100-0xE000E11C) Address Name Type 0xE000E100 NVIC->ISER[0]

More information

Grundlagen Microcontroller Interrupts. Günther Gridling Bettina Weiss

Grundlagen Microcontroller Interrupts. Günther Gridling Bettina Weiss Grundlagen Microcontroller Interrupts Günther Gridling Bettina Weiss 1 Interrupts Lecture Overview Definition Sources ISR Priorities & Nesting 2 Definition Interrupt: reaction to (asynchronous) external

More information

ARM Architecture and Assembly Programming Intro

ARM Architecture and Assembly Programming Intro ARM Architecture and Assembly Programming Intro Instructors: Dr. Phillip Jones http://class.ece.iastate.edu/cpre288 1 Announcements HW9: Due Sunday 11/5 (midnight) Lab 9: object detection lab Give TAs

More information

EE458 - Embedded Systems Exceptions and Interrupts

EE458 - Embedded Systems Exceptions and Interrupts EE458 - Embedded Systems Exceptions and Interrupts Outline Exceptions Interrupts References RTC: Chapters 10 CUG: Chapters 8, 21, 23 1 Introduction An exception is any event that disrupts the normal execution

More information

I/O - input/output. system components: CPU, memory, and bus -- now add I/O controllers and peripheral devices. CPU Cache

I/O - input/output. system components: CPU, memory, and bus -- now add I/O controllers and peripheral devices. CPU Cache I/O - input/output system components: CPU, memory, and bus -- now add I/O controllers and peripheral devices CPU Cache CPU must perform all transfers to/from simple controller, e.g., CPU reads byte from

More information

ECE 598 Advanced Operating Systems Lecture 8

ECE 598 Advanced Operating Systems Lecture 8 ECE 598 Advanced Operating Systems Lecture 8 Vince Weaver http://www.eece.maine.edu/~vweaver vincent.weaver@maine.edu 11 February 2016 Homework #3 Due. Announcements Homework #4 Posted Soon 1 HW#3 Comments

More information

8086 Interrupts and Interrupt Responses:

8086 Interrupts and Interrupt Responses: UNIT-III PART -A INTERRUPTS AND PROGRAMMABLE INTERRUPT CONTROLLERS Contents at a glance: 8086 Interrupts and Interrupt Responses Introduction to DOS and BIOS interrupts 8259A Priority Interrupt Controller

More information

Input/Output. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Input/Output. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University Input/Output Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu mechanism I/O Devices Usually includes some non-digital component Typical digital interface

More information

Lecture 10 Exceptions and Interrupts. How are exceptions generated?

Lecture 10 Exceptions and Interrupts. How are exceptions generated? Lecture 10 Exceptions and Interrupts The ARM processor can work in one of many operating modes. So far we have only considered user mode, which is the "normal" mode of operation. The processor can also

More information

(5) Question 2. Give the two most important factors for effective debugging. Jonathan W. Valvano

(5) Question 2. Give the two most important factors for effective debugging. Jonathan W. Valvano EE445M/EE380L Quiz 1 Spring 2013 Page 1 of 5 First Name: Last Name: March 1, 2013, 10:00 to 10:50am Quiz 1 is a closed book exam. You may have one 8.5 by 11 inch sheet of hand-written crib notes, but no

More information

Hercules ARM Cortex -R4 System Architecture. Processor Overview

Hercules ARM Cortex -R4 System Architecture. Processor Overview Hercules ARM Cortex -R4 System Architecture Processor Overview What is Hercules? TI s 32-bit ARM Cortex -R4/R5 MCU family for Industrial, Automotive, and Transportation Safety Hardware Safety Features

More information

L2 - C language for Embedded MCUs

L2 - C language for Embedded MCUs Formation C language for Embedded MCUs: Learning how to program a Microcontroller (especially the Cortex-M based ones) - Programmation: Langages L2 - C language for Embedded MCUs Learning how to program

More information

ARM Cortex -M for Beginners

ARM Cortex -M for Beginners ARM Cortex -M for Beginners An overview of the ARM Cortex-M processor family and comparison Joseph Yiu September 2016 Abstract The ARM Cortex -M family now has six processors. In this paper, we compare

More information

ARM. Cortex -M7 Devices. Generic User Guide. Copyright 2015 ARM. All rights reserved. ARM DUI 0646A (ID042815)

ARM. Cortex -M7 Devices. Generic User Guide. Copyright 2015 ARM. All rights reserved. ARM DUI 0646A (ID042815) ARM Cortex -M7 Devices Generic User Guide Copyright 2015 ARM. All rights reserved. ARM DUI 0646A () ARM Cortex-M7 Devices Generic User Guide Copyright 2015 ARM. All rights reserved. Release Information

More information

Design and development of embedded systems for the Internet of Things (IoT) Fabio Angeletti Fabrizio Gattuso

Design and development of embedded systems for the Internet of Things (IoT) Fabio Angeletti Fabrizio Gattuso Design and development of embedded systems for the Internet of Things (IoT) Fabio Angeletti Fabrizio Gattuso Microcontroller It is essentially a small computer on a chip Like any computer, it has memory,

More information

Troubleshooting Guide

Troubleshooting Guide APPENDIX I Troubleshooting Guide I.1 Overview There can be various different symptoms when an application does not work. For example: The program does not run at all, or the processor failed to start.

More information

EEL 4744C: Microprocessor Applications. Lecture 7. Part 1. Interrupt. Dr. Tao Li 1

EEL 4744C: Microprocessor Applications. Lecture 7. Part 1. Interrupt. Dr. Tao Li 1 EEL 4744C: Microprocessor Applications Lecture 7 Part 1 Interrupt Dr. Tao Li 1 M&M: Chapter 8 Or Reading Assignment Software and Hardware Engineering (new version): Chapter 12 Dr. Tao Li 2 Interrupt An

More information

Reading Assignment. Interrupt. Interrupt. Interrupt. EEL 4744C: Microprocessor Applications. Lecture 7. Part 1

Reading Assignment. Interrupt. Interrupt. Interrupt. EEL 4744C: Microprocessor Applications. Lecture 7. Part 1 Reading Assignment EEL 4744C: Microprocessor Applications Lecture 7 M&M: Chapter 8 Or Software and Hardware Engineering (new version): Chapter 12 Part 1 Interrupt Dr. Tao Li 1 Dr. Tao Li 2 Interrupt An

More information

Systems Architecture The ARM Processor

Systems Architecture The ARM Processor Systems Architecture The ARM Processor The ARM Processor p. 1/14 The ARM Processor ARM: Advanced RISC Machine First developed in 1983 by Acorn Computers ARM Ltd was formed in 1988 to continue development

More information

STM32 MICROCONTROLLER

STM32 MICROCONTROLLER STM32 MICROCONTROLLER Lecture 4 Prof. Yasser Mostafa Kadah Nested Vectored Interrupt Controller The NVIC supports up to 56 maskable interrupt channels with 16 programmable priority levels Not including

More information

CprE 288 Introduction to Embedded Systems Course Review for Exam 3. Instructors: Dr. Phillip Jones

CprE 288 Introduction to Embedded Systems Course Review for Exam 3. Instructors: Dr. Phillip Jones CprE 288 Introduction to Embedded Systems Course Review for Exam 3 Instructors: Dr. Phillip Jones 1 Announcements Exam 3: See course website for day/time. Exam 3 location: Our regular classroom Allowed

More information

Course Introduction. Purpose: Objectives: Content: 27 pages 4 questions. Learning Time: 20 minutes

Course Introduction. Purpose: Objectives: Content: 27 pages 4 questions. Learning Time: 20 minutes Course Introduction Purpose: This course provides an overview of the Direct Memory Access Controller and the Interrupt Controller on the SH-2 and SH-2A families of 32-bit RISC microcontrollers, which are

More information

Developing a Generic Hard Fault handler for ARM Cortex-M3/Cortex-M4

Developing a Generic Hard Fault handler for ARM Cortex-M3/Cortex-M4 Developing a Generic Hard Fault handler for ARM Cortex-M3/Cortex-M4 Niall Cooling Feabhas Limited www.feabhas.com Place company logo here. Recommend a white transparent GIF logo which cannot be larger

More information

Microprocessors & Interfacing

Microprocessors & Interfacing Lecture Overview Microprocessors & Interfacing Interrupts (I) Lecturer : Dr. Annie Guo Introduction to Interrupts Interrupt system specifications Multiple sources of interrupts Interrupt priorities Interrupts

More information

Interrupts (I) Lecturer: Sri Notes by Annie Guo. Week8 1

Interrupts (I) Lecturer: Sri Notes by Annie Guo. Week8 1 Interrupts (I) Lecturer: Sri Notes by Annie Guo Week8 1 Lecture overview Introduction to Interrupts Interrupt system specifications Multiple Sources of Interrupts Interrupt Priorities Interrupts in AVR

More information

Stack Frames. September 2, Indiana University. Geoffrey Brown, Bryce Himebaugh 2015 September 2, / 15

Stack Frames. September 2, Indiana University. Geoffrey Brown, Bryce Himebaugh 2015 September 2, / 15 Stack Frames Geoffrey Brown Bryce Himebaugh Indiana University September 2, 2016 Geoffrey Brown, Bryce Himebaugh 2015 September 2, 2016 1 / 15 Outline Preserving Registers Saving and Restoring Registers

More information

PC Interrupt Structure and 8259 DMA Controllers

PC Interrupt Structure and 8259 DMA Controllers ELEC 379 : DESIGN OF DIGITAL AND MICROCOMPUTER SYSTEMS 1998/99 WINTER SESSION, TERM 2 PC Interrupt Structure and 8259 DMA Controllers This lecture covers the use of interrupts and the vectored interrupt

More information

CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 09, SPRING 2013

CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 09, SPRING 2013 CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 09, SPRING 2013 TOPICS TODAY I/O Architectures Interrupts Exceptions FETCH EXECUTE CYCLE 1.7 The von Neumann Model This is a general

More information

real-time kernel documentation

real-time kernel documentation version 1.1 real-time kernel documentation Introduction This document explains the inner workings of the Helium real-time kernel. It is not meant to be a user s guide. Instead, this document explains overall

More information

Common Computer-System and OS Structures

Common Computer-System and OS Structures Common Computer-System and OS Structures Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection General System Architecture Oct-03 1 Computer-System Architecture

More information

Lecture notes Lectures 1 through 5 (up through lecture 5 slide 63) Book Chapters 1-4

Lecture notes Lectures 1 through 5 (up through lecture 5 slide 63) Book Chapters 1-4 EE445M Midterm Study Guide (Spring 2017) (updated February 25, 2017): Instructions: Open book and open notes. No calculators or any electronic devices (turn cell phones off). Please be sure that your answers

More information

Returning from an Exception. ARM Exception(Interrupt) Processing. Exception Vector Table (Assembly code) Exception Handlers (and Vectors) in C code

Returning from an Exception. ARM Exception(Interrupt) Processing. Exception Vector Table (Assembly code) Exception Handlers (and Vectors) in C code ARM Exception(Interrupt) Processing Returning from an Exception main: instruction instruction instruction instruction Exception The ARM processor automatically: 1. Saves CPSR into banked SPSR 2. Saves

More information

Interrupts in Zynq Systems

Interrupts in Zynq Systems Interrupts in Zynq Systems C r i s t i a n S i s t e r n a U n i v e r s i d a d N a c i o n a l d e S a n J u a n A r g e n t i n a Exception / Interrupt Special condition that requires a processor's

More information

Program SoC using C Language

Program SoC using C Language Program SoC using C Language 1 Module Overview General understanding of C, program compilation, program image, data storage, data type, and how to access peripherals using C language; Program SoC using

More information

ARM Cortex-M0 DesignStart Processor and v6-m Architecture. Joe Bungo ARM University Program Manager Americas/Europe R&D Division

ARM Cortex-M0 DesignStart Processor and v6-m Architecture. Joe Bungo ARM University Program Manager Americas/Europe R&D Division ARM Cortex-M0 DesignStart Processor and v6-m Architecture Joe Bungo ARM University Program Manager Americas/Europe R&D Division 1 2 Agenda Introduction to ARM Ltd Cortex-M0 DesignStart Processor ARM v6-m

More information

Embedded System Design

Embedded System Design Embedded System Design Lecture 4 Jaeyong Chung System-on-Chips (SoC) Laboratory Incheon National University CPUs Takes inputs from input devices (sensors, keyboards, ) Process inputs and produce results

More information

UM LPC5410x User Manual. Document information. LPC5410x, ARM Cortex-M4, ARM Cortex-M0+, microcontroller, sensor hub

UM LPC5410x User Manual. Document information. LPC5410x, ARM Cortex-M4, ARM Cortex-M0+, microcontroller, sensor hub LPC5410x User manual Rev. 2.0 10 April 2015 User manual Document information Info Keywords Abstract Content LPC5410x, ARM Cortex-M4, ARM Cortex-M0+, microcontroller, sensor hub LPC5410x User Manual LPC5410x

More information

Cortex-M1 v3.1 Handbook

Cortex-M1 v3.1 Handbook Cortex-M1 v3.1 Handbook Cortex-M1 v3.1 Handbook Table of Contents Introduction...................................................................... 3 Key Features..............................................................................

More information

Measuring Interrupt Latency

Measuring Interrupt Latency NXP Semiconductors Document Number: AN12078 Application Note Rev. 0, 10/2017 Measuring Interrupt Latency 1. Introduction The term interrupt latency refers to the delay between the start of an Interrupt

More information

Forth and C on the Cortex-M3. Saturday, April 28, 12

Forth and C on the Cortex-M3. Saturday, April 28, 12 Forth and C on the Cortex-M3 Arm Cortex-M3! 32-Bit Architecture Low-latency Prioritized Interrupt controller - NVIC Single-Cycle Multiply Sophisticated Debug C and Assembly friendly Common across all major

More information

ECE 598 Advanced Operating Systems Lecture 8

ECE 598 Advanced Operating Systems Lecture 8 ECE 598 Advanced Operating Systems Lecture 8 Vince Weaver http://web.eece.maine.edu/~vweaver vincent.weaver@maine.edu 15 February 2018 Homework #3 Due. Announcements Homework #4 Posted Soon 1 (Review)

More information

CPUs. Input and output. Supervisor mode, exceptions, traps. Co-processors. Computers as Components 4e 2016 Marilyn Wolf

CPUs. Input and output. Supervisor mode, exceptions, traps. Co-processors. Computers as Components 4e 2016 Marilyn Wolf CPUs Input and output. Supervisor mode, exceptions, traps. Co-processors. I/O devices Usually includes some non-digital component. Typical digital interface to CPU: CPU status reg data reg mechanism Application:

More information

ARM Processor Architecture

ARM Processor Architecture Chapters 1 and 3 ARM Processor Architecture Embedded Systems with ARM Cortext-M Updated: Monday, February 5, 2018 A Little about ARM The company Originally Acorn RISC Machine (ARM) Later Advanced RISC

More information

SISTEMI EMBEDDED. (Software) Exceptions and (Hardware) Interrupts. Federico Baronti Last version:

SISTEMI EMBEDDED. (Software) Exceptions and (Hardware) Interrupts. Federico Baronti Last version: SISTEMI EMBEDDED (Software) Exceptions and (Hardware) Interrupts Federico Baronti Last version: 20160410 Exceptions and Interrupts Exception: a transfer of control away from a program s normal flow of

More information

Cooperative Multitasking

Cooperative Multitasking Cooperative Multitasking Cooperative Multitasking let's make the controller for the lamp in an LCD projector Lamp off Fan off evbutton Lamp on Fan on evtimeout Lamp off Fan on evbutton Code for LCD Projector

More information

Introduction to C. Write a main() function that swaps the contents of two integer variables x and y.

Introduction to C. Write a main() function that swaps the contents of two integer variables x and y. Introduction to C Write a main() function that swaps the contents of two integer variables x and y. void main(void){ int a = 10; int b = 20; a = b; b = a; } 1 Introduction to C Write a main() function

More information

Hardware OS & OS- Application interface

Hardware OS & OS- Application interface CS 4410 Operating Systems Hardware OS & OS- Application interface Summer 2013 Cornell University 1 Today How my device becomes useful for the user? HW-OS interface Device controller Device driver Interrupts

More information

Cortex -M0. Technical Reference Manual. Revision: r0p0. Copyright 2009 ARM Limited. All rights reserved. ARM DDI 0432C (ID112415)

Cortex -M0. Technical Reference Manual. Revision: r0p0. Copyright 2009 ARM Limited. All rights reserved. ARM DDI 0432C (ID112415) Cortex -M0 Revision: r0p0 Technical Reference Manual Copyright 2009 ARM Limited. All rights reserved. ARM DDI 0432C () Cortex-M0 Technical Reference Manual Copyright 2009 ARM Limited. All rights reserved.

More information

EEL 4744C: Microprocessor Applications. Lecture 7. Part 2. M68HC12 Interrupt. Dr. Tao Li 1

EEL 4744C: Microprocessor Applications. Lecture 7. Part 2. M68HC12 Interrupt. Dr. Tao Li 1 EEL 4744C: Microprocessor Applications Lecture 7 Part 2 M68HC12 Interrupt Dr. Tao Li 1 Reading Assignment Software and Hardware Engineering (New version): Chapter 12 or SHE (old version) Chapter 8 And

More information

IoT and Security: ARM v8-m Architecture. Robert Boys Product Marketing DSG, ARM. Spring 2017: V 3.1

IoT and Security: ARM v8-m Architecture. Robert Boys Product Marketing DSG, ARM. Spring 2017: V 3.1 IoT and Security: ARM v8-m Architecture Robert Boys Product Marketing DSG, ARM Spring 2017: V 3.1 ARM v8-m Trustzone. Need to add security to Cortex -M processors. IoT Cortex-A has had TrustZone for a

More information

AN209 Using Cortex-M3/M4/M7 Fault Exceptions

AN209 Using Cortex-M3/M4/M7 Fault Exceptions Using Cortex-M3/M4/M7 Fault Exceptions MDK Tutorial AN209, Summer 2017, V 5.0 Abstract ARM Cortex -M processors implement an efficient exception model that traps illegal memory accesses and several incorrect

More information

LDR R0,=0x L: LDREX R1, [R0] ORR R1, #4 STR R1, [R0] (5) Part a) Why does the 9S12 code not have a critical section?

LDR R0,=0x L: LDREX R1, [R0] ORR R1, #4 STR R1, [R0] (5) Part a) Why does the 9S12 code not have a critical section? EE445M/EE380L Quiz 1 Spring 2017 Solution Page 1 of 5 First Name: Last Name: March 3, 2017, 10:00 to 10:50am Open book and open notes. No calculators or any electronic devices (turn cell phones off). Please

More information