Lab #3 Instructions - Microprocessor-Based System Design | EEL 4746, Lab Reports of Electrical and Electronics Engineering

Material Type: Lab; Class: MICRO BASED SYS DES; Subject: ENGINEERING: ELECTRICAL; University: Florida State University; Term: Fall 2004;

Typology: Lab Reports

Pre 2010

Uploaded on 08/30/2009

koofers-user-u0k
koofers-user-u0k 🇺🇸

10 documents

1 / 6

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
EEL 4746L
Microprocessor Based System Design Lab
Fall 2004
Lab #3 Instructions
In this lab, you will learn how to use THRSIM11 to simulate HC11 programs at home for
purposes of homework assignments, projects, and lab assignments, in such a way that
they will be able to run on the actual hardware when you bring them into the lab.
General Lab Procedures
See the previous lab assignments.
Objectives
At the conclusion of this lab session, you should be able to:
Configure THRSIM11 to match a particular board configuration.
Operate the HC11 processor in emulation under the THRSIM environment.
Interact with serial-I/O HC11 programs running under THRSIM11.
Assemble, download, and run the Buffalo ROM monitor under THRSIM.
Use I/O subroutines built into the Buffalo code.
Write a new “Hello World” program using the Buffalo subroutines.
Step through and debug a program under THRSIM.
Prelab Instructions
Note! Most of this lab assignment you should complete by yourself or with friends at
home, before coming in to the lab. The purpose of the actual in-lab session will be to
validate your code—to confirm that it runs on the real hardware in the same way that it
runs in simulation at home or at the computer labs.
IMPORTANT: Take detailed notes in your lab notebook as you are going
through the below process. If something goes wrong, this will help you (or your TA)
trace back through your steps and figure out what you did wrong and how to fix it.
1. The first thing we have to do is configure THRSIM11 to have the same memory
map as our actual board does.
a. Start THRSIM11.
b. On the menus, select ViewMemoryMemory Configuration. Click
through the prompts to close THRSIM, and a window will open titled
“THRSIM11 Memory Configuration Tool” (or “Memconf” when
minimized).
c. In the pulldown menu, note that several versions of the HC11 processor
are listed. Which one are we using? Select it.
pf3
pf4
pf5

Partial preview of the text

Download Lab #3 Instructions - Microprocessor-Based System Design | EEL 4746 and more Lab Reports Electrical and Electronics Engineering in PDF only on Docsity!

EEL 4746L

Microprocessor Based System Design Lab

Fall 2004

Lab #3 Instructions

In this lab, you will learn how to use THRSIM11 to simulate HC11 programs at home for purposes of homework assignments, projects, and lab assignments, in such a way that they will be able to run on the actual hardware when you bring them into the lab.

General Lab Procedures

See the previous lab assignments.

Objectives

At the conclusion of this lab session, you should be able to:  Configure THRSIM11 to match a particular board configuration.  Operate the HC11 processor in emulation under the THRSIM environment.  Interact with serial-I/O HC11 programs running under THRSIM11.  Assemble, download, and run the Buffalo ROM monitor under THRSIM.  Use I/O subroutines built into the Buffalo code.  Write a new “Hello World” program using the Buffalo subroutines.  Step through and debug a program under THRSIM.

Prelab Instructions

Note! Most of this lab assignment you should complete by yourself or with friends at home, before coming in to the lab. The purpose of the actual in-lab session will be to validate your code—to confirm that it runs on the real hardware in the same way that it runs in simulation at home or at the computer labs. IMPORTANT: Take detailed notes in your lab notebook as you are going through the below process. If something goes wrong, this will help you (or your TA) trace back through your steps and figure out what you did wrong and how to fix it.

  1. The first thing we have to do is configure THRSIM11 to have the same memory map as our actual board does. a. Start THRSIM11. b. On the menus, select ViewMemoryMemory Configuration. Click through the prompts to close THRSIM, and a window will open titled “THRSIM11 Memory Configuration Tool” (or “Memconf” when minimized). c. In the pulldown menu, note that several versions of the HC11 processor are listed. Which one are we using? Select it.

d. Compare the window contents with the memory map on p.12 of the CME11E9-EVBU manual. Note that initially, only one RAM (at $0000:01FF) and one ROM ($D000:FFFF) are checked off as “enabled.” e. Recall from the previous labs (or by looking at the original “hello.asm” source code) where our program was originally loaded. Is this region included in the memory that the simulator is presently configured to use? f. Enable a new RAM region that encompasses the entire range of addresses spanned by the 32K RAM chip in U5. (Don’t worry that the HC configuration registers are mapped to the middle of this range. They will automatically take priority.) g. Also, enable a new ROM region that corresponds to the HC11 internal EEPROM. h. Finally, make sure that the LCD is enabled and that it is mapped to the correct location in the Peripheral area. i. Say “OK” and THRSIM11 should start back up.

  1. Now, programs that run on the board should also run properly under THRSIM. As a test, we will try running the Buffalo ROM monitor program which you have been interacting with in the previous labs. The binary executable for the monitor comes pre-loaded onto the HC11E9B (“B” for “Buffalo”) chips as they are shipped from Motorola, in the internal PROM. You don’t have access to the actual chips at home. However, the source code for the monitor is also available free of charge from Freescale, so we can run it under THRSIM. a. On Blackboard, under “Course Library” “Technical Documents”  “Example Programs” you will find the file Buffalo34AsmFW.asm. This is the ROM monitor program. Download it to your computer. b. Open it in THRSIM and assemble it. You will notice it is a rather long program! What is its starting address? (Label name “BUFFALO”) c. When assembling, THRSIM should automatically also load the assembled program into memory. The line where the PC starts should be highlighted in green in the .LST window. If this does not occur, you can still load the program as follows: i. Go to the THRSIM11 command window (the one with the prompt “THRSim11>”). You can type “help” (and scroll back through the output) to find a list of commands. Find an appropriate command to load your Buffalo34AsmFW.s19 file, and type it. ii. THRSIM should give you a warning and then bring up a “Disassembler” window. This shows the starting location of the PC. d. Now, use the “step” command (in the Execute menu, toolbar button, or shortcut key F7) to single-step through the program. Watch what happens to the registers in the “CPU Registers” window as instructions are executed, and also watch what happens to the PC in the .LST and/or the Disassembler window. You can use the “reset” command (menu or toolbar) to start execution over from the beginning when you want.

should see the familiar bytes including the “Hello World” string once it is properly loaded. b. Alternatively, send a “load t” command in the serial transmitter window, then copy and paste the contents of the hello.s19 file. Reset the emulator to regain control.

  1. Once you are back at the Buffalo prompt, you should be able to type “call 2400” just like in the first lab assignment to begin running the program from within Buffalo. It should print the usual string and Buffalo prompt as expected.
  2. Now comes the most interesting part of the lab. We are going to write a shorter, simpler “Hello World” program that takes advantage of the built-in ROM routines provided in Buffalo, and step through it one line at a time to see how it works. a. Download and skim through the “Buffalo_ROM_Monitor_User_s_Manual.pdf” file from Blackboard… Course LibraryTechnical DocumentsManuals. Note that it documents all the Buffalo commands. b. Read the section near the end on “Utility Subroutines”. This explains how to call the built-in subroutines in Buffalo. c. Find the routine that prints an ASCII string terminated by an End-of- Transmission character, without an initial Carriage-Return/Line-Feed combination. d. Using this knowledge, compose from scratch a new file “myhello.asm” that uses this built-in Buffalo routine to print the string “Hello (your name here)” to the serial port. Coding guidelines: (Best practices!) i. Format your code neatly. (Line things up in columns, etc. ) ii. Comment it extensively – enough so that your fellow students (and the TAs!) should be able to easily understand every line. iii. Use assembler directives such as EQU, ORG, FCC, FCB, and RMB appropriately to define symbols and constants that will be used. Refer to the various example programs for ideas on how to do this; in particular see the example file MMapEqus.asm which is in Course LibraryTechnical DocumentsExample Programs on BB. Also, see the AS11 manual in Manuals for detailed documentation on how to use the assembler directives. (Ch.3 in our textbook also has a nice summary.) iv. Originate your program at the base of the external RAM in U5. v. This particular version of “Hello World” should contain only three actual executable instructions! e. Now you should execute your program. i. Exit THRSIM11 and restart it to be sure memory is cleared. ii. Load your program into THRSIM11 after loading Buffalo. iii. Reset the HC11, bring up the serial transmit and receive windows. iv. Run the HC11, get into buffalo, and call your program’s start address. Hopefully it works!

f. Your program may or may not work the first time. In either case, we are going to step through the program to see exactly what happens. Do the following: i. Stop the simulated processor; reset it if necessary. ii. In the .LST window (Assembly output window) for your program in THRSIM, click on the first executable line. It should get highlighted in grey. iii. Click “Run Until…” (Toolbar, Execute menu, or F4). This should start your program running, except that execution will halt when you get to the selected line. iv. In Buffalo, invoke your program’s start address. v. The simulation should halt with the first line of your program highlighted in green. Now, you can step through your program. vi. Before executing each line, try to anticipate what effect it will have on the registers. Watch the CPU Register window to see if you are right. vii. At some point, you may get tired of single-stepping through the Buffalo internals and decide to return to your code. Select the last line of your code, and do Run Until again. (If you used the right instructions, the Buffalo routines should return to your program.) viii. Hit Run and let things get back to the Buffalo prompt. ix. If your program didn’t work or something happened that you don’t understand, bring your program in to lab and your TA will help you debug it. g. Bring the new .asm program that you created in to lab with you, on electronic media (floppy disk or USB flash drive) as well as on a paper printout.

In-Lab Instructions

  1. Write the header information for this lab assignment and ground yourself.
  2. Show the TA your new “Hello (your name here)” hello.asm program printout (either complete, or, as far as you got). The TA should critique your coding style and whether you met the program specifications.
  3. If you were unable to get your new Hello World program to work under THRSIM, get as far as you can in lab, and show the TA where you got stuck, or that your program works in the simulator.
  4. With the TA watching, power up the board and use AxIDE to assemble your new hello.s19 program and upload it to the board. Do an MD to verify that it is there. Call it and make sure that it works. With this assignment completed, you should be prepared to complete future lab assignments, programming homework assignments, and projects at home or in the