Realtime Systems Fundamnetals - PowerPoint PPT Presentation

About This Presentation
Title:

Realtime Systems Fundamnetals

Description:

Obtain a cross-compiler to compile embedded XINU kernel into MIPS code for the CPU on WRT54GL. ... compile/ contains the Makefile and other necessities for ... – PowerPoint PPT presentation

Number of Views:56
Avg rating:3.0/5.0
Slides: 16
Provided by: bina1
Learn more at: https://cse.buffalo.edu
Category:

less

Transcript and Presenter's Notes

Title: Realtime Systems Fundamnetals


1
Realtime Systems Fundamnetals
  • B. Ramamurthy

2
Topics for Discussion
  • Project 1 Review
  • Kernel and device drivers
  • Realtime kernel fundamentals (chapter 3)

3
Project 1 Load Embedded XINU into WRT54GL
wireless router
  • We create a little computer out of WR54GL by
    loading embedded XINU in to its RAM.
  • Read project 1 handout
  • Assemble the components needed to add a UART chip
    to the WRT54GL that will enable you to access
    WRT54GL storage and devices.
  • Obtain a cross-compiler to compile embedded XINU
    kernel into MIPS code for the CPU on WRT54GL.
  • We have downloaded a Linux-based cross-compiler
    that will compile the embedded XINU files and
    generate xinu.boot or variations of this.
  • Download embedded xinu tar ball and untar it and
    compile it (gmake) to obtain it to generate the
    xinu.boot
  • Lets study the various components of the embedded
    XINU distribution.

4
Once you have downloaded and extracted the xinu
tarball, you will see a basic directory
structure AUTHORS include/ LICENSE README
system/ tty/ compile/ lib/ loader/ shell/ test/
uart/ AUTHORS is a brief history of
contributors to the XINU operating system in it's
varying iterations. compile/ contains the
Makefile and other necessities for building the
XINU system once you have a cross-compiler.
include/ contains all the header files used by
XINU. lib/ contains a folder (libxc/) with a
Makefile and source for the library, as well as a
binary blob which contains the pre-compiled
library. LICENSE is the license under which
this project falls. loader/ contains assembly
files and is where the bootloader will begin
execution of O/S code. README is this document.
shell/ contains the source for all shell
related functions. system/ contains the source
for all system functions such as the nulluser
process (initialize.c) as well as code to set up
a C environment (startup.S). test/ contains a
number of testcases (which can be run using the
shell command testsuite). tty/ contains the
source for the tty driver. uart/ contains the
source for the uart driver.
5
Next steps
  • Connect the serial port of the modified hardware
    to the serial port of a host computer with
    xinu.boot code.
  • Use a serial communication program (we used
    Hyperterminal) to configure the serial port of
    the host to the settings 8 data bits, no parity
    bit, and 1 stop bit (8N1) with a speed of 115,200
    bps.
  • Use another router to form a local network and
    assign IP addresses to the router and the host
    computer.
  • Power up the WRT54GL. If you send cntrlC (break)
    characters from host console, you will see it
    responding with CFEgt (common firmware environment
    for WRT54GL)
  • The Broadcom Common Firmware Environment (CFE) is
    a collection of software modules for
    initialization and bootstrap of designs
    incorporating Broadcom MIPS64 processors. Link
  • Serial port you created is your means to
    communicate with WRT54GL CFE
  • Use a TFTP on the host to make the boot images
    available on the network for XINU to boot.
    (How?)
  • ifconfig eth0 auto (obtain ip address for eth0
    of WRT54GL)
  • boot -elf host ipxinu.boot (initiate a TFTP
    boot)
  • Above two commands are given from CFE command
    line
  • Once XINU boots (uploads into the RAM), you will
    see XINU shell.
  • Now you can run XINU commands help, ps etc.
  • Add a simple C program hello.c to print hello
    world.
  • End of first project.

