Real-Time Embedded Operating System for a SoC System

Slides:



Advertisements
Similar presentations
ECE 353 Introduction to Microprocessor Systems
Advertisements

1 ARM Movement Instructions u MOV Rd, ; updates N, Z, C Rd = u MVN Rd, ; Rd = 0xF..F EOR.
Lab III Real-Time Embedded Operating System for a SoC System.
Exceptions. Exception Types Exception Handling Vectoring Interrupts Interrupt Handlers Interrupt Priorities Interrupt applications 6-2.
Interrupts, Low Power Modes and Timer A (Chapters 6 & 8)
Introduction to Embedded Systems Intel Xscale® Assembly Language and C Lecture #3.
Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 1.
68HC11 Polling and Interrupts
CSC Timers Since this is a microcontroller it mainly finds itself in embedded devices Quite often embedded devices need to synchronize events The.
Chapter 12: Software interrupts (SWI) and exceptions
ARM Exception Handling
COMP3221: Microprocessors and Embedded Systems Lecture 15: Interrupts I Lecturer: Hui Wu Session 1, 2005.
LOGO Chapter 1 Interrupt handling. hardware interrupt Under x86, hardware interrupts are called IRQ's. When the CPU receives an interrupt, it stops whatever.
Introduction To The ARM Microprocessor
Communication Lab - Interrupts 1/13 Sequential Programming  Our C++ programs are sequential ( סדרתיים), they start at the first instruction and end at.
ARM 7 Datapath. Has “BIGEND” input bit, which defines whether the memory is big or little endian Modes: ARM7 supports six modes of operation: (1) User.
COMP3221 lec28-exception-II.1 Saeid Nooshabadi COMP 3221 Microprocessors and Embedded Systems Lectures 28: Exceptions & Interrupts - II
COMP3221 lec27-exception-I.1 Saeid Nooshabadi COMP 3221 Microprocessors and Embedded Systems Lectures 27: Exceptions & Interrupts - I
Embedded System Design Center Sai Kumar Devulapalli ARM7TDMI Microprocessor Thumb Instruction Set.
Exception and Interrupt Handling
Introduction to Embedded Systems
Interrupts. What Are Interrupts? Interrupts alter a program’s flow of control  Behavior is similar to a procedure call »Some significant differences.
Lecture 23: LM3S9B96 Microcontroller - Interrupts.
CORTEX-M0 Structure Discussion 2 – Core Peripherals
Introduction to Embedded Systems Rabie A. Ramadan 6.
Lecture 4. ARM Instructions #1 Prof. Taeweon Suh Computer Science Education Korea University ECM586 Special Topics in Embedded Systems.
USB Peripheral Controller John Jones 12/11/08 Embedded Systems Architecture.
Lab I Real-Time Embedded Operating System for a SoC System.
1 © Unitec New Zealand Interrupt Lecture 6 Date: - 20 Sept, 2011 Embedded Hardware ETEC 6416.
George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction.
AT91 Interrupt Handling. 2 Stops the execution of main software Redirects the program flow, based on an event, to execute a different software subroutine.
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.
AT91 C-startup. 2 For reasons of modularity and portability most application code for an embedded application is written in C The application entry point.
Embedded Systems Design 1 Lecture Set 8 MCS-51 Interrupts.
Resets & Interrupts MTT CPU08 Core Motorola CPU08 RESETS & INTERRUPTS.
The 8051 Microcontroller Chapter 6 INTERRUPTS. 2/29 Interrupt is the occurrence of a condition an event that causes a temporary suspension of a program.
George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction.
1 TM 1 Embedded Systems Lab./Honam University r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 (sp) r14 (lr) r15 (pc) cpsr r13 (sp) r14 (lr) spsr r13 (sp)
Introduction to ARM processor. Intro.. ARM founded in November 1990 Advanced RISC Machines Company headquarters in Cambridge, UK Processor design centers.
Instruction Set Architectures Early trend was to add more and more instructions to new CPUs to do elaborate operations –VAX architecture had an instruction.
Introduction to Exceptions 1 Introduction to Exceptions ARM Advanced RISC Machines.
Intel Xscale® Assembly Language and C. The Intel Xscale® Programmer’s Model (1) (We will not be using the Thumb instruction set.) Memory Formats –We will.
Interrupt 마이크로 프로세서 (Micro Processor) 2015년 2학기 충북대학교 전자공학과 박 찬식
Intel Xscale® Assembly Language and C. The Intel Xscale® Programmer’s Model (1) (We will not be using the Thumb instruction set.) Memory Formats –We will.
A walk through interrupts on the PPC 823
Chapter 12: Software interrupts (SWI) and exceptions
Chapter 4: Introduction to Assembly Language Programming
68HC11 Interrupts & Resets.
Microprocessor Systems Design I
Embedded System Design Center
Chapter 9 Exception & Interruption
Timer and Interrupts.
Introduction to the ARM Instruction Set
Interrupts In 8085 and 8086.
May 2006 Saeid Nooshabadi ELEC2041 Microprocessors and Interfacing Lectures 27: Exceptions & Interrupts - I
Chapter 4 Addressing modes
Lab 5 – Interrupts vs Polling
Computer Organization and ASSEMBLY LANGUAGE
AT91 C-startup This training module describes the C-Startup sequence, which performs initialization of the microcontroller from the reset up to the calling.
Chapter 12: Software interrupts (SWI) and exceptions
CORTEX-M0 Structure Discussion 1
ARM Introduction.
ME 4447/6405 Microprocessor Control of Manufacturing Systems and
Computer System Laboratory
CPU Structure and Function
Multiply Instructions
COMP3221: Microprocessors and Embedded Systems
May, 2004 Modified from notes by Saeid Nooshabadi
ME 4447/6405 Microprocessor Control of Manufacturing Systems and
ME 4447/6405 Microprocessor Control of Manufacturing Systems and
Presentation transcript:

