SOC Consortium Course Material SoC Design Laboratory Lab 8 Real-time OS - 1 Speaker: Yung-Chih Chen Advisor: Prof. Chun-Yao Wang November 17, 2003 Department.

Slides:



Advertisements
Similar presentations
Embedded System Presentation Nguyễn Trần Quang Nguyễn Công Vũ 1µC/OS-II.
Advertisements

Department of Mathematics and Computer Science μC/OS-II 2IN60: Real-time Architectures (for automotive systems)
Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators.
OS Fall ’ 02 Introduction Operating Systems Fall 2002.
CSE Fall Introduction - 1 What is an Embedded Systems  Its not a desktop system  Fixed or semi-fixed functionality (not user programmable)
Embedded Real-time Systems The Linux kernel. The Operating System Kernel Resident in memory, privileged mode System calls offer general purpose services.
OS Spring’03 Introduction Operating Systems Spring 2003.
Chapter 11 Operating Systems
Real-Time Kernels and Operating Systems. Operating System: Software that coordinates multiple tasks in processor, including peripheral interfacing Types.
Threads CS 416: Operating Systems Design, Spring 2001 Department of Computer Science Rutgers University
MicroC/OS-II Embedded Systems Design and Implementation.
Real-Time Operating Systems Suzanne Rivoire November 20, 2002
Performance Evaluation of Real-Time Operating Systems
Chapter 1 Embedded And Real-Time System Department of Computer Science Hsu Hao Chen Professor Hsung-Pin Chang.
ΜC/OS-III Tasks Akos Ledeczi EECE 354, Fall 2010 Vanderbilt University.
Advanced Embedded Systems Design Pre-emptive scheduler BAE 5030 Fall 2004 Roshani Jayasekara Biosystems and Agricultural Engineering Oklahoma State University.
Introduction to Embedded Systems
SOC Consortium Course Material SoC Design Laboratory Lab 8 Real-time OS - 2 Speaker: Yung-Chih Chen Advisor: Prof. Chun-Yao Wang November 17, 2003 Department.
Real-Time Kernel (Part 1)
Advanced Operating Systems CIS 720 Lecture 1. Instructor Dr. Gurdip Singh – 234 Nichols Hall –
The  C/OS-II Real-Time Operating System.  C/OS-II Real-time kernel –Portable, scalable, preemptive RTOS –Ported to over 90 processors Pronounced “microC.
Introduction to Embedded Systems Rabie A. Ramadan 6.
SOC Consortium Course Material Real-time OS Speaker: 沈文中 April. 9, 2003 National Taiwan University Adopted from National Chiao- Tung University SOC Course.
Getting Started with the µC/OS-III Real Time Kernel Akos Ledeczi EECE 6354, Fall 2015 Vanderbilt University.
Processes and Threads CS550 Operating Systems. Processes and Threads These exist only at execution time They have fast state changes -> in memory and.
Real-Time Operating Systems for Embedded Computing 李姿宜 R ,06,10.
Real Time Operating Systems
Real-time OS Hao-yuan Chin Feb. 18, Institute of Electronics, National Chiao Tung University Real-time OS 1 Outline Introduction to RTOS Introduction.
Embedded Operating System Leo Philip 10/5/ Do we need an OS ?
What Every Developer Should Know about the Kernel Dr. Michael L. Collard 1.
Chapter 2 Processes and Threads Introduction 2.2 Processes A Process is the execution of a Program More specifically… – A process is a program.
Embedded Systems OS. Reference Materials The Concise Handbook of Real- Time Systems TimeSys Corporation.
RTX - 51 Objectives  Resources needed  Architecture  Components of RTX-51 - Task - Memory pools - Mail box - Signals.
ECGR-6185 µC/OS II Nayana Rao University of North Carolina at Charlotte.
Real Time Operating Systems Michael Thomas Date: Rev. 1.00Date.
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
MicroC/OS-II S O T R.  MicroC/OS-II (commonly termed as µC/OS- II or uC/OS-II), is the acronym for Micro-Controller Operating Systems Version 2.  It.
1 VxWorks 5.4 Group A3: Wafa’ Jaffal Kathryn Bean.
Department of Computer Science and Software Engineering
Processes, Threads, and Process States. Programs and Processes  Program: an executable file (before/after compilation)  Process: an instance of a program.
SOC Consortium Course Material Standard IO National Taiwan University Adopted from National Taiwan University SoC Design Laboratory.
Implementation of Embedded OS Lab3 Porting μC/OS-II.
6.0 INTRODUCTION TO REAL-TIME OPERATING SYSTEMS (RTOS) 6.0 Introduction A more complex software architecture is needed to handle multiple tasks, coordination,
Lab 3 Department of Computer Science and Information Engineering National Taiwan University Lab3 – μC/OS 2015/10/13/ 13 1.
Embedded Computer - Definition When a microcomputer is part of a larger product, it is said to be an embedded computer. The embedded computer retrieves.
Slides created by: Professor Ian G. Harris Operating Systems  Allow the processor to perform several tasks at virtually the same time Ex. Web Controlled.
1 J.O. KLEIN Institut Universitaire de Technologie de CACHAN Université PARIS SUD - FRANCE An Introduction to Real Time Operating System.
1.  System Characteristics  Features of Real-Time Systems  Implementing Real-Time Operating Systems  Real-Time CPU Scheduling  An Example: VxWorks5.x.
Unit - I Real Time Operating System. Content : Operating System Concepts Real-Time Tasks Real-Time Systems Types of Real-Time Tasks Real-Time Operating.
Chapter 3 RTOS Concepts And Definitions Department of Computer Science Hsu Hao Chen Professor Hsung-Pin Chang.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
Real Time Operating Systems Johan Dams
Big Picture Lab 4 Operating Systems C Andras Moritz
Chapter 1: Getting Started with μC/OS-II 1. kernel Introduction 2 LinuxμC/OS-II Task (process) kernel Device driver User mode (0-3G) (Kernel mode) 3G-4G.
Outlines  Introduction  Kernel Structure  Porting.
Advanced Operating Systems CS6025 Spring 2016 Processes and Threads (Chapter 2)
Embedded Real-Time Systems
CONCEPTS OF REAL-TIME OPERATING SYSTEM. OBJECTIVE  To Understand Why we need OS?  To identify Types of OS  To Define Real - Time Systems  To Classify.
Lab 5 Department of Computer Science and Information Engineering National Taiwan University Lab5 – μC/OS 2016/5/31/ 13 1.
REAL TIME OPERATING SYSTEM
Chapter 1: Getting Started with μC/OS-II
REAL-TIME OPERATING SYSTEMS
CS 6560: Operating Systems Design
OPERATING SYSTEMS CS3502 Fall 2017
Getting Started with the µC/OS-III Real Time Kernel
Intro to Processes CSSE 332 Operating Systems
Operating Systems Chapter 5: Input/Output Management
EE 472 – Embedded Systems Dr. Shwetak Patel.
Computer System Laboratory
Threads CSE 2431: Introduction to Operating Systems
Presentation transcript:

