Laboratory: Computer Organization

Size: px
Start display at page:

Download "Laboratory: Computer Organization"

Transcription

1 Laboratory: Computer Organization Software Engineering (International Program) International College King Mongkutś Institute of Technology Ladkrabang

2 Contents I Contents 1 Introduction to Raspberry Pi Hardware Hardware Assembly Heat Sink Assembly Raspberry Pi 3 Case Assembly Software Installation Format the MicroSD Card NOOBS Installation Preparing the Raspberry Pi Installing an Operating System on the Raspberry Pi Setting up Wi-Fi via Graphical Interface VIM Installation Some Useful Terminal Commands First Assembly Program Assembly Programming (Part 1) Secure Shell (SSH) Setup SSH for Raspberry Pi 3 Using Linux or MAC OS SSH for Raspberry Pi 3 Using Windows Creating Makefiles Rule of Makefiles A Simple Makefile (For C Language) Creating Your Own Makefile

3 CONTENTS II Assignments Assembly Programming for ARM The ARM architecture Assembler Language Arithmetic-Logic Instructions Branch Instructions Assignments Load/Store Instruction Assembly Programming (Part 2) ARM Registers General Purpose Register Register Accesses Hello World Keyboard Input Assignment Looping First Looping Current Program Status Register Conditional Programming Second Looping Assignment Barrel Shifter Assignment

4 CONTENTS III 4 Assembly Programming (Part 3) A GDB Debugger Debugging the Assembly Program Memory Storage Loading Data from Memory Address Loading Address to the Register Reading from the List in Memory Stack Pointer Programming of Stack Pointer

5 1 Introduction to Raspberry Pi 1 Date: 04/08/2016 Name: ID: Name: ID: 1 Introduction to Raspberry Pi The Raspberry Pi is a credit card-sized computer designed and manufactured in the UK with the initial intention of providing a cheap computing device for education. However, its applications grown beyond academic area. The Raspberry Pi s initial commercial release was in February Since then, the board has gone through a number of revisions with two models available; Model A and Model B. The Model A device is the cheaper and simpler of the two computers whereas the Model B is more powerful, including support for Ethernet connectivity.the Raspberry Pi 2 Model B was released in February 2015 while the recent one is the Raspberry Pi 3 Model B (using in this lab). Figure 1.1: Raspberry Pi 3 Model B The Raspberry Pi 3 Model B is the third generation Raspberry Pi. It can be used in various applications and supersedes the original Raspberry Pi Model B+ and Raspberry Pi 2 Model B. Whilst maintaining the popular board format the Raspberry Pi 3 Model B brings you a more powerful processer, 10x faster than the first generation Raspberry Pi. Additionally it adds wireless LAN Bluetooth connectivity making it the ideal solution for powerful connected designs.

6 1 Introduction to Raspberry Pi Hardware Raspberry Pi 3 s layout is shown in the following figure. Figure 1.2: Layout of Raspberry Pi 3 Model B The characterisitcs of Raspberry Pi 3 Model B concerning specifications, connectors, key benefits, and key applications are shown as in the following table.

7 1 Introduction to Raspberry Pi 3 Specifications Processor GPU Memory Operating System Broadcom BCM2837 chipset 1.2 GHz Quad-Core ARM Cortex-A b/g/h Wireless LAN and Bluetooth 4.1 (Bluetooth Classic and LE) Dual Core VideoCore IVR Multimedia Co-Processor, Provides Open GL ES 2.0, hardware-accelerated OpenVG and 1080p30 H.264 high-profile decode Capable of 1 Gpixel/s, 1.5 Gtexel/s or 24GFLOPs with texure filtering and DMA infrastructure 1 GB LPDDR2 Boots from Micro SD card, running a version of the Linux operating system or Windows 10 IoT 85 x 56 x 17 mm Dimensions Power Micro USB socket 5V1, 2.5A Connectors Ethernet 10/100 BaseT Ethernet socket Video Output HDMI (rev 1.3 & 1.4) Composite RCA (PAL and NTSC) Audio Output Audio Output 3.5 mm jack, HDMI USB 4 x USB 2.0 Connector GPIO Connector Camera Connector Display Connector Memory Card Slot Key Benefits 40-pin 2.54 mm(100 mil) expansion header: 2x20 strip Providing 27 GPIO pins as well as +3.3V, +5V and GND supply lines 15-pin MIPI Camera Serial Interface (CSI-2) Display Serial Interface (DSI) 15 way flat flex cable connector with two data lanes and a clock lane Push/Pull MicroSDIO Low cost 10x faster processing Consistent board format Added connectivity

8 1 Introduction to Raspberry Pi 4 Key Applications Low cost PC/tablet/laptop Media center Industrial/Home automation Print server Web camera Wireless access point Environmental sensing/monitoring IoT applications Robotics Server/cloud server Security monitoring Gaming 1.2 Hardware Assembly The Raspberry Pi 3 toolkit comes with various devices. Please check the following items inside the toolkit box. Figure 1.3: Layout of Raspberry Pi 3 Model B

9 1 Introduction to Raspberry Pi 5 No. Descriptions Qty. Yes/No 1 Raspberry Pi 3 Model B 1GB 1 2 Adapter Power Supply 5.1VDC 2.5A (USB Micro-B) 1 3 HDMI Cable 1 4 Breadboard 830 points 1 5 Raspberry Pi GPIO Extension Board for Rasp Pi B+/2 1 6 GPIO Ribbon Cable 40 pins for Raspberry Pi Model B+/2 1 7 Heat sink for Raspberry Pi 1 8 Scandisk MicroSD Ultra 16GB 1 9 Raspberry Pi Acrylic case (Model RPi3) x20 Extra Tall Stacking Header 1 11 Female to Female cable 40 pins 1 12 Male to Male cable 40 pins 1 13 VGA to HDMI adapter 1 Instructor s signature Heat Sink Assembly There are two sizes of heat sink which come with the toolkit. The larger one is used for the CPU whereas the other is used for the chipset for USB 2.0 hub and 10/100 ethernet controller. Follow the instruction in order to install the heat sink. 1. Get the larger heat sink 2. Peel of the paper to expose the glue underneath 3. Attach the heat sink on the CPU (position A) 4. Get the smaller heat sink 5. Peel of the paper to expose the glue underneath 6. Attach the heat sink on the USB 2.0 hub and 10/100 ethernet controller (position B) Instructor s signature

10 1 Introduction to Raspberry Pi 6 Figure 1.4: Raspberry Pi 3 with heat sinks Raspberry Pi 3 Case Assembly Raspberry Pi 3 toolkit comes with a case. The case consists of five pieces (see the following figure) 1. Assemble the Raspberry Pi 3 case as shown in the Figure Use screws to tighten them with the Raspberry Pi 3 board. 3. Install the 2x20 tall stacking header. The board should look like Figure 1.7 when finish Instructor s signature 1.3 Software Installation efore you can start installing Raspbian, the OS for Raspberry Pi, you will have to get the installer setup on a microsd card. Follow the steps below to prepare your microsd Card by formatting it, and then installing the NOOBS software. Regardless of which operating system you are using, begin with inserting the

11 1 Introduction to Raspberry Pi 7 Figure 1.5: Raspberry Pi 3 case Figure 1.6: A Raspberry Pi 3 with case microsd card to your computer. After that, you will have to begin by formatting the card. Follow along with the section below that matches your OS.

12 1 Introduction to Raspberry Pi 8 Figure 1.7: Raspberry Pi 3 case with 2x20 tall stack header Format the MicroSD Card Windows: Figure 1.8: SDCard formatting (Windows) 1. Download SDFormatter for Window from this link: Unzip it, and run Setup.exe. Follow along with the installshield Wizard to install SDFormatter

13 1 Introduction to Raspberry Pi 9 2. Open SDFormatter 3. Click Option and set FORMAT SIZE ADJUSTMENT to ON 4. Select your card from the Drive dropdown menu (if it wasn t selected automatically). CHECK and DOUBLE-CHECK that the drive letter is correct 5. Click Format, then click OK a couple times. You should get a Drive Format complete! pop up shortly. Mac OS X: 1. Download SDFormatter for Mac from the this link: 2. Open SDFormatter (it should be in your application folder) 3. Select Overwrite Format as the format option Figure 1.9: SDCard formatting (Mac OS X) 4. Select your card from the top dropdown menu (if it wasn t selected automatically). Make sure it s correct! 5. Click Format, and watch the progress bar slowly crawl across the bottom of the window. A Card Format complete! message should appear once successful.

14 1 Introduction to Raspberry Pi NOOBS Installation Windows: 1. Download Raspberry Pi s New Out of Box Software (NOOBS) from the this link: 2. Extract the ZIP folder and place the contents at the top level of your SD card. 3. Once unzipped, the directory structure should look similar to the Figure 1.10 Figure 1.10: Unzipped NOOBS file for Windows 4. Remove the microsd Card from the card reader. Mac OS X: 1. Download Raspberry Pi s New Out of Box Software (NOOBS) from the this link: 2. Extract the zip file, to a folder, by double-click the downloaded zip file 3. Locate the contents of the extracted NOOBS folder and copy all of the files of the NOOBS folder to the root SD card. The directory structure should look similar to the Figure 1.11 Remark: DO NOT copy the NOOBS folder itselft. Instead, copy the contents of the NOOBS folder to the root of the SD card.

15 1 Introduction to Raspberry Pi 11 Figure 1.11: Unzipped NOOBS file for Mac OS X 4. Once everything is complete eject the microsd card from your computer. Instructor s signature

16 1 Introduction to Raspberry Pi Preparing the Raspberry Pi 1. Connect HDMI to VGA adapter from the Raspberry Pi to a monitor. 2. Connect mouse and keyboard to USB ports. Figure 1.12: Connect HDMI to VGA adapter, mouse and keyboard to the Raspberry Pi 3. Insert microsd card into the Raspberry Pi Figure 1.13: Insert microsd card to the Raspberry Pi 4. Connect the power cable to the Raspberry Pi