Real-Time Embedded Operating System for a SoC System Lab III Real-Time Embedded Operating System for a SoC System

Initiation Stack Pointer for Exception mode and SPSR Startup Flow Chat initialization Stack LDR r7, #RAMBased MRS r4, cpsr ORR r4, r4, #NoIRQ ORR r4, r4, #NoFIQ BIC r4, r4, #ModeMask Clear Mode MOV r2, #User32Mode ;-------------------------------------------------- ORR r5, r4, #IRQ32Mode MSR cpsr_c, r5 MSR spsr_c, r2 MOV sp, r7 ; Initial IRQ stack pointer... SUB r7, r7, #IRQStackSize ....;;Set SVC Mode Stack pointer ;;Set User Mode Stack pointer Reset Building Exception Handler Set INTMSK ;Disable IRQ Clear INTPND Initiation Stack Pointer for Exception mode and SPSR Execution C_function

ARM Exception ARM Exception Events

Install an Exception Handler: Method Vector_Init_Block b Reset_Addr b Undefined_Addr b SWI_Addr b Prefetch_Addr b Abort_Addr NOP ;Reserved vector b IRQ_Addr b FIQ_Addr Reset_Addr … Undefined_Addr … B .For loop SWI_Addr … Prefetch_Addr … B . For loop Abort_Addr … IRQ_Addr … FIQ_Addr …

Install an Exception Handler: Method Vector_Init_Block LDR PC, Reset_Addr LDR PC, Undefined_Addr LDR PC, SWI_Addr LDR PC, Prefetch_Addr LDR PC, Abort_Addr NOP ;Reserved vector LDR PC, IRQ_Addr LDR PC, FIQ_Addr Reset_Addr DCD Start_Boot Undefined_Addr DCD Undefined_Handler SWI_Addr DCD SWI_Handler Prefetch_Addr DCD Prefetch_Handler Abort_Addr DCD Abort_Handler DCD 0 ;Reserved vector IRQ_Addr DCD IRQ_Handler FIQ_Addr DCD FIQ_Handle Start_Boot LDR … Undefined_Handler B . (for loop)