SOC Consortium Course Material SoC Design Laboratory Lab 8 Real-time OS - 1 Speaker: Yung-Chih Chen Advisor: Prof. Chun-Yao Wang November 17, 2003 Department of Computer Science National Tsing Hua University

SOC Consortium Course Material Real-time OS SoC Design Laboratory 1 Outline  Introduction to Real-time Operation System (RTOS)  Introduction to μC/OS-II – Features – Task & task scheduling – Start μC/OS-II – Port application

SOC Consortium Course Material Real-time OS SoC Design Laboratory 2 Real-time OS  Real-time OS (RTOS) is an intermediate layer between hardware devices and software programming  “Real-time” means keeping deadlines, not speed  Advantages of RTOS in SoC design Shorter development time Less porting efforts Better reusability  Disadvantages More system resources needed Future development confined to the chosen RTOS

SOC Consortium Course Material Real-time OS SoC Design Laboratory 3 Soft and Hard Real Time  Soft real-time Tasks are performed by the system as fast as possible, but tasks don’t have to finish by specific times Priority scheduling Multimedia streaming  Hard real-time Tasks have to be performed correctly and on time Deadline scheduling Aircraft controller, Nuclear reactor controller

SOC Consortium Course Material Real-time OS SoC Design Laboratory 4 Outline  Introduction to RTOS  Introduction to μC/OS-II – Features – Task & task scheduling – Start μC/OS-II – Port application

SOC Consortium Course Material Real-time OS SoC Design Laboratory 5 μC/OS-II  Written by Jean J. Labrosse in ANSI C  A portable, ROMable, scalable, preemptive, real-time, multitasking kernel  Used in hundreds of products since its introduction in 1992  Certified by the FAA for use in commercial aircraft  Available in ARM Firmware Suite (AFS)  Over 90 ports for free download 

SOC Consortium Course Material Real-time OS SoC Design Laboratory 6 μC/OS-II Features  Portable runs on architectures ranging from 8- bit to 64-bit  ROMable small memory footprint  Scalable select features at compile time  Multitasking preemptive scheduling, up to 64 tasks

SOC Consortium Course Material Real-time OS SoC Design Laboratory 7 μC/OS-II vs. μHAL  uHAL (pronounced Micro-HAL) is the ARM Hardware Abstraction Layer that is the basis of the ARM Firmware Suite  uHAL is a basic library that enables simple application to run on a variety of ARM-based development systems  uC/OS-II use uHAL to access ARM-based hardware uC/OS-II & User applicationAFS Utilities C, C++ libraries uHAL routines Development board AFS support routines

