CPTR-215 Assembly Language Programming HW#6 for Monday 10/15/12
If you have not already done so, finish reading chapter 4 of the text.
Sections 4.6, 4.7, 4.8, and 4.9 contain information about writing an
assembly program and using the development software. Note that we
will be using the Keil company's RealView assembler and uVision
simulator software and thus you can ignore comments about the IAR
development system (section 4.7.3) and the ADS development system
(section 4.7.2) and any mention of GNU assembly language.
As mentioned earlier, the Keil software is loaded and available
on the KRH PC lab computers.
New reading for Monday: chapter 5.
Problem: Write a program what will add the numbers 15 and 32 (base 10)
and place the result into register zero and then subract 16 and place
the result in register 1. Load 0x0f45 into r2 and then execute the
instruction RSB r5,r2, #209. Look at the contents of memory to see
the results of these instructions.
You can begin writing your program by using a copy of the shell.s file
that I have placed on the class webpage. Copy the program to a folder
you wish to use for this lab and change its name from shell to say
hw6_name where name is your last name. Place your instructions in
the file starting at the label Main.
The principle steps to creating this program are:
- Start the keil software
- If a project is open in the keil environment, close it. (via the
Project tab on the tool bar)
- Create a new project (again, via Project tab). I suggest creating a
new folder to put the project in.
- A dialog box will open asking to Select Device for Target. Click on NXP and
then select LPC-2148. Click OK.
- A box will open asking if you wish to copy the Philips LPC2100 start
up code. Click NO !!
- In the Project Workspace window to the left of the screen, Target1
should be displayed. Left click on the + sign and Source Group 1
should appear. Right click on Source Group 1 and another dialog
box should appear.
- Left click on Add Files to Group 'Source Group 1' Another dialog
box will open. Only .c files will be displayed, so to the right
of the Files of Type field click the little down arrow and
select ASM files (which include .s files).
- The new .s file you created should now appear. Select it, click
ADD, and then click Close.
- Back in the Project Workspace window, click the + to the left of
Source Group 1. Your new file should be listed there. Double click
that file and it should open in an editor window. Edit the shell
by adding statements (beginning at the 'main' label) to perform the
desired tasks. Save the file.
When you have finished creating the assembly language program file (i.e.
the .s file), assemble the program by doing a Build Target on the Projects
tab, start the debugger via the Debug tab, and then single
step through the program watching the contents of the registers to see
if the program is doing what you expect. For this program the only
"output" is looking at the register contents. Print out a copy of your
.s file to hand in as homework #6. Write on it the results of your effort
and any observations you wish. Fold the printout and put your name etc. on the
outside.
Larry Aamodt PhD, PE
Professor of Engineering and Computer Science
Walla Walla College
Contact:
via email: AamoLa (at) wallawalla.edu
via phone: x2058