SWI Exception and Handler Top-Level SWI Handlers The SWI number is stored in bits 0-23 of the instruction Save all other r0~r12 and lr to the stack Calculate the SWI number Jump Your Handler Return void __swi(n) SWI_Name(void); for C Call

SWI_Handler Flow SWI_Handler ; top-level handler STMFD sp!,{r0-r12,lr} ; Store registers. LDR r0,[lr,#-4] ; Calculate address of SWI instruction ; and load it into r0. BIC r0,r0,#0xff000000 ; Mask off top 8 bits of instruction ;to give SWI number. ; ; Use value in r0 to determine which SWI routine to execute. ; BNE after ; Branch You Handler ; Branch your Handler LDMFD sp!, {r0-r12,pc}^ ; Restore registers and return

IRQ Handler Flow IRQ_Handler ; top-level handler STMFD sp!,{r0-r12,lr} ; Store registers. BL ISR_IRQ LDMFD sp!, {r0-r12,pc} ; Restore registers and return SUBS pc, lr, #4

S3C4510B Interrupt Sources S3C4510B Interrupt Sources

Samsung S3C4510B Interrupt Controller Five special registers used to control the interrupt generation and handling Interrupt mode register Defines the interrupt mode, IRQ(0) or FIQ(1), for each interrupt source. Interrupt pending register Indicates that an interrupt request is pending Interrupt mask register The current interrupt is disabled if the corresponding mask bit is "1“ If the global mask bit (bit 21) is set to "1", no interrupts are serviced. Interrupt priority registers Interrupt offset register Determine the highest priority among the pending interrupts.

Interrupt Mask Register (INTMSK) If global mask bit (bit 21) is 1, no interrupts are serviced If bit is 1, the interrupt is not serviced by the CPU when the corresponding interrupt is generated

Interrupt pending register Each of the 21 bits corresponds to an interrupt source The service routine must then clear the pending condition by writing a 1 to the appropriate pending bit at start. #define Clear_PendingBit(n) INTPND_REG=(1<<n)

Interrupt offset register Contains the interrupt offset address of the interrupt Hold the highest priority among the pending interrupts The content of the interrupt offset address is "bit position value of the interrupt source << 2“ You can read this register to get the IRQNumber #define INTOFFSET REG32(SYS_BASE+0x4024) int currentIRQnumber=INTOFFSET >> 2;

32-BIT TIMERS INTERVAL MODE OPERATION TOGGLE MODE OPERATION fTOUT = fMCLK / Timer data value Example. 2 = 50 MHz /25 MHz 25MHz=2FAF080 TOGGLE MODE OPERATION fTOUT = fMCLK / (2 * Timer data value)

TIMER MODE REGISTER The timer mode register, TMOD, is used to control the operation of the two 32-bit timers [0] Timer 0 enable (TE0) 0 = Disable timer 0 1 = Enable timer 0 [1] Timer 0 mode selection (TMD0) 0 = Interval mode 1 = Toggle mode [2] Timer 0 initial TOUT0 value (TCLR0) 0 = Initial TOUT0 is 0 in toggle mode 1 = Initial TOUT0 is 1 in toggle mode #define TMOD REG32(SYS_BASE+0x6000)

TIMER DATA REGISTERS #define TDATA0 REG32(SYS_BASE+0x6004)

About CodeWarrior Configure

Reference Samsung S3C4510B User’s Manual http://www.samsung.com/Products/Semiconductor/SystemLSI/Networks/PersonalNTASSP/CommunicationProcessor/S3C4510B/S3C4510B.htm Chapter 7 ARM Exceptions ARM 原理與實作 – 以網路SOC為例