Professional Documents
Culture Documents
Fundamnetals
B. Ramamurthy
1
Topics for Discussion
Project 1 Review
Kernel and device drivers
Realtime kernel fundamentals (chapter 3)
2
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.
3
Once you have downloaded and extracted the xinu tarball, you will see a basic
directory structure:
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.
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.
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. 4
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 CFE> (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 ip]:xinu.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.
5
Kernel & Device drivers
Servers (application ~, web ~, component ~)
Device drivers
Hardware/controller
Devices
6
Real-time Kernels
7
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_here=0;
}
}
Excellent for handling high-speed data channels, a processor is
dedicated to handling the data channel.
Disadvantage: cannot handle bursts
8
Simple kernels: cyclic executives
9
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.
10
Finite state automata and Co-routine
based kernels
void process_a(void){ state_a and state_b are state
for(;;) { counters;
switch (state_a) { Communication between coroutines
case 1: phase_a1(); | thru global variables;
case 2: phase_a2(); | Example: the fanous CICS from IBM
: Customer Information Control
. System
case n: phase_an();}}} IBMs OS/2 uses this in Windows
presentation management.
void process_b(void){
for(;;) {
switch (state_b) {
case 1: phase_b1(); |
case 2: phase_b2(); |
.
case n: phase_bn();}}}
11
Interrupt driven systems
12
Interrupt driven systems: code example
void int1(void){
save (context);
taks1();
retore (context);}
void int1(void){
save (context);
taks1();
restore (context);}
13
Process scheduling
14
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 i: 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.
15