17 1 Introduction to Raspberry Pi 13 Figure 1.14: Power cable connection Installing an Operating System on the Raspberry Pi 1. Check that a newly created microsd card into the Raspberry Pi and the power cable is connected 2. NOOBS will run automatically, first resizing the FAT partition and formatting the stteing partition, then launching into a graphical user interface 3. Choose to install Raspbian by clicking to place an X in the adjacent box. Then click Install 4. You will be advised and prompted when the operating system has finished installing. Click OK and the Raspberry Pi will reboot into the Raspberry Pi Software Configuration Tool (raspi-config) 5. Leave the configuration as its default 6. If you do not change the user passward, the login for your Pi will default to the username pi with the password raspberry 7. The graphical user interface will be launched. Raspbian can be started from the command line, type startx Instructor s signature

18 1 Introduction to Raspberry Pi 14 Figure 1.15: Install Raspbian Operating System Figure 1.16: Graphical User Interface of Raspbian

19 1 Introduction to Raspberry Pi Setting up Wi-Fi via Graphical Interface 1. In the Desktop environment locate the network icon in the top right hand side and click on the icon to see the list of available Wi-Fi networks to connect (see Figure 1.17) Figure 1.17: List of available Wi-Fi networks 2. Select your Wi-Fi SSID in the drop down list (see Figure 1.18) Figure 1.18: List of available Wi-Fi networks

20 1 Introduction to Raspberry Pi You will be prompted to enter the selected WI-Fi password into the text box, so go ahead and do so (see Figure 1.19) Figure 1.19: List of available Wi-Fi networks 4. Finally, click OK and you should be connected to Wi-Fi. The signal strength should be displayed on the upper task bar on the right (see Figure 1.20) Figure 1.20: List of available Wi-Fi networks 5. It is preferable to update the cache of apt-get repository. In order to do so, start the terminal and type in sudo apt-get update in the terminal

21 1 Introduction to Raspberry Pi 17 Assignments Several commands can be used for diagnostic tests in order to obtain basic information from the Raspberry Pi. The following table shows the list of these commands. No. Commands Descriptions 1 cat /proc/cpuinfo CPU information 2 cat /proc/version OS version information 3 cat /proc/meminfo Memory information 4 cat /proc/partitions microsd Card partition 5 vcgencmd measure_temp Checking the temperature 6 vcgencmd measure_volts core Checking for the core voltage 7 vcgencmd measure_volts sdram_c Checking for the SD-RAM core voltage 8 vcgencmd measure_volts sdram_i Checking for the SD-RAM I/O voltage 9 vcgencmd measure_volts sdram_p Checking for the SD-RAM PHY voltage Answer the following questions How many core(s) does your Raspberry Pi has? What is the model of the CPU of the Raspberry Pi? Give the version of the operating system.

22 1 Introduction to Raspberry Pi 18 Give the temperature of the device. Give the voltage of SD-RAM I/O. Instructor s signature

23 1 Introduction to Raspberry Pi VIM Installation 1. Start the terminal 2. Run the following command to install Vim via the package manager sudo apt-get install vim Further information for Vim can be found at this website: Some Useful Terminal Commands The following table shows some useful terminal commands. No. Descriptions Commands 1 Move file mv <source_file> <destination_file> Ex.: mv source.c destination.c mv can also be used for renaming 2 Copy file cp <source_file> <destination_file> Ex.: cp source.c destination.c 3 Change directory cd <destination> Ex.: cd /User/Admin/Document / means start from root directory./ means start from current directory../ means start from parent directory 4 List file/directory ls <parameter> Ex.: ls -a list all files and directory including hidden files/directory Ex.: ls -l list all files and directories in long format(including permission Ex.: ls -la list all files and directories with long format(including permission) including hidden files/directories 5 Create an empty File touch <file_name> Ex.: touch test.txt creat an empty file name text.txt 6 Current directory pwd Ex.: pwd Find out which directory are you in 7 Create new directory mkdir <directory_name> Ex.: mkdir /home/lab Creat a new directory Lab under the path /home 8 Interface configuration: Show config- ifconfig <parameter> uration of all interfaces. In addition, specific interface can be specified Ex.: ifconfig wlan0 show all configuration of wlan0

24 1 Introduction to Raspberry Pi 20 Assignments Create a new directory under /home/pi user as AssemblyLabs Create a new directory under /AssemblyLabs as Lab1 Create a new empty file name TestLab1.txt List to see the file(s) in the current directory Change directory back to the root Instructor s signature

25 1 Introduction to Raspberry Pi First Assembly Program 1. Create a new directory under the pi user, i.e. /home/pi/assemblylabs/lab1 2. Naavigate to such directory such that when you type in pwd command you should be on the directory /home/pi/assemblylabs/lab1 3. Create a new assembly file using vim; type in vim Lab1.s 4. In order to edit in Vim you need to change into Insert mode. This can be done by pressing key I. 5. Add the following code in exactly manner including spacing..text.global _start _start: MOV R0, #65 MOV R7, #1 SWI 0 6. Press Esc key to change into Command mode in Vim. 7. Type in :wq to save and quit program 8. In the terminal, compile the program by typing as -o Lab1.o Lab1.s 9. Make an executable file by typing ld -o Lab1 Lab1.o 10. Run the program and see the result by typing./lab1 ; echo $?

26 1 Introduction to Raspberry Pi 22 Assignment Record the result of the previous program Change to code such that the result of the program shows 100 Instructor s signature

27 2 Assembly Programming (Part 1) 23 Date: 04/08/2016 Name: ID: Name: ID: 2 Assembly Programming (Part 1) This laboratory session discusses about Secure Shell Setup and Assembly Programming. The students should be able to do the followings: Setup SSH Create makefile Assembly programming 2.1 Secure Shell (SSH) Setup Secure Shell (SSH) is a network protocol that provides adminstrators with a secure way to access a remote computer. SSH provides strong authentication and secure encripted data communications between two computers connecting over an insecure network such as internet. SSH is widely used by network administrators for managing systems and applications remotely, allowing them to log in to another computer over a network, execute commands and move files from one computer to another. In case you are using MAC OS or Linx operating system continue to otherwise proceed to SSH for Raspberry Pi 3 Using Linux or MAC OS SSH can be used to connect to the Raspberry Pi from a Linux computer or Mac (or from another Raspberry Pi) from the terminal, without installing additional software. Follow the instruction to setup SSH. 1. Open terminal in the Raspberry Pi 2. Identify your Raspberry Pi s IP address in order to connect to it by typing the following command. hostname -I

28 2 Assembly Programming (Part 1) Write down the IP address 4. Use the following command in the terminal to connect to the Raspberry Pi from a DIFFERENT computer. ssh pi@<ip> 5. In case you receive a connection timed out error, it is likely that you have entered the wrong IP address for the Raspberry Pi. 6. When the connection works, a security/authenticity warning message will appear. Type yes to continue. This warning will be shown only for the first time you connect. 7. You will be prompted for the password for the pi login: on Raspbian. The default password is raspberry 8. Show that you can access the Raspberry Pi from DIFFERENT computer SSH for Raspberry Pi 3 Using Windows 1. Open terminal in the Raspberry Pi 2. Identify your Raspberry Pi s IP address in order to connect to it by typing the following command. hostname -I 3. Write down the IP address 4. Download SSH client called PuTTY from Look for putty.exe under the heading For Windows on Intel x86 5. Run putty.exe. The configuration screen will be shown (see Figure 2.1) 6. Type the IP address of the Raspberry Pi into the Host Name field and click Open button.

29 2 Assembly Programming (Part 1) 25 Figure 2.1: PuTTY Configuration Screen 7. If nothing happens when you click the Open button, and you eventually see a message saying Network error: Connection timed out. It is likely that you have entered the wrong IP address for the Raspberry Pi 8. When the connection works you will see the security warning as shown in Figure 2.2. Figure 2.2: PuTTY Security Alert Screen 9. Click Yes button. This screen will be shown only for the first time when PuTTY connects to the Raspberry Pi that it has never seen before.

30 2 Assembly Programming (Part 1) You should have the usual login prompt. Log in with the same username and password as if you would use on the Raspberry Pi itself. 11. The default login for Raspbian is pi with the password raspberry 12. Show that you can access the Raspberry Pi from DIFFERENT computer. 13. You can type exit to close PuTTY window Instructor s signature

31 2 Assembly Programming (Part 1) Creating Makefiles A makefile is a file created to tell make command what to do. Most often, the makefile tells make how to compile and link a program Rule of Makefiles A simple makefile consits of rules with the following shape target... : prerequisites... recipe A target is usually the name of a file that is generated by a program; examples of targets are executable or object files. A target can also be the name of an action to carry out, such as clean. A prerequisite is a file that is used as input to create the target. A target often depends on several files. A recipe is an action that make carries out. A recipe may have more than one command, either on the same line or each on its own line. Note that you need to put a tab character at the beginning of every recipe line. Usually a recipe is in a rule with prerequisites and serves to create a target file if any of the prerequisites change. However, the rule that specifies a recipe for the target need not have prerequisites. A rule explains how and when to remake certain files which are the targets of the particular rule. make carries out the recipe on the prerequisites to create or update the target. A rule can also explain how and when to carry out an action A Simple Makefile (For C Language) The following makefile describes the way an executable file called edit depends on eight object files, which in turn, depend on eigh C source and three header files.

32 2 Assembly Programming (Part 1) 28 edit : main.o kbd.o command.o display.o \ insert.o search.o files.o utils.o cc -o edit main.o kbd.o command.o display.o \ insert.o search.o files.o utils.o main.o : main.c defs.h cc -c main.c kbd.o : kbd.c defs.h command.h cc -c kbd.c command.o : command.c defs.h command.h cc -c command.c display.o : display.c defs.h buffer.h cc -c display.c insert.o : insert.c defs.h buffer.h cc -c insert.c search.o : search.c defs.h buffer.h cc -c search.c files.o : files.c defs.h buffer.h command.h cc -c files.c utils.o : utils.c defs.h cc -c utils.c clean : rm edit main.o kbd.o command.o display.o \ insert.o search.o files.o utils.o Here the \ refers to newline. To use this make file to create the executable file called edit, type: make To use makefile to delete the executable file and all the objects files from the directory, type: make clean In this example makefile, the targets include the executable file edit, and the object files main.o and kbd.o. The prerequisites are files such as main.c and defs.h. In fact, each.o fils is both a target and a prerequisite. Recipes include cc -c main.c and cc -c kbd.c When a target is a file, it needs to be recompiled or relinked if any of its prerequisites change. In addition, any requisites that are themselves automatically generated should be updated first. In this example, edit depends on each of the eight object files; the object file main.odepends on the source file main.c and on the header file defs.h A recipe may follow each line that contains a target and prerequisites. These

33 2 Assembly Programming (Part 1) 29 recipes say how to update the target file. A tab character (or whatever character is specified by the.recipeprefix) variable) must come at the beginning of every line in the recipe to distinguish recipes from other lines in the makefile. Note that make does not know anything about how the recipes work. It is up to the developer to supply recipes that will update the target file properly. All make does is execute the recipe that have specified when the target file needs to be updated. The target clean is not a file, but merely the name of an action. Since you normally do not want to carry out the actions in this rule, clean is not a prerequisite of any other rule. Consequently, make never does anything with it unless you tell it specifically. Thus, the only purpose of the rule is to run the specified recipe. Targets that do not refer to files but are just actions are called phony targets Creating Your Own Makefile 1. Navigate to the directory /home/pi/assemblylabs/lab1 2. Type in pwd command and be assure that you are on the directory /home/pi/assemblylabs/lab1 3. Create a new assembly file name makefile using vim 4. Enter Insert mode and put in the code as shown in the following: Lab1: Lab1.o ld -o Lab1 Lab1.o Lab1.o: Lab1.s as -o Lab1.o Lab1.s clean: rm *.o Lab1 Remarks: DO NOT forget to hit a tab key before entering the recipes. 5. Press esc key. Save and quit by typing :wq 6. Execute the makefile by typing make. Record the result shown from the terminal screen.