SOC Consortium Course Material Real-time OS SoC Design Laboratory 8 Task  Task is an instance of program  Task thinks that it has the CPU all to itself  Task is assigned a unique priority  Task has its own set of stack  Task has its own set of CPU registers (backup in its stack)  Task is the basic unit for scheduling  Task status are stored in Task Control Block (TCB)

SOC Consortium Course Material Real-time OS SoC Design Laboratory 9 Task Structure Task structure:  An infinite loop  An self-delete function void ExampleTask(void *pdata) { for(;;) { /* User Code */ /* System Call */ /* User Code */ } Task with infinite loop structure void ExampleTask(void *pdata) { /* User Code */ OSTaskDel(PRIO_SELF); } Task that delete itself

SOC Consortium Course Material Real-time OS SoC Design Laboratory 10 Task States Waiting Dormant Ready Running ISR Task Create Task Delete Highest Priority Task Task is Preempted Task Pending EventsTask Gets Event Task Delete Interrupt Int. Exit Task Delete

SOC Consortium Course Material Real-time OS SoC Design Laboratory 11 Task Priority  Unique priority (also used as task identifiers)  64 priorities max (8 reserved)  Always run the highest priority task that is READY  Allow dynamically change priority

SOC Consortium Course Material Real-time OS SoC Design Laboratory 12 Task Control Block uC/OS-II use TCB to keep record of each task States Stack Pointer Priority Misc … Link Pointer

SOC Consortium Course Material Real-time OS SoC Design Laboratory 13 Task Control Block(cont.)

SOC Consortium Course Material Real-time OS SoC Design Laboratory 14 Exchanging CPU Control void ExampleTask(void *pdata) { for(;;) { /* User Code */ /*System Call */ /* User Code */ } OSMboxPend(); OSQPend(); OSSemPend(); OSTaskSuspend(); OSTimeDly(); OSTimeDlyHMSM(); More… uC/OS-II Kernel API Control returns from task to OS when Kernel API is called

SOC Consortium Course Material Real-time OS SoC Design Laboratory 15 Exchanging CPU Control ABBCA Interrupt Handler OS Task Time Scheduling System Call Interrupt Interrupt Exit Only one of OS, Task, Interrupt Handler gets CPU control at a time

SOC Consortium Course Material Real-time OS SoC Design Laboratory 16 Task Scheduling Time ISR Low-priority Task High-priority Task ISR makes the high-priority task ready low-priority task Relinquishes the CPU  Non-preemptive

SOC Consortium Course Material Real-time OS SoC Design Laboratory 17 Task Scheduling  Preemptive uC/OS-II adopts preemptive scheduling Time ISR Low-priority Task High-priority Task ISR makes the high-priority task ready high-priority task Relinquishes the CPU

SOC Consortium Course Material Real-time OS SoC Design Laboratory 18 Starting  C/OS-II Initialize hardware & uC/OS-II ARMTargetInit(), OSInit() Initialize hardware & uC/OS-II ARMTargetInit(), OSInit() Allocate resources OSMemCreate(), OSMboxCreate(), …etc Allocate resources OSMemCreate(), OSMboxCreate(), …etc Create at least one task OSTaskCreate() Create at least one task OSTaskCreate() Start Scheduler OSStart() Start Scheduler OSStart()

SOC Consortium Course Material Real-time OS SoC Design Laboratory 19 Porting Application Necessary coding changes  variables use local variables for preemption use semaphore to protect global variables (resources)  data transfer arguments => mailbox/queue  memory allocation malloc() => OSMemCreate() OSMemGet()

SOC Consortium Course Material Real-time OS SoC Design Laboratory 20 Porting Application assign task priorities  unique priority level in uC/OS-II only 56 levels available priority can be change dynamically  call OSTimeDly() in infinite loop task ensure lower priority task get a chance to run MUST: if lower priority task is pending data from higher priority task

SOC Consortium Course Material Real-time OS SoC Design Laboratory 21 Lab 8:Real-time OS - 1  Goal – A guide to use RTOS and port programs to it  Principles – Basic concepts and capabilities of RTOS Task, task scheduling – Coding guideline for a program running on the embedded RTOS – Setting up the ARMulator  Guidance  Steps – Building  C/OS-II – Porting Program to  C/OS-II – Building Program with  C/OS-II  Requirements and Exercises – Write an embedded software for ID checking engine (single task)  Discussion – What are the advantages and disadvantages of using RTOS in SOC design?

SOC Consortium Course Material Real-time OS SoC Design Laboratory 22 References [1] AFS_Reference_Guide.pdf