6
Kernel Device drivers
Servers (application , web , component )
Shell
XWin
Thread lib
ftp
User applications
System call interface
Process, memory, file system, network managers.
Kernel
Device drivers
Hardware/controller
Devices
7
Real-time Kernels
  • A process is an abstraction of a running program
    and a logical unit of work scheduled by the
    operating system.
  • A thread is a light weight process that
    represents of a flow of control thorough a
    process.
  • Real-time operating system must provide these
    specific functions for processes
  • Scheduling
  • Dispatching
  • Intercommunication and synchronization
  • Kernel of an operating system provides these
    functions.

8
Simple kernels
  • Polled loop Say a kernel needs to process
    packets that are transferred into the DMA and a
    flag is set after transfer
  • for()
  • if (packet_here)
  • process_data()
  • packet_here0
  • Excellent for handling high-speed data channels,
    a processor is dedicated to handling the data
    channel.
  • Disadvantage cannot handle bursts

9
Simple kernels cyclic executives
  • Illusion of simultaneity by taking advantage of
    relatively short processes in a continuous loop
  • for()
  • process_1()
  • process_2()
  • process_3()
  • process_n()
  • Different rate structures can be achieved by
    repeating tasks in the list
  • for()
  • process_1()
  • process_2()
  • process_3()
  • process_3()

10
Cyclic Executives example Interactive games
  • Space invaders
  • for()
  • check_for_keypressed()
  • move_aliens()
  • check_for_keypressed()
  • check_collision()
  • check_for_keypressed()
  • update_screen()
  • check_keypressed() checks for three button
    pressings move tank left or right and fire
    missiles.
  • If the schedule is carefully constructed we could
    achieve a very efficient game program with a
    simple kernel as shown above.

11
Finite state automata and Co-routine based kernels
  • void process_a(void)
  • for()
  • switch (state_a)
  • case 1 phase_a1()
  • case 2 phase_a2()
  • .
  • case n phase_an()
  • void process_b(void)
  • for()
  • switch (state_b)
  • case 1 phase_b1()
  • case 2 phase_b2()
  • .
  • case n phase_bn()
  • state_a and state_b are state counters
  • Communication between coroutines thru global
    variables
  • Example the fanous CICS from IBM Customer
    Information Control System
  • IBMs OS/2 uses this in Windows presentation
    management.

12
Interrupt driven systems
  • Main program is a simple loop.
  • Various tasks in the system are schedules via
    software or hardware interrupts
  • Dispatching performed by interrupt handling
    routines.
  • Hardware and software interrupts.
  • Hardware asynchronous
  • Software typically synchronous
  • Executing process is suspended, state and context
    saved and control is transferred to ISR
    (interrupt service routine)

13
Interrupt driven systems code example
  • void main()
  • init()
  • while(TRUE)
  • void int1(void)
  • save (context)
  • taks1()
  • retore (context)
  • void int1(void)
  • save (context)
  • taks1()
  • restore (context)
  • Foreground/background systems is a variation of
    this where main does some useful task in the
    background

14
Process scheduling
  • Scheduling is a very important function in a
    real-time operating system.
  • Two types pre-run-time and run-time
  • Pre-run-time scheduling create a feasible
    schedule offline to meet time constraints,
    guarantee execution order of processes, and
    prevents simultaneous accesses to shared
    resources.
  • Run-time scheduling allows events to interrupt
    processes, on demand allocation of resources ,
    and used complex run-time mechanisms to meet time
    constraints.

15
Task characteristics of real workload
  • Each task Ti is characterized by the following
    temporal parameters
  • Precedence constraints specify any tasks need to
    precede other tasks.
  • Release or arrival time ri,j jth instance of
    ith task
  • Phase Fi release time of first instant of ith
    task
  • Response time time between activation and
    completion
  • Absolute deadline instant by which task must
    complete
  • Relative deadline maximum allowable response
    time
  • Period Pi maximum length of intervals between
    the release times of consecutive tasks.
  • Execution time the maximum amount of time
    required to complete a instance of the task
    assuming all the resources are available.
  • Lets look at some examples.
Write a Comment
User Comments (0)
About PowerShow.com