34 2 Assembly Programming (Part 1) Modify the code of Lab1.s to be as follows Instructor s signature.global _start _start: MOV R0, #100 MOV R7, #1 SWI 0 8. Save and exit Lab1.s. Execute the makefile again and record the result shown from the terminal screen.

35 2 Assembly Programming (Part 1) Explain why do you get different results shown in the terminal. 10. Type./Lab1 ; echo $? and record the result. 11. Type in command ls and see the list of the file within the current directory. 12. Type in make clean. Record the result shown in the terminal screen and explain the operation of this command. Instructor s signature Assignments 1. Modify the code of Lab1.s by replacing all _start with start. Save and run the make file. Record the result shown in the termimal screen. Explain this result.

36 2 Assembly Programming (Part 1) Modify the code of makefile by replacing all ld with gcc. Save and run the make file. Record the result shown in the termimal screen. Explain this result. 3. Modify the code of Lab1.s by replacing all start with main. Save and run the make file. Record the result shown in the termimal screen. Explain this result. Instructor s signature

37 2 Assembly Programming (Part 1) Assembly Programming for ARM The ARM architecture The ARM architecture is a relatively simple implementation of a load/store architecture, i.e. an architecture where main memory (RAM) access is performed through dedicated load and store instructions, while all computation (sums,products, logical operations, etc.) is performed on values held in registers. For example, ADD R4, R1, R2 will store in register R4 the sum of the values held in R1 and R2. The ARM architecture provides 16 registers, numbered from R0 to R15, of which the last three have special hardware significance. R13, also known as SP, is the stack pointer, that is it holds the address ofthe top element of the program stack. It is used automatically in the PUSH and POP instructions to manage storage and recovery of registers in the stack. R14, also known as LR is the link register, and holds the return address, that is the address of the first instruction to be executed after returning from the current function. R15, also known as PC is the program counter, and holds the address of the next instruction Assembler Language Assembly statements are structured in the following way: label: instruction Comments can be inserted for one line case and /* */ for multiple lines case. The label is optional, that is it is possible to define instructions without a label. The label is used to refer to the instruction address in the code - in particular, this is necessary to perform branch instructions. Labels can be any sequence of alphanumeric characters. The underscore(_) and dollar ($) characters can also be used, and numeric characters (digits) cannot appear as the first character of a symbol. Instructions can be divided into three different sets: Arithmetic-Logic: This group of instructions perform mathematical operations on data. They can be arithmetic (sum, subtraction, multiplication), logic (boolean operations), or relational (comparison of two values). Branch: This group of instructions change the control flow, by modifying the

