The eCos real-time operating system an open source tool to create embedded kernels and applications.

Slides:



Advertisements
Similar presentations
The OS kernel: Implementing processes and Threads Kernel Definitions and Objects Queue Structures Threads Implementing Processes and Threads Implementing.
Advertisements

Resource management and Synchronization Akos Ledeczi EECE 354, Fall 2010 Vanderbilt University.
Real-Time Library: RTX
Bilgisayar Mühendisliği Bölümü GYTE - Bilgisayar Mühendisliği Bölümü Multithreading the SunOS Kernel J. R. Eykholt, S. R. Kleiman, S. Barton, R. Faulkner,
Chorus and other Microkernels Presented by: Jonathan Tanner and Brian Doyle Articles By: Jon Udell Peter D. Varhol Dick Pountain.
Model for Supporting High Integrity and Fault Tolerance Brian Dobbing, Aonix Europe Ltd Chief Technical Consultant.
Chapter 13 Embedded Systems
Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,
ECE 526 – Network Processing Systems Design Software-based Protocol Processing Chapter 7: D. E. Comer.
Contiki A Lightweight and Flexible Operating System for Tiny Networked Sensors Presented by: Jeremy Schiff.
1 CS318 Project #3 Preemptive Kernel. 2 Continuing from Project 2 Project 2 involved: Context Switch Stack Manipulation Saving State Moving between threads,
Home: Phones OFF Please Unix Kernel Parminder Singh Kang Home:
Chapter 13 Embedded Systems
OS Spring’03 Introduction Operating Systems Spring 2003.
1 Chapter 13 Embedded Systems Embedded Systems Characteristics of Embedded Operating Systems.
1 Threads Chapter 4 Reading: 4.1,4.4, Process Characteristics l Unit of resource ownership - process is allocated: n a virtual address space to.
Performance Evaluation of Real-Time Operating Systems
Embedded Operating System Design October 4, 2012 Doug Kelly.
Introduction to Embedded Systems
Chapter 8 Windows Outline Programming Windows 2000 System structure Processes and threads in Windows 2000 Memory management The Windows 2000 file.
Presentation by Betsy Kavali
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.
1 Lecture 4: Threads Operating System Fall Contents Overview: Processes & Threads Benefits of Threads Thread State and Operations User Thread.
RTEMS overview W. Eric Norum Introduction RTEMS is a tool designed specifically for real-time embedded systems The RTEMS product is an executive.
OS provide a user-friendly environment and manage resources of the computer system. Operating systems manage: –Processes –Memory –Storage –I/O subsystem.
Introduction to Embedded Systems Rabie A. Ramadan 6.
Scheduling Basic scheduling policies, for OS schedulers (threads, tasks, processes) or thread library schedulers Review of Context Switching overheads.
Real-Time Systems Design1 Priority Inversion When a low-priority task blocks a higher-priority one, a priority inversion is said to occur Assume that priorities:
CSE451 NT Synchronization Autumn 2002 Gary Kimura Lecture #9 October 18, 2002.
The Performance of Micro-Kernel- Based Systems H. Haertig, M. Hohmuth, J. Liedtke, S. Schoenberg, J. Wolter Presentation by: Seungweon Park.
CS 346 – Chapter 4 Threads –How they differ from processes –Definition, purpose Threads of the same process share: code, data, open files –Types –Support.
® 7-2 Semaphores 7.1Overview Binary Semaphores and Synchronization Mutual Exclusion.
Fall 2013 SILICON VALLEY UNIVERSITY CONFIDENTIAL 1 Introduction to Embedded Systems Dr. Jerry Shiao, Silicon Valley University.
1 EPICS Bus Errors & Power PC u VME Bus Error can generate a Machine Check Exception (MCE) u The WRS mv2700 BSP doesn’t have code to do this u Write cycles.
The Mach System Abraham Silberschatz, Peter Baer Galvin, Greg Gagne Presentation By: Agnimitra Roy.
The Performance of μ-Kernel-Based Systems H. Haertig, M. Hohmuth, J. Liedtke, S. Schoenberg, J. Wolter Presenter: Sunita Marathe.
The Mach System Abraham Silberschatz, Peter Baer Galvin, and Greg Gagne Presented by: Jee Vang.
Embedded Systems OS. Reference Materials The Concise Handbook of Real- Time Systems TimeSys Corporation.
ECGR-6185 µC/OS II Nayana Rao University of North Carolina at Charlotte.
4th December 2003 Kernel Implementation of Monitors for E.R.I.K.A. 1 KERNEL IMPLEMENTATION OF MONITORS FOR ERIKA (MS Final Examination) by Sathish Kumar.
1 VxWorks 5.4 Group A3: Wafa’ Jaffal Kathryn Bean.
CS399 New Beginnings Jonathan Walpole. 2 Concurrent Programming & Synchronization Primitives.
The Performance of Micro-Kernel- Based Systems H. Haertig, M. Hohmuth, J. Liedtke, S. Schoenberg, J. Wolter Presentation by: Tim Hamilton.
Managing Processors Jeff Chase Duke University. The story so far: protected CPU mode user mode kernel mode kernel “top half” kernel “bottom half” (interrupt.
1 Process Description and Control Chapter 3. 2 Process A program in execution An instance of a program running on a computer The entity that can be assigned.
CHAPTER 7 CONCURRENT SOFTWARE Copyright © 2000, Daniel W. Lewis. All Rights Reserved.
CSCI1600: Embedded and Real Time Software Lecture 17: Concurrent Programming Steven Reiss, Fall 2015.
DSP/BIOS Real Time Operating system using DSP /ARM processor.
Where Testing Fails …. Problem Areas Stack Overflow Race Conditions Deadlock Timing Reentrancy.
Mutual Exclusion -- Addendum. Mutual Exclusion in Critical Sections.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
CSCI/CMPE 4334 Operating Systems Review: Exam 1 1.
The Structuring of Systems Using Upcalls By David D. Clark Presented by Samuel Moffatt.
WORKING OF SCHEDULER IN OS
REAL-TIME OPERATING SYSTEMS
PROCESS MANAGEMENT IN MACH
CS 6560: Operating Systems Design
The Mach System Sri Ramkrishna.
Topics Covered What is Real Time Operating System (RTOS)
Chapter 5: Process Synchronization – Part 3
6.0 INTRODUCTION TO REAL-TIME OPERATING SYSTEMS (RTOS/RTK)
CSCI 511 Operating Systems Chapter 5 (Part C) Monitor
Lecture Topics: 11/1 General Operating System Concepts Processes
Lecture 2 Part 2 Process Synchronization
CSCI1600: Embedded and Real Time Software
CSE 153 Design of Operating Systems Winter 19
CS333 Intro to Operating Systems
Outline Operating System Organization Operating System Examples
CSCI1600: Embedded and Real Time Software
In Today’s Class.. General Kernel Responsibilities Kernel Organization
Presentation transcript:

The eCos real-time operating system an open source tool to create embedded kernels and applications

Layering of eCos system packages

Configuration System It is the ‘heart’ of eCos. Select only the packages that are necessary through configuration. This reduces the footprint of the application. eCos uses compile-time control methods. This allows the application writer control over individual lines of code in the packages. The control methods are implemented through C Preprocessor

Example of Configuration #if defined(CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS) && !defined(CYGPKG_CYGMON) if (__mem_fault_handler) { regs->pc = (CYG_ADDRWORD)__mem_fault_handler; return; } _hal_registers = regs; __handle_exception();

Example of Configuration #elif defined(CYGFUN_HAL_COMMON_KERNEL_SUPPORT) && defined(CYGPKG_HAL_EXCEPTIONS) cyg_hal_deliver_exception( regs->vector>>8, (CYG_ADDRWORD)regs ); #else CYG_FAIL("Exception!!!");

eCos Components The following are the core components : – Hardware Abstraction Layer – Real-time kernel. – ISO C and math libraries – Device drivers – GNU Debugger (GDB) support The real-time kernel is the central core component.

eCos API eCos supports the following standard API – µitron – POSIX – Embedded Linux API compatible with EL/IX. – It’s own native API.

Hardware Abstraction Layer (HAL) The HAL is a software layer. It provides a platform independent API for platform specific functionality. Enhances portability of code.

Example Implementation for ARM architecture #define HAL_ENABLE_INTERRUPTS() \ asm volatile { \ “mrs r3,cpsr;” \ “bic r3,r3,#0xc0;” \ : \ : “r3” \ };

Example implementation for PowerPC Architecture #define HAL_ENABLE_INTERRUPTS() \ CYG_MACRO_START \ cyg_uint32 tmp1, tmp2; \ asm volatile ( \ "mfmsr %0;" \ "ori %1,%1,0x8000;" \ "rlwimi %0,%1,0,16,16;" \ "mtmsr %0;" \ : "=r" (tmp1), "=r" (tmp2)); \ CYG_MACRO_END

Example Implementation For both the platforms the underlying implementation of the macro HAL_ENABLE_INTERRUPTS() is different. But the API is the same macro HAL_ENABLE_INTERRUPTS()

Example Scenario Generally on being interrupted, all interrupts are disabled. Bad idea : –Enable interrupts at the end of ISR. –Disadv. : System loses predictability. Good idea : –Enable all interrupts at the start of ISR. –Adv. : interrupts can be pre-empted

The Kernel The Kernel is the core to the eCos system. Provides standard functionality like – interrupt and exception handling – scheduling – threads – synchronization

Kernel API The kernel provides a C API for direct interfacing to the kernel. The kernel API does not return error codes as is usual. Instead it provides a number of assertions that can be enabled or disabled.

Assertions available CYG_FAIL ( diag_message ) Does not accept a condition as its first argument. CYG_ASSERT ( condition, diag_message ) Accepts a condition as it’s first argument. CYG_ASSERTC ( condition ) Compact version of the above assertion

Assertions The first two assertions output a diagnostic message that is given as parameter. CYG_FAIL outputs the messages irrespective of any conditions. CYG_ASSERTC() macro does not output any diagnostic messages.

Exception Handling Exception handling can be done in two ways : – HAL + Kernel Exception Handling – Application Exception Handling HAL + Kernel Exception Handling is the default option.

HAL + Kernel Exception Handling Uses a Vector Service Routine (VSR). It is an array of pointers to exception handler routines. HAL does basic interrupt processing like saving the context etc … Then control goes to kernel for further processing if required.

Application Exception Handling Applications can provide their own VSR when an exception occurs. VSR’s must be written in assembly language. HAL_VSR_GET and HAL_VSR_SET are macros provided to give access to VSR table.

Interrupt Processing Provides ISR’s and DSR’s ISR’s perform most common tasks. They are small and execute quickly. DSR’s perform additional processing if necessary.

Interrupt Processing In ISR’s calling synchronization primitives is not allowed. They are allowed in DSR. DSR must not make any synchronization calls that block.

Interrupt Processing Synchronization primitives are not allowed inside the ISR’s because –ISR’s must be fast and bounded by time. –If due to some reason a synchronization primitive causes the task to wait or sleep then it is not acceptable.

Scheduler It’s the core of the kernel. eCos provides two schedulers –Multilevel Queue Scheduler –Bitmap Scheduler

Multilevel Queue Scheduler Allows multiple threads at same priority level. Allows pre-emption between different priority levels. Timeslicing within a priority level allowed.

Bitmap Scheduler Only single thread at each priority level. Pre-emption between different priority levels allowed. Makes the scheduling algorithm simple and hence efficient.

Threads eCos kernel provides API functions for controlling threads within a function. In addition to kernel threads eCos also allows POSIX threads.

Thread handling fuctions Various thread controlling functions exist to – create and exit threads – kill or delete threads – yield a thread. – delay, suspend and resume threads. – and more thread specific functions

Synchronization Mechanisms The synchronization mechanisms provided by eCos are : – mutexes – semaphores – condition variables – flags – message Boxes – spinlocks (For SMP systems)

Mutexes Mutexes allow multiple threads to share resources serially. Mutexes provide protection against Priority Inversion Problem. eCos provides Priority Ceiling Protocol and Priority Inheritance protocol as solutions to above problem.

The Protocols Priority Ceiling Protocol –priority of the owner of mutex is raised to some predefined value. –not elegant. Priority Inheritance –priority of owner of thread is raised to highest level of all threads waiting for the mutex. –Synchronization calls are costlier.

Mutexes API Kernel Mutex controlling API cyg_mutex_init() cyg_mutex_destroy() cyg_mutex_lock() cyg_mutex_trylock() cyg_mutex_unlock() cyg_mutex_release() cyg_mutex_set_ceiling() cyg_mutex_set_protocol()

Semaphores eCos kernel provides API functions for creating and manipulating semaphores. Kernel API is for counting semaphores and not binary semaphores.

Semaphores API Kernel Semaphore controlling API cyg_semaphore_init() cyg_sempahore_destroy() cyg_semaphore_wait() cyg_semaphore_trywait() cyg_semaphore_timed_wait() cyg_semaphore_post() cyg_semaphore_peek()

Condition Variables Condition variables are used with mutexes to allow multiple threads to access shared data. eCos kernel provides API to control condition variables.

Condition Variables API Kernel API to control condition variables cyg_cond_init() cyg_cond_destroy() cyg_cond_wait() cyg_cond_timed_wait() cyg_cond_signal() cyg_cond_broadcast