TEACHING MICROPROCESSOR SYSTEMS BY BUILDING LINUX DRIVERS
Most of the computer science and information technology courses are about programming in a high level, based on mathematical principles and methodologies of abstraction, such as object-oriented programming, message passing, event-based, object-oriented, distributed-orientated code and data persistence. Our department follows the same guidelines.
The problem that inherently appears is that high-level programming does not provide a clear understanding of what the computer really does when executing a program. Students are alienated from the infrastructure, which in turn renders impossible to understand lower-level issues, such as memory leakage and other problems, or synchronisation issues that appear in embedded or real-time systems. Most of the students build a distorted perception of hardware matters and dim view about how a program works in the digital microcosm.
The course of “Microcomputers and applications” focuses on providing the low-level details of computing to students. It aims to clarify the infrastructure of computing by studying the parts of a computer (from CPU to I/O) and their functionality in terms of software. Completing the course, students have a clear understanding of the computer parts, functions and communications.
A survey in several curricula agreed with our feeling that Linux kernel modules may be used excellently as educational tool. Linux kernel modules offer several advantages over user-level programs, including the availability of open-source code, while they simplify and isolate the work from the actual kernel code, although they are part of a running kernel. Also, they protect against some of the vulnerabilities of system programming. Administrative difficulties that system programming imposes are annihilated using virtual machines.
In our lab session, we introduced Linux kernel modules as a long project. First, a project drives from 8086 Assembly to 32-bit Assembly and C on Linux. Then, students build a simple kernel module in C. There, they link a function in Assembly that becomes the interrupt handler for the serial port. The requirements were: (a) Introduce interrupts and IRQ handling and (b) control serial port (the UART). Previously, those issues where studied independently, in separate projects for interrupts and serial communication in 8086 Assembly. We felt that introducing C linked to Assembly, in a contemporary set-up (32-bit) and together with more operating systems experience, would increase students' interest on the course. A Linux kernel module for a serial-port device driver was the conclusion. The serial port is read -when interrupts- and the characters found are sent back.
The project was introduced in autumn 2007, after discussion with the students, who responded unexpectedly positive, immediately expressing their interest. During the semester they showed initiatives to learn more in a faster, self-driven pace.
The following semester it was a positive surprise that more people applied for the course.