38 2 Assembly Programming (Part 1) 34 value of the Program Counter (R15). They are needed to implement conditional statements, loops, and function calls. Load/Store: This group of instructions move data to and from the main memory. Since all other operations only work with immediate constant values (encoded in the instruction itself) or with values from the registers, the load/store instructions are necessary to deal with all but the smallest data sets Arithmetic-Logic Instructions Arithmetic instructions include the following (where Rd, Rn and Rm are any three registers, and #imm are 8-bit immediates): Syntax Semantics ADD Rd, Rn, Rm/#imm Rd = Rn + Rm/#imm SUB Rd, Rn, Rm/#imm Rd = Rn - Rm/#imm MUL Rd, Rn, Rm Rd = (Rn * Rm/#imm)%2 32 (truncated at 32 bits) AND Rd, Rn, Rm/#imm Rd = Rn & Rm/#imm) (bitwise AND) EOR Rd, Rn, Rm/#imm Rd = Rn ^ Rm/#imm) (bitwise XOR) ORR Rd, Rn, Rm/#imm Rd = Rn Rm/imm) (bitwise OR) MVN Rd, Rm/#imm Rd = ~Rm/#imm) (bitwise negation) CMP Rn, Rm/#imm Status comparison (<,>,==) of Rn and Rm/#imm) MOV Rd, Rm/#imm Rd = Rm/#imm) 1. Create a new directory under the pi user, i.e. /home/pi/assemblylabs/lab2 2. Naavigate to such directory such that when you type in pwd command you should be on the directory /home/pi/assemblylabs/lab2 3. Create a new assembly file vim Lab2.s using vim 4. Enter the following code:.global _start _start: MOV R0, #0 MOV R1, #2 MOV R2, #4 ORR R0, R1, R2 MOV R7, #1

39 2 Assembly Programming (Part 1) 35 SWI 0 5. Record and explain the program output. 6. Modify the code of vim Lab2.s as follows:.global _start _start: MOV R0, #0 MOV R1, #2 MOV R2, #4 ADD R3, R1, R2 SUB R0, R3, #5 MOV R7, #1 SWI 0 7. Record and explain the program output.

40 2 Assembly Programming (Part 1) Modify the code of Lab2.s by replacing SUB R0, R3, #5 by SUB R0, R3, #9 and SUB R0, R3, R1. 9. Record and explain the program output. Instructor s signature

41 2 Assembly Programming (Part 1) Branch Instructions The basic functionality of the branch instruction is to change the Program Counter by setting it to a new value (usually a constant, but not always). The set of branch instructions includes the following: Syntax B label BEQ label BNE label BGT label BLT label BGE label BLE label BL label BX Rd Semantics Jump to label (uncondition) Jump to label if previously compared values were equal Jump to label if previously compared values were different Jump to label if previously compared Rn > Rm/#imm Jump to label if previously compared Rn < Rm/#imm Jump to label if previously compared Rn >= Rm/#imm Jump to label if previously compared Rn <= Rm/#imm Function call (label is the function name/entry point) Return from function (always as BX LR) B label is the basic branch. Control is changed to run the instruction labeled with label next. BL label perform function call, which means it jumps as in B label, but also saves the value of the Program Counter in the Link Register (as by command MOV LR PC) Return from function is performed by BX LR. It is almost the same as MOV LR PC, but PC should not be manipulated explicitly by programmer, unless there is a very good reason to do so. 1. Modify the code of Lab2.s as follows:.global _start _start: MOV R0, #0x14 B other MOV R0, #0xB other: MOV R7, #1 SWI 0

42 2 Assembly Programming (Part 1) Record and explain the program output. 3. Modify the code of Lab2.s as follows:.global _start _start: CMP R4, #0 BLE else MOV R5, #1 B end else: MOV R5, #2 end: MOV R0, R5 MOV R7, #1 SWI 0 4. Record and explain the program output.

43 2 Assembly Programming (Part 1) Suppose an extra command MOV R4, #1 is added before the line CMP R4, #0 what would be the output. Explain your answer. 6. Modify the code of Lab2.s as follows:.global _start _start: MOV R5, #1 loop: CMP R4, #0 BLE end else: MOV R5, #2 end: MOV R0, R5 BX LR 7. Record and explain the program output. Instructor s signature

44 2 Assembly Programming (Part 1) Assignments 1. Modify the code of Lab2.s such that the program outputs 10 when R3 > 2 and 20 otherwise. Write down your program below and run to show the output to the instructor. Instructor s signature

45 2 Assembly Programming (Part 1) Load/Store Instruction Load and store instructions perform data transfer from memory to registers and vice versa. The following instructions allow us to work with word and byte sized data: Syntax LDR Rd [Rn, Rm/#imm] STR Rd [Rn, Rm/#imm] LDRB Rd [Rn, Rm/#imm] STRB Rd [Rn, Rm/#imm] PUSH {register list} POP {register list} Semantics Rd = mem[rn+rm/#imm] (32 bit copy) mem[rn+rm/#imm] = Rd (32 bit copy) Rd = mem[rn+rm/#imm] (8 bit copy) mem[rn+rm/#imm] = Rd (8 bit copy) Push registers onto stack Pop registers from stack In load instructions, values are read from a certain memory address and moved to register Rd, while in store instructions Rd is the source from which data is read, and the values are stored in memory. The meomory address employed is, in both cases, computed as the sum of a base Rn and an offset (Rm or a constant.) Usually, the programmer uses this capability to access arrays of data. 1. Modify the code of Lab2.s as follows:.data.balign 4 wordvar1:.word 1.text.global main main: LDR R2, wordvar1addr LDR R0, [R2] BX LR wordvar1addr:.word wordvar1 2. Record and explain the program output.

46 2 Assembly Programming (Part 1) Modify the code of Lab2.s as follows:.data.balign 4 wordvar1:.word 1.text.global main main: MOV R1, #2 LDR R2, wordvar1addr STR R1, [R2] LDR R0, [R2] BX LR wordvar1addr:.word wordvar1 4. Record and explain the program output. Instructor s signature

47 3 Assembly Programming (Part 2) 43 Date: 01/09/2016 Name: ID: Name: ID: 3 Assembly Programming (Part 2) This laboratory session discusses about Secure Shell Setup and Assembly Programming. The students should be able to do the followings: Output to the terminal Get input from key board Loop programming Barrel shifter 3.1 ARM Registers ARM processors provide general-purpose and sepcial-purpose registers. Some additional registers are available in privileged execution mode. In all ARM processors, the following registers are available and accessible in any processor mode: 13 general-purpose registers R0-R12 One Stack Pointer (SP) One Link Register (LR) One Program Counter (PC) One Appplication Program Register (APSR) General Purpose Register There are restrictions on the use of SP and LR as general-purpose registers.

48 3 Assembly Programming (Part 2) 44 With the exception of ARMv6-M and ARMv7-M based processors, there are 30 (or 32 if Security Extensions are implemented) general-purpose 32-bit registers, that include the banked SP and LR registers. Fifteen general-purpose registers are visible at any one time, depending on the current processor mode. These are R0-R12, SP, LR. The PC (R15) is not considered a general-purpose register. SP (or R13) is the stack pointer. The C and C++ compilers always use SP as the stack pointer. Use of SP as a general purpose register is discouraged. In Thumb, SP is strictly defined as the stack pointer. The instruction descriptions mention when SP and PC can be used. In User mode, LR (or R14) is used as a link register to store the return address when a subroutine call is made. It can also be used as a general-purpose register if the return address is stored on the stack. In the exception handling modes, LR holds the return address for the exception, or a subroutine return address if subroutine calls are executed within an exception. LR can be used as a general-purpose register if the return address is stored on the stack Register Accesses 16-bit Thumb instructions can access only a limited set of registers. There are also some restrictions on the use of special-purpose registers by ARM and 32-bit Thumb instructions. Most 16-bit Thumb instructions can only access R0 to R7. Only a small number of these instructions can access R8-R12, SP, LR, and PC. Registers R0 to R7 are called Lo registers. Registers R8-R12, SP, LR, and PC are called Hi registers. All 32-bit Thumb instructions can access R0 to R12, and LR. However, apart from a few designated stack manipulation instructions, most Thumb instructions cannot use SP. Except for a few specific instructions where PC is useful, most Thumb instructions cannot use PC. In ARM state, all instructions can access R0 to R12, SP, and LR, and most instructions can also access PC (R15). However, the use of the SP in an ARM instruction, in any way that is not possible in the corresponding Thumb instruction, is deprecated. Explicit use of the PC in an ARM instruction is not usually useful, and except for specific instances that are useful, such use is deprecated. Implicit use of the PC, for example in branch instructions or load (literal) instructions, is never deprecated.

49 3 Assembly Programming (Part 2) Hello World 1. Create a new directory under the pi user, i.e. /home/pi/assemblylabs/lab3 2. Naavigate to such directory such that when you type in pwd command you should be on the directory /home/pi/assemblylabs/lab3 3. Create a new assembly file vim Lab3.s using vim 4. Create a makefile to run the program Lab3.s 5. Enter the following code:.global _start _start: MOV R7, #4 MOV R0, #1 MOV R2, #12 LDR R1, =message SWI Write to the Output to the Length of output string end: MOV R7, #1 SWI Jump to the terminal.data message:.ascii Hello World\n 6. Run the makefile 7. Type.\Lab3 and record the result

50 3 Assembly Programming (Part 2) Keyboard Input 1. Modify the code of Lab3.s as follows:.global _start _start: MOV R7, #3 MOV R0, #0 MOV R2, #10 LDR R1, =message SWI System call Input from Length of input string _write: MOV R7, #4 MOV R0, #1 MOV R2, #5 LDR R1, =message SWI 0 end: MOV R7, #1 SWI Jump to the terminal.data message:.ascii 2. Run the makefile 3. Type.\Lab3 input the string and record the result Instructor s signature

51 3 Assembly Programming (Part 2) Assignment The instruction BIC has the following syntax: BIC Rd, Rn, Operand2 The BIC(Bit Clear) instruction performs an AND operation on the bits in Rn with the complements of the corresponding bits in the value of operand2 Write an assembly program that receive a lower case character from keyboard as an input, e.g. a, and output the corresponding uppercase letter to the screen, e.g. A. Hint: Use LDR and STR to load and store the value/address to the register. Use ASCII code table to see the binary code of the character. Use BIC command in uppercase transformation Instructor s signature

52 3 Assembly Programming (Part 2) Looping Performin looping in the program is one of the important ingredient in programming. In this case, the program will perform the task until the pre-set conditions are met First Looping In general, performing looping, for example a while loop, has the following structure R0 = 0 while(r0 <= 10) R0 = R0+1 This can also be done in assembly language. The following program illustrates it. 1. Modify the code of Lab3.s as follows:.global _start _start: MOV R0, #0 MOV R1, #1 B _continue_loop _loop: ADD R0, R0, R1 _continue_loop: CMP R0, #9 BLE _loop end: MOV R7, #1 SWI 0 2. Run the makefile

53 3 Assembly Programming (Part 2) Type.\Lab3 ; echo $? and record the result 4. Explain the program and the result Instructor s signature Current Program Status Register The Current Program Status Register is a 32-bit wide register used in the ARM architecture to record various pieces of information regarding the state of the program being executed by the processor and the state of the processor. This information is recorded by setting or clearing specific bits in the register. This is shown in Figure 3.1 Condition code flags The N, Z, C, and V bits are the condition code flags. They can be by arithmetic and logical operations. They can also be set by MSR and LDM instructions. The ARM processor tests these flags to determine whether to execute an instruction.

54 3 Assembly Programming (Part 2) 50 Figure 3.1: Current Program Status Register All instructions can execute conditionally in ARM state. In Thumb state, only the Branch instruction can be executed conditionally. Control bits The bottom eight bits of a PSR are known collectively as the control bits. They are the: Interrupt disable bits T bit mode bits The control bits change when an exception occurs. When the processor is operating in a privileged mode, software can manipulate these bits. Reserved bits The remaining bits in the CPSRs are unused, but are reserved. When changing a PSR flag or control bits, make sure that these reserved bits are not altered. Also, make sure that your program does not rely on reserved bits containing specific values because future processors might have these bits set to 1 or Conditional Programming The following list show the conditional code which can be used in the program in order to make the program operates according to the desired conditions.

55 3 Assembly Programming (Part 2) 51 EQ : Z Set NE : Z Not Set CS : Carry Set CC : Carry Not Set MI : Negative Set PL : Negative Not Set VS : Overflow Set VC : Overflow Not Set HI : Carry &!Zero LS : Carry & Zero GE : Negative == Overflow LT : Negative!= Overflow GT :!Zero && Negative = Overflow LE : Zero Negative!= Overflow Second Looping Now, we would like to perform the loop as shown in the following: R0 = 50 R1 = 2 while(r0 > R1) R0 -= 2 1. Modify the code of Lab3.s as follows:.global _start _start: MOV R0, #50 MOV R1, #2 B _loop _decrement: SUBGT R0, R0, R1 _loop: CMP R0, R1 BNE _decrement

56 3 Assembly Programming (Part 2) 52 end: MOV R7, #1 SWI 0 2. Run the makefile 3. Type.\Lab3 ; echo $? and record the result 4. Explain the program and the result Instructor s signature Assignment Write assembly program which add the even number from 0 to 9 and output to the screen. Instructor s signature

57 3 Assembly Programming (Part 2) Barrel Shifter The barrel shifter is a functional unit which can be used in a number of different circumstances. It provides five types of shifts and rotates which can be applied to Operand2. (These are not operations themselves in ARM mode.) Logical Shift Left (LSL) Example of Logical Shift Left by 4 is shown in Figure 3.2. This is equivalent to << in C. Figure 3.2: Logical Shift Left Logical Shift Right (LSR) Example of Logical Shift Right by 4 is shown in Figure 3.3. This is equivalent to >> in C, i.e. unsigned division by a power of 2. Figure 3.3: Logical Shift Right Arithmetic Shift Right (ASR) Example of Arithmetic Shift Right by 4, positive valueis is shown in Figure 3.4 Figure 3.4: Arithmetic Shift Right (positive value) Example of Arithmetic Shift Right by 4, negative value is shown in Figure 3.5 This is equivalent to >> in C, i.e. signed division by a power of 2. Rotate Right (ROR) Example of Rotate Right by 4 is shown in Figure 3.6. This is a bit rotation with wrap-around.

58 3 Assembly Programming (Part 2) 54 Figure 3.5: Arithmetic Shift Right (negative value) Figure 3.6: Rotate Right Rotate Right Extended (RRX) Example of Rotate Right Extended is shown in Figure 3.7. This is a 33-bit rotation with wrap-around through carry bit. Figure 3.7: Rotate Right Extended 1. Modify the code of Lab3.s as follows:.global _start _start: MOV R1, #15 MOV R0, R1, LSL #1 end: MOV R7, #1 SWI 0 2. Run the makefile

59 3 Assembly Programming (Part 2) Type.\Lab3 ; echo $? and record the result 4. Explain the program and result. Instructor s signature Assignment Write an assembly program which accepts a number n (0-9) from keyboard. The program then calculates 4 n and output to the screen using barrel shifter command. Instructor s signature Write an assembly program whcih sets R3=5 and then divide R3 by 2. Output the result to the screen. Explain the result. Instructor s signature

60 4 Assembly Programming (Part 3) 56 Date: 08/09/2016 Name: ID: Name: ID: 4 Assembly Programming (Part 3) pointer: This laboratory session discusses about debugging, memory storage, and stack Using gdb to debug the program Load and store from/to memory Stack pointer programming 4.1 A GDB Debugger A debugger is a program that runs other programs, allowing the user to exercise control over these programs, and to examine variables when problems arise. gdb is the GNU source-level debugger that is standard on the linux systems. It can be used both for programs written in highlevel languages like C and C++ and for assembly code programs. gdb will work in an ordinary terminal window, and this is fine for debugging assembly code. Here are some useful commands. Many can be abbreviated, as shown. Hitting return generally repeats the last command, sometimes advancing the current location. Syntax Descriptions h[elp][keyword] Display help information. r[un][arg] Begin program execution. If the program normally takes command-line arguments (e.g., foo hi 3), you should specify them here (e.g., run hi 3).

61 4 Assembly Programming (Part 3) 57 Syntax b[reak][address] c[ontinue] i[nfo] b[reak] d[elete] b[reakpoints] number p[rint] [/format] expr Descriptions Set a breakpoint at the specified address (or at the current address if none specified). Addresses can be given symbolically (e.g., foo) or numerically (e.g.*0x10a38). When execution reaches a breakpoint, you are thrown back into the gdb command line interpreter Continue execution after stopping at a breakpoint Display numbered list of all breakpoints currently set Delete specified breakpoint number Print the value of an expression using the specified format (decimal if unspecified). Expressions can involve program variables or registers, which are specified using a $ rather than a % sign. Useful formats include: d decimal regis- i[nfo] r[egister] ter x hexadecimal t binary f floating point i instruction c character For example to display the value of register R1 in decimal, type p/d $R1. To see the value of the current program counter, type p/x $pc. An alternative way to print the value of a register (or, if none is specified, of all registers) in hex and decimal. Specify the register without a leading %, e.g., R4.

62 4 Assembly Programming (Part 3) 58 Syntax Descriptions x/[count][format] [address] Examine the contents of a specified memory address, or the current address if none specified. If count is specified, displays specified number of words. Addresses can be symbolic (e.g., main) or numeric (e.g., 0x10a44). Formats are as for print. Particularly useful for printing the program text, e.g., x/100i foo disassembles and prints 100 instructions starting at foo. set var = expr Set specified register or memory location to value of expression. Examples:set $g4=0x456789ab or set myvar=myvar*2. s[tep]i Execute a single instruction and then return to the command line interpreter n[ext]i Like stepi, except that if the instruction is a subroutine call, the entire subroutine is executed before control returns to the interpreter. where Show current activation stack q[uit] Exit from gdb Debugging the Assembly Program 1. Navigate to the directory /home/pi/assemblylabs 2. Create a new directory Lab4 3. Navigate to the directory /home/pi/assemblylabs/lab4 4. Type in pwd command and be assure that you are on the directory /home/pi/assemblylabs/lab4 5. Create a new assembly file name Lab4 using vim 6. Enter Insert mode and put in the code as shown in the following:.global _start _start: MOV R0, #0 MOV R1, #1

63 4 Assembly Programming (Part 3) 59 B _loop: ADD _continue_loop R0, R0, R1 _continue_loop: CMP R0, #9 BLE _loop end: MOV R7, #1 SWI 0 7. To compile the program with debug add -g option as follows as -g -o Lab4.o Lab4.s ld -o Lab4 Lab4.o gdb Lab4 8. Type list after (gdb) and record the result. 9. Type q and answer y to quit. 10. Edit you makefile such that the target debug: with the code shown in the previous step is included.

64 4 Assembly Programming (Part 3) Run the makefile by typing make debug. Record and explain the result. Instructor s signature 12. The command disassemble dumps a range of memory as machine instructions. To disassemble the code attached to the label _loop type disassemble _loop. Record the result. The first number is the location in memory for the instruction. The second part is the number of bytes from the beginning of the label or function. 13. Disassemble the code attached to the label _start. What is the starting memory location of the label _start and how many bytes are b is away from the starting memory location? Instructor s signature

65 4 Assembly Programming (Part 3) By using breakpoints, you can step through your code one line at a time and see how register and flag values change. At (gdb) type b 13. This command sets a breakpoint at line 13. (d 13 to delete the breakpoint) 15. Use list command to indicate the line no of the command CMP R0, #9 in the code. Set a break point at this particular line. 16. Type run to run the program. Observe and record the result. 17. Type info r to return the current register values. Record the values of register r0, r1, sp, pc, cpsr 18. Type c to continue running the code until next breakpoint. Record the valus of the register r0, r1, sp, pc, cpsr. Explain the changes observed from these registers.

66 4 Assembly Programming (Part 3) Type c to continue running the code AGAIN until next breakpoint. Record the valus of the register r0, r1, sp, pc, cpsr. Explain the changes observed from these registers. 20. Type q to exit the gdb. Instructor s signature 4.2 Memory Storage In the previous assembly program, we have been storing data in registers for the most part. Now we will store the data in memory. In this approach, the data is stored by referring to that data address in memory. We can store an address in a register and then use that register to load and store data. The labels we have used are addresses that refer to code, but we can also use them to refer to data.

1 Introduction to Raspberry Pi. Date: 24/08/2016 Name: ID:

1 Introduction to Raspberry Pi. Date: 24/08/2016 Name: ID: 1 Introduction to Raspberry Pi 1 Date: 24/08/2016 Name: ID: Name: ID: 1 Introduction to Raspberry Pi The Raspberry Pi is a credit card-sized computer designed and manufactured in the UK with the initial

More information

3 Assembly Programming (Part 2) Date: 07/09/2016 Name: ID:

3 Assembly Programming (Part 2) Date: 07/09/2016 Name: ID: 3 Assembly Programming (Part 2) 43 Date: 07/09/2016 Name: ID: Name: ID: 3 Assembly Programming (Part 2) This laboratory session discusses about Secure Shell Setup and Assembly Programming. The students

More information

Raspberry Pi 3 Model B

Raspberry Pi 3 Model B Raspberry Pi 3 Model B Product Name Raspberry Pi 3 Product Description The Raspberry Pi 3 Model B is the third generation Raspberry Pi. This powerful credit-card sized single board computer can be used

More information

An Introduction to Assembly Programming with the ARM 32-bit Processor Family

An Introduction to Assembly Programming with the ARM 32-bit Processor Family An Introduction to Assembly Programming with the ARM 32-bit Processor Family G. Agosta Politecnico di Milano December 3, 2011 Contents 1 Introduction 1 1.1 Prerequisites............................. 2

More information

GNU Make 1. 1 material adapted from GNU Make by Richard Stallman

GNU Make 1. 1 material adapted from GNU Make by Richard Stallman 1 The make utility automatically determines which pieces of a large program need to be recompiled, and issues commands to recompile them. Make can be used with any programming language whose compiler can

More information

STEVEN R. BAGLEY ARM: PROCESSING DATA

STEVEN R. BAGLEY ARM: PROCESSING DATA STEVEN R. BAGLEY ARM: PROCESSING DATA INTRODUCTION CPU gets instructions from the computer s memory Each instruction is encoded as a binary pattern (an opcode) Assembly language developed as a human readable

More information

Chapter 2: An Introduction to Makeles 5 2 An Introduction to Makeles You need a le called a makele to tell make what to do. Most often, the makele tel

Chapter 2: An Introduction to Makeles 5 2 An Introduction to Makeles You need a le called a makele to tell make what to do. Most often, the makele tel Chapter 2: An Introduction to Makeles 5 2 An Introduction to Makeles You need a le called a makele to tell make what to do. Most often, the makele tells make how to compile and link a program. In this

More information

Writing ARM Assembly. Steven R. Bagley

Writing ARM Assembly. Steven R. Bagley Writing ARM Assembly Steven R. Bagley Hello World B main hello DEFB Hello World\n\0 goodbye DEFB Goodbye Universe\n\0 ALIGN main ADR R0, hello ; put address of hello string in R0 SWI 3 ; print it out ADR

More information

Raspberry Pi / ARM Assembly. OrgArch / Fall 2018

Raspberry Pi / ARM Assembly. OrgArch / Fall 2018 Raspberry Pi / ARM Assembly OrgArch / Fall 2018 The Raspberry Pi uses a Broadcom System on a Chip (SoC), which is based on an ARM CPU. https://en.wikipedia.org/wiki/arm_architecture The 64-bit ARM processor

More information

Assembler: Basics. Alberto Bosio October 20, Univeristé de Montpellier

Assembler: Basics. Alberto Bosio October 20, Univeristé de Montpellier Assembler: Basics Alberto Bosio bosio@lirmm.fr Univeristé de Montpellier October 20, 2017 Assembler Program Template. t e x t / S t a r t o f the program code s e c t i o n /.data / V a r i a b l e s /

More information

Comparison InstruCtions

Comparison InstruCtions Status Flags Now it is time to discuss what status flags are available. These five status flags are kept in a special register called the Program Status Register (PSR). The PSR also contains other important

More information

ARM Shift Operations. Shift Type 00 - logical left 01 - logical right 10 - arithmetic right 11 - rotate right. Shift Amount 0-31 bits

ARM Shift Operations. Shift Type 00 - logical left 01 - logical right 10 - arithmetic right 11 - rotate right. Shift Amount 0-31 bits ARM Shift Operations A novel feature of ARM is that all data-processing instructions can include an optional shift, whereas most other architectures have separate shift instructions. This is actually very

More information

Processor Status Register(PSR)

Processor Status Register(PSR) ARM Registers Register internal CPU hardware device that stores binary data; can be accessed much more rapidly than a location in RAM ARM has 13 general-purpose registers R0-R12 1 Stack Pointer (SP) R13

More information

F28HS2 Hardware-Software Interfaces. Lecture 6: ARM Assembly Language 1

F28HS2 Hardware-Software Interfaces. Lecture 6: ARM Assembly Language 1 F28HS2 Hardware-Software Interfaces Lecture 6: ARM Assembly Language 1 CISC & RISC CISC: complex instruction set computer original CPUs very simple poorly suited to evolving high level languages extended

More information

ARM Instruction Set Architecture. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

ARM Instruction Set Architecture. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University ARM Instruction Set Architecture Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Condition Field (1) Most ARM instructions can be conditionally

More information

ENGN1640: Design of Computing Systems Topic 03: Instruction Set Architecture Design

ENGN1640: Design of Computing Systems Topic 03: Instruction Set Architecture Design ENGN1640: Design of Computing Systems Topic 03: Instruction Set Architecture Design Professor Sherief Reda http://scale.engin.brown.edu School of Engineering Brown University Spring 2016 1 ISA is the HW/SW

More information

Topic 10: Instruction Representation

Topic 10: Instruction Representation Topic 10: Instruction Representation CSE 30: Computer Organization and Systems Programming Summer Session II Dr. Ali Irturk Dept. of Computer Science and Engineering University of California, San Diego

More information

The PAW Architecture Reference Manual

The PAW Architecture Reference Manual The PAW Architecture Reference Manual by Hansen Zhang For COS375/ELE375 Princeton University Last Update: 20 September 2015! 1. Introduction The PAW architecture is a simple architecture designed to be

More information

CprE 288 Introduction to Embedded Systems Course Review for Exam 3. Instructors: Dr. Phillip Jones

CprE 288 Introduction to Embedded Systems Course Review for Exam 3. Instructors: Dr. Phillip Jones CprE 288 Introduction to Embedded Systems Course Review for Exam 3 Instructors: Dr. Phillip Jones 1 Announcements Exam 3: See course website for day/time. Exam 3 location: Our regular classroom Allowed

More information

MNEMONIC OPERATION ADDRESS / OPERAND MODES FLAGS SET WITH S suffix ADC

MNEMONIC OPERATION ADDRESS / OPERAND MODES FLAGS SET WITH S suffix ADC ECE425 MNEMONIC TABLE MNEMONIC OPERATION ADDRESS / OPERAND MODES FLAGS SET WITH S suffix ADC Adds operands and Carry flag and places value in destination register ADD Adds operands and places value in

More information

ECE 571 Advanced Microprocessor-Based Design Lecture 3

ECE 571 Advanced Microprocessor-Based Design Lecture 3 ECE 571 Advanced Microprocessor-Based Design Lecture 3 Vince Weaver http://www.eece.maine.edu/ vweaver vincent.weaver@maine.edu 22 January 2013 The ARM Architecture 1 Brief ARM History ACORN Wanted a chip

More information

ARM Assembly Language. Programming

ARM Assembly Language. Programming Outline: ARM Assembly Language the ARM instruction set writing simple programs examples Programming hands-on: writing simple ARM assembly programs 2005 PEVE IT Unit ARM System Design ARM assembly language

More information

Chapter 2 Instructions Sets. Hsung-Pin Chang Department of Computer Science National ChungHsing University

Chapter 2 Instructions Sets. Hsung-Pin Chang Department of Computer Science National ChungHsing University Chapter 2 Instructions Sets Hsung-Pin Chang Department of Computer Science National ChungHsing University Outline Instruction Preliminaries ARM Processor SHARC Processor 2.1 Instructions Instructions sets

More information

Hi Hsiao-Lung Chan, Ph.D. Dept Electrical Engineering Chang Gung University, Taiwan

Hi Hsiao-Lung Chan, Ph.D. Dept Electrical Engineering Chang Gung University, Taiwan ARM Programmers Model Hi Hsiao-Lung Chan, Ph.D. Dept Electrical Engineering Chang Gung University, Taiwan chanhl@maili.cgu.edu.twcgu Current program status register (CPSR) Prog Model 2 Data processing

More information

ECE 598 Advanced Operating Systems Lecture 4

ECE 598 Advanced Operating Systems Lecture 4 ECE 598 Advanced Operating Systems Lecture 4 Vince Weaver http://www.eece.maine.edu/~vweaver vincent.weaver@maine.edu 28 January 2016 Announcements HW#1 was due HW#2 was posted, will be tricky Let me know

More information

ARM Cortex-M4 Architecture and Instruction Set 3: Branching; Data definition and memory access instructions

ARM Cortex-M4 Architecture and Instruction Set 3: Branching; Data definition and memory access instructions ARM Cortex-M4 Architecture and Instruction Set 3: Branching; Data definition and memory access instructions M J Brockway February 17, 2016 Branching To do anything other than run a fixed sequence of instructions,

More information

Cortex M3 Programming

Cortex M3 Programming Cortex M3 Programming EE8205: Embedded Computer Systems http://www.ee.ryerson.ca/~courses/ee8205/ Dr. Gul N. Khan http://www.ee.ryerson.ca/~gnkhan Electrical and Computer Engineering Ryerson University

More information

ARM Architecture and Instruction Set

ARM Architecture and Instruction Set AM Architecture and Instruction Set Ingo Sander ingo@imit.kth.se AM Microprocessor Core AM is a family of ISC architectures, which share the same design principles and a common instruction set AM does

More information

ECE 471 Embedded Systems Lecture 6

ECE 471 Embedded Systems Lecture 6 ECE 471 Embedded Systems Lecture 6 Vince Weaver http://web.eece.maine.edu/~vweaver vincent.weaver@maine.edu 15 September 2016 Announcements HW#3 will be posted today 1 What the OS gives you at start Registers

More information

Control Flow Instructions

Control Flow Instructions Control Flow Instructions CSE 30: Computer Organization and Systems Programming Diba Mirza Dept. of Computer Science and Engineering University of California, San Diego 1 So Far... v All instructions have

More information

Basic Compilation Control with Make

Basic Compilation Control with Make by P.N. Hilfinger (U.C. Berkeley) modified by M. Clancy (UCB) and C. Bono Basic Compilation Control with Make Even relatively small software systems can require rather involved, or at least tedious, sequences

More information

The ARM Cortex-M0 Processor Architecture Part-2

The ARM Cortex-M0 Processor Architecture Part-2 The ARM Cortex-M0 Processor Architecture Part-2 1 Module Syllabus ARM Cortex-M0 Processor Instruction Set ARM and Thumb Instruction Set Cortex-M0 Instruction Set Data Accessing Instructions Arithmetic

More information

CprE 288 Introduction to Embedded Systems ARM Assembly Programming: Translating C Control Statements and Function Calls

CprE 288 Introduction to Embedded Systems ARM Assembly Programming: Translating C Control Statements and Function Calls CprE 288 Introduction to Embedded Systems ARM Assembly Programming: Translating C Control Statements and Function Calls Instructors: Dr. Phillip Jones 1 Announcements Final Projects Projects: Mandatory

More information

RETROPIE INSTALLATION GUIDE

RETROPIE INSTALLATION GUIDE RETROPIE INSTALLATION GUIDE CONTENTS THE FOLLOWING GUIDE WILL COVER THE INSTALLATION, SETUP AND CONFIGURATION OF THE RASPBERRY PI, RASPBIAN OS AND RETROPIE Author: http://rpiarcadebuild.wordpress.com/

More information

Assembly Language Programming

Assembly Language Programming Assembly Language Programming ECE 362 https://engineering.purdue.edu/ee362/ Rick Reading and writing arrays Consider this C code again: int array1[100]; int array2[100]; for(n=0; n

More information

Build. System building

Build. System building Build System building The process of compiling and linking software components into an executable system Different systems are built from different combinations of components Invariably supported by automated

More information

ECE 471 Embedded Systems Lecture 5

ECE 471 Embedded Systems Lecture 5 ECE 471 Embedded Systems Lecture 5 Vince Weaver http://www.eece.maine.edu/ vweaver vincent.weaver@maine.edu 17 September 2013 HW#1 is due Thursday Announcements For next class, at least skim book Chapter

More information

Control Flow. September 2, Indiana University. Geoffrey Brown, Bryce Himebaugh 2015 September 2, / 21

Control Flow. September 2, Indiana University. Geoffrey Brown, Bryce Himebaugh 2015 September 2, / 21 Control Flow Geoffrey Brown Bryce Himebaugh Indiana University September 2, 2016 Geoffrey Brown, Bryce Himebaugh 2015 September 2, 2016 1 / 21 Outline Condition Codes C Relational Operations C Logical

More information

ARM Cortex-M4 Architecture and Instruction Set 2: General Data Processing Instructions

ARM Cortex-M4 Architecture and Instruction Set 2: General Data Processing Instructions ARM Cortex-M4 Architecture and Instruction Set 2: General Data Processing Instructions M J Brockway January 31, 2016 Cortex-M4 Machine Instructions - simple example... main FUNCTION ; initialize registers

More information

VE7104/INTRODUCTION TO EMBEDDED CONTROLLERS UNIT III ARM BASED MICROCONTROLLERS

VE7104/INTRODUCTION TO EMBEDDED CONTROLLERS UNIT III ARM BASED MICROCONTROLLERS VE7104/INTRODUCTION TO EMBEDDED CONTROLLERS UNIT III ARM BASED MICROCONTROLLERS Introduction to 32 bit Processors, ARM Architecture, ARM cortex M3, 32 bit ARM Instruction set, Thumb Instruction set, Exception

More information

6 GPIO 84. Date: 29/09/2016 Name: ID: This laboratory session discusses about writing program to interact with GPIO of Reapberry Pi.

6 GPIO 84. Date: 29/09/2016 Name: ID: This laboratory session discusses about writing program to interact with GPIO of Reapberry Pi. 6 GPIO 84 Date: 29/09/2016 Name: ID: Name: ID: 6 GPIO This laboratory session discusses about writing program to interact with GPIO of Reapberry Pi. GPIO programming with Assembly Code:block installation

More information

Branch Instructions. R type: Cond

Branch Instructions. R type: Cond Branch Instructions Standard branch instructions, B and BL, change the PC based on the PCR. The next instruction s address is found by adding a 24-bit signed 2 s complement immediate value

More information

EE319K Fall 2013 Exam 1B Modified Page 1. Exam 1. Date: October 3, 2013

EE319K Fall 2013 Exam 1B Modified Page 1. Exam 1. Date: October 3, 2013 EE319K Fall 2013 Exam 1B Modified Page 1 Exam 1 Date: October 3, 2013 UT EID: Printed Name: Last, First Your signature is your promise that you have not cheated and will not cheat on this exam, nor will

More information

CS240: Programming in C. Lecture 2: Overview

CS240: Programming in C. Lecture 2: Overview CS240: Programming in C Lecture 2: Overview 1 Programming Model How does C view the world? Stack Memory code Globals 2 Programming Model Execution mediated via a stack function calls and returns local

More information

ARM Assembly Programming

ARM Assembly Programming Introduction ARM Assembly Programming The ARM processor is very easy to program at the assembly level. (It is a RISC) We will learn ARM assembly programming at the user level and run it on a GBA emulator.

More information

Architecture. Digital Computer Design

Architecture. Digital Computer Design Architecture Digital Computer Design Architecture The architecture is the programmer s view of a computer. It is defined by the instruction set (language) and operand locations (registers and memory).

More information

ARM Cortex M3 Instruction Set Architecture. Gary J. Minden March 29, 2016

ARM Cortex M3 Instruction Set Architecture. Gary J. Minden March 29, 2016 ARM Cortex M3 Instruction Set Architecture Gary J. Minden March 29, 2016 1 Calculator Exercise Calculate: X = (45 * 32 + 7) / (65 2 * 18) G. J. Minden 2014 2 Instruction Set Architecture (ISA) ISAs define

More information

Instruction Sets: Characteristics and Functions Addressing Modes

Instruction Sets: Characteristics and Functions Addressing Modes Instruction Sets: Characteristics and Functions Addressing Modes Chapters 10 and 11, William Stallings Computer Organization and Architecture 7 th Edition What is an Instruction Set? The complete collection

More information

Computer Organization CS 206 T Lec# 2: Instruction Sets

Computer Organization CS 206 T Lec# 2: Instruction Sets Computer Organization CS 206 T Lec# 2: Instruction Sets Topics What is an instruction set Elements of instruction Instruction Format Instruction types Types of operations Types of operand Addressing mode

More information

Systems Architecture The ARM Processor

Systems Architecture The ARM Processor Systems Architecture The ARM Processor The ARM Processor p. 1/14 The ARM Processor ARM: Advanced RISC Machine First developed in 1983 by Acorn Computers ARM Ltd was formed in 1988 to continue development

More information

Kevin Meehan Stephen Moskal Computer Architecture Winter 2012 Dr. Shaaban

Kevin Meehan Stephen Moskal Computer Architecture Winter 2012 Dr. Shaaban Kevin Meehan Stephen Moskal Computer Architecture Winter 2012 Dr. Shaaban Contents Raspberry Pi Foundation Raspberry Pi overview & specs ARM11 overview ARM11 cache, pipeline, branch prediction ARM11 vs.

More information

Who am I and what am I doing?

Who am I and what am I doing? Who am I and what am I doing? Airscanner.com Mobile Security (AV, firewall, sniffer) Dissemination of Information Reverse-engineering is a tool not a weapon Knowing your computer Don t steal pay the programmers

More information

Digital Design and Computer Architecture Harris and Harris, J. Spjut Elsevier, 2007

Digital Design and Computer Architecture Harris and Harris, J. Spjut Elsevier, 2007 Digital Design and Computer Architecture Harris and Harris, J. Spjut Elsevier, 2007 Lab 8: MIPS ARM Assembly Language Programming Introduction In this lab, you will learn to write ARM assembly language

More information

VARDHAMAN COLLEGE OF ENGINEERING (AUTONOMOUS) Shamshabad, Hyderabad

VARDHAMAN COLLEGE OF ENGINEERING (AUTONOMOUS) Shamshabad, Hyderabad Introduction to MS-DOS Debugger DEBUG In this laboratory, we will use DEBUG program and learn how to: 1. Examine and modify the contents of the 8086 s internal registers, and dedicated parts of the memory

More information

Sneha Rajguru & Prajwal Panchmahalkar

Sneha Rajguru & Prajwal Panchmahalkar Sneha Rajguru & Prajwal Panchmahalkar Sneha Rajguru Security Consultant, Payatu Technologies Pvt Ltd. @sneharajguru Prajwal Panchmahalkar Red Team Lead Security Engineer, VMware @pr4jwal Introduction to

More information

ARM Assembler Workbook. CS160 Computer Organization Version 1.1 October 27 th, 2002 Revised Fall 2005

ARM Assembler Workbook. CS160 Computer Organization Version 1.1 October 27 th, 2002 Revised Fall 2005 ARM Assembler Workbook CS160 Computer Organization Version 1.1 October 27 th, 2002 Revised Fall 2005 ARM University Program Version 1.0 January 14th, 1997 Introduction Aim This workbook provides the student

More information

Programming Studio #1 ECE 190

Programming Studio #1 ECE 190 Programming Studio #1 ECE 190 Programming Studio #1 Announcements In Studio Assignment Introduction to Linux Command-Line Operations Recitation Floating Point Representation Binary & Hexadecimal 2 s Complement

More information

ARM Cortex-A9 ARM v7-a. A programmer s perspective Part 2

ARM Cortex-A9 ARM v7-a. A programmer s perspective Part 2 ARM Cortex-A9 ARM v7-a A programmer s perspective Part 2 ARM Instructions General Format Inst Rd, Rn, Rm, Rs Inst Rd, Rn, #0ximm 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7

More information

Exam 1 Fun Times. EE319K Fall 2012 Exam 1A Modified Page 1. Date: October 5, Printed Name:

Exam 1 Fun Times. EE319K Fall 2012 Exam 1A Modified Page 1. Date: October 5, Printed Name: EE319K Fall 2012 Exam 1A Modified Page 1 Exam 1 Fun Times Date: October 5, 2012 Printed Name: Last, First Your signature is your promise that you have not cheated and will not cheat on this exam, nor will

More information

Raspberry Pi Setup Tutorial

Raspberry Pi Setup Tutorial Raspberry Pi Setup Tutorial The Raspberry Pi is basically a miniature linux- based computer. It has an ARM processor on it, specifically the ARM1176JZF- S 700 MHz processor. This is the main reason why

More information

ARM Cortex-M4 Programming Model Flow Control Instructions

ARM Cortex-M4 Programming Model Flow Control Instructions ARM Cortex-M4 Programming Model Flow Control Instructions Textbook: Chapter 4, Section 4.9 (CMP, TEQ,TST) Chapter 6 ARM Cortex-M Users Manual, Chapter 3 1 CPU instruction types Data movement operations

More information

ECE 3210 Lab 4: Calculator

ECE 3210 Lab 4: Calculator ECE 3210 Lab 4: Calculator Fall 2017 1 Objective In this lab, you will develop an complete assembly program that takes an user input, performs data operations, and produces the expected output. After finishing

More information

ECE 498 Linux Assembly Language Lecture 5

ECE 498 Linux Assembly Language Lecture 5 ECE 498 Linux Assembly Language Lecture 5 Vince Weaver http://www.eece.maine.edu/ vweaver vincent.weaver@maine.edu 29 November 2012 Clarifications from Lecture 4 What is the Q saturate status bit? Some

More information

Chapter 15. ARM Architecture, Programming and Development Tools

Chapter 15. ARM Architecture, Programming and Development Tools Chapter 15 ARM Architecture, Programming and Development Tools Lesson 4 ARM CPU 32 bit ARM Instruction set 2 Basic Programming Features- ARM code size small than other RISCs 32-bit un-segmented memory

More information

The ARM Instruction Set

The ARM Instruction Set The ARM Instruction Set Minsoo Ryu Department of Computer Science and Engineering Hanyang University msryu@hanyang.ac.kr Topics Covered Data Processing Instructions Branch Instructions Load-Store Instructions

More information

Embedded assembly is more useful. Embedded assembly places an assembly function inside a C program and can be used with the ARM Cortex M0 processor.

Embedded assembly is more useful. Embedded assembly places an assembly function inside a C program and can be used with the ARM Cortex M0 processor. EE 354 Fall 2015 ARM Lecture 4 Assembly Language, Floating Point, PWM The ARM Cortex M0 processor supports only the thumb2 assembly language instruction set. This instruction set consists of fifty 16-bit

More information

ARM-7 ADDRESSING MODES INSTRUCTION SET

ARM-7 ADDRESSING MODES INSTRUCTION SET ARM-7 ADDRESSING MODES INSTRUCTION SET Dr. P. H. Zope 1 Assistant Professor SSBT s COET Bambhori Jalgaon North Maharashtra University Jalgaon India phzope@gmail.com 9860631040 Addressing modes When accessing

More information

E85 Lab 8: Assembly Language

E85 Lab 8: Assembly Language E85 Lab 8: Assembly Language E85 Spring 2016 Due: 4/6/16 Overview: This lab is focused on assembly programming. Assembly language serves as a bridge between the machine code we will need to understand

More information

Introduction to the ARM Processor Using Intel FPGA Toolchain. 1 Introduction. For Quartus Prime 16.1

Introduction to the ARM Processor Using Intel FPGA Toolchain. 1 Introduction. For Quartus Prime 16.1 Introduction to the ARM Processor Using Intel FPGA Toolchain For Quartus Prime 16.1 1 Introduction This tutorial presents an introduction to the ARM Cortex-A9 processor, which is a processor implemented

More information

18-349: Introduction to Embedded Real- Time Systems Lecture 3: ARM ASM

18-349: Introduction to Embedded Real- Time Systems Lecture 3: ARM ASM 18-349: Introduction to Embedded Real- Time Systems Lecture 3: ARM ASM Anthony Rowe Electrical and Computer Engineering Carnegie Mellon University Lecture Overview Exceptions Overview (Review) Pipelining

More information

Programming Studio #1 ECE 190

Programming Studio #1 ECE 190 Programming Studio #1 ECE 190 Programming Studio #1 Announcements Recitation Binary representation, hexadecimal notation floating point representation, 2 s complement In Studio Assignment Introduction

More information

Introduction to C. Write a main() function that swaps the contents of two integer variables x and y.

Introduction to C. Write a main() function that swaps the contents of two integer variables x and y. Introduction to C Write a main() function that swaps the contents of two integer variables x and y. void main(void){ int a = 10; int b = 20; a = b; b = a; } 1 Introduction to C Write a main() function

More information

ECE 471 Embedded Systems Lecture 8

ECE 471 Embedded Systems Lecture 8 ECE 471 Embedded Systems Lecture 8 Vince Weaver http://web.eece.maine.edu/~vweaver vincent.weaver@maine.edu 21 September 2018 Announcements HW#2 was due HW#3 will be posted today. Work in groups? Note

More information

Flow Control In Assembly

Flow Control In Assembly Chapters 6 Flow Control In Assembly Embedded Systems with ARM Cortext-M Updated: Monday, February 19, 2018 Overview: Flow Control Basics of Flowcharting If-then-else While loop For loop 2 Flowcharting

More information

ARM Cortex A9. ARM Cortex A9

ARM Cortex A9. ARM Cortex A9 ARM Cortex A9 Four dedicated registers are used for special purposes. The IP register works around the limitations of the ARM functional call instruction (BL) which cannot fully address all of its 2 32

More information

CS240: Programming in C

CS240: Programming in C CS240: Programming in C Lecture 2: Hello World! Cristina Nita-Rotaru Lecture 2/ Fall 2013 1 Introducing C High-level programming language Developed between 1969 and 1973 by Dennis Ritchie at the Bell Labs

More information

University of California, San Diego CSE 30 Computer Organization and Systems Programming Winter 2014 Midterm Dr. Diba Mirza

University of California, San Diego CSE 30 Computer Organization and Systems Programming Winter 2014 Midterm Dr. Diba Mirza Name Student ID University of California, San Diego CSE 30 Computer Organization and Systems Programming Winter 2014 Midterm Dr. Diba Mirza Name of person to your left Name of person to your right Please

More information

(2) Part a) Registers (e.g., R0, R1, themselves). other Registers do not exists at any address in the memory map

(2) Part a) Registers (e.g., R0, R1, themselves). other Registers do not exists at any address in the memory map (14) Question 1. For each of the following components, decide where to place it within the memory map of the microcontroller. Multiple choice select: RAM, ROM, or other. Select other if the component is

