CSCE 313 - Embedded Systems Programming

Course Lecture Plan, Notes & Resources

I list each Lecture for a given date, including topic, and also post any lecture materials when they are available.  I'll try and plan far enough out for you know what's going on; although I may not have links to materials until they are completed.  Some of the planned stuff may change, based on whether I decide to use material out of the text and pontificate directly to the blackboard.  So, you should plan on keeping a course notebook, labeling each lecture's entry by date, organized chronologically, in order to have notes that will be useful in working the homework problems, executing the laboratories and studying for exams.

Lecture Date Topics Reading/Lecture/Lab Materials
1 Mon 1/12/04 Introduction - Structure and content of the course.  Introduction to the problem space we will investigate in this course.

Lectures 1&2 Notes (PDF).  These are now available.

2 Wed 1/14/04 Introduction - discussion of the role of the microprocessor in computing systems; the layered "virtual machine" model; the "big picture" about how a CPU basically does FETCH, DECODE & EXECUTE functions over and over, and that WE will write programs for the CPU where it will read our instructions and data from memory to do useful work.

Lectures 1&2 Notes (above). Mackenzie Chapters 0 & 1.  Chapter 0 basically is a review of CSCE 211 material, and Chapter 1 is a review of CSCE 212 material.

3 Fri 1/16/04 Embedded systems development process, methods and tools.  Overview of the WISM68 development environment.

In lieu of lab this week, we will discuss and review more of the materials in Chapters 0 and 1  Specifically, I want to talk about some tools we will use for creating and running programs.  Lecture 3 Notes (PDF).  

This is the URL for getting a copy of the WISM68K windows-based simulator program for 68K program development.  http://www.hildreds.freeserve.co.uk/WISM68/  Download a copy onto your own PC and play with it, as we will use it for the homework assignments and labs during the first part of the course.

-- Mon 1/19/04 Martin Luther King holiday - No Classes.   --
4 Wed 1/21/04 Review of Microcomputer concepts: starting with gate level primitives, we build to function units, including the Decoder, MUX, Adder and the composite ALU, and show how these are combined, bottom-up, into principal building blocks of the CPU.

This material is taken from MacKenzie, Chapter 0, and is summarized in my lecture notes, Lecture 4 Notes (PDF).  The pages from the text are referenced in the lecture notes.

5 Fri 1/23/04 Review of Microcomputer architecture concepts: starting where we left off last time, we look at some additional function units--the PLA and the Decoder (again), and move on to the description of Memory arrays, how we read and write to them (using flip flops as storage elements, and other control signals), to where we use decoders to provide the selection of specific banks of memory as part of the Address passed between the CPU and memory.

This material is also based on some of MacKenzie, Chapters 0 & 1, and also on my summary lecture notes, Lecture 5 Notes (PDF).  The pages from the text are referenced in the lecture notes.

6 Mon 1/26/04 Review of Microcomputer architecture concepts: continuing on with discussion of memory, and creating a conceptual model for memory access--at the heart of the Fetch, Decode, Execute cycle of the CPU.

Based on MacKenzie, Chapter 1.  Here's my specific Lecture 6 Notes (PDF) for the lecture.

7 Wed 1/28/04 Overview of MC68000 architecture: register model, memory model, instruction format (opcodes, operands, addressing modes, sources and destinations).

MacKenzie, Chapter 2, sections 2.2 and 2.3, introductory remarks for 2.4.  Lecture 7 Notes (PDF).

8 Fri 1/30/04 Addressing modes in detail: coverage of the various modes and the data sizes to which they apply.

MacKenzie, Chapter 2, section 2.4, 58-69.  Lecture 8 Notes (PDF).

9 Mon 2/2/04 Either Addressing modes (continued) or discussion of 68000 hardware and signal timing model.

MacKenzie, Chapter 2, sections 2.5 & 2.6, pp. 69-77.  Lecture 9&10 Notes (PDF).

10 Wed 2/4/04 Continuation of 68000 hardware and timing model, or start Chapter 3 - Instruction set architectural overview.  This will relate the category of instruction to the portion of the architecture that executes it.

MacKenzie, Chapter 2, sections 2.5 & 2.6, pp. 69-77 (continued), Chapter 3, section 3.2 (start).

11 Fri 2/6/04 Detailed discussion of 68000 instruction set.  Now that we understand the addressing modes, we'll have the instructions and their behavior now to go with the modes.  It will now be time to write some code!!!

MacKenzie, Chapter 3, sections 3.2 (continued).   Lecture 11 Notes (PDF).

NOTE 2/6/04: We covered noted from Lecture 8 on the addressing modes in today's class. See Lecture 8 above to download the slides we used.

