Getting Started with ARM Assembly Language Programming Tools Working in Pairs
CS1021 lab1, lab2, lab3 and lab4 require you to work in pairs.
You should work together in the lab using one workstation.
Although working as a pair, you should each submit your solution using Blackboard. General Tips Before Starting
You should keep copies of everything that you work on and submit.
You should use your network file store (U: drive) or a USB “memory stick” to store
your CS1021 lab exercises, assignments and other programs.
Create a folder on your network file store (U:) or USB memory stick (called CS1021Projects) and store each of your projects in its own folder.
DropBox (http://www.dropbox.com) is also a good way to back up your important coursework files and get access to them at home.
DO NOT store your projects on the local hard disk (C: or D:) of lab computers. They will probably not be there when you return.
Always maintain backup copies of all of your coursework, particularly when working on larger assignments.
Using the Keil μVision IDE
1. Log in to the computer using your username and password (this may take several minutes).
2. Create a folder for your CS1021 projects on your network file store or on a USB stick. Call it CS1021Projects.
3. Download lab1.zip from the CS1021 website and extract the zip file to your CS1021Projects folder.
After extracting the .zip files, your CS1021Projects folder should contain a directory lab1 which contains a number of files such as lib1.s, lib1.uvproj and lib1.uvopt.
4. Open μVision 5 (Start Menu – All Programs – Keil uVision 5).
2018 jones@scss.tcd.ie
1
2018 jones@scss.tcd.ie
5. From the Project menu, select Open Project… and browse to the Lab1 folder that you
extracted above and select lab1.uvproj.
6. From the Project menu, select Build Target.
Some text should appear at the bottom of the screen, ending in 0 Error(s), 0 Warning(s).
7. From the Debug menu select Start/Stop Debug Session to start your programing executing.
2
You should see a window containing an ARM Assembly Language program with a yellow arrow beside the line starting with memory address 0x00000000. The yellow arrow is the Program Counter (PC) and shows the next instruction to be executed. The processor is “halted” waiting for you to start the program.
8. You can step through the program one instruction at a time selecting Step (F11) or Step Over (F10) from the Debug menu. It is much easier to use the F11 or F10 shortcut keys.
Alternatively, you can run the program by selecting Run (F5) from the Debug menu You can halt the program by selecting Stop from the Debug menu.
You can stop the Debug session by selecting Start/Stop Debug Session again on the Debug menu.
9. Full documentation for the μVision IDE is available on-line from Keil:
http://www.keil.com/support/man/docs/uv4/
2018 jones@scss.tcd.ie
3
Writing and submitting your first program
Having followed the steps above, you can modify lab1.s by adding in your ARM assembly language instructions after “add your code here”.
1. Remember to Build Target before trying to run your programme. Check that there are no build errors. This will also save the changes you have made to lab1.s.
2. You may find it useful to set the size of a TAB to be 8 spaces rather than 4. This will improve the readability of your programs. In the Edit menu, choose Configuration… and under ASM Files change the Tab size to 8.
3. Rebuild the project and execute it using the same sequence of steps described above. You can check the registers after each instruction is executed to make sure your programme is executing as intended.
4. Instead of initialising the R1 and R2 with the first two instructions of the programme, it is possible to modify the registers directly in the Registers window. An alternative approach is to remove the first two instructions and when the program stops before the first instruction is executed, double-click on the value shown beside the register in the Registers window and edit its value.
5. The program ends with an infinite loop using a branch instruction. This is to stop the simulator executing instructions beyond the end of the programme.
6. You must submit your answer to each lab using the CS1021 Blackboard site. You need only upload your assembly language file (eg lab1.s). Do NOT place it in a compressed archive (.zip file). For some labs you will also be asked to submit evidence that your program works. You can do this by using the Windows snipping tool to paste copies of the uVision window into a word document, which you can then submit.
4
2018 jones@scss.tcd.ie