More information

EE319K Exam 1 Summer 2014 Page 1. Exam 1. Date: July 9, Printed Name:

EE319K Exam 1 Summer 2014 Page 1. Exam 1. Date: July 9, Printed Name: EE319K Exam 1 Summer 2014 Page 1 Exam 1 Date: July 9, 2014 UT EID: Printed Name: Last, First Your signature is your promise that you have not cheated and will not cheat on this exam, nor will you help

More information

EE319K Spring 2015 Exam 1 Page 1. Exam 1. Date: Feb 26, 2015

EE319K Spring 2015 Exam 1 Page 1. Exam 1. Date: Feb 26, 2015 EE319K Spring 2015 Exam 1 Page 1 Exam 1 Date: Feb 26, 2015 UT EID: Printed Name: Last, First Your signature is your promise that you have not cheated and will not cheat on this exam, nor will you help

More information

Exam 1. Date: Oct 4, 2018

Exam 1. Date: Oct 4, 2018 Exam 1 Date: Oct 4, 2018 UT EID: Professor: Valvano Printed Name: Last, First Your signature is your promise that you have not cheated and will not cheat on this exam, nor will you help others to cheat

More information

Microprocessor-Based Systems (E155)

Microprocessor-Based Systems (E155) Microprocessor-Based Systems (E155) D. Harris and M. Spencer Fall 2017 Lab 4: Life of Pi Requirement 1) Set up your Raspberry Pi 2) Write an assembly-language program to sort an array of 12 signed bytes

