[ENGN3213 Home]
You will not need to install any special startup files
or linker scripts since we will use the pre-installed ones
for the MCF5200 series processors.
NOTE: Assembling and compiling for the 5206 is
not the same as for the 68000. It is very similar, and
the same software is used. But the configuration for
the 5206 is different to that of the 68000.
You will see below how to set the options for the 5206.
Assemble the program in a terminal window as follows:
- 1.
- First, check with your tutor that the environment on your
computer has been set up correctly.
- 2.
- Run the assembler in the terminal window :
m68k-coff-as hlab61s.s -o hlab61s.o -m5200 -ahls=hlab61s.lst
This will produce an object file hlab61s.o
and a listing file hlab61s.lst
- 3.
- Next, run the linker:
m68k-coff-gcc -m5200 -Wl,-s -Wl,-n -Tsbc5206-srec.ld hlab61s.o
-o hlab61s.x
(This should be typed on a single line!)
This will produce a Motorola s-record hlab61s.x
which can be serially downloaded to the SBC.
This linking process
links in the startup routine and any other required routines
from the standard C libraries.
Exercise.
- 1.
- Load the program hlab61s.x into the SBC.
Your tutor will explain the procedure:
- (a)
- At the dBUG prompt, type dl. This tells the
monitor to expect a program to be downloaded.
- (b)
- Use the terminal emulation program to send
the program as a text file.
- (c)
- When the download is complete, you can run the code as described
next.
The program will be stored from memory location 0x10000.
- 2.
- Run the code and check for correct operation:
go 10000
and check the register and memory contents.
- 3.
- Find the memory
location where the variable sum is stored, and check its
contents. What size is it?
- 4.
- Examine the program listing in the memory viewer.
Notice that the code which has been loaded into memory includes
the startup routine and so your user program appears in the middle
of this. Closely examine the listing and memory contents. Explain.
What addressing modes are used, and what offsets have been used
in referring to count and sum.
[ENGN3213 Home]
ANU Engineering - ENGN3213