12 Mon 2/9/04 Program examples.  We'll examine some of the programs in Chapter 5, and discuss how the programs are constructed.

The reading assignment is to read Chapter 3, as we'll need this to understand the examples in Chapter 5.  MacKenzie, Chapter 5 reference, Examples 5.6 Find Negative Numbers in a Sequence (pp. 133-135), 5.9 Conversion of ASCII to Binary (pp. 137-139), and 5-10 Sort a List of Bytes (pp. 139-141).

NOTE 2/9/04 (after class): Because we are behind due to earlier weather, etc., we covered slides from Lectures 6 & 9 in today's class.

13 Wed 2/11/04 New 2/9/04: Looking at problem examples from Chapter 2 (like HW#3).  Also, program examples from Chapter 5 (download them if you don't have a book yet--see links at right).

NOTE 2/9/04: We'll walk through the code examples in Chapter 5.  MacKenzie, Chapter 5 reference, Examples 5.6: Find Negative Numbers in a Sequence (pp. 133-135), and Example 5-10: Sort a List of Bytes (pp. 139-141).  Examples 5-6, 5-10.  We've already looked at Example 5.9, and it is the focus of HW#4.

14 Fri 2/13/04 Program examples (continued).  We will focus on using the WISM68 simulation tools to execute the model.  (I'll do this from my laptop in class.)

NOTE 2/9/04(1):  We were scheduled to meet in lab. but we'll meet in the classroom instead.  We'll run the simulator to assemble and load the two examples (5-6, 5-10), and walk through how to use the tools.  You will have had some experience in doing HW#4, but I want to show you how I use the tools, which should be helpful.  (When you go to work in industry, there will usually be someone in your company to "show you the ropes" on a new job assignment....this is like that process.)

NOTE 2/9/04(2): Please get with another student in the class and fill out the form, indicating who your Lab Partner will be for the semester.  Please download either the Template (MS-Word) or Template (PDF) versions.  Use the Word version if you are going to email it back to me; otherwise, print out PDF version, fill it out, and hand it to me after class.

NOTE 2/13/04: We will start meeting in lab 1D15 every Friday to work with WISM68 simulation and debugging tools.  Today, we'll look at the Count Negative Numbers NEG2 (ASM) and Bubblesort SORT (ASM) programs.  Download them here into your directory for use in class.

15 Mon 2/16/04 Discussion of instruction machine formats, and instruction decoding.  This involves hand assembly and disassembly of instructions, to gain insight into how they are organized for decoding and execution on the 68K architecture.

MacKenzie, Chapter 3, section 3.3 and Appendix B.  

Lecture 15 Notes (PDF) covering some general principles for examining instructions.

16 Wed 2/18/04 Discussion of instruction machine formats, and instruction decoding (continued), and some examples. MacKenzie, Chapter 3, section 3.4 and Appendix C.

MacKenzie, Chapter 3.   Lecture 16 & 18 Notes (PDF) on the topics of instruction machine codes and instruction timing.

Take a look at the examples at the end of Chapter 3, as these are good ones.

17 Fri 2/20/04 NOTE 2/18/04: We'll meet in the Lab 1D15, and work on debugging a 68K program with a "bug" in it, using WISM68 simulator/debugger tools.

The program we're using is posted here (and also on the Assignments page): Bubblesort.asm, written by G. La'Trice Johnson (from last summer's CSCE 498) and butchered up by me.

18 Mon 2/23/04 Instruction timing analysis.  We need to understand how to assess the timing of instruction execution, as we want to adopt the most efficient method for solving a problem using the instruction set.  This implies design tradeoffs: selecting fast instructions versus other engineering objectives, such as "extensibility", "robustness".  Programs are fluid, and they change over time:  this is an important tradeoff, since performance versus ongoing robustness in the face of constant system change is a very real and significant cost factor in most industries employing embedded technology.

MacKenzie, Chapter 3, section 3.4 and Appendix C.

MacKenzie, Chapter 3.   Lecture 16 & 18 Notes (PDF) on the topics of instruction machine codes and instruction timing.

Since you'll have HW#6 due on Wed 2/25, you might want to be prepared to ask questions.

19 Wed 2/25/04 Assembler directives and the program translation process.  We've seen and discussed some of these, as they appear to work like regular instructions.  But as we've discussed in the lab, these are translated by the assembler and loader programs (ORG, Labels, etc.). NOTE 2/18/04: I moved the Exam #1 out until March 3rd.  This gives us time to finish Chapters 3 & 4 and get enough of Ch 5 done.  See updated lesson plan, below.

Reading: MacKenzie, Chapter 4.

 

20 Fri 2/27/04 NOTE: We don't meet in the Lab, but meet in the classroom today.

Topics: Interrupts handling, Exception processing, transition between User/Supervisor states (again).

Reading: MacKenzie, Chapter 6.1-6.5 (pp. 145-157).  Note 2/27/04 (late afternoon): For those who missed lecture today because of the foul weather, here's the revised set of Lecture 19&20 Notes (a revision of Lectures 17&18) we went over today--instruction decoding, instruction timing--which will be on the exam.  Homework sets are due on Monday if you haven't gotten them to me (try and get the programming assignments done, so that we can discuss as part of our exam review on Monday).

21 Mon 3/1/04 Midpoint in the semester!

Exam  #1 Review.  We'll discuss the exam and work some problems of the type that you might see on the exam.  These will be similar to the homework problems we've had to date.  If I ask you to write sections of a program, I'll give you the algorithm (as a flowchart) and I'll give you the instructions to use.  If I ask you to evaluate which program is more efficient, I'll give you execution cycles for the individual instructions.

Review of key topics from MacKenzie, Chapters 2, 3, 4 and 5, but will imply that you have command of the introductory materials from Chapters 0 and 1.

So, for the exam, 4 problems: 1 problem on instruction fetch and the 68000 architecture--buses, memory, registers, and how it all works together (see Chapter 2 and my lecture notes), 2 problems on instruction decoding (just like what will be covered in lectures 17 & 18), and 1 on instruction execution (given a program, and initial memory contents, what happens to memory once you execute the instructions OR given the 'before' and 'after', what instruction(s) would lead to the updated contents of the given location(s) in memory?)  The best study method: (1) work the odd problems from MacKenzie that were assigned, since they have answers in the back of the book, (2) make sure you understand the examples from the text in the covered sections, and (3) review the lecture notes.  Good luck.

22 Wed 3/3/04 Exam  #1.  Closed book, closed notes, open mind.  See the Code of Academic Responsibility to remind yourself about test-taking ethics.

Exam coverage of MacKenzie, Chapters 2, 3, 4 and 5, but will imply that you have command of the introductory materials in Chapters 0 & 1.

 

23 Fri 3/5/04 Interrupt handling, Exception processing, transition between User/Supervisor states.

MacKenzie, Chapter 6.1-6.5 (pp. 145-157).

NOTE 3/4/04 (late):  We'll meet in the classroom for lecture; sorry I didn't make this clear.  No Lab today 3/5.

-- Mon 3/8/04 Spring Break - No Classes.

---

-- Wed 3/10/04 Spring Break - No Classes.

---

-- Fri 3/12/04 Spring Break - No Classes.

---

24 Mon 3/15/04 Interrupt handling, Exception processing, transition between User/Supervisor states.

MacKenzie, Chapter 6, sections 6.1-6.5 (pp. 145-157).  Here's the set of notes for Lectures 24 & 25 (PDF).  These notes are based on the material from the Pettus & Byrd text, (C) 1993, Prentice-Hall.  Here's the section from Chapter 9 of this text.  Pettus-Chapter-9 (PDF), if you want to read from a different perspective.  I highly recommend it.

 

25 Wed 3/17/04 Interrupt handling, Exception processing, transition between User/Supervisor states. Continued discussion from Lecture Notes 24 & 25 (above).  Also, here are Lecture 25 (UML) Notes (PDF) covering the UML Class and Sequence diagrams showing some aspects of the interface between the OS and ISA Layers of an embedded system.  We'll see the Sequence diagram notation again as we start to analyze system functionality and behavior.
26 Fri 3/19/04 Laboratory: Discussion and exploration. We'll meet in lab 1D15 as usual.  I plan on posting the programming problem here by Thursday (3/18), which will be an exercise in using the Trap mechanisms to emulate the layering of an embedded Operating System onto the ISA (instruction set architecture) layer of the 68000.  Lab Notes & Assignment (PDF) to be posted here.
27 Mon 3/22/04 I/O Interfacing with the 68000 and its peripheral devices.  Discussion on interfacing 68000 with the 68681 DUART serial data transmission device.

MacKenzie, Chapter 7, sections 7.1-7.8 (pp. 159-180).  Lecture 27  Notes (PDF).  These give a general solution to the UART problem through problem partitioning, algorithm control analysis, handshaking, and an implementation using Flow Charts.

28 Wed 3/24/04 I/O Interfacing to the 68000 (continued).

MacKenzie, Chapter 7, sections 7.1-7.8 (pp. 159-180).

29 Fri 3/26/04 Lab: We'll meet in 1D15 to work on programming problems using WISM68.  I'll be available to answer questions and discuss with lab teams.

 

See Assignment #9 (Assignments page), which is MacKenzie's Lab #5 (PDF).

 

30 Mon 3/29/04 Interfacing examples and programming: practice problems.

Chapter 9, sections 9.1-9.4 (pp. 199-209), Chapter 9, sections 9.5-9.9 (pp. 209-222).   Discussion of program examples from Chapter 9.

We'll allocate class time for discussing next Lab, MacKenzie's Lab #6 exercise (PDF).

31 Wed 3/31/04 Interfacing examples and programming: practice problems.

Chapter 9, sections 9.1-9.4 (pp. 199-209) continued,  Discussion of program examples from Chapter 9.

32 Fri 4/2/04 Lab: We'll meet in 2A16 to work on interfacing problems using the 68000 lab hardware.   See Assignment #10 (Assignments page), which is MacKenzie's Lab #6 (PDF), covering programming to the 68681 DUART device.
33 Mon 4/5/04 Chapter 9 (continued): detailed programming of the 68681 DUART device.

Continued coverage of program examples from Chapter 9.  Chapter 9, sections 9.5-9.9 (pp. 209-222).

34 Wed 4/7/04 Lab: We'll meet in 2A16 to work on interfacing problems using the 68000 lab hardware. 

See Assignment #11 (Assignments page), which is MacKenzie's Lab #7 (PDF).

NOTE: We will have lab on Wednesday this week, as I will be traveling to a research meeting.  Sreesa Akella will be available during class time to answer questions.

35 Fri 4/9/04 Chapter 9 (continued): detailed programming of the 68681 DUART device. Continued coverage of program examples from Chapter 9.  Chapter 9, sections 9.5-9.9 (pp. 209-222).
36 Mon 4/12/04 Overview of the 68KMB - real interface board.

MacKenzie, Chapter 8.

37 Wed 4/14/04 Overview of the 68KMB - real interface board (continued).

MacKenzie, Chapter 8.

38 Fri 4/16/04

Lab.  Using the 68KMB board.

We'll meet in Lab 2A16.  We'll go through the working of Assignment #12, MacKenzie's Lab #8 (PDF).  New 4/21/04.  I posted the correct link to this lab PDF file.

39 Mon 4/19/04 Interfacing to the keypad controller through the 6821 PIA chip.

We'll discuss this device and the programming to talk to it.  MacKenzie, Chapter 9, sections 9.11, 9.12.

40 Wed 4/21/04 Interfacing to the keypad controller through the 6821 PIA chip.  New 4/21/04.  Discussion of the last exam, and Booster Team Take-home Problem to give you opportunity to boost your exam scores.

MacKenzie, Chapter 9, sections 9.11, 9.12.  We'll also discuss Assignment #13, MacKenzie's Lab #11 (PDF).  New 4/21/04.  I posted the correct link to this lab PDF file.

41 Fri 4/23/04 Lecture. Interfacing to keypad controller; discussion of take-home, team-based Booster Problem.

We'll meet in Classroom This is MacKenzie's Lab #11 (PDF).  Lecture will cover sections in Chapter 9, MacKenzie, Sections 9.7, 9.11, 9.12.  We'll go over the code in the text.

New 4/21/04.  We'll also discuss the Booster Problem, which will count as an Exam #2.  As mentioned in class, this will be an embedded systems interface design problem, for which you'll have to write the interface routines to access a device through a defined peripheral interface (which I'll provide to you). The task will be for you (with your project teammate) to write the access routines, interrupt routine, and set up the vectoring through the 68000 trap interface.  Should be fun!  It doesn't get any more "real world" than this....  The Booster Problem will be due Wed 4/28.  You can work with your teammate, but with no one else; anything other than this will be cheating.  So, don't do it!  Thanks.

Exam #2 Grade Booster Lab Take Home (PDF) - Get it here!

42 Mon 4/26/04 Laboratory.  Working Labs 8 and 11.

New 4/21/04.  The hardware is set up.  Stations #1 and #3 have Board #2, and Station #2 has Board #5 set up.  

43 Wed 4/28/04 Last day of Classes.

New 4/21/04.  Booster Exam  (#2) due.  Open book, and open mind, and performed with your lab teammate.  See the Code of Academic Responsibility to remind yourself about test-taking ethics.

Review for Final Exam.

Bring any questions or issues to class.  You won't want to miss this one (for all those who usually have better things to do....)

-- Thurs 5/6/04 New 4/21/04.  Final Exam at 2 PM.  Open book, and open mind.  See the Code of Academic Responsibility to remind yourself about test-taking ethics.

Topics: memory mapped I/O architecture and interfacing, programming to read/write to I/O devices, responding to interrupts from I/O devices to respond to reading data from an I/O device.  This exam is based on the Labs 5, 6, 7, 9, 11 from MacKenzie text.  Here's the figure for the problem on memory-mapped I/O address determination that we will discuss in this class: work-example-2.pdf