More information

Development Environment Embedded Linux Primer Ch 1&2

Development Environment Embedded Linux Primer Ch 1&2 Development Environment Embedded Linux Primer Ch 1&2 Topics 1) Systems: Host and Target 2) Host setup 3) Host-Target communication CMPT 433 Slides #3 Dr. B. Fraser 18-05-05 2 18-05-05 1 Host & Target Host

More information

EE251: Tuesday September 5

EE251: Tuesday September 5 EE251: Tuesday September 5 Shift/Rotate Instructions Bitwise logic and Saturating Instructions A Few Math Programming Examples ARM Assembly Language and Assembler Assembly Process Assembly Structure Assembler

More information

Raspberry Pi Introduction

Raspberry Pi Introduction ECE 1160/2160 Embedded Systems Design Raspberry Pi Introduction Wei Gao ECE 1160/2160 Embedded Systems Design 1 Raspberry Pi Classic embedded computer Single board computer Size of a credit card ECE 1160/2160

More information

Computer Organization & Assembly Language Programming (CSE 2312)

Computer Organization & Assembly Language Programming (CSE 2312) Computer Organization & Assembly Language Programming (CSE 2312) Lecture 15: Running ARM Programs in QEMU and Debugging with gdb Taylor Johnson Announcements and Outline Homework 5 due Thursday Midterm

