*See attachment for clear understanding* This lab presumes that you have a Raspb

*See attachment for clear understanding*
This lab presumes that you have a Raspberry Pi computer configured with a recent version of the Raspbian operating system.
Pre-lab reading:
•    ARM assembler in Raspberry Pi – Chapter 1
•    ARM assembler in Raspberry Pi – Chapter 2
The focus for this lab is not to learn new ARM instructions, but to learn how to write, assemble, and link ARM assembly on your Raspberry Pi computer.
Instructions:
Part 1:
1.    Complete the “first program” example outlined in the Chapter 1 tutorial link above, but use the linker rather than the C compiler to create your executable. Your program will look like this: Please note that the comments start with a different symbol from AAL #1. Save the file as first.s (the extension of assembly files is s).
/* — first.s */
/* Jie Liu */
.global _start @ declare entry point
_start:        @ label for the entry point
mov r0, #2 @ Put a 2 in r0
mov r7, #1 @ setup system call to exit to terminal
swi 0      @ system call to exit – just need to do this
2.    Use the Unix shell (similar to Windows’ cmd) and make sure you are in the same directory as the file first.s (use ls -al to list all files in the current directory and make sure you see first.s), the do the following:
Assemble your code with as –o first.o first.s,
link it into an executable with ld –o first first.o,
run it with ./first,
look at the returned error code with echo $?.
3.    Save a screenshot of your interaction with the Raspbian shell showing how you assembled, linked, executed, and inspected the return code from your program. You can take a screenshot from the command line using the scrot command.
Part 2: 
1.    Write an ARM assembly program that subtracts 50 from 300 and allows you to inspect the results in the shell. From the tutorial you’ll see that this requires you to store the result in R0 before returning from your main function.
2.    Save a screenshot of your interaction with the Raspbian shell showing how you assembled, linked, executed, and inspected the return code from your program.
Part 3:
1.    Create and run a “Hello world!” program based on this example:
/* — helloworld.s */
.global _start
_start:       
mov r0, #1      @ stdout is monitor
ldr r1, =string1 @ location of string to write
mov r2, #13      @ number of characters to write
mov r7, #4      @ setup system call to write
swi 0            @ system call to write
mov r7, #1      @ setup system call to exit
swi 0            @ system call to exit
.data
string1:
.ascii “Hello World!n”
2.    Save a screenshot of your interaction with the Raspbian shell showing how you assembled, linked, executed, and inspected the return code from your program.
Turn in:
Again, for this week, just turn in a SINGLE document with your 3 screenshots as specified in the above assignment instructions. Submit the result as a pdf file.

Posted in Uncategorized

Place this order or similar order and get an amazing discount. USE Discount code “GET20” for 20% discount