CS 452/652 - Real-time Programming
|
I hear the train a comin'
It's rollin' 'round the bend
And I ain't seen the sunshine
Since I don't know when...
Johnny Cash
|
Photo courtesy of y3285wan (W23) |
|
Fall 2023
Important Note for Students Not Enrolled Yet
Official Course Outline
Registrar's Schedule of Classes
Communication
Piazza is used as the primary communication channel for announcements, clarifications, questions, discussions, etc. It is expected that all students are familiar with all material posted and discussed on Piazza. There are different Q&A folders for each assignment, as well as:
- a general folder
- a Trains+Tracks folder for reporting hardware issues in the lab
Private posting is disabled.
For any personal matters, please email the instructor.
Accommodations
If a student needs to self-isolate due to COVID protocols, individual adjustments will be made to assignment deadlines and/or weighting depending on the particular circumstances.
Lecture Notes
Lecture notes will be posted here after class. They are telegraphic, so they are not a substitute for the lectures. But if you attend the lectures they will most likely be a good memory prosthetic.
- Sep 07, 2023 - Introduction and Overview
- Sep 12, 2023 - Raspberry Pi Devices
- Sep 14, 2023 - Trains + Concurrency and Kernel
- Sep 19, 2023 - Kernel and System Calls
- Sep 21, 2023 - System Call Return, ABI, Kernel Initialization
- Sep 26, 2023 - Scheduling, Memory and Synchronization, Message Passing
- Sep 28, 2023 - Communication Patterns, Name Server, Measurement
- Oct 03, 2023 - Interrupts
- Oct 05, 2023 - AwaitEvent, Clock Server
- Oct 10, 2023 - reading week, no class
- Oct 12, 2023 - reading week, no class
- Oct 17, 2023 - UART interrupt handling
- Oct 19, 2023 - Train Modeling, Velocity
- Oct 24, 2023 - Train Modeling (cont'd)
- Oct 26, 2023 - Train Control Architecture, Latency Analysis
- Oct 31, 2023 - Student Kernel Design Presentations
- Nov 02, 2023 - Student Kernel Design Presentations
- Nov 07, 2023 - Demo Preparations, Routing
- Nov 09, 2023 - TC1 Demos (no class)
- Nov 14, 2023 - TC1 Debrief, TC2 Issues
- Nov 16, 2023 - Track Contention, Routing, Task Priorities
- Nov 21, 2023 - Demo/Project Q&A (in office)
- Nov 22, 2023 - TC2 Demos (note: Wednesday)
- Nov 23, 2023 - no class
- Nov 28, 2023 - Hard Real-Time Scheduling
- Nov 30, 2023 - Priority Inversion, Priority Inheritance
- Dec 05, 2023 - Final Project Demos (no class)
Assignments
Assignment A0 is to be completed independently by each student. Afterwards, groups of 2 students (or 3 in exceptional circumstances) work on the remaining assignments.
IMPORTANT: Late assignment submissions will not be accepted. Plagiarism detection software will be used. Students might be asked to meet with TAs and explain their code. See below for further information about academic integrity and appeals. Also see Notes on Assignments.
Due dates below are tentative until the assignment is published.
Assignment | Link to Assignment | Due Date | Notes
|
---|
A0 | Polling Loop | Tue, Sep 19, 8:30am | Communication with Trains and Terminal
|
K1 | Kernel (Part 1) | Thu, Sep 28, 8:30am Fri, Sep 29, noon | Context-Switch, Task Scheduling
|
K2 | Kernel (Part 2) | Thu, Oct 05, 8:30am Tue, Oct 10, 5pm | Message Passing, Name Server
|
K3 | Kernel (Part 3) | Thu, Oct 19, 8:30am | Event Notification, Clock Server
|
K4 | Kernel (Part 4) | Thu, Oct 26, 8:30am 11:59pm | I/O Server(s)
|
TC1 | Train Control (Part 1) | Thu, Nov 9, 8:30am | Demo: control one train
|
Project | Project Proposal | Thu, Nov 16, 11:59pm | submitted for feedback, not graded
|
TC2 | Train Control (Part 2) | Wed, Nov 22, 8:30am | Demo: control multiple trains
|
Project | Final Project | Tue, Dec 5 | Demos
|
Final Exam
The final exam is scheduled by the Registrar. It will cover material from the entire course. The final exam will be available on Learn 24 hours before the registrar-scheduled start time.
UW Final Exam Regulations
Math Faculty INC Rules
Resources
Lab
The lab room is MC 3018 and is for the exclusive use of CS 452/652 students. The access code is announced in class. Do not give the code to other students!
The usual rules apply, such as no food. Please see CSCF Teaching Lab Policies for details.
Most workstations in the main room run Ubuntu Linux with access to the regular linux.student.cs environment. The workstations connected to the Raspberry Pi computers run a slightly different Linux setup with a default login. Two of those are connected to train tracks. You can use the gtkterm terminal emulator to communicate with the Raspberry Pi via serial interface.
Raspberry Pi
Train Set
The track and trains are controlled by sending commands via the serial interface.
Building, Deploying and Running Code on the Raspberry Pi's in the Lab
- Cross-Compiling for the Raspberry Pi
- on linux.student.cs: You'll find the gcc cross-compiler pre-installed in /u/cs452/public/xdev/bin/aarch64-none-elf-gcc. You'll find the rest of the toolchain (e.g, ld, objdump, readelf) in the same bin.
- on your own machine: To develop on your own machine, you'll first need to install the cross-compiler:
- Download the appropriate aarch64-none-elf cross compiler for your development system from here.
- Untar it to your desired location by running, e.g.:
bash tar -xaf arm-gnu-toolchain-12.2.rel1-x86_64-aarch64-none-elf.tar.xz -C /path/to/dest
- Sample Program (iotest)
- There is a small sample program, which you should be able to cross-compile and run. You can download the sample code from here, or you can grab it from /u/cs452/public/iotest/ in the linux.student.cs environment.
- The README file included with the sample program explains how to build the sample program. A successful build should result in a iotest.img file.
- Deploy and Test (New)
Starting with assignment K1, we will use a different method to deploy your code to the Raspeberry Pi and boot it.
Instead of relying on u-boot, you'll directly boot the Raspberry Pi using your program image.
Let's suppose you have written code for A0, and you want to direct-boot it using the new method.
Before you can do so, you'll need to make a few one-time changes to your code so that it will
boot properly. Read and follow these instructions for patching your code for direct booting
before you deploy and boot your code.
Once your code has been patched, you can build and deploy it using the following steps:
- First, make your patched code to produce an image file - let's suppose the image file is called a0.img
- Next, go to https://cs452.student.cs.uwaterloo.ca and authenticate.
You'll see a list of available Raspberry Pis. Choose the Pi you want to upload your image to,
select the image file you just built (a0.img), and hit "Upload". Your image file will be uploaded to the boot server.
- Once you have uploaded your image, power on the Raspberry Pi that you loaded the image for. It should directly boot and run the image you just uploaded. There is no longer any need to enter u-boot commands, since we are no longer using u-boot.
- Deploy and Test (old)
First, upload iotest.img to the deployment TFTP server:
Go to https://cs452.student.cs.uwaterloo.ca, authenticate, select the iotest.img file you just built, and hit "Upload"
Your image file will be uploaded as user.img, where "user" is the userid you authenticated with.
If you upload a new image, it will just overwrite your previous upload.
Next, boot the Raspberry Pi using the uploaded image:
On the workstation attached to your Raspberry Pi, launch a gtkterm terminal emulator connected to channel 1 of your RPi. This is so that you can see console output from the Raspberry Pi.
Power on the RPi you're using. It should netboot into U-boot, and you should eventually see a U-boot command prompt. (This takes a few seconds, and you should see boot output on the gtkterm.)
Issue the following U-boot commands at the U-Boot prompt:
dhcp
tftpboot 0x200000 129.97.167.60:images/user.img, where "user" is the userid you used to upload your image file
go 0x200000
Other
Curiosities