D0003E: Real-Time Systems

Spring 2016
Old web page from 2015


News and updates will always be announced here, with latest news on topmost row:
2016-04-06The grading of the exam consumes more time than I hade hoped; unfortunately, I have two courses to grade, and I am grading alone. The result will be announced as soon as possible.
2016-03-08Because of the severe problems in the lab (which is hopefully solved now), we cancel lab 5 this year.
2016-03-08The lecture on friday is cancelled (not needed).
2016-03-08Atmel studio 7.0 will be installed today manually on all computers. They'r supposed to work at the lab class this afternoon.
2016-03-04The lab is now supposed to work. Please test!
2016-03-02Lab class tomorrow morning is cancelled because of the software problems in the lab.
Since the lab have had severe software problems the last week, I have adjusted the deadlines. I will also schedule extra lab classes, please look in the schedule.
2016-02-01All keyvards should now work.
Not related to this course specifically: When the new keycard system was launched, a large njumber of pincodes got lost. If this is the case, you might have to update your pin-code: Mitt LTU -> Mina Uppgifter -> LTU Kort -> Ändra PIN-Kod. Information about this habe also appeared elsewhere.
2016-01-28I got information that the keycards does not work for the lab. I have ordered that all the keycards for all the corses that are scheduled in the lab should work. It became a huge order, so it will probably take a day or two.
2016-01-22Lab deadlines now exists!
2016-01-22Updated links and added section on C programming. Added pdf link to C book.
2016-01-22Please pick upp your lab equipment at the first lab-class on monday since hasans office is not suitable for equpment hand-out i a large scale.
2016-01-08Updated links.
2016-01-07 Nu börjar vi på 2016 års version av webbsidan.


Schedule for Luleå


Lecture 1:
Introduction to real-time systems and C slides (pdf)
Lecture 2:
Bit manipulation and hardware interfacing
slides (pdf), extra slides (pdf)
Lecture 3:
Concurrent threads and mutual exclusion
slides (pdf)
Lecture 4:
The inner workings of a kernel
main slides (pdf), extra slides (pdf)
Lecture 5:
Events, interrupts & reactions
slides (pdf)
Lecture 6:
A model of reactive objects
slides (pdf)
Lecture 7:
Continuation of lecture 6

Lecture 8:
Clocks, timers, and periodic execution slides (pdf)
Lecture 9:
Deadlines and priorities slides (pdf), examples (pdf)
Lecture 10:
Scheduling and feasability slides (pdf)
Lecture 11:
Priority Inversion slides (pdf)
Lecture 12:
POSIX threads slides (pdf)
Lecture 13:
More inter-process communication
slides (pdf)
Lecture 14:
Real-Time Languages and synchronization
Lecture 15:
Repetition and infamous realtime systems
slides (pdf, full-page),slides (pdf, 6 per page), infamous systems (pdf)
Lecture 16:

Course aim

The aim of the course is to give competence in the development of real time systems in high level programming
languages, to discuss various models of synchronization and communication between concurrent processes in such
systems, and to study the characteristics of real time systems and their constructions.  The central concepts of the
course are concurrency - where programs are built using several concurrent threads of execution, reactivity  -
where external input is reacted to rather than requested, and real-time - where the timing behavior of a reactive
system is also of interest.

Course content

Concurrent Programming:
Reactive Programming:
Real Time Systems:
Course description from the course catalog

Course literature

Alan Burns and Andy Wellings.
Real-Time Systems and Programming Languages.
Addison-Wesley, third edition, 2001.
ISBN: 0-201-72988-1.

Fouth edition is also perfectly usable.

Examiner & lecturer

Fredrik Bengtsson
E-mail: bson@ltu.se
Office: A3308
Phone: 49 24 31

Lab supervisor

Hasan Derhamy
E-mail: hasan.derhamy@ltu.se
Office: A3203

Niklas Karvonen

Lab assignments

Rules (Must read!)

It is very easy to get started with the new equipment. Just connect the AVR ISP programmer to the computer by USB and to the Butterfly board with the USB cable. Programming is performed in "Atmel Studio". Choose to crerate a new GCC C Executable project and select ATmega169P as device. Use Tools > Device programming to program your device with an elf or hex file. Here, you need to select ATmega169P again. If you're asked to upgrade the firmware on the programmer, choose to do so. Be sure to work in your home directory and not on the local computer.

Lab 1: C programming on bare metal
deadline: 1/2
Lab 2: A lightweight multi-threading kernel
deadline: 12/2
Lab 3: A threaded reformulation of lab 1
deadline: 22/2
Lab 4: Dual pulse generators with a GUI
deadline: -
Lab 5: Traffic light control and simulation
deadline: -
Extra: Lab 6: Commanding a robot (not mandatory)
deadline before exam

Target platform documentation

The AVR Butterfly User's Guide describes the features of the platform (an evaluation kit) in overall terms.

The ATmega169 datasheet gives detailed information about the microcontroller that powers the Butterfly board.

Standard libraries in the C implementation on the AVR

The AVR instruction set explains the assembly language instructions that the ATmega169 uses.

The AVR065 application note provides details about the LCD driver on the Butterfly board.

The ATmega32 datasheet gives detailed information about the microcontroller that powers the miniature robots.

The AVR-P40-USB notes provide an overview of the development circuit board on the miniature robots.

Target platform resources

Lawicel, online supplier of AVR Butterfly cards.

Software Crew, another AVR Butterfly supplier.

Smiley Micros, USA-based supplier of AVR material.

WinAVR, open source C cross-compiler, libraries and download utilities (for Windows).

AVR Studio, optional AVR integrated development environment for Windows that installs on top of WinAVR.

Darwinports avr-gcc, open source C cross-compiler, libraries and download utilities (MacOS X)

AVR freaks, miscellaneous AVR-related info.

References for the C programming language

The C programming language - ANSI C version

Dave Marshall, Programming in C

Steve Holmes, C Programming

Steve Summit, C Programming Notes

Marshall Brain, How C Programming Works

Lee Tauck, C Tutorial

Mikael Sundström, Some C-tricks and Tips for Real-time Programming

Java and C Comparison Chart

Links to related information

Johan Nordlander, Programming with the TinyTimber Kernel

POSIX Threads Programming, Livermore Computer Traning, Lawrence Livermore National Laboratory

Ken Tindell & Hans Hansson, Real-Time Systems by Fixed Priority Scheduling, Tech. report, Uppsala University, 1996

The POSIX specification

POSIX in realtime

UnixWare 7 online manual pages

ANSI terminal control codes

Cygwin documentation

Ariane 5 Launch Failure

Apollo 11 Program Alarms

Mars Pathfinder Priority Inversion

Therac-25 Accidents