More information

GNU Make. A Program for Directing Recompilation GNU make Version 3.79 April Richard M. Stallman and Roland McGrath

GNU Make. A Program for Directing Recompilation GNU make Version 3.79 April Richard M. Stallman and Roland McGrath GNU Make GNU Make A Program for Directing Recompilation GNU make Version 3.79 April 2000 Richard M. Stallman and Roland McGrath Copyright c 1988, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000 Free

More information

Introduction to Supercomputing

Introduction to Supercomputing Introduction to Supercomputing TMA4280 Introduction to UNIX environment and tools 0.1 Getting started with the environment and the bash shell interpreter Desktop computers are usually operated from a graphical

More information

Chapter 15. ARM Architecture, Programming and Development Tools

Chapter 15. ARM Architecture, Programming and Development Tools Chapter 15 ARM Architecture, Programming and Development Tools Lesson 5 ARM 16-bit Thumb Instruction Set 2 - Thumb 16 bit subset Better code density than 32-bit architecture instruction set 3 Basic Programming

More information

Assembly language Simple, regular instructions building blocks of C, Java & other languages Typically one-to-one mapping to machine language

Assembly language Simple, regular instructions building blocks of C, Java & other languages Typically one-to-one mapping to machine language Assembly Language Readings: 2.1-2.7, 2.9-2.10, 2.14 Green reference card Assembly language Simple, regular instructions building blocks of C, Java & other languages Typically one-to-one mapping to machine

