CS-3410 Systems Programming Spring 2013

advertisement
CS-3410 Systems Programming
Spring 2013
http://atomicrhubarb.com/systems
Course Description
This course introduces students to many concepts underlying all computer systems
and ties together the basic concepts from transistors though software development.
Topics include: processor operation, hierarchical memory systems, microcontroller
architecture, digital and analog data acquisition, actuation, and systems software
development topics from the programmer's perspective such as compilers, linkers,
operating systems, testing and debugging. The course uses embedded platforms to teach
students how programs interact with and are constrained by hardware (with a little
bit of “Basic Electronics” included so that the embedded systems part can be more
easily understood).
Prerequisites:
CSci 2113 Software Engineering
< http://faculty.cs.gwu.edu/~timwood/wiki/doku.php/teaching:f2011:cs2113:home >
CSci 2461 Computer Architecture 1
< http://www.seas.gwu.edu/~bhagiweb/cs2461/ >
Required Textbooks
Embedded Systems: A Contemporary Design
Tool, by James K Peckol, Wiley, ISBN10: 0471721808; ISBN-13: 978-0471721802
(while the title is “Embedded Systems”,
this book is structured very closely to
the proposed outline for this course
including chapters on Combinational
Logic, Sequential Logic, Memory,
Software Development, Embedded Systems
Design, Operating Systems, Task
Management, Interfacing, Networking)
Practical C Programming 3rd Edition, by
Steve Qualline, O’Reilly & Associates
Inc, ISBN-10: 1565923065
(more than a C book, has excellent
chapters in Modular Programming,
Portable Code, Developing Complex C
programs, as well as chapters that
Embedded Developers need such as Bit
Operations, Pointers, Debugging,
Optimization)
Spring 2013 Schedule
01.
02.
03.
04.
05.
06.
07.
08.
January
January
January
February
February
February
February
March 05
15
22
29
05
12
19
26
(Mid term prep)
Spring Break. March 12
09. March 19 (Mid Term)
10. March 26
11. April 02
12. April 09
13. April 16
14. April 23 (project demo, final prep)
Final Exam - May 7?
Grading
Labs - 20%
Exercises (homework or in class) - 20%
Midterm - 20%
Final Exam - 20%
Project - 20%
Outline
Week 1.
1. Intro to class, requirements, expectations, project, labs, exercises.
2. Review of chapters 2-5 of Introduction to Computing Systems, Patt & Patel
Transistors: Hexadecimal, Logic, Gates, Combinational logic, Decoders, Latches,
Registers, Memory, Arithmetic Logic Unit, Basic Instruction Set Architecture, von
Neumann vs Harvard architecture
Week 2
1. Map all of the above into the Z16F Microcontroller.
2. Basic Electronics for CS Students.
3. Oscillators
Week 3
1. RAM, ROM, Flash, Memory Maps, Memory selection circuits, special function
registers
2. Review of C, Embedded C
3. Building the lab circuits
Week 4
1. General Purpose IO
2. Interrupts/Polling
3. Timers
Week 5
1. The Software Development Process
2. Embedded Software Architecture
3. Version Control
Week 6
1. Uart, Serial. Emphasis on UART/RS-232 and SPI (common) with light coverage on ...
2. I/O, I2C, SPI, 1-wire.
Week 7
1. Analog I/O
2. Sensors
3. Debugging
Week 8
1. Actuation (motors, servos, relays, digital outputs, etc)
2. Networks: WiFi, Ethernet, USB, CAN
3. Design for Test
[spring break is in here somewhere]
Week 9
1. Mid Term
2. Discussion on project development
Week 10
1 Compiling, Assembling
10.2 Linking, Loading, Flash Programming
Week 11
1. Memory Models, Stack Frames, discuss pros/cons to memory model sizes
2. Dissassembly, Objects files, Symbols, libraries
3. Build tools
Week 12
1. Real Time Operating Systems
2. Virtual Machines
3. Interpreters, Threaded Interpreter
Week 13
1. Advanced Topics
2. In class exercise: Bit-Bang 1-wire control
Week 14
1. Final Review
2. Project demo in class [4 weeks since status report 2]
3. Open discussion on success, failures, possibilities ...
Im still working out the exercises and labs that will help reinforce the material and
help the students build toward the project.
Exercises
The exercises are intended to be short, maybe 1-2 hours of work, and will include a
guided worksheet, with a review in class. The work done in the exercises will help
prepare the students for the labs and project.
#1: Some simple latch, counter, address decode questions
#2: A OpAmp, Level shifter and Open Drain questions
#3: Simple memory map circuits. Some C pointer exercises.
#4: Reading sensor datasheets, controlling speaker.
#5: Assembly, C, mixed developing in Assembly and C, using linker symbols
Labs
Labs are intended to be 8-10 hours of work, are less guided that exercises, include
developing a simple embedded program.
#1:
#2:
#3:
#4:
#5:
Assembly program to blink some LEDs, respond to a button press, simple stuff
Stop Watch (I provide the LED display character driver, and basic structure)
Function Scheduler, Command Line Interpreter
Read from the RTC, Control the WiFi radio (guided lab, I provide stubs & example)
Flash loader, RTOS and/or VM and/or Interpreter (I provide code, students modify)
Project
Each student will build a similar project. The whole class will build essentially
the same thing, which includes the Z16 developer kit, a WiFi wireless communications
board, a real time clock, and one input device/sensor and one output device/display/
actuator. I will assign the sensor/display randomly from a list. The project
assignment will be for each student to assemble the components (simple wiring with
instructions and supported by the exercises and labs) and write a program that read
data from the input device and the real-time clock, format the data appropriately,
and sends the data to the output device. The students program will also need to
publish the sensor data to either cosm.com (formerly pachube.com) or sen.se, the real
time clock will provide time stamp data. In essence, the class will be building a
collection of nodes on the Internet-of-Things. By design no 2 students will build
the same thing, this increases variety and offers an opportunity for the students to
interact and learn from each other. The project will be a practical implementation of
all of the topics in the class from software design, hardware interfacing, embedded
systems, debugging, and basic networking. I will provide the students with blocks of
code (the WiFi radio is a good possibility) and a stubbed-out shell program for the
students to start with. The in class demo of the project will give an opportunity
for the students to show their work to the rest of the class and learn from the
others.
The components necessary are described below. A good number of the part are reused
from CSCI-4415 and a number of the sensors and output devices are ones that I have
collected over the years. I am proposing a one time equipment purchase of $200 per
student for the WiFi radio, additional real-time clocks, and the more interesting
sensors and output devices, and I can provide a spreadsheet detailing the exact
devices, prices, and source of supply.
Generic Project Block Diagram
A typical project: Using the base Z16 developer kit, Real Time Clock, and the WiFi
radio, the student will connect a temperature sensor and character based liquid
crystal display. The student will read the sensor data sheet and determine how to
access the sensor data, then write a program to read the temperature from the sensor
and display it, read the time from the clock, and publish the data (time/temp pairs)
to cosm.com. To add variety, similar input devices can be paired with different
output devices for different students so that no 2 students will build exactly the
same node (temperature input, tone output (high pitch for higher temperature), or use
a stepper motor as a simple meter-like display, or send the text temperature to the
SpeakJet to speak the temperature in words).
Download