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

Slides:



Advertisements
Similar presentations
ECE 353 Introduction to Microprocessor Systems
Advertisements

Exceptions. Exception Types Exception Handling Vectoring Interrupts Interrupt Handlers Interrupt Priorities Interrupt applications 6-2.
Introduction to Embedded Systems Intel Xscale® Assembly Language and C Lecture #3.
Interrupts Chapter 8 – pp Chapter 10 – pp Appendix A – pp 537 &
Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 1.
1 中斷 Interrupt. 2 謂何需要 Interrupt I/O  Busy/wait I/O is very inefficient. CPU can ’ t do other work while testing device. Hard to do simultaneous I/O.
68HC11 Polling and Interrupts
Multiple data transfer instructions ARM also supports multiple loads and stores: ldm/ldmia/ldmfd: load multiple registers starting from [base register],
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.
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.
Embedded System:ARM Software Development 1 ARM Software Development.
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
COMP3221 lec40-exception-review.1 Saeid Nooshabadi COMP 3221 Microprocessors and Embedded Systems Lecture 40: Review of Exception
The ARM Programmer’s Model
Embedded System Design Center Sai Kumar Devulapalli ARM7TDMI Microprocessor Thumb Instruction Set.
Exception and Interrupt Handling
Embedded Systems 7763B Mt Druitt College of TAFE
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.
Revised: Aug 1, ECE 263 Embedded System Design Lessons 23, 24 - Exceptions - Resets and Interrupts.
Introduction to Embedded Systems Rabie A. Ramadan 6.
ECE 353 Introduction to Microprocessor Systems Discussion 11.
Lecture 4. ARM Instructions #1 Prof. Taeweon Suh Computer Science Education Korea University ECM586 Special Topics in Embedded Systems.
Lab I Real-Time Embedded Operating System for a SoC System.
ARM Cortex-M0 August 23, 2012 Paul Nickelsberg Orchid Technologies Engineering and Consulting, Inc. CORTEX-M0 Structure Discussion.
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.
Exceptions and Interrputs CS 321 – Introduction to Computer Architecture and Machine-Level Programming Barry Britt, Systems Analyst II Department of Computer.
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.
Resets & Interrupts MTT CPU08 Core Motorola CPU08 RESETS & INTERRUPTS.
Lecture 6: Branching CS 2011 Fall 2014, Dr. Rozier.
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.
ARM7 TDMI INTRODUCTION.
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.
Ch 5. ARM Instruction Set  Data Type: ARM processors supports six data types  8-bit signed and unsigned bytes  16-bit signed and unsigned half-words.
DATE S. S.. Sandstone The sandstone carries out the following tasks: 1. Set up target platform environment, 2. Load a bootable image into memory, 3. Relinquish.
Cortex-M3 Exceptions RTLAB. Hyeonggon Jo.  Exceptions Exception types & priority Abort model SVC and PendSV  Interrupt operation Pre-emption & Exit.
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학기 충북대학교 전자공학과 박 찬식
Multiple data transfer instructions ARM also supports multiple loads and stores: When the data to be copied to the stack is known to be a multiple of 4.
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.
Chapter 12: Software interrupts (SWI) and exceptions
Chapter 9: Hardware Interrupts -- IRQ=External Interrupt Request
68HC11 Interrupts & Resets.
Embedded System Design Center
Chapter 9 Exception & Interruption
Timer and Interrupts.
May 2006 Saeid Nooshabadi ELEC2041 Microprocessors and Interfacing Lectures 27: Exceptions & Interrupts - I
Lecture 5: Lab 3 – Active HW Accelerator Design
Real-Time Embedded Operating System for a SoC System
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
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:

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

Startup Flow Chat Reset Building Exception Handler Initiation Stack Pointer for Exception mode and SPSR Execution C_function initialization Stack LDR r7, #RAMBased MRSr4, cpsr ORRr4, r4, #NoIRQ ORRr4, r4, #NoFIQ BICr4, r4, #ModeMask Clear Mode MOVr2, #User32Mode ; ORRr5, r4, #IRQ32Mode MSRcpsr_c, r5 MSRspsr_c, r2 MOVsp, r7; Initial IRQ stack pointer... SUBr7, r7, #IRQStackSize....;;Set SVC Mode Stack pointer ;;Set User Mode Stack pointer Set INTMSK ;Disable IRQ Clear INTPND

ARM Exception ARM Exception Events 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,#0xff ; 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

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 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) #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 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 INTERVAL 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) #define TDATA0 REG32(SYS_BASE+0x6004)

About CodeWarrior Configure

Reference Samsung S3C4510B User ’ s Manual Samsung S3C4510B User ’ s Manual r/SystemLSI/Networks/PersonalNTASSP/Commu nicationProcessor/S3C4510B/S3C4510B.htm r/SystemLSI/Networks/PersonalNTASSP/Commu nicationProcessor/S3C4510B/S3C4510B.htm Chapter 7 ARM Exceptions ARM 原理與實作 – 以網路 SOC 為例