Schedule


Below is a preview of our week-by-week plan for the entire quarter. There may be slight adjustments and rearrangements as we go. The schedule for the final project is set and will not change.

In the readings below, K&R refers to Kernighan and Ritchie's classic text The C Programming Language (accessible via Stanford's subscription to Safari Books Online). Nick Parlante's EssentialC is another great C reference. Please do the recommended readings before lecture for best effect!

Week 1
Lecture
Mon 9/23
Introduction and welcome ( slides, code )

Readings:

Lab/assign Lab 0: Orientation ( writeup )

Please do the Lab 0 prelab preparation before coming to lab.

Assignment 0: Git oriented ( writeup )
Lecture
Fri 9/27
RISC-V architecture ( slides, code )
Week 2
Lecture
Mon 9/30
RISC-V assembly and machine code ( slides, code )
Lab/assign Lab 1: Getting to know your Mango Pi ( writeup )

Please do the Lab 1 prelab preparation before coming to lab.

Assignment 1: Larson Scanner ( writeup )
Lecture
Fri 10/4
From Assembly to C ( slides, code )
  • Our one-page guide to RISC-V.
  • Brush up on C basics (syntax, data types, operators, control structures) via your favorite C reference; sections 1-2 of Nick Parlante's EssentialC; or chapters 1, 2, and 3 of K&R. Skip content on I/O and standard libraries (we are bare metal!)
  • Read Dennis Ritchie's account of the history of C
  • Try out the Compiler Explorer demoed in lecture
  • Read our guides on make and gcc
Week 3
Lecture
Mon 10/7
C Pointers and Arrays ( slides, code )
  • Review EssentialC chapters 3 (skip material on structures) and 6 (skip material on the heap and memory management) or K&R 5.1-5.4. C-strings are primitive compared to Java/C++ strings; take note of the manual effort required to use and pitfalls to avoid.
  • C volatile can be subtle and tricky. See GeeksForGeeks advice on correct use and John Regehr's blog on what NOT to do with volatile
Lab/assign Lab 2: Below C Level ( writeup )

Prelab to prep before lab.

Assignment 2: Clock ( writeup )
Lecture
Fri 10/11
C Functions ( slides, code )
  • Read up on C functions (Chapter 4 in K&R, or Section 4 in Essential C).
Week 4
Lecture
Mon 10/14
Communication and the Serial Protocol ( slides, code )
  • Read about characters and strings, IO functions (putc,puts,printf), and structures (Sections 1.5, 1.6, 1.9, 5.5, 6, 7 in K&R; or Section 3 in EssentialC).
  • Poul-Henning Kamp's essay on The Most Expensive One-byte Mistake. Did Ken, Dennis, and Brian choose wrong with NUL-terminated text strings?
  • Read Sparkfun's tutorial on serial communication.
Lab/assign Lab 3: Debugging and Testing ( writeup )

Prelab to prep before lab.

Assignment 3: String Formatting ( writeup )
Lecture
Fri 10/18
Modules, Libraries, and Linking ( slides, code )
Week 5
Lecture
Mon 10/21
Memory Management ( slides, code )
  • Read our overview of stack frames
  • Review dynamic memory allocation (malloc/free in C) and the operation of the heap (K&R 5.6-5.9 or Essential C Section 6). Consider the comparison/contrast between stack and heap allocation and use cases for each.
Lab/assign Lab 4: Linked and Loaded ( writeup )

Prelab to prep before lab.

Assignment 4: Stack and Heap ( writeup )
Lecture
Fri 10/25
C Mastery ( slides, code )

We've crossed the halfway point! We will use this lecture to catch-up/expand on lecture content covered lightly on first pass, and discuss how to further your mastery of C.

Readings:

Week 6
Lecture
Mon 10/28
Keyboards and the PS/2 Protocol ( slides, code )
  • Read Adam Chapweske's overview of the PS/2 protocol for keyboards and mice.
  • Neat video from Ben Eater demonstrating how to read PS/2 scancode via breadboard wizardry. He does it all in hardware, thankfully easier for us in software!
Lab/assign Lab 5: Keyboard Surfin' ( writeup )

Prelab to prep before lab.

Assignment 5: Keyboard and Simple Shell ( writeup )
Lecture
Fri 11/1
Number Representation and Arithmetic ( slides, code )

Representation of integer and integer arithmetic, two's complement, unsigned and signed overflow, types and type conversion, light intro to floating point

Week 7
Lecture
Mon 11/4
Graphics and the framebuffer ( slides, code )
Lab/assign Lab 6: Drawing into the Framebuffer ( writeup )

Prelab to prep before lab.

Assignment 6: Graphics Library and Console ( writeup )
Lecture
Fri 11/8
Interrupts ( slides, code )

In this first lecture on interrupts, we'll focus on the low-level mechanics and what needs to happen at the assembly level to enable and process an interrupt.

Week 8
Lecture
Mon 11/11
Interrupts, cont'd ( slides, code )

Now we move up to the higher-level abstractions for interrupts, including library support for managing interrupt handlers and best practices for interrupt-safe code.

Lab/assign Lab 7: Mango Pi, Interrupted ( writeup )

Prelab to prep before lab.

Assignment 7: System Monitor with Interrupts ( writeup )
Lecture
Fri 11/15
Project ( slides )
  • Didi, Ben, Aditri, and Ishita will offer guidance and inspiration on how to achieve a satisfying and successful final project!
  • Ben's slides and sample datasheet annotated
Week 9
Lecture
Mon 11/18
Sensor Input ( slides, code )
Lab/assign Lab 8: Project Team Meeting 1 ( writeup )
  • Prelab to prep before lab.
  • Lab will be a project work session. Plan to attend same lab session as your partner.
Final Project ( writeup )
Lecture
Fri 11/22
Sensors output
Week 10
Lecture
Mon 11/25
Thanksgiving recess
Lab/assign
Lecture
Fri 11/29
Thanksgiving recess
Week 11
Lecture
Mon 12/2
Guest
Lab/assign Lab 9: Project Team Meeting 2
Lecture
Fri 12/6
Wrap or There and Back Again
Week 12
Final Project
Demo session Fri 12/13 at 9:00 am
Code submission due Fri 12/13 at 11:59 pm