More information

Advanced Assembly, Branching, and Monitor Utilities

Advanced Assembly, Branching, and Monitor Utilities 2 Advanced Assembly, Branching, and Monitor Utilities 2.1 Objectives: There are several different ways for an instruction to form effective addresses to acquire data, called addressing modes. One of these

More information

Program Development Tools

Program Development Tools Program Development Tools GNU make (much of this material is adapted from GNU Make by Richard Stallman) The make utility automatically determines which pieces of a large program need to be recompiled,

More information

Computer Organization & Assembly Language Programming (CSE 2312)

Computer Organization & Assembly Language Programming (CSE 2312) Computer Organization & Assembly Language Programming (CSE 2312) Lecture 16: Processor Pipeline Introduction and Debugging with GDB Taylor Johnson Announcements and Outline Homework 5 due today Know how

More information

Practical Malware Analysis

Practical Malware Analysis Practical Malware Analysis Ch 4: A Crash Course in x86 Disassembly Revised 1-16-7 Basic Techniques Basic static analysis Looks at malware from the outside Basic dynamic analysis Only shows you how the

More information

Outline. ARM Introduction & Instruction Set Architecture. ARM History. ARM s visible registers

Outline. ARM Introduction & Instruction Set Architecture. ARM History. ARM s visible registers Outline ARM Introduction & Instruction Set Architecture Aleksandar Milenkovic E-mail: Web: milenka@ece.uah.edu http://www.ece.uah.edu/~milenka ARM Architecture ARM Organization and Implementation ARM Instruction

More information

Unsigned and signed integer numbers

Unsigned and signed integer numbers Unsigned and signed integer numbers Binary Unsigned Signed 0000 0 0 0001 1 1 0010 2 2 0011 3 3 0100 4 4 Subtraction sets C flag opposite of carry (ARM specialty)! - if (carry = 0) then C=1 - if (carry

More information

Lab: Setting up PL-App with a Raspberry Pi

Lab: Setting up PL-App with a Raspberry Pi Lab Topology Objectives Set up a Raspberry Pi board as a PL-App device Use PL-App Launcher to provision and discover PL-App devices Background Cisco Prototyping Lab is a set of hardware and software components

More information

Lab 0: Intro to running Jupyter Notebook on a Raspberry Pi

Lab 0: Intro to running Jupyter Notebook on a Raspberry Pi Lab 0: Intro to running Jupyter Notebook on a Raspberry Pi Nick Antipa, Li-Hao Yeh, based on labs by Jon Tamir and Frank Ong January 24, 2018 This lab will walk you through setting up your Raspberry Pi

More information

Lab6 GDB debugging. Conventions. Department of Computer Science and Information Engineering National Taiwan University

Lab6 GDB debugging. Conventions. Department of Computer Science and Information Engineering National Taiwan University Lab6 GDB debugging 1 / 15 Learn how to perform source-level debugging with GDB. 2 / 15 Host Machine OS: Windows Target Machine Raspberry Pi (2 or 3) Build Machine A computer with a SD card slot OS: Ubuntu

More information

Lecture 15 ARM Processor A RISC Architecture

Lecture 15 ARM Processor A RISC Architecture CPE 390: Microprocessor Systems Fall 2017 Lecture 15 ARM Processor A RISC Architecture Bryan Ackland Department of Electrical and Computer Engineering Stevens Institute of Technology Hoboken, NJ 07030

More information