
Lab 2
Cross compiling on a host system
Before the Lab
In this lab you will learn to use a host program development system. It
provides support for editing, assembly and downloading of your MC68HC11
programs. Procedurally, you will set up your Axiom board and terminal as usual.
After booting up the Axiom board, an MS-Windows hyper-terminal window should be
opened to allow a communication with the HC11 board. Then, an MS-DOS command
box window must be opened to let you edit and assemble your programs. Once the
binary file of your program is complete (in Motorola S-format) it is dumped from
the disk file in the DOS host to the Axiom board. The program may then be run
and debugged. Any changes made in the program at run time (on the Axiom board)
must be re-entered in the program file on the host, but when you are done you
have a permanent record of your program in machine-readable form. The on-line
assembler also makes it much easier to insert words of code without having to
recalculate all of your offsets, etc.
Your first exercise will be to enter, download and run a program you have
already written, to familiarize yourself with these techniques. Review your
code for the program that fills page $C100-C1FF with even address values to make
sure you understand it and that it works correctly.
You will also be required to perform some other manipulations. One area in which
microprocessors exhibit distinct advantages over hard-wired logic systems is in
the total flexibility of the tasks that they can execute. Many times control
algorithms will require counting of objects or finding the maximum value in a
list of data. Write programs to do the following:
-
A list of
numbers (representing, for example, the weights of items coming off of an
assembly line) begins at location $C100. The end of the list is signified
by a “null” byte ($00), indicating an item of 0 weight (no item). Find the
total number of items produced.
-
Now write a program to
find the maximum value in the list.
-
Quality control requires some degree of uniformity in the finished product.
Write a program to find out whether the maximum value in the list is greater
than twice the minimum value in the list.
You must make your own list; use one of at least 15 numbers. These numbers can
be entered via the assembler “FCB” command; see
the manual for details.
In
order to complete this assignment in a timely fashion, you must write and enter
these programs into the host system BEFORE YOU COME TO LAB.
This means in turn that you have some familiarity with the MS-DOS system
and the EDIT editor IN ADVANCE (NOTEPAD under Windows also works).
You will not be permitted to
enter the lab until your TA has checked that your program is on the DOS system.
This requirement will hold true for all remaining labs.
Assembling
your program
The
cross-assembler for 68HC11 code is a program called "as11.exe".
Separate documentation for this program is available elsewhere in the lab manual.
The procedure for
assembling your program is as follows: type "as11
filename.asm"
where
filename.asm
is the program you generated using the editor. The cross-assembler will do its
job, and will either generate error messages or will tell you that it has
successfully completed assembly. In either case, if you have included "l" in
your option line (e.g., opt l,s) it generates a list file and send it to the
default output device. To be able to store on file use redirection as follows:
C:\>
asl1 -lo filename.asm
which will save
the listing in a file containing the opcodes and addresses generated (along with
error codes, if any). If assembly is successful, it also generates a file
called “filename.s19”,
which is the object code in Motorola S-format. Since S-format is in ASCII, this
file may be typed or printed. Check the other assembling options that you can
use to generate a cross-reference table, cycle count and a symbol table.
In the Lab
Have
the lab TA approve the code that you have generated. The terminal must be
connected to the primary port of the Axiom board. In case you suspect baud rate
problems, all communication is currently implemented at 9600
baud. Concentrate first on the program that fills a page in memory; it's much
simpler and you have a fair chance that it will work.
Downloading to the Axiom board
Once a load module (filename.s19) has been assembled without errors, it's time
to test it by running it on the Axiom board. The procedure is simple as follows:
In your windows hyper-terminal select the
Transfer->Send Text File… menu option. Then, specify as File name the
filename.s19, and say Open. This will
start transferring the S19 file, and can be
verified by the receipt of the BUFFALO prompt (>).
You may need to hit the ENTER key once or twice to ensure returning to the
monitor.
Once you have successfully loaded and tested your memory fill program, you can
appreciate the speed and efficiency of program development when supported by a
host system. Now you are in a position to work on the other programs, which are
more challenging, but with such powerful tools should be no trouble at all...
Enter your programs and verify correct operation. Keep records of the results.
Test your programs with at least two different sets of values in the data lists.
After the Lab
Print listings of your correctly operating programs, which should be liberally
commented. Insert these in a program notebook. Make notes on any peculiarities
of the system you may have noticed.
| EE-218 Homepage |
Syllabus
| Schedule | Lab News | Faculty |
Contact
Information | Lab Info | Project
|
Department of Electrical Engineering and Computer Science
Box 1824 Station B
Nashville, TN 37235
Phone: 322-2771
Fax: 343-6702
|
Search |
Site Index
| People Finder
| Phone
Directory | VUnet |
VUmail | VU
Library | Help
|
Last Updated:
Saturday, March 05, 2005
Turker Keskinpala
Copyright © 2003
